@okam/next-component 0.4.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,3791 +1,12 @@
1
- import { useThemeContext } from '@okam/stack-ui';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useThemeContext, Anchor } from '@okam/stack-ui';
2
3
  import Image from 'next/image';
4
+ import NextLink from 'next/link';
5
+ import { useState, useCallback, useEffect, forwardRef } from 'react';
6
+ import { usePathname, useSearchParams, useParams } from 'next/navigation';
7
+ import { useEvent } from 'react-use';
3
8
 
4
- var jsxRuntime = {
5
- exports: {}
6
- };
7
-
8
- var reactJsxRuntime_production_min = {};
9
-
10
- var react = {
11
- exports: {}
12
- };
13
-
14
- var react_production_min = {};
15
-
16
- /**
17
- * @license React
18
- * react.production.min.js
19
- *
20
- * Copyright (c) Facebook, Inc. and its affiliates.
21
- *
22
- * This source code is licensed under the MIT license found in the
23
- * LICENSE file in the root directory of this source tree.
24
- */
25
-
26
- var hasRequiredReact_production_min;
27
-
28
- function requireReact_production_min () {
29
- if (hasRequiredReact_production_min) return react_production_min;
30
- hasRequiredReact_production_min = 1;
31
- function _type_of(obj) {
32
- "@swc/helpers - typeof";
33
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
34
- }
35
- var l = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), u = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), x = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), z = Symbol.iterator;
36
- function A(a) {
37
- if (null === a || "object" !== (typeof a === "undefined" ? "undefined" : _type_of(a))) return null;
38
- a = z && a[z] || a["@@iterator"];
39
- return "function" === typeof a ? a : null;
40
- }
41
- var B = {
42
- isMounted: function isMounted() {
43
- return !1;
44
- },
45
- enqueueForceUpdate: function enqueueForceUpdate() {},
46
- enqueueReplaceState: function enqueueReplaceState() {},
47
- enqueueSetState: function enqueueSetState() {}
48
- }, C = Object.assign, D = {};
49
- function E(a, b, e) {
50
- this.props = a;
51
- this.context = b;
52
- this.refs = D;
53
- this.updater = e || B;
54
- }
55
- E.prototype.isReactComponent = {};
56
- E.prototype.setState = function(a, b) {
57
- if ("object" !== (typeof a === "undefined" ? "undefined" : _type_of(a)) && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
58
- this.updater.enqueueSetState(this, a, b, "setState");
59
- };
60
- E.prototype.forceUpdate = function(a) {
61
- this.updater.enqueueForceUpdate(this, a, "forceUpdate");
62
- };
63
- function F() {}
64
- F.prototype = E.prototype;
65
- function G(a, b, e) {
66
- this.props = a;
67
- this.context = b;
68
- this.refs = D;
69
- this.updater = e || B;
70
- }
71
- var H = G.prototype = new F;
72
- H.constructor = G;
73
- C(H, E.prototype);
74
- H.isPureReactComponent = !0;
75
- var I = Array.isArray, J = Object.prototype.hasOwnProperty, K = {
76
- current: null
77
- }, L = {
78
- key: !0,
79
- ref: !0,
80
- __self: !0,
81
- __source: !0
82
- };
83
- function M(a, b, e) {
84
- var d, c = {}, k = null, h = null;
85
- if (null != b) for(d in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b)J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]);
86
- var g = arguments.length - 2;
87
- if (1 === g) c.children = e;
88
- else if (1 < g) {
89
- for(var f = Array(g), m = 0; m < g; m++)f[m] = arguments[m + 2];
90
- c.children = f;
91
- }
92
- if (a && a.defaultProps) for(d in g = a.defaultProps, g)void 0 === c[d] && (c[d] = g[d]);
93
- return {
94
- $$typeof: l,
95
- type: a,
96
- key: k,
97
- ref: h,
98
- props: c,
99
- _owner: K.current
100
- };
101
- }
102
- function N(a, b) {
103
- return {
104
- $$typeof: l,
105
- type: a.type,
106
- key: b,
107
- ref: a.ref,
108
- props: a.props,
109
- _owner: a._owner
110
- };
111
- }
112
- function O(a) {
113
- return "object" === (typeof a === "undefined" ? "undefined" : _type_of(a)) && null !== a && a.$$typeof === l;
114
- }
115
- function escape(a) {
116
- var b = {
117
- "=": "=0",
118
- ":": "=2"
119
- };
120
- return "$" + a.replace(/[=:]/g, function(a) {
121
- return b[a];
122
- });
123
- }
124
- var P = /\/+/g;
125
- function Q(a, b) {
126
- return "object" === (typeof a === "undefined" ? "undefined" : _type_of(a)) && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
127
- }
128
- function R(a, b, e, d, c) {
129
- var k = typeof a === "undefined" ? "undefined" : _type_of(a);
130
- if ("undefined" === k || "boolean" === k) a = null;
131
- var h = !1;
132
- if (null === a) h = !0;
133
- else switch(k){
134
- case "string":
135
- case "number":
136
- h = !0;
137
- break;
138
- case "object":
139
- switch(a.$$typeof){
140
- case l:
141
- case n:
142
- h = !0;
143
- }
144
- }
145
- if (h) return h = a, c = c(h), a = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", null != a && (e = a.replace(P, "$&/") + "/"), R(c, b, e, "", function(a) {
146
- return a;
147
- })) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), b.push(c)), 1;
148
- h = 0;
149
- d = "" === d ? "." : d + ":";
150
- if (I(a)) for(var g = 0; g < a.length; g++){
151
- k = a[g];
152
- var f = d + Q(k, g);
153
- h += R(k, b, e, f, c);
154
- }
155
- else if (f = A(a), "function" === typeof f) for(a = f.call(a), g = 0; !(k = a.next()).done;)k = k.value, f = d + Q(k, g++), h += R(k, b, e, f, c);
156
- else if ("object" === k) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead.");
157
- return h;
158
- }
159
- function S(a, b, e) {
160
- if (null == a) return a;
161
- var d = [], c = 0;
162
- R(a, d, "", "", function(a) {
163
- return b.call(e, a, c++);
164
- });
165
- return d;
166
- }
167
- function T(a) {
168
- if (-1 === a._status) {
169
- var b = a._result;
170
- b = b();
171
- b.then(function(b) {
172
- if (0 === a._status || -1 === a._status) a._status = 1, a._result = b;
173
- }, function(b) {
174
- if (0 === a._status || -1 === a._status) a._status = 2, a._result = b;
175
- });
176
- -1 === a._status && (a._status = 0, a._result = b);
177
- }
178
- if (1 === a._status) return a._result.default;
179
- throw a._result;
180
- }
181
- var U = {
182
- current: null
183
- }, V = {
184
- transition: null
185
- }, W = {
186
- ReactCurrentDispatcher: U,
187
- ReactCurrentBatchConfig: V,
188
- ReactCurrentOwner: K
189
- };
190
- function X() {
191
- throw Error("act(...) is not supported in production builds of React.");
192
- }
193
- react_production_min.Children = {
194
- map: S,
195
- forEach: function forEach(a, b, e) {
196
- S(a, function() {
197
- b.apply(this, arguments);
198
- }, e);
199
- },
200
- count: function count(a) {
201
- var b = 0;
202
- S(a, function() {
203
- b++;
204
- });
205
- return b;
206
- },
207
- toArray: function toArray(a) {
208
- return S(a, function(a) {
209
- return a;
210
- }) || [];
211
- },
212
- only: function only(a) {
213
- if (!O(a)) throw Error("React.Children.only expected to receive a single React element child.");
214
- return a;
215
- }
216
- };
217
- react_production_min.Component = E;
218
- react_production_min.Fragment = p;
219
- react_production_min.Profiler = r;
220
- react_production_min.PureComponent = G;
221
- react_production_min.StrictMode = q;
222
- react_production_min.Suspense = w;
223
- react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W;
224
- react_production_min.act = X;
225
- react_production_min.cloneElement = function(a, b, e) {
226
- if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + ".");
227
- var d = C({}, a.props), c = a.key, k = a.ref, h = a._owner;
228
- if (null != b) {
229
- void 0 !== b.ref && (k = b.ref, h = K.current);
230
- void 0 !== b.key && (c = "" + b.key);
231
- if (a.type && a.type.defaultProps) var g = a.type.defaultProps;
232
- for(f in b)J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]);
233
- }
234
- var f = arguments.length - 2;
235
- if (1 === f) d.children = e;
236
- else if (1 < f) {
237
- g = Array(f);
238
- for(var m = 0; m < f; m++)g[m] = arguments[m + 2];
239
- d.children = g;
240
- }
241
- return {
242
- $$typeof: l,
243
- type: a.type,
244
- key: c,
245
- ref: k,
246
- props: d,
247
- _owner: h
248
- };
249
- };
250
- react_production_min.createContext = function(a) {
251
- a = {
252
- $$typeof: u,
253
- _currentValue: a,
254
- _currentValue2: a,
255
- _threadCount: 0,
256
- Provider: null,
257
- Consumer: null,
258
- _defaultValue: null,
259
- _globalName: null
260
- };
261
- a.Provider = {
262
- $$typeof: t,
263
- _context: a
264
- };
265
- return a.Consumer = a;
266
- };
267
- react_production_min.createElement = M;
268
- react_production_min.createFactory = function(a) {
269
- var b = M.bind(null, a);
270
- b.type = a;
271
- return b;
272
- };
273
- react_production_min.createRef = function() {
274
- return {
275
- current: null
276
- };
277
- };
278
- react_production_min.forwardRef = function(a) {
279
- return {
280
- $$typeof: v,
281
- render: a
282
- };
283
- };
284
- react_production_min.isValidElement = O;
285
- react_production_min.lazy = function(a) {
286
- return {
287
- $$typeof: y,
288
- _payload: {
289
- _status: -1,
290
- _result: a
291
- },
292
- _init: T
293
- };
294
- };
295
- react_production_min.memo = function(a, b) {
296
- return {
297
- $$typeof: x,
298
- type: a,
299
- compare: void 0 === b ? null : b
300
- };
301
- };
302
- react_production_min.startTransition = function(a) {
303
- var b = V.transition;
304
- V.transition = {};
305
- try {
306
- a();
307
- } finally{
308
- V.transition = b;
309
- }
310
- };
311
- react_production_min.unstable_act = X;
312
- react_production_min.useCallback = function(a, b) {
313
- return U.current.useCallback(a, b);
314
- };
315
- react_production_min.useContext = function(a) {
316
- return U.current.useContext(a);
317
- };
318
- react_production_min.useDebugValue = function() {};
319
- react_production_min.useDeferredValue = function(a) {
320
- return U.current.useDeferredValue(a);
321
- };
322
- react_production_min.useEffect = function(a, b) {
323
- return U.current.useEffect(a, b);
324
- };
325
- react_production_min.useId = function() {
326
- return U.current.useId();
327
- };
328
- react_production_min.useImperativeHandle = function(a, b, e) {
329
- return U.current.useImperativeHandle(a, b, e);
330
- };
331
- react_production_min.useInsertionEffect = function(a, b) {
332
- return U.current.useInsertionEffect(a, b);
333
- };
334
- react_production_min.useLayoutEffect = function(a, b) {
335
- return U.current.useLayoutEffect(a, b);
336
- };
337
- react_production_min.useMemo = function(a, b) {
338
- return U.current.useMemo(a, b);
339
- };
340
- react_production_min.useReducer = function(a, b, e) {
341
- return U.current.useReducer(a, b, e);
342
- };
343
- react_production_min.useRef = function(a) {
344
- return U.current.useRef(a);
345
- };
346
- react_production_min.useState = function(a) {
347
- return U.current.useState(a);
348
- };
349
- react_production_min.useSyncExternalStore = function(a, b, e) {
350
- return U.current.useSyncExternalStore(a, b, e);
351
- };
352
- react_production_min.useTransition = function() {
353
- return U.current.useTransition();
354
- };
355
- react_production_min.version = "18.3.1";
356
- return react_production_min;
357
- }
358
-
359
- var react_development = {
360
- exports: {}
361
- };
362
-
363
- /**
364
- * @license React
365
- * react.development.js
366
- *
367
- * Copyright (c) Facebook, Inc. and its affiliates.
368
- *
369
- * This source code is licensed under the MIT license found in the
370
- * LICENSE file in the root directory of this source tree.
371
- */
372
- react_development.exports;
373
-
374
- var hasRequiredReact_development;
375
-
376
- function requireReact_development () {
377
- if (hasRequiredReact_development) return react_development.exports;
378
- hasRequiredReact_development = 1;
379
- (function (module, exports) {
380
- function _instanceof(left, right) {
381
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
382
- return !!right[Symbol.hasInstance](left);
383
- } else {
384
- return left instanceof right;
385
- }
386
- }
387
- function _type_of(obj) {
388
- "@swc/helpers - typeof";
389
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
390
- }
391
- if (process.env.NODE_ENV !== "production") {
392
- (function() {
393
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === 'function') {
394
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
395
- }
396
- var ReactVersion = '18.3.1';
397
- // ATTENTION
398
- // When adding new symbols to this file,
399
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
400
- // The Symbol used to tag the ReactElement-like types.
401
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
402
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
403
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
404
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
405
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
406
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
407
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
408
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
409
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
410
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
411
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
412
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
413
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
414
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
415
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
416
- function getIteratorFn(maybeIterable) {
417
- if (maybeIterable === null || (typeof maybeIterable === "undefined" ? "undefined" : _type_of(maybeIterable)) !== 'object') {
418
- return null;
419
- }
420
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
421
- if (typeof maybeIterator === 'function') {
422
- return maybeIterator;
423
- }
424
- return null;
425
- }
426
- /**
427
- * Keeps track of the current dispatcher.
428
- */ var ReactCurrentDispatcher = {
429
- /**
430
- * @internal
431
- * @type {ReactComponent}
432
- */ current: null
433
- };
434
- /**
435
- * Keeps track of the current batch's configuration such as how long an update
436
- * should suspend for if it needs to.
437
- */ var ReactCurrentBatchConfig = {
438
- transition: null
439
- };
440
- var ReactCurrentActQueue = {
441
- current: null,
442
- // Used to reproduce behavior of `batchedUpdates` in legacy mode.
443
- isBatchingLegacy: false,
444
- didScheduleLegacyUpdate: false
445
- };
446
- /**
447
- * Keeps track of the current owner.
448
- *
449
- * The current owner is the component who should own any components that are
450
- * currently being constructed.
451
- */ var ReactCurrentOwner = {
452
- /**
453
- * @internal
454
- * @type {ReactComponent}
455
- */ current: null
456
- };
457
- var ReactDebugCurrentFrame = {};
458
- var currentExtraStackFrame = null;
459
- function setExtraStackFrame(stack) {
460
- {
461
- currentExtraStackFrame = stack;
462
- }
463
- }
464
- {
465
- ReactDebugCurrentFrame.setExtraStackFrame = function(stack) {
466
- {
467
- currentExtraStackFrame = stack;
468
- }
469
- }; // Stack implementation injected by the current renderer.
470
- ReactDebugCurrentFrame.getCurrentStack = null;
471
- ReactDebugCurrentFrame.getStackAddendum = function() {
472
- var stack = ''; // Add an extra top frame while an element is being validated
473
- if (currentExtraStackFrame) {
474
- stack += currentExtraStackFrame;
475
- } // Delegate to the injected renderer-specific implementation
476
- var impl = ReactDebugCurrentFrame.getCurrentStack;
477
- if (impl) {
478
- stack += impl() || '';
479
- }
480
- return stack;
481
- };
482
- }
483
- // -----------------------------------------------------------------------------
484
- var enableScopeAPI = false; // Experimental Create Event Handle API.
485
- var enableCacheElement = false;
486
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
487
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
488
- // stuff. Intended to enable React core members to more easily debug scheduling
489
- // issues in DEV builds.
490
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
491
- var ReactSharedInternals = {
492
- ReactCurrentDispatcher: ReactCurrentDispatcher,
493
- ReactCurrentBatchConfig: ReactCurrentBatchConfig,
494
- ReactCurrentOwner: ReactCurrentOwner
495
- };
496
- {
497
- ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
498
- ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
499
- }
500
- // by calls to these methods by a Babel plugin.
501
- //
502
- // In PROD (or in packages without access to React internals),
503
- // they are left as they are instead.
504
- function warn(format) {
505
- {
506
- {
507
- for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
508
- args[_key - 1] = arguments[_key];
509
- }
510
- printWarning('warn', format, args);
511
- }
512
- }
513
- }
514
- function error(format) {
515
- {
516
- {
517
- for(var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++){
518
- args[_key2 - 1] = arguments[_key2];
519
- }
520
- printWarning('error', format, args);
521
- }
522
- }
523
- }
524
- function printWarning(level, format, args) {
525
- // When changing this logic, you might want to also
526
- // update consoleWithStackDev.www.js as well.
527
- {
528
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
529
- var stack = ReactDebugCurrentFrame.getStackAddendum();
530
- if (stack !== '') {
531
- format += '%s';
532
- args = args.concat([
533
- stack
534
- ]);
535
- } // eslint-disable-next-line react-internal/safe-string-coercion
536
- var argsWithFormat = args.map(function(item) {
537
- return String(item);
538
- }); // Careful: RN currently depends on this prefix
539
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
540
- // breaks IE9: https://github.com/facebook/react/issues/13610
541
- // eslint-disable-next-line react-internal/no-production-logging
542
- Function.prototype.apply.call(console[level], console, argsWithFormat);
543
- }
544
- }
545
- var didWarnStateUpdateForUnmountedComponent = {};
546
- function warnNoop(publicInstance, callerName) {
547
- {
548
- var _constructor = publicInstance.constructor;
549
- var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
550
- var warningKey = componentName + "." + callerName;
551
- if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
552
- return;
553
- }
554
- 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);
555
- didWarnStateUpdateForUnmountedComponent[warningKey] = true;
556
- }
557
- }
558
- /**
559
- * This is the abstract API for an update queue.
560
- */ var ReactNoopUpdateQueue = {
561
- /**
562
- * Checks whether or not this composite component is mounted.
563
- * @param {ReactClass} publicInstance The instance we want to test.
564
- * @return {boolean} True if mounted, false otherwise.
565
- * @protected
566
- * @final
567
- */ isMounted: function isMounted(publicInstance) {
568
- return false;
569
- },
570
- /**
571
- * Forces an update. This should only be invoked when it is known with
572
- * certainty that we are **not** in a DOM transaction.
573
- *
574
- * You may want to call this when you know that some deeper aspect of the
575
- * component's state has changed but `setState` was not called.
576
- *
577
- * This will not invoke `shouldComponentUpdate`, but it will invoke
578
- * `componentWillUpdate` and `componentDidUpdate`.
579
- *
580
- * @param {ReactClass} publicInstance The instance that should rerender.
581
- * @param {?function} callback Called after component is updated.
582
- * @param {?string} callerName name of the calling function in the public API.
583
- * @internal
584
- */ enqueueForceUpdate: function enqueueForceUpdate(publicInstance, callback, callerName) {
585
- warnNoop(publicInstance, 'forceUpdate');
586
- },
587
- /**
588
- * Replaces all of the state. Always use this or `setState` to mutate state.
589
- * You should treat `this.state` as immutable.
590
- *
591
- * There is no guarantee that `this.state` will be immediately updated, so
592
- * accessing `this.state` after calling this method may return the old value.
593
- *
594
- * @param {ReactClass} publicInstance The instance that should rerender.
595
- * @param {object} completeState Next state.
596
- * @param {?function} callback Called after component is updated.
597
- * @param {?string} callerName name of the calling function in the public API.
598
- * @internal
599
- */ enqueueReplaceState: function enqueueReplaceState(publicInstance, completeState, callback, callerName) {
600
- warnNoop(publicInstance, 'replaceState');
601
- },
602
- /**
603
- * Sets a subset of the state. This only exists because _pendingState is
604
- * internal. This provides a merging strategy that is not available to deep
605
- * properties which is confusing. TODO: Expose pendingState or don't use it
606
- * during the merge.
607
- *
608
- * @param {ReactClass} publicInstance The instance that should rerender.
609
- * @param {object} partialState Next partial state to be merged with state.
610
- * @param {?function} callback Called after component is updated.
611
- * @param {?string} Name of the calling function in the public API.
612
- * @internal
613
- */ enqueueSetState: function enqueueSetState(publicInstance, partialState, callback, callerName) {
614
- warnNoop(publicInstance, 'setState');
615
- }
616
- };
617
- var assign = Object.assign;
618
- var emptyObject = {};
619
- {
620
- Object.freeze(emptyObject);
621
- }
622
- /**
623
- * Base class helpers for the updating state of a component.
624
- */ function Component(props, context, updater) {
625
- this.props = props;
626
- this.context = context; // If a component has string refs, we will assign a different object later.
627
- this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
628
- // renderer.
629
- this.updater = updater || ReactNoopUpdateQueue;
630
- }
631
- Component.prototype.isReactComponent = {};
632
- /**
633
- * Sets a subset of the state. Always use this to mutate
634
- * state. You should treat `this.state` as immutable.
635
- *
636
- * There is no guarantee that `this.state` will be immediately updated, so
637
- * accessing `this.state` after calling this method may return the old value.
638
- *
639
- * There is no guarantee that calls to `setState` will run synchronously,
640
- * as they may eventually be batched together. You can provide an optional
641
- * callback that will be executed when the call to setState is actually
642
- * completed.
643
- *
644
- * When a function is provided to setState, it will be called at some point in
645
- * the future (not synchronously). It will be called with the up to date
646
- * component arguments (state, props, context). These values can be different
647
- * from this.* because your function may be called after receiveProps but before
648
- * shouldComponentUpdate, and this new state, props, and context will not yet be
649
- * assigned to this.
650
- *
651
- * @param {object|function} partialState Next partial state or function to
652
- * produce next partial state to be merged with current state.
653
- * @param {?function} callback Called after state is updated.
654
- * @final
655
- * @protected
656
- */ Component.prototype.setState = function(partialState, callback) {
657
- if ((typeof partialState === "undefined" ? "undefined" : _type_of(partialState)) !== 'object' && typeof partialState !== 'function' && partialState != null) {
658
- throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.');
659
- }
660
- this.updater.enqueueSetState(this, partialState, callback, 'setState');
661
- };
662
- /**
663
- * Forces an update. This should only be invoked when it is known with
664
- * certainty that we are **not** in a DOM transaction.
665
- *
666
- * You may want to call this when you know that some deeper aspect of the
667
- * component's state has changed but `setState` was not called.
668
- *
669
- * This will not invoke `shouldComponentUpdate`, but it will invoke
670
- * `componentWillUpdate` and `componentDidUpdate`.
671
- *
672
- * @param {?function} callback Called after update is complete.
673
- * @final
674
- * @protected
675
- */ Component.prototype.forceUpdate = function(callback) {
676
- this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
677
- };
678
- /**
679
- * Deprecated APIs. These APIs used to exist on classic React classes but since
680
- * we would like to deprecate them, we're not going to move them over to this
681
- * modern base class. Instead, we define a getter that warns if it's accessed.
682
- */ {
683
- var deprecatedAPIs = {
684
- isMounted: [
685
- 'isMounted',
686
- 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'
687
- ],
688
- replaceState: [
689
- 'replaceState',
690
- 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'
691
- ]
692
- };
693
- var defineDeprecationWarning = function defineDeprecationWarning(methodName, info) {
694
- Object.defineProperty(Component.prototype, methodName, {
695
- get: function get() {
696
- warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
697
- return undefined;
698
- }
699
- });
700
- };
701
- for(var fnName in deprecatedAPIs){
702
- if (deprecatedAPIs.hasOwnProperty(fnName)) {
703
- defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
704
- }
705
- }
706
- }
707
- function ComponentDummy() {}
708
- ComponentDummy.prototype = Component.prototype;
709
- /**
710
- * Convenience component with default shallow equality check for sCU.
711
- */ function PureComponent(props, context, updater) {
712
- this.props = props;
713
- this.context = context; // If a component has string refs, we will assign a different object later.
714
- this.refs = emptyObject;
715
- this.updater = updater || ReactNoopUpdateQueue;
716
- }
717
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
718
- pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
719
- assign(pureComponentPrototype, Component.prototype);
720
- pureComponentPrototype.isPureReactComponent = true;
721
- // an immutable object with a single mutable value
722
- function createRef() {
723
- var refObject = {
724
- current: null
725
- };
726
- {
727
- Object.seal(refObject);
728
- }
729
- return refObject;
730
- }
731
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
732
- function isArray(a) {
733
- return isArrayImpl(a);
734
- }
735
- /*
736
- * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
737
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
738
- *
739
- * The functions in this module will throw an easier-to-understand,
740
- * easier-to-debug exception with a clear errors message message explaining the
741
- * problem. (Instead of a confusing exception thrown inside the implementation
742
- * of the `value` object).
743
- */ // $FlowFixMe only called in DEV, so void return is not possible.
744
- function typeName(value) {
745
- {
746
- // toStringTag is needed for namespaced types like Temporal.Instant
747
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
748
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
749
- return type;
750
- }
751
- } // $FlowFixMe only called in DEV, so void return is not possible.
752
- function willCoercionThrow(value) {
753
- {
754
- try {
755
- testStringCoercion(value);
756
- return false;
757
- } catch (e) {
758
- return true;
759
- }
760
- }
761
- }
762
- function testStringCoercion(value) {
763
- // If you ended up here by following an exception call stack, here's what's
764
- // happened: you supplied an object or symbol value to React (as a prop, key,
765
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
766
- // coerce it to a string using `'' + value`, an exception was thrown.
767
- //
768
- // The most common types that will cause this exception are `Symbol` instances
769
- // and Temporal objects like `Temporal.Instant`. But any object that has a
770
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
771
- // exception. (Library authors do this to prevent users from using built-in
772
- // numeric operators like `+` or comparison operators like `>=` because custom
773
- // methods are needed to perform accurate arithmetic or comparison.)
774
- //
775
- // To fix the problem, coerce this object or symbol value to a string before
776
- // passing it to React. The most reliable way is usually `String(value)`.
777
- //
778
- // To find which value is throwing, check the browser or debugger console.
779
- // Before this exception was thrown, there should be `console.error` output
780
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
781
- // problem and how that type was used: key, atrribute, input value prop, etc.
782
- // In most cases, this console output also shows the component and its
783
- // ancestor components where the exception happened.
784
- //
785
- // eslint-disable-next-line react-internal/safe-string-coercion
786
- return '' + value;
787
- }
788
- function checkKeyStringCoercion(value) {
789
- {
790
- if (willCoercionThrow(value)) {
791
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
792
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
793
- }
794
- }
795
- }
796
- function getWrappedName(outerType, innerType, wrapperName) {
797
- var displayName = outerType.displayName;
798
- if (displayName) {
799
- return displayName;
800
- }
801
- var functionName = innerType.displayName || innerType.name || '';
802
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
803
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
804
- function getContextName(type) {
805
- return type.displayName || 'Context';
806
- } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
807
- function getComponentNameFromType(type) {
808
- if (type == null) {
809
- // Host root, text node or just invalid type.
810
- return null;
811
- }
812
- {
813
- if (typeof type.tag === 'number') {
814
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
815
- }
816
- }
817
- if (typeof type === 'function') {
818
- return type.displayName || type.name || null;
819
- }
820
- if (typeof type === 'string') {
821
- return type;
822
- }
823
- switch(type){
824
- case REACT_FRAGMENT_TYPE:
825
- return 'Fragment';
826
- case REACT_PORTAL_TYPE:
827
- return 'Portal';
828
- case REACT_PROFILER_TYPE:
829
- return 'Profiler';
830
- case REACT_STRICT_MODE_TYPE:
831
- return 'StrictMode';
832
- case REACT_SUSPENSE_TYPE:
833
- return 'Suspense';
834
- case REACT_SUSPENSE_LIST_TYPE:
835
- return 'SuspenseList';
836
- }
837
- if ((typeof type === "undefined" ? "undefined" : _type_of(type)) === 'object') {
838
- switch(type.$$typeof){
839
- case REACT_CONTEXT_TYPE:
840
- var context = type;
841
- return getContextName(context) + '.Consumer';
842
- case REACT_PROVIDER_TYPE:
843
- var provider = type;
844
- return getContextName(provider._context) + '.Provider';
845
- case REACT_FORWARD_REF_TYPE:
846
- return getWrappedName(type, type.render, 'ForwardRef');
847
- case REACT_MEMO_TYPE:
848
- var outerName = type.displayName || null;
849
- if (outerName !== null) {
850
- return outerName;
851
- }
852
- return getComponentNameFromType(type.type) || 'Memo';
853
- case REACT_LAZY_TYPE:
854
- {
855
- var lazyComponent = type;
856
- var payload = lazyComponent._payload;
857
- var init = lazyComponent._init;
858
- try {
859
- return getComponentNameFromType(init(payload));
860
- } catch (x) {
861
- return null;
862
- }
863
- }
864
- }
865
- }
866
- return null;
867
- }
868
- var hasOwnProperty = Object.prototype.hasOwnProperty;
869
- var RESERVED_PROPS = {
870
- key: true,
871
- ref: true,
872
- __self: true,
873
- __source: true
874
- };
875
- var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
876
- {
877
- didWarnAboutStringRefs = {};
878
- }
879
- function hasValidRef(config) {
880
- {
881
- if (hasOwnProperty.call(config, 'ref')) {
882
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
883
- if (getter && getter.isReactWarning) {
884
- return false;
885
- }
886
- }
887
- }
888
- return config.ref !== undefined;
889
- }
890
- function hasValidKey(config) {
891
- {
892
- if (hasOwnProperty.call(config, 'key')) {
893
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
894
- if (getter && getter.isReactWarning) {
895
- return false;
896
- }
897
- }
898
- }
899
- return config.key !== undefined;
900
- }
901
- function defineKeyPropWarningGetter(props, displayName) {
902
- var warnAboutAccessingKey = function warnAboutAccessingKey() {
903
- {
904
- if (!specialPropKeyWarningShown) {
905
- specialPropKeyWarningShown = true;
906
- 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);
907
- }
908
- }
909
- };
910
- warnAboutAccessingKey.isReactWarning = true;
911
- Object.defineProperty(props, 'key', {
912
- get: warnAboutAccessingKey,
913
- configurable: true
914
- });
915
- }
916
- function defineRefPropWarningGetter(props, displayName) {
917
- var warnAboutAccessingRef = function warnAboutAccessingRef() {
918
- {
919
- if (!specialPropRefWarningShown) {
920
- specialPropRefWarningShown = true;
921
- 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);
922
- }
923
- }
924
- };
925
- warnAboutAccessingRef.isReactWarning = true;
926
- Object.defineProperty(props, 'ref', {
927
- get: warnAboutAccessingRef,
928
- configurable: true
929
- });
930
- }
931
- function warnIfStringRefCannotBeAutoConverted(config) {
932
- {
933
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
934
- var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
935
- if (!didWarnAboutStringRefs[componentName]) {
936
- 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);
937
- didWarnAboutStringRefs[componentName] = true;
938
- }
939
- }
940
- }
941
- }
942
- /**
943
- * Factory method to create a new React element. This no longer adheres to
944
- * the class pattern, so do not use new to call it. Also, instanceof check
945
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
946
- * if something is a React Element.
947
- *
948
- * @param {*} type
949
- * @param {*} props
950
- * @param {*} key
951
- * @param {string|object} ref
952
- * @param {*} owner
953
- * @param {*} self A *temporary* helper to detect places where `this` is
954
- * different from the `owner` when React.createElement is called, so that we
955
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
956
- * functions, and as long as `this` and owner are the same, there will be no
957
- * change in behavior.
958
- * @param {*} source An annotation object (added by a transpiler or otherwise)
959
- * indicating filename, line number, and/or other information.
960
- * @internal
961
- */ var ReactElement = function ReactElement(type, key, ref, self, source, owner, props) {
962
- var element = {
963
- // This tag allows us to uniquely identify this as a React Element
964
- $$typeof: REACT_ELEMENT_TYPE,
965
- // Built-in properties that belong on the element
966
- type: type,
967
- key: key,
968
- ref: ref,
969
- props: props,
970
- // Record the component responsible for creating this element.
971
- _owner: owner
972
- };
973
- {
974
- // The validation flag is currently mutative. We put it on
975
- // an external backing store so that we can freeze the whole object.
976
- // This can be replaced with a WeakMap once they are implemented in
977
- // commonly used development environments.
978
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
979
- // the validation flag non-enumerable (where possible, which should
980
- // include every environment we run tests in), so the test framework
981
- // ignores it.
982
- Object.defineProperty(element._store, 'validated', {
983
- configurable: false,
984
- enumerable: false,
985
- writable: true,
986
- value: false
987
- }); // self and source are DEV only properties.
988
- Object.defineProperty(element, '_self', {
989
- configurable: false,
990
- enumerable: false,
991
- writable: false,
992
- value: self
993
- }); // Two elements created in two different places should be considered
994
- // equal for testing purposes and therefore we hide it from enumeration.
995
- Object.defineProperty(element, '_source', {
996
- configurable: false,
997
- enumerable: false,
998
- writable: false,
999
- value: source
1000
- });
1001
- if (Object.freeze) {
1002
- Object.freeze(element.props);
1003
- Object.freeze(element);
1004
- }
1005
- }
1006
- return element;
1007
- };
1008
- /**
1009
- * Create and return a new ReactElement of the given type.
1010
- * See https://reactjs.org/docs/react-api.html#createelement
1011
- */ function createElement(type, config, children) {
1012
- var propName; // Reserved names are extracted
1013
- var props = {};
1014
- var key = null;
1015
- var ref = null;
1016
- var self = null;
1017
- var source = null;
1018
- if (config != null) {
1019
- if (hasValidRef(config)) {
1020
- ref = config.ref;
1021
- {
1022
- warnIfStringRefCannotBeAutoConverted(config);
1023
- }
1024
- }
1025
- if (hasValidKey(config)) {
1026
- {
1027
- checkKeyStringCoercion(config.key);
1028
- }
1029
- key = '' + config.key;
1030
- }
1031
- self = config.__self === undefined ? null : config.__self;
1032
- source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
1033
- for(propName in config){
1034
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1035
- props[propName] = config[propName];
1036
- }
1037
- }
1038
- } // Children can be more than one argument, and those are transferred onto
1039
- // the newly allocated props object.
1040
- var childrenLength = arguments.length - 2;
1041
- if (childrenLength === 1) {
1042
- props.children = children;
1043
- } else if (childrenLength > 1) {
1044
- var childArray = Array(childrenLength);
1045
- for(var i = 0; i < childrenLength; i++){
1046
- childArray[i] = arguments[i + 2];
1047
- }
1048
- {
1049
- if (Object.freeze) {
1050
- Object.freeze(childArray);
1051
- }
1052
- }
1053
- props.children = childArray;
1054
- } // Resolve default props
1055
- if (type && type.defaultProps) {
1056
- var defaultProps = type.defaultProps;
1057
- for(propName in defaultProps){
1058
- if (props[propName] === undefined) {
1059
- props[propName] = defaultProps[propName];
1060
- }
1061
- }
1062
- }
1063
- {
1064
- if (key || ref) {
1065
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1066
- if (key) {
1067
- defineKeyPropWarningGetter(props, displayName);
1068
- }
1069
- if (ref) {
1070
- defineRefPropWarningGetter(props, displayName);
1071
- }
1072
- }
1073
- }
1074
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1075
- }
1076
- function cloneAndReplaceKey(oldElement, newKey) {
1077
- var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
1078
- return newElement;
1079
- }
1080
- /**
1081
- * Clone and return a new ReactElement using element as the starting point.
1082
- * See https://reactjs.org/docs/react-api.html#cloneelement
1083
- */ function cloneElement(element, config, children) {
1084
- if (element === null || element === undefined) {
1085
- throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
1086
- }
1087
- var propName; // Original props are copied
1088
- var props = assign({}, element.props); // Reserved names are extracted
1089
- var key = element.key;
1090
- var ref = element.ref; // Self is preserved since the owner is preserved.
1091
- var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
1092
- // transpiler, and the original source is probably a better indicator of the
1093
- // true owner.
1094
- var source = element._source; // Owner will be preserved, unless ref is overridden
1095
- var owner = element._owner;
1096
- if (config != null) {
1097
- if (hasValidRef(config)) {
1098
- // Silently steal the ref from the parent.
1099
- ref = config.ref;
1100
- owner = ReactCurrentOwner.current;
1101
- }
1102
- if (hasValidKey(config)) {
1103
- {
1104
- checkKeyStringCoercion(config.key);
1105
- }
1106
- key = '' + config.key;
1107
- } // Remaining properties override existing props
1108
- var defaultProps;
1109
- if (element.type && element.type.defaultProps) {
1110
- defaultProps = element.type.defaultProps;
1111
- }
1112
- for(propName in config){
1113
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1114
- if (config[propName] === undefined && defaultProps !== undefined) {
1115
- // Resolve default props
1116
- props[propName] = defaultProps[propName];
1117
- } else {
1118
- props[propName] = config[propName];
1119
- }
1120
- }
1121
- }
1122
- } // Children can be more than one argument, and those are transferred onto
1123
- // the newly allocated props object.
1124
- var childrenLength = arguments.length - 2;
1125
- if (childrenLength === 1) {
1126
- props.children = children;
1127
- } else if (childrenLength > 1) {
1128
- var childArray = Array(childrenLength);
1129
- for(var i = 0; i < childrenLength; i++){
1130
- childArray[i] = arguments[i + 2];
1131
- }
1132
- props.children = childArray;
1133
- }
1134
- return ReactElement(element.type, key, ref, self, source, owner, props);
1135
- }
1136
- /**
1137
- * Verifies the object is a ReactElement.
1138
- * See https://reactjs.org/docs/react-api.html#isvalidelement
1139
- * @param {?object} object
1140
- * @return {boolean} True if `object` is a ReactElement.
1141
- * @final
1142
- */ function isValidElement(object) {
1143
- return (typeof object === "undefined" ? "undefined" : _type_of(object)) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1144
- }
1145
- var SEPARATOR = '.';
1146
- var SUBSEPARATOR = ':';
1147
- /**
1148
- * Escape and wrap key so it is safe to use as a reactid
1149
- *
1150
- * @param {string} key to be escaped.
1151
- * @return {string} the escaped key.
1152
- */ function escape(key) {
1153
- var escapeRegex = /[=:]/g;
1154
- var escaperLookup = {
1155
- '=': '=0',
1156
- ':': '=2'
1157
- };
1158
- var escapedString = key.replace(escapeRegex, function(match) {
1159
- return escaperLookup[match];
1160
- });
1161
- return '$' + escapedString;
1162
- }
1163
- /**
1164
- * TODO: Test that a single child and an array with one item have the same key
1165
- * pattern.
1166
- */ var didWarnAboutMaps = false;
1167
- var userProvidedKeyEscapeRegex = /\/+/g;
1168
- function escapeUserProvidedKey(text) {
1169
- return text.replace(userProvidedKeyEscapeRegex, '$&/');
1170
- }
1171
- /**
1172
- * Generate a key string that identifies a element within a set.
1173
- *
1174
- * @param {*} element A element that could contain a manual key.
1175
- * @param {number} index Index that is used if a manual key is not provided.
1176
- * @return {string}
1177
- */ function getElementKey(element, index) {
1178
- // Do some typechecking here since we call this blindly. We want to ensure
1179
- // that we don't block potential future ES APIs.
1180
- if ((typeof element === "undefined" ? "undefined" : _type_of(element)) === 'object' && element !== null && element.key != null) {
1181
- // Explicit key
1182
- {
1183
- checkKeyStringCoercion(element.key);
1184
- }
1185
- return escape('' + element.key);
1186
- } // Implicit key determined by the index in the set
1187
- return index.toString(36);
1188
- }
1189
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
1190
- var type = typeof children === "undefined" ? "undefined" : _type_of(children);
1191
- if (type === 'undefined' || type === 'boolean') {
1192
- // All of the above are perceived as null.
1193
- children = null;
1194
- }
1195
- var invokeCallback = false;
1196
- if (children === null) {
1197
- invokeCallback = true;
1198
- } else {
1199
- switch(type){
1200
- case 'string':
1201
- case 'number':
1202
- invokeCallback = true;
1203
- break;
1204
- case 'object':
1205
- switch(children.$$typeof){
1206
- case REACT_ELEMENT_TYPE:
1207
- case REACT_PORTAL_TYPE:
1208
- invokeCallback = true;
1209
- }
1210
- }
1211
- }
1212
- if (invokeCallback) {
1213
- var _child = children;
1214
- var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
1215
- // so that it's consistent if the number of children grows:
1216
- var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
1217
- if (isArray(mappedChild)) {
1218
- var escapedChildKey = '';
1219
- if (childKey != null) {
1220
- escapedChildKey = escapeUserProvidedKey(childKey) + '/';
1221
- }
1222
- mapIntoArray(mappedChild, array, escapedChildKey, '', function(c) {
1223
- return c;
1224
- });
1225
- } else if (mappedChild != null) {
1226
- if (isValidElement(mappedChild)) {
1227
- {
1228
- // The `if` statement here prevents auto-disabling of the safe
1229
- // coercion ESLint rule, so we must manually disable it below.
1230
- // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
1231
- if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
1232
- checkKeyStringCoercion(mappedChild.key);
1233
- }
1234
- }
1235
- mappedChild = cloneAndReplaceKey(mappedChild, // traverseAllChildren used to do for objects as children
1236
- escapedPrefix + (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // eslint-disable-next-line react-internal/safe-string-coercion
1237
- escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
1238
- }
1239
- array.push(mappedChild);
1240
- }
1241
- return 1;
1242
- }
1243
- var child;
1244
- var nextName;
1245
- var subtreeCount = 0; // Count of children found in the current subtree.
1246
- var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1247
- if (isArray(children)) {
1248
- for(var i = 0; i < children.length; i++){
1249
- child = children[i];
1250
- nextName = nextNamePrefix + getElementKey(child, i);
1251
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1252
- }
1253
- } else {
1254
- var iteratorFn = getIteratorFn(children);
1255
- if (typeof iteratorFn === 'function') {
1256
- var iterableChildren = children;
1257
- {
1258
- // Warn about using Maps as children
1259
- if (iteratorFn === iterableChildren.entries) {
1260
- if (!didWarnAboutMaps) {
1261
- warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
1262
- }
1263
- didWarnAboutMaps = true;
1264
- }
1265
- }
1266
- var iterator = iteratorFn.call(iterableChildren);
1267
- var step;
1268
- var ii = 0;
1269
- while(!(step = iterator.next()).done){
1270
- child = step.value;
1271
- nextName = nextNamePrefix + getElementKey(child, ii++);
1272
- subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1273
- }
1274
- } else if (type === 'object') {
1275
- // eslint-disable-next-line react-internal/safe-string-coercion
1276
- var childrenString = String(children);
1277
- throw new 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.');
1278
- }
1279
- }
1280
- return subtreeCount;
1281
- }
1282
- /**
1283
- * Maps children that are typically specified as `props.children`.
1284
- *
1285
- * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1286
- *
1287
- * The provided mapFunction(child, index) will be called for each
1288
- * leaf child.
1289
- *
1290
- * @param {?*} children Children tree container.
1291
- * @param {function(*, int)} func The map function.
1292
- * @param {*} context Context for mapFunction.
1293
- * @return {object} Object containing the ordered map of results.
1294
- */ function mapChildren(children, func, context) {
1295
- if (children == null) {
1296
- return children;
1297
- }
1298
- var result = [];
1299
- var count = 0;
1300
- mapIntoArray(children, result, '', '', function(child) {
1301
- return func.call(context, child, count++);
1302
- });
1303
- return result;
1304
- }
1305
- /**
1306
- * Count the number of children that are typically specified as
1307
- * `props.children`.
1308
- *
1309
- * See https://reactjs.org/docs/react-api.html#reactchildrencount
1310
- *
1311
- * @param {?*} children Children tree container.
1312
- * @return {number} The number of children.
1313
- */ function countChildren(children) {
1314
- var n = 0;
1315
- mapChildren(children, function() {
1316
- n++; // Don't return anything
1317
- });
1318
- return n;
1319
- }
1320
- /**
1321
- * Iterates through children that are typically specified as `props.children`.
1322
- *
1323
- * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1324
- *
1325
- * The provided forEachFunc(child, index) will be called for each
1326
- * leaf child.
1327
- *
1328
- * @param {?*} children Children tree container.
1329
- * @param {function(*, int)} forEachFunc
1330
- * @param {*} forEachContext Context for forEachContext.
1331
- */ function forEachChildren(children, forEachFunc, forEachContext) {
1332
- mapChildren(children, function() {
1333
- forEachFunc.apply(this, arguments); // Don't return anything.
1334
- }, forEachContext);
1335
- }
1336
- /**
1337
- * Flatten a children object (typically specified as `props.children`) and
1338
- * return an array with appropriately re-keyed children.
1339
- *
1340
- * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1341
- */ function toArray(children) {
1342
- return mapChildren(children, function(child) {
1343
- return child;
1344
- }) || [];
1345
- }
1346
- /**
1347
- * Returns the first child in a collection of children and verifies that there
1348
- * is only one child in the collection.
1349
- *
1350
- * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1351
- *
1352
- * The current implementation of this function assumes that a single child gets
1353
- * passed without a wrapper, but the purpose of this helper function is to
1354
- * abstract away the particular structure of children.
1355
- *
1356
- * @param {?object} children Child collection structure.
1357
- * @return {ReactElement} The first and only `ReactElement` contained in the
1358
- * structure.
1359
- */ function onlyChild(children) {
1360
- if (!isValidElement(children)) {
1361
- throw new Error('React.Children.only expected to receive a single React element child.');
1362
- }
1363
- return children;
1364
- }
1365
- function createContext(defaultValue) {
1366
- // TODO: Second argument used to be an optional `calculateChangedBits`
1367
- // function. Warn to reserve for future use?
1368
- var context = {
1369
- $$typeof: REACT_CONTEXT_TYPE,
1370
- // As a workaround to support multiple concurrent renderers, we categorize
1371
- // some renderers as primary and others as secondary. We only expect
1372
- // there to be two concurrent renderers at most: React Native (primary) and
1373
- // Fabric (secondary); React DOM (primary) and React ART (secondary).
1374
- // Secondary renderers store their context values on separate fields.
1375
- _currentValue: defaultValue,
1376
- _currentValue2: defaultValue,
1377
- // Used to track how many concurrent renderers this context currently
1378
- // supports within in a single renderer. Such as parallel server rendering.
1379
- _threadCount: 0,
1380
- // These are circular
1381
- Provider: null,
1382
- Consumer: null,
1383
- // Add these to use same hidden class in VM as ServerContext
1384
- _defaultValue: null,
1385
- _globalName: null
1386
- };
1387
- context.Provider = {
1388
- $$typeof: REACT_PROVIDER_TYPE,
1389
- _context: context
1390
- };
1391
- var hasWarnedAboutUsingNestedContextConsumers = false;
1392
- var hasWarnedAboutUsingConsumerProvider = false;
1393
- var hasWarnedAboutDisplayNameOnConsumer = false;
1394
- {
1395
- // A separate object, but proxies back to the original context object for
1396
- // backwards compatibility. It has a different $$typeof, so we can properly
1397
- // warn for the incorrect usage of Context as a Consumer.
1398
- var Consumer = {
1399
- $$typeof: REACT_CONTEXT_TYPE,
1400
- _context: context
1401
- }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1402
- Object.defineProperties(Consumer, {
1403
- Provider: {
1404
- get: function get() {
1405
- if (!hasWarnedAboutUsingConsumerProvider) {
1406
- hasWarnedAboutUsingConsumerProvider = true;
1407
- 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?');
1408
- }
1409
- return context.Provider;
1410
- },
1411
- set: function set(_Provider) {
1412
- context.Provider = _Provider;
1413
- }
1414
- },
1415
- _currentValue: {
1416
- get: function get() {
1417
- return context._currentValue;
1418
- },
1419
- set: function set(_currentValue) {
1420
- context._currentValue = _currentValue;
1421
- }
1422
- },
1423
- _currentValue2: {
1424
- get: function get() {
1425
- return context._currentValue2;
1426
- },
1427
- set: function set(_currentValue2) {
1428
- context._currentValue2 = _currentValue2;
1429
- }
1430
- },
1431
- _threadCount: {
1432
- get: function get() {
1433
- return context._threadCount;
1434
- },
1435
- set: function set(_threadCount) {
1436
- context._threadCount = _threadCount;
1437
- }
1438
- },
1439
- Consumer: {
1440
- get: function get() {
1441
- if (!hasWarnedAboutUsingNestedContextConsumers) {
1442
- hasWarnedAboutUsingNestedContextConsumers = true;
1443
- 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?');
1444
- }
1445
- return context.Consumer;
1446
- }
1447
- },
1448
- displayName: {
1449
- get: function get() {
1450
- return context.displayName;
1451
- },
1452
- set: function set(displayName) {
1453
- if (!hasWarnedAboutDisplayNameOnConsumer) {
1454
- warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
1455
- hasWarnedAboutDisplayNameOnConsumer = true;
1456
- }
1457
- }
1458
- }
1459
- }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1460
- context.Consumer = Consumer;
1461
- }
1462
- {
1463
- context._currentRenderer = null;
1464
- context._currentRenderer2 = null;
1465
- }
1466
- return context;
1467
- }
1468
- var Uninitialized = -1;
1469
- var Pending = 0;
1470
- var Resolved = 1;
1471
- var Rejected = 2;
1472
- function lazyInitializer(payload) {
1473
- if (payload._status === Uninitialized) {
1474
- var ctor = payload._result;
1475
- var thenable = ctor(); // Transition to the next state.
1476
- // This might throw either because it's missing or throws. If so, we treat it
1477
- // as still uninitialized and try again next time. Which is the same as what
1478
- // happens if the ctor or any wrappers processing the ctor throws. This might
1479
- // end up fixing it if the resolution was a concurrency bug.
1480
- thenable.then(function(moduleObject) {
1481
- if (payload._status === Pending || payload._status === Uninitialized) {
1482
- // Transition to the next state.
1483
- var resolved = payload;
1484
- resolved._status = Resolved;
1485
- resolved._result = moduleObject;
1486
- }
1487
- }, function(error) {
1488
- if (payload._status === Pending || payload._status === Uninitialized) {
1489
- // Transition to the next state.
1490
- var rejected = payload;
1491
- rejected._status = Rejected;
1492
- rejected._result = error;
1493
- }
1494
- });
1495
- if (payload._status === Uninitialized) {
1496
- // In case, we're still uninitialized, then we're waiting for the thenable
1497
- // to resolve. Set it as pending in the meantime.
1498
- var pending = payload;
1499
- pending._status = Pending;
1500
- pending._result = thenable;
1501
- }
1502
- }
1503
- if (payload._status === Resolved) {
1504
- var moduleObject = payload._result;
1505
- {
1506
- if (moduleObject === undefined) {
1507
- error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
1508
- 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject);
1509
- }
1510
- }
1511
- {
1512
- if (!('default' in moduleObject)) {
1513
- error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
1514
- 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
1515
- }
1516
- }
1517
- return moduleObject.default;
1518
- } else {
1519
- throw payload._result;
1520
- }
1521
- }
1522
- function lazy(ctor) {
1523
- var payload = {
1524
- // We use these fields to store the result.
1525
- _status: Uninitialized,
1526
- _result: ctor
1527
- };
1528
- var lazyType = {
1529
- $$typeof: REACT_LAZY_TYPE,
1530
- _payload: payload,
1531
- _init: lazyInitializer
1532
- };
1533
- {
1534
- // In production, this would just set it on the object.
1535
- var defaultProps;
1536
- var propTypes; // $FlowFixMe
1537
- Object.defineProperties(lazyType, {
1538
- defaultProps: {
1539
- configurable: true,
1540
- get: function get() {
1541
- return defaultProps;
1542
- },
1543
- set: function set(newDefaultProps) {
1544
- 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.');
1545
- defaultProps = newDefaultProps; // Match production behavior more closely:
1546
- // $FlowFixMe
1547
- Object.defineProperty(lazyType, 'defaultProps', {
1548
- enumerable: true
1549
- });
1550
- }
1551
- },
1552
- propTypes: {
1553
- configurable: true,
1554
- get: function get() {
1555
- return propTypes;
1556
- },
1557
- set: function set(newPropTypes) {
1558
- 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.');
1559
- propTypes = newPropTypes; // Match production behavior more closely:
1560
- // $FlowFixMe
1561
- Object.defineProperty(lazyType, 'propTypes', {
1562
- enumerable: true
1563
- });
1564
- }
1565
- }
1566
- });
1567
- }
1568
- return lazyType;
1569
- }
1570
- function forwardRef(render) {
1571
- {
1572
- if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1573
- error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1574
- } else if (typeof render !== 'function') {
1575
- error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render === "undefined" ? "undefined" : _type_of(render));
1576
- } else {
1577
- if (render.length !== 0 && render.length !== 2) {
1578
- 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.');
1579
- }
1580
- }
1581
- if (render != null) {
1582
- if (render.defaultProps != null || render.propTypes != null) {
1583
- error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
1584
- }
1585
- }
1586
- }
1587
- var elementType = {
1588
- $$typeof: REACT_FORWARD_REF_TYPE,
1589
- render: render
1590
- };
1591
- {
1592
- var ownName;
1593
- Object.defineProperty(elementType, 'displayName', {
1594
- enumerable: false,
1595
- configurable: true,
1596
- get: function get() {
1597
- return ownName;
1598
- },
1599
- set: function set(name) {
1600
- ownName = name; // The inner component shouldn't inherit this display name in most cases,
1601
- // because the component may be used elsewhere.
1602
- // But it's nice for anonymous functions to inherit the name,
1603
- // so that our component-stack generation logic will display their frames.
1604
- // An anonymous function generally suggests a pattern like:
1605
- // React.forwardRef((props, ref) => {...});
1606
- // This kind of inner function is not used elsewhere so the side effect is okay.
1607
- if (!render.name && !render.displayName) {
1608
- render.displayName = name;
1609
- }
1610
- }
1611
- });
1612
- }
1613
- return elementType;
1614
- }
1615
- var REACT_MODULE_REFERENCE;
1616
- {
1617
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
1618
- }
1619
- function isValidElementType(type) {
1620
- if (typeof type === 'string' || typeof type === 'function') {
1621
- return true;
1622
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1623
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
1624
- return true;
1625
- }
1626
- if ((typeof type === "undefined" ? "undefined" : _type_of(type)) === 'object' && type !== null) {
1627
- 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 || // This needs to include all possible module reference object
1628
- // types supported by any Flight configuration anywhere since
1629
- // we don't know which Flight build this will end up being used
1630
- // with.
1631
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
1632
- return true;
1633
- }
1634
- }
1635
- return false;
1636
- }
1637
- function memo(type, compare) {
1638
- {
1639
- if (!isValidElementType(type)) {
1640
- error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type === "undefined" ? "undefined" : _type_of(type));
1641
- }
1642
- }
1643
- var elementType = {
1644
- $$typeof: REACT_MEMO_TYPE,
1645
- type: type,
1646
- compare: compare === undefined ? null : compare
1647
- };
1648
- {
1649
- var ownName;
1650
- Object.defineProperty(elementType, 'displayName', {
1651
- enumerable: false,
1652
- configurable: true,
1653
- get: function get() {
1654
- return ownName;
1655
- },
1656
- set: function set(name) {
1657
- ownName = name; // The inner component shouldn't inherit this display name in most cases,
1658
- // because the component may be used elsewhere.
1659
- // But it's nice for anonymous functions to inherit the name,
1660
- // so that our component-stack generation logic will display their frames.
1661
- // An anonymous function generally suggests a pattern like:
1662
- // React.memo((props) => {...});
1663
- // This kind of inner function is not used elsewhere so the side effect is okay.
1664
- if (!type.name && !type.displayName) {
1665
- type.displayName = name;
1666
- }
1667
- }
1668
- });
1669
- }
1670
- return elementType;
1671
- }
1672
- function resolveDispatcher() {
1673
- var dispatcher = ReactCurrentDispatcher.current;
1674
- {
1675
- if (dispatcher === null) {
1676
- 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:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');
1677
- }
1678
- }
1679
- // intentionally don't throw our own error because this is in a hot path.
1680
- // Also helps ensure this is inlined.
1681
- return dispatcher;
1682
- }
1683
- function useContext(Context) {
1684
- var dispatcher = resolveDispatcher();
1685
- {
1686
- // TODO: add a more generic warning for invalid values.
1687
- if (Context._context !== undefined) {
1688
- var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
1689
- // and nobody should be using this in existing code.
1690
- if (realContext.Consumer === Context) {
1691
- 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?');
1692
- } else if (realContext.Provider === Context) {
1693
- error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1694
- }
1695
- }
1696
- }
1697
- return dispatcher.useContext(Context);
1698
- }
1699
- function useState(initialState) {
1700
- var dispatcher = resolveDispatcher();
1701
- return dispatcher.useState(initialState);
1702
- }
1703
- function useReducer(reducer, initialArg, init) {
1704
- var dispatcher = resolveDispatcher();
1705
- return dispatcher.useReducer(reducer, initialArg, init);
1706
- }
1707
- function useRef(initialValue) {
1708
- var dispatcher = resolveDispatcher();
1709
- return dispatcher.useRef(initialValue);
1710
- }
1711
- function useEffect(create, deps) {
1712
- var dispatcher = resolveDispatcher();
1713
- return dispatcher.useEffect(create, deps);
1714
- }
1715
- function useInsertionEffect(create, deps) {
1716
- var dispatcher = resolveDispatcher();
1717
- return dispatcher.useInsertionEffect(create, deps);
1718
- }
1719
- function useLayoutEffect(create, deps) {
1720
- var dispatcher = resolveDispatcher();
1721
- return dispatcher.useLayoutEffect(create, deps);
1722
- }
1723
- function useCallback(callback, deps) {
1724
- var dispatcher = resolveDispatcher();
1725
- return dispatcher.useCallback(callback, deps);
1726
- }
1727
- function useMemo(create, deps) {
1728
- var dispatcher = resolveDispatcher();
1729
- return dispatcher.useMemo(create, deps);
1730
- }
1731
- function useImperativeHandle(ref, create, deps) {
1732
- var dispatcher = resolveDispatcher();
1733
- return dispatcher.useImperativeHandle(ref, create, deps);
1734
- }
1735
- function useDebugValue(value, formatterFn) {
1736
- {
1737
- var dispatcher = resolveDispatcher();
1738
- return dispatcher.useDebugValue(value, formatterFn);
1739
- }
1740
- }
1741
- function useTransition() {
1742
- var dispatcher = resolveDispatcher();
1743
- return dispatcher.useTransition();
1744
- }
1745
- function useDeferredValue(value) {
1746
- var dispatcher = resolveDispatcher();
1747
- return dispatcher.useDeferredValue(value);
1748
- }
1749
- function useId() {
1750
- var dispatcher = resolveDispatcher();
1751
- return dispatcher.useId();
1752
- }
1753
- function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
1754
- var dispatcher = resolveDispatcher();
1755
- return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
1756
- }
1757
- // Helpers to patch console.logs to avoid logging during side-effect free
1758
- // replaying on render function. This currently only patches the object
1759
- // lazily which won't cover if the log function was extracted eagerly.
1760
- // We could also eagerly patch the method.
1761
- var disabledDepth = 0;
1762
- var prevLog;
1763
- var prevInfo;
1764
- var prevWarn;
1765
- var prevError;
1766
- var prevGroup;
1767
- var prevGroupCollapsed;
1768
- var prevGroupEnd;
1769
- function disabledLog() {}
1770
- disabledLog.__reactDisabledLog = true;
1771
- function disableLogs() {
1772
- {
1773
- if (disabledDepth === 0) {
1774
- /* eslint-disable react-internal/no-production-logging */ prevLog = console.log;
1775
- prevInfo = console.info;
1776
- prevWarn = console.warn;
1777
- prevError = console.error;
1778
- prevGroup = console.group;
1779
- prevGroupCollapsed = console.groupCollapsed;
1780
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
1781
- var props = {
1782
- configurable: true,
1783
- enumerable: true,
1784
- value: disabledLog,
1785
- writable: true
1786
- }; // $FlowFixMe Flow thinks console is immutable.
1787
- Object.defineProperties(console, {
1788
- info: props,
1789
- log: props,
1790
- warn: props,
1791
- error: props,
1792
- group: props,
1793
- groupCollapsed: props,
1794
- groupEnd: props
1795
- });
1796
- /* eslint-enable react-internal/no-production-logging */ }
1797
- disabledDepth++;
1798
- }
1799
- }
1800
- function reenableLogs() {
1801
- {
1802
- disabledDepth--;
1803
- if (disabledDepth === 0) {
1804
- /* eslint-disable react-internal/no-production-logging */ var props = {
1805
- configurable: true,
1806
- enumerable: true,
1807
- writable: true
1808
- }; // $FlowFixMe Flow thinks console is immutable.
1809
- Object.defineProperties(console, {
1810
- log: assign({}, props, {
1811
- value: prevLog
1812
- }),
1813
- info: assign({}, props, {
1814
- value: prevInfo
1815
- }),
1816
- warn: assign({}, props, {
1817
- value: prevWarn
1818
- }),
1819
- error: assign({}, props, {
1820
- value: prevError
1821
- }),
1822
- group: assign({}, props, {
1823
- value: prevGroup
1824
- }),
1825
- groupCollapsed: assign({}, props, {
1826
- value: prevGroupCollapsed
1827
- }),
1828
- groupEnd: assign({}, props, {
1829
- value: prevGroupEnd
1830
- })
1831
- });
1832
- /* eslint-enable react-internal/no-production-logging */ }
1833
- if (disabledDepth < 0) {
1834
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
1835
- }
1836
- }
1837
- }
1838
- var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1839
- var prefix;
1840
- function describeBuiltInComponentFrame(name, source, ownerFn) {
1841
- {
1842
- if (prefix === undefined) {
1843
- // Extract the VM specific prefix used by each line.
1844
- try {
1845
- throw Error();
1846
- } catch (x) {
1847
- var match = x.stack.trim().match(/\n( *(at )?)/);
1848
- prefix = match && match[1] || '';
1849
- }
1850
- } // We use the prefix to ensure our stacks line up with native stack frames.
1851
- return '\n' + prefix + name;
1852
- }
1853
- }
1854
- var reentry = false;
1855
- var componentFrameCache;
1856
- {
1857
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
1858
- componentFrameCache = new PossiblyWeakMap();
1859
- }
1860
- function describeNativeComponentFrame(fn, construct) {
1861
- // If something asked for a stack inside a fake render, it should get ignored.
1862
- if (!fn || reentry) {
1863
- return '';
1864
- }
1865
- {
1866
- var frame = componentFrameCache.get(fn);
1867
- if (frame !== undefined) {
1868
- return frame;
1869
- }
1870
- }
1871
- var control;
1872
- reentry = true;
1873
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
1874
- Error.prepareStackTrace = undefined;
1875
- var previousDispatcher;
1876
- {
1877
- previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
1878
- // for warnings.
1879
- ReactCurrentDispatcher$1.current = null;
1880
- disableLogs();
1881
- }
1882
- try {
1883
- // This should throw.
1884
- if (construct) {
1885
- // Something should be setting the props in the constructor.
1886
- var Fake = function Fake() {
1887
- throw Error();
1888
- }; // $FlowFixMe
1889
- Object.defineProperty(Fake.prototype, 'props', {
1890
- set: function set() {
1891
- // We use a throwing setter instead of frozen or non-writable props
1892
- // because that won't throw in a non-strict mode function.
1893
- throw Error();
1894
- }
1895
- });
1896
- if ((typeof Reflect === "undefined" ? "undefined" : _type_of(Reflect)) === 'object' && Reflect.construct) {
1897
- // We construct a different control for this case to include any extra
1898
- // frames added by the construct call.
1899
- try {
1900
- Reflect.construct(Fake, []);
1901
- } catch (x) {
1902
- control = x;
1903
- }
1904
- Reflect.construct(fn, [], Fake);
1905
- } else {
1906
- try {
1907
- Fake.call();
1908
- } catch (x) {
1909
- control = x;
1910
- }
1911
- fn.call(Fake.prototype);
1912
- }
1913
- } else {
1914
- try {
1915
- throw Error();
1916
- } catch (x) {
1917
- control = x;
1918
- }
1919
- fn();
1920
- }
1921
- } catch (sample) {
1922
- // This is inlined manually because closure doesn't do it for us.
1923
- if (sample && control && typeof sample.stack === 'string') {
1924
- // This extracts the first frame from the sample that isn't also in the control.
1925
- // Skipping one frame that we assume is the frame that calls the two.
1926
- var sampleLines = sample.stack.split('\n');
1927
- var controlLines = control.stack.split('\n');
1928
- var s = sampleLines.length - 1;
1929
- var c = controlLines.length - 1;
1930
- while(s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]){
1931
- // We expect at least one stack frame to be shared.
1932
- // Typically this will be the root most one. However, stack frames may be
1933
- // cut off due to maximum stack limits. In this case, one maybe cut off
1934
- // earlier than the other. We assume that the sample is longer or the same
1935
- // and there for cut off earlier. So we should find the root most frame in
1936
- // the sample somewhere in the control.
1937
- c--;
1938
- }
1939
- for(; s >= 1 && c >= 0; s--, c--){
1940
- // Next we find the first one that isn't the same which should be the
1941
- // frame that called our sample function and the control.
1942
- if (sampleLines[s] !== controlLines[c]) {
1943
- // In V8, the first line is describing the message but other VMs don't.
1944
- // If we're about to return the first line, and the control is also on the same
1945
- // line, that's a pretty good indicator that our sample threw at same line as
1946
- // the control. I.e. before we entered the sample frame. So we ignore this result.
1947
- // This can happen if you passed a class to function component, or non-function.
1948
- if (s !== 1 || c !== 1) {
1949
- do {
1950
- s--;
1951
- c--; // We may still have similar intermediate frames from the construct call.
1952
- // The next one that isn't the same should be our match though.
1953
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
1954
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
1955
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
1956
- // but we have a user-provided "displayName"
1957
- // splice it in to make the stack more readable.
1958
- if (fn.displayName && _frame.includes('<anonymous>')) {
1959
- _frame = _frame.replace('<anonymous>', fn.displayName);
1960
- }
1961
- {
1962
- if (typeof fn === 'function') {
1963
- componentFrameCache.set(fn, _frame);
1964
- }
1965
- }
1966
- return _frame;
1967
- }
1968
- }while (s >= 1 && c >= 0);
1969
- }
1970
- break;
1971
- }
1972
- }
1973
- }
1974
- } finally{
1975
- reentry = false;
1976
- {
1977
- ReactCurrentDispatcher$1.current = previousDispatcher;
1978
- reenableLogs();
1979
- }
1980
- Error.prepareStackTrace = previousPrepareStackTrace;
1981
- } // Fallback to just using the name if we couldn't make it throw.
1982
- var name = fn ? fn.displayName || fn.name : '';
1983
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
1984
- {
1985
- if (typeof fn === 'function') {
1986
- componentFrameCache.set(fn, syntheticFrame);
1987
- }
1988
- }
1989
- return syntheticFrame;
1990
- }
1991
- function describeFunctionComponentFrame(fn, source, ownerFn) {
1992
- {
1993
- return describeNativeComponentFrame(fn, false);
1994
- }
1995
- }
1996
- function shouldConstruct(Component) {
1997
- var prototype = Component.prototype;
1998
- return !!(prototype && prototype.isReactComponent);
1999
- }
2000
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
2001
- if (type == null) {
2002
- return '';
2003
- }
2004
- if (typeof type === 'function') {
2005
- {
2006
- return describeNativeComponentFrame(type, shouldConstruct(type));
2007
- }
2008
- }
2009
- if (typeof type === 'string') {
2010
- return describeBuiltInComponentFrame(type);
2011
- }
2012
- switch(type){
2013
- case REACT_SUSPENSE_TYPE:
2014
- return describeBuiltInComponentFrame('Suspense');
2015
- case REACT_SUSPENSE_LIST_TYPE:
2016
- return describeBuiltInComponentFrame('SuspenseList');
2017
- }
2018
- if ((typeof type === "undefined" ? "undefined" : _type_of(type)) === 'object') {
2019
- switch(type.$$typeof){
2020
- case REACT_FORWARD_REF_TYPE:
2021
- return describeFunctionComponentFrame(type.render);
2022
- case REACT_MEMO_TYPE:
2023
- // Memo may contain any component type so we recursively resolve it.
2024
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
2025
- case REACT_LAZY_TYPE:
2026
- {
2027
- var lazyComponent = type;
2028
- var payload = lazyComponent._payload;
2029
- var init = lazyComponent._init;
2030
- try {
2031
- // Lazy may contain any component type so we recursively resolve it.
2032
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
2033
- } catch (x) {}
2034
- }
2035
- }
2036
- }
2037
- return '';
2038
- }
2039
- var loggedTypeFailures = {};
2040
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
2041
- function setCurrentlyValidatingElement(element) {
2042
- {
2043
- if (element) {
2044
- var owner = element._owner;
2045
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2046
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
2047
- } else {
2048
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
2049
- }
2050
- }
2051
- }
2052
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
2053
- {
2054
- // $FlowFixMe This is okay but Flow doesn't know it.
2055
- var has = Function.call.bind(hasOwnProperty);
2056
- for(var typeSpecName in typeSpecs){
2057
- if (has(typeSpecs, typeSpecName)) {
2058
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
2059
- // fail the render phase where it didn't fail before. So we log it.
2060
- // After these have been cleaned up, we'll let them throw.
2061
- try {
2062
- // This is intentionally an invariant that gets caught. It's the same
2063
- // behavior as without this statement except with a better message.
2064
- if (typeof typeSpecs[typeSpecName] !== 'function') {
2065
- // eslint-disable-next-line react-internal/prod-error-codes
2066
- var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + _type_of(typeSpecs[typeSpecName]) + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
2067
- err.name = 'Invariant Violation';
2068
- throw err;
2069
- }
2070
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
2071
- } catch (ex) {
2072
- error$1 = ex;
2073
- }
2074
- if (error$1 && !_instanceof(error$1, Error)) {
2075
- setCurrentlyValidatingElement(element);
2076
- 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 === "undefined" ? "undefined" : _type_of(error$1));
2077
- setCurrentlyValidatingElement(null);
2078
- }
2079
- if (_instanceof(error$1, Error) && !(error$1.message in loggedTypeFailures)) {
2080
- // Only monitor this failure once because there tends to be a lot of the
2081
- // same error.
2082
- loggedTypeFailures[error$1.message] = true;
2083
- setCurrentlyValidatingElement(element);
2084
- error('Failed %s type: %s', location, error$1.message);
2085
- setCurrentlyValidatingElement(null);
2086
- }
2087
- }
2088
- }
2089
- }
2090
- }
2091
- function setCurrentlyValidatingElement$1(element) {
2092
- {
2093
- if (element) {
2094
- var owner = element._owner;
2095
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2096
- setExtraStackFrame(stack);
2097
- } else {
2098
- setExtraStackFrame(null);
2099
- }
2100
- }
2101
- }
2102
- var propTypesMisspellWarningShown;
2103
- {
2104
- propTypesMisspellWarningShown = false;
2105
- }
2106
- function getDeclarationErrorAddendum() {
2107
- if (ReactCurrentOwner.current) {
2108
- var name = getComponentNameFromType(ReactCurrentOwner.current.type);
2109
- if (name) {
2110
- return '\n\nCheck the render method of `' + name + '`.';
2111
- }
2112
- }
2113
- return '';
2114
- }
2115
- function getSourceInfoErrorAddendum(source) {
2116
- if (source !== undefined) {
2117
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
2118
- var lineNumber = source.lineNumber;
2119
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
2120
- }
2121
- return '';
2122
- }
2123
- function getSourceInfoErrorAddendumForProps(elementProps) {
2124
- if (elementProps !== null && elementProps !== undefined) {
2125
- return getSourceInfoErrorAddendum(elementProps.__source);
2126
- }
2127
- return '';
2128
- }
2129
- /**
2130
- * Warn if there's no key explicitly set on dynamic arrays of children or
2131
- * object keys are not valid. This allows us to keep track of children between
2132
- * updates.
2133
- */ var ownerHasKeyUseWarning = {};
2134
- function getCurrentComponentErrorInfo(parentType) {
2135
- var info = getDeclarationErrorAddendum();
2136
- if (!info) {
2137
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
2138
- if (parentName) {
2139
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2140
- }
2141
- }
2142
- return info;
2143
- }
2144
- /**
2145
- * Warn if the element doesn't have an explicit key assigned to it.
2146
- * This element is in an array. The array could grow and shrink or be
2147
- * reordered. All children that haven't already been validated are required to
2148
- * have a "key" property assigned to it. Error statuses are cached so a warning
2149
- * will only be shown once.
2150
- *
2151
- * @internal
2152
- * @param {ReactElement} element Element that requires a key.
2153
- * @param {*} parentType element's parent's type.
2154
- */ function validateExplicitKey(element, parentType) {
2155
- if (!element._store || element._store.validated || element.key != null) {
2156
- return;
2157
- }
2158
- element._store.validated = true;
2159
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2160
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2161
- return;
2162
- }
2163
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2164
- // property, it may be the creator of the child that's responsible for
2165
- // assigning it a key.
2166
- var childOwner = '';
2167
- if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2168
- // Give the component that originally created this child.
2169
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
2170
- }
2171
- {
2172
- setCurrentlyValidatingElement$1(element);
2173
- 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);
2174
- setCurrentlyValidatingElement$1(null);
2175
- }
2176
- }
2177
- /**
2178
- * Ensure that every element either is passed in a static location, in an
2179
- * array with an explicit keys property defined, or in an object literal
2180
- * with valid key property.
2181
- *
2182
- * @internal
2183
- * @param {ReactNode} node Statically passed child of any type.
2184
- * @param {*} parentType node's parent's type.
2185
- */ function validateChildKeys(node, parentType) {
2186
- if ((typeof node === "undefined" ? "undefined" : _type_of(node)) !== 'object') {
2187
- return;
2188
- }
2189
- if (isArray(node)) {
2190
- for(var i = 0; i < node.length; i++){
2191
- var child = node[i];
2192
- if (isValidElement(child)) {
2193
- validateExplicitKey(child, parentType);
2194
- }
2195
- }
2196
- } else if (isValidElement(node)) {
2197
- // This element was passed in a valid location.
2198
- if (node._store) {
2199
- node._store.validated = true;
2200
- }
2201
- } else if (node) {
2202
- var iteratorFn = getIteratorFn(node);
2203
- if (typeof iteratorFn === 'function') {
2204
- // Entry iterators used to provide implicit keys,
2205
- // but now we print a separate warning for them later.
2206
- if (iteratorFn !== node.entries) {
2207
- var iterator = iteratorFn.call(node);
2208
- var step;
2209
- while(!(step = iterator.next()).done){
2210
- if (isValidElement(step.value)) {
2211
- validateExplicitKey(step.value, parentType);
2212
- }
2213
- }
2214
- }
2215
- }
2216
- }
2217
- }
2218
- /**
2219
- * Given an element, validate that its props follow the propTypes definition,
2220
- * provided by the type.
2221
- *
2222
- * @param {ReactElement} element
2223
- */ function validatePropTypes(element) {
2224
- {
2225
- var type = element.type;
2226
- if (type === null || type === undefined || typeof type === 'string') {
2227
- return;
2228
- }
2229
- var propTypes;
2230
- if (typeof type === 'function') {
2231
- propTypes = type.propTypes;
2232
- } else if ((typeof type === "undefined" ? "undefined" : _type_of(type)) === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2233
- // Inner props are checked in the reconciler.
2234
- type.$$typeof === REACT_MEMO_TYPE)) {
2235
- propTypes = type.propTypes;
2236
- } else {
2237
- return;
2238
- }
2239
- if (propTypes) {
2240
- // Intentionally inside to avoid triggering lazy initializers:
2241
- var name = getComponentNameFromType(type);
2242
- checkPropTypes(propTypes, element.props, 'prop', name, element);
2243
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2244
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2245
- var _name = getComponentNameFromType(type);
2246
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2247
- }
2248
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2249
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2250
- }
2251
- }
2252
- }
2253
- /**
2254
- * Given a fragment, validate that it can only be provided with fragment props
2255
- * @param {ReactElement} fragment
2256
- */ function validateFragmentProps(fragment) {
2257
- {
2258
- var keys = Object.keys(fragment.props);
2259
- for(var i = 0; i < keys.length; i++){
2260
- var key = keys[i];
2261
- if (key !== 'children' && key !== 'key') {
2262
- setCurrentlyValidatingElement$1(fragment);
2263
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2264
- setCurrentlyValidatingElement$1(null);
2265
- break;
2266
- }
2267
- }
2268
- if (fragment.ref !== null) {
2269
- setCurrentlyValidatingElement$1(fragment);
2270
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
2271
- setCurrentlyValidatingElement$1(null);
2272
- }
2273
- }
2274
- }
2275
- function createElementWithValidation(type, props, children) {
2276
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2277
- // succeed and there will likely be errors in render.
2278
- if (!validType) {
2279
- var info = '';
2280
- if (type === undefined || (typeof type === "undefined" ? "undefined" : _type_of(type)) === 'object' && type !== null && Object.keys(type).length === 0) {
2281
- 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.";
2282
- }
2283
- var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2284
- if (sourceInfo) {
2285
- info += sourceInfo;
2286
- } else {
2287
- info += getDeclarationErrorAddendum();
2288
- }
2289
- var typeString;
2290
- if (type === null) {
2291
- typeString = 'null';
2292
- } else if (isArray(type)) {
2293
- typeString = 'array';
2294
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2295
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
2296
- info = ' Did you accidentally export a JSX literal instead of a component?';
2297
- } else {
2298
- typeString = typeof type === "undefined" ? "undefined" : _type_of(type);
2299
- }
2300
- {
2301
- 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);
2302
- }
2303
- }
2304
- var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
2305
- // TODO: Drop this when these are no longer allowed as the type argument.
2306
- if (element == null) {
2307
- return element;
2308
- } // Skip key warning if the type isn't valid since our key validation logic
2309
- // doesn't expect a non-string/function type and can throw confusing errors.
2310
- // We don't want exception behavior to differ between dev and prod.
2311
- // (Rendering will throw with a helpful message and as soon as the type is
2312
- // fixed, the key warnings will appear.)
2313
- if (validType) {
2314
- for(var i = 2; i < arguments.length; i++){
2315
- validateChildKeys(arguments[i], type);
2316
- }
2317
- }
2318
- if (type === REACT_FRAGMENT_TYPE) {
2319
- validateFragmentProps(element);
2320
- } else {
2321
- validatePropTypes(element);
2322
- }
2323
- return element;
2324
- }
2325
- var didWarnAboutDeprecatedCreateFactory = false;
2326
- function createFactoryWithValidation(type) {
2327
- var validatedFactory = createElementWithValidation.bind(null, type);
2328
- validatedFactory.type = type;
2329
- {
2330
- if (!didWarnAboutDeprecatedCreateFactory) {
2331
- didWarnAboutDeprecatedCreateFactory = true;
2332
- warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
2333
- } // Legacy hook: remove it
2334
- Object.defineProperty(validatedFactory, 'type', {
2335
- enumerable: false,
2336
- get: function get() {
2337
- warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2338
- Object.defineProperty(this, 'type', {
2339
- value: type
2340
- });
2341
- return type;
2342
- }
2343
- });
2344
- }
2345
- return validatedFactory;
2346
- }
2347
- function cloneElementWithValidation(element, props, children) {
2348
- var newElement = cloneElement.apply(this, arguments);
2349
- for(var i = 2; i < arguments.length; i++){
2350
- validateChildKeys(arguments[i], newElement.type);
2351
- }
2352
- validatePropTypes(newElement);
2353
- return newElement;
2354
- }
2355
- function startTransition(scope, options) {
2356
- var prevTransition = ReactCurrentBatchConfig.transition;
2357
- ReactCurrentBatchConfig.transition = {};
2358
- var currentTransition = ReactCurrentBatchConfig.transition;
2359
- {
2360
- ReactCurrentBatchConfig.transition._updatedFibers = new Set();
2361
- }
2362
- try {
2363
- scope();
2364
- } finally{
2365
- ReactCurrentBatchConfig.transition = prevTransition;
2366
- {
2367
- if (prevTransition === null && currentTransition._updatedFibers) {
2368
- var updatedFibersCount = currentTransition._updatedFibers.size;
2369
- if (updatedFibersCount > 10) {
2370
- warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.');
2371
- }
2372
- currentTransition._updatedFibers.clear();
2373
- }
2374
- }
2375
- }
2376
- }
2377
- var didWarnAboutMessageChannel = false;
2378
- var enqueueTaskImpl = null;
2379
- function enqueueTask(task) {
2380
- if (enqueueTaskImpl === null) {
2381
- try {
2382
- // read require off the module object to get around the bundlers.
2383
- // we don't want them to detect a require and bundle a Node polyfill.
2384
- var requireString = ('require' + Math.random()).slice(0, 7);
2385
- var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
2386
- // version of setImmediate, bypassing fake timers if any.
2387
- enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
2388
- } catch (_err) {
2389
- // we're in a browser
2390
- // we can't use regular timers because they may still be faked
2391
- // so we try MessageChannel+postMessage instead
2392
- enqueueTaskImpl = function enqueueTaskImpl(callback) {
2393
- {
2394
- if (didWarnAboutMessageChannel === false) {
2395
- didWarnAboutMessageChannel = true;
2396
- if (typeof MessageChannel === 'undefined') {
2397
- error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
2398
- }
2399
- }
2400
- }
2401
- var channel = new MessageChannel();
2402
- channel.port1.onmessage = callback;
2403
- channel.port2.postMessage(undefined);
2404
- };
2405
- }
2406
- }
2407
- return enqueueTaskImpl(task);
2408
- }
2409
- var actScopeDepth = 0;
2410
- var didWarnNoAwaitAct = false;
2411
- function act(callback) {
2412
- {
2413
- // `act` calls can be nested, so we track the depth. This represents the
2414
- // number of `act` scopes on the stack.
2415
- var prevActScopeDepth = actScopeDepth;
2416
- actScopeDepth++;
2417
- if (ReactCurrentActQueue.current === null) {
2418
- // This is the outermost `act` scope. Initialize the queue. The reconciler
2419
- // will detect the queue and use it instead of Scheduler.
2420
- ReactCurrentActQueue.current = [];
2421
- }
2422
- var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
2423
- var result;
2424
- try {
2425
- // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
2426
- // set to `true` while the given callback is executed, not for updates
2427
- // triggered during an async event, because this is how the legacy
2428
- // implementation of `act` behaved.
2429
- ReactCurrentActQueue.isBatchingLegacy = true;
2430
- result = callback(); // Replicate behavior of original `act` implementation in legacy mode,
2431
- // which flushed updates immediately after the scope function exits, even
2432
- // if it's an async function.
2433
- if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
2434
- var queue = ReactCurrentActQueue.current;
2435
- if (queue !== null) {
2436
- ReactCurrentActQueue.didScheduleLegacyUpdate = false;
2437
- flushActQueue(queue);
2438
- }
2439
- }
2440
- } catch (error) {
2441
- popActScope(prevActScopeDepth);
2442
- throw error;
2443
- } finally{
2444
- ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
2445
- }
2446
- if (result !== null && (typeof result === "undefined" ? "undefined" : _type_of(result)) === 'object' && typeof result.then === 'function') {
2447
- var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait
2448
- // for it to resolve before exiting the current scope.
2449
- var wasAwaited = false;
2450
- var thenable = {
2451
- then: function then(resolve, reject) {
2452
- wasAwaited = true;
2453
- thenableResult.then(function(returnValue) {
2454
- popActScope(prevActScopeDepth);
2455
- if (actScopeDepth === 0) {
2456
- // We've exited the outermost act scope. Recursively flush the
2457
- // queue until there's no remaining work.
2458
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2459
- } else {
2460
- resolve(returnValue);
2461
- }
2462
- }, function(error) {
2463
- // The callback threw an error.
2464
- popActScope(prevActScopeDepth);
2465
- reject(error);
2466
- });
2467
- }
2468
- };
2469
- {
2470
- if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
2471
- // eslint-disable-next-line no-undef
2472
- Promise.resolve().then(function() {}).then(function() {
2473
- if (!wasAwaited) {
2474
- didWarnNoAwaitAct = true;
2475
- error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);');
2476
- }
2477
- });
2478
- }
2479
- }
2480
- return thenable;
2481
- } else {
2482
- var returnValue = result; // The callback is not an async function. Exit the current scope
2483
- // immediately, without awaiting.
2484
- popActScope(prevActScopeDepth);
2485
- if (actScopeDepth === 0) {
2486
- // Exiting the outermost act scope. Flush the queue.
2487
- var _queue = ReactCurrentActQueue.current;
2488
- if (_queue !== null) {
2489
- flushActQueue(_queue);
2490
- ReactCurrentActQueue.current = null;
2491
- } // Return a thenable. If the user awaits it, we'll flush again in
2492
- // case additional work was scheduled by a microtask.
2493
- var _thenable = {
2494
- then: function then(resolve, reject) {
2495
- // Confirm we haven't re-entered another `act` scope, in case
2496
- // the user does something weird like await the thenable
2497
- // multiple times.
2498
- if (ReactCurrentActQueue.current === null) {
2499
- // Recursively flush the queue until there's no remaining work.
2500
- ReactCurrentActQueue.current = [];
2501
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2502
- } else {
2503
- resolve(returnValue);
2504
- }
2505
- }
2506
- };
2507
- return _thenable;
2508
- } else {
2509
- // Since we're inside a nested `act` scope, the returned thenable
2510
- // immediately resolves. The outer scope will flush the queue.
2511
- var _thenable2 = {
2512
- then: function then(resolve, reject) {
2513
- resolve(returnValue);
2514
- }
2515
- };
2516
- return _thenable2;
2517
- }
2518
- }
2519
- }
2520
- }
2521
- function popActScope(prevActScopeDepth) {
2522
- {
2523
- if (prevActScopeDepth !== actScopeDepth - 1) {
2524
- error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
2525
- }
2526
- actScopeDepth = prevActScopeDepth;
2527
- }
2528
- }
2529
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
2530
- {
2531
- var queue = ReactCurrentActQueue.current;
2532
- if (queue !== null) {
2533
- try {
2534
- flushActQueue(queue);
2535
- enqueueTask(function() {
2536
- if (queue.length === 0) {
2537
- // No additional work was scheduled. Finish.
2538
- ReactCurrentActQueue.current = null;
2539
- resolve(returnValue);
2540
- } else {
2541
- // Keep flushing work until there's none left.
2542
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2543
- }
2544
- });
2545
- } catch (error) {
2546
- reject(error);
2547
- }
2548
- } else {
2549
- resolve(returnValue);
2550
- }
2551
- }
2552
- }
2553
- var isFlushing = false;
2554
- function flushActQueue(queue) {
2555
- {
2556
- if (!isFlushing) {
2557
- // Prevent re-entrance.
2558
- isFlushing = true;
2559
- var i = 0;
2560
- try {
2561
- for(; i < queue.length; i++){
2562
- var callback = queue[i];
2563
- do {
2564
- callback = callback(true);
2565
- }while (callback !== null);
2566
- }
2567
- queue.length = 0;
2568
- } catch (error) {
2569
- // If something throws, leave the remaining callbacks on the queue.
2570
- queue = queue.slice(i + 1);
2571
- throw error;
2572
- } finally{
2573
- isFlushing = false;
2574
- }
2575
- }
2576
- }
2577
- }
2578
- var createElement$1 = createElementWithValidation;
2579
- var cloneElement$1 = cloneElementWithValidation;
2580
- var createFactory = createFactoryWithValidation;
2581
- var Children = {
2582
- map: mapChildren,
2583
- forEach: forEachChildren,
2584
- count: countChildren,
2585
- toArray: toArray,
2586
- only: onlyChild
2587
- };
2588
- exports.Children = Children;
2589
- exports.Component = Component;
2590
- exports.Fragment = REACT_FRAGMENT_TYPE;
2591
- exports.Profiler = REACT_PROFILER_TYPE;
2592
- exports.PureComponent = PureComponent;
2593
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
2594
- exports.Suspense = REACT_SUSPENSE_TYPE;
2595
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2596
- exports.act = act;
2597
- exports.cloneElement = cloneElement$1;
2598
- exports.createContext = createContext;
2599
- exports.createElement = createElement$1;
2600
- exports.createFactory = createFactory;
2601
- exports.createRef = createRef;
2602
- exports.forwardRef = forwardRef;
2603
- exports.isValidElement = isValidElement;
2604
- exports.lazy = lazy;
2605
- exports.memo = memo;
2606
- exports.startTransition = startTransition;
2607
- exports.unstable_act = act;
2608
- exports.useCallback = useCallback;
2609
- exports.useContext = useContext;
2610
- exports.useDebugValue = useDebugValue;
2611
- exports.useDeferredValue = useDeferredValue;
2612
- exports.useEffect = useEffect;
2613
- exports.useId = useId;
2614
- exports.useImperativeHandle = useImperativeHandle;
2615
- exports.useInsertionEffect = useInsertionEffect;
2616
- exports.useLayoutEffect = useLayoutEffect;
2617
- exports.useMemo = useMemo;
2618
- exports.useReducer = useReducer;
2619
- exports.useRef = useRef;
2620
- exports.useState = useState;
2621
- exports.useSyncExternalStore = useSyncExternalStore;
2622
- exports.useTransition = useTransition;
2623
- exports.version = ReactVersion;
2624
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === 'function') {
2625
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2626
- }
2627
- })();
2628
- }
2629
- } (react_development, react_development.exports));
2630
- return react_development.exports;
2631
- }
2632
-
2633
- var hasRequiredReact;
2634
-
2635
- function requireReact () {
2636
- if (hasRequiredReact) return react.exports;
2637
- hasRequiredReact = 1;
2638
- if (process.env.NODE_ENV === 'production') {
2639
- react.exports = requireReact_production_min();
2640
- } else {
2641
- react.exports = requireReact_development();
2642
- }
2643
- return react.exports;
2644
- }
2645
-
2646
- /**
2647
- * @license React
2648
- * react-jsx-runtime.production.min.js
2649
- *
2650
- * Copyright (c) Facebook, Inc. and its affiliates.
2651
- *
2652
- * This source code is licensed under the MIT license found in the
2653
- * LICENSE file in the root directory of this source tree.
2654
- */
2655
-
2656
- var hasRequiredReactJsxRuntime_production_min;
2657
-
2658
- function requireReactJsxRuntime_production_min () {
2659
- if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
2660
- hasRequiredReactJsxRuntime_production_min = 1;
2661
- var f = requireReact(), k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = {
2662
- key: !0,
2663
- ref: !0,
2664
- __self: !0,
2665
- __source: !0
2666
- };
2667
- function q(c, a, g) {
2668
- var b, d = {}, e = null, h = null;
2669
- void 0 !== g && (e = "" + g);
2670
- void 0 !== a.key && (e = "" + a.key);
2671
- void 0 !== a.ref && (h = a.ref);
2672
- for(b in a)m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
2673
- if (c && c.defaultProps) for(b in a = c.defaultProps, a)void 0 === d[b] && (d[b] = a[b]);
2674
- return {
2675
- $$typeof: k,
2676
- type: c,
2677
- key: e,
2678
- ref: h,
2679
- props: d,
2680
- _owner: n.current
2681
- };
2682
- }
2683
- reactJsxRuntime_production_min.Fragment = l;
2684
- reactJsxRuntime_production_min.jsx = q;
2685
- reactJsxRuntime_production_min.jsxs = q;
2686
- return reactJsxRuntime_production_min;
2687
- }
2688
-
2689
- var reactJsxRuntime_development = {};
2690
-
2691
- /**
2692
- * @license React
2693
- * react-jsx-runtime.development.js
2694
- *
2695
- * Copyright (c) Facebook, Inc. and its affiliates.
2696
- *
2697
- * This source code is licensed under the MIT license found in the
2698
- * LICENSE file in the root directory of this source tree.
2699
- */
2700
-
2701
- var hasRequiredReactJsxRuntime_development;
2702
-
2703
- function requireReactJsxRuntime_development () {
2704
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
2705
- hasRequiredReactJsxRuntime_development = 1;
2706
- function _instanceof(left, right) {
2707
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
2708
- return !!right[Symbol.hasInstance](left);
2709
- } else {
2710
- return left instanceof right;
2711
- }
2712
- }
2713
- function _type_of(obj) {
2714
- "@swc/helpers - typeof";
2715
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2716
- }
2717
- if (process.env.NODE_ENV !== "production") {
2718
- (function() {
2719
- var React = requireReact();
2720
- // ATTENTION
2721
- // When adding new symbols to this file,
2722
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
2723
- // The Symbol used to tag the ReactElement-like types.
2724
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
2725
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
2726
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
2727
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
2728
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
2729
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
2730
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
2731
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
2732
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
2733
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
2734
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
2735
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
2736
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
2737
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
2738
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
2739
- function getIteratorFn(maybeIterable) {
2740
- if (maybeIterable === null || (typeof maybeIterable === "undefined" ? "undefined" : _type_of(maybeIterable)) !== 'object') {
2741
- return null;
2742
- }
2743
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
2744
- if (typeof maybeIterator === 'function') {
2745
- return maybeIterator;
2746
- }
2747
- return null;
2748
- }
2749
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2750
- function error(format) {
2751
- {
2752
- {
2753
- for(var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++){
2754
- args[_key2 - 1] = arguments[_key2];
2755
- }
2756
- printWarning('error', format, args);
2757
- }
2758
- }
2759
- }
2760
- function printWarning(level, format, args) {
2761
- // When changing this logic, you might want to also
2762
- // update consoleWithStackDev.www.js as well.
2763
- {
2764
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2765
- var stack = ReactDebugCurrentFrame.getStackAddendum();
2766
- if (stack !== '') {
2767
- format += '%s';
2768
- args = args.concat([
2769
- stack
2770
- ]);
2771
- } // eslint-disable-next-line react-internal/safe-string-coercion
2772
- var argsWithFormat = args.map(function(item) {
2773
- return String(item);
2774
- }); // Careful: RN currently depends on this prefix
2775
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
2776
- // breaks IE9: https://github.com/facebook/react/issues/13610
2777
- // eslint-disable-next-line react-internal/no-production-logging
2778
- Function.prototype.apply.call(console[level], console, argsWithFormat);
2779
- }
2780
- }
2781
- // -----------------------------------------------------------------------------
2782
- var enableScopeAPI = false; // Experimental Create Event Handle API.
2783
- var enableCacheElement = false;
2784
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
2785
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
2786
- // stuff. Intended to enable React core members to more easily debug scheduling
2787
- // issues in DEV builds.
2788
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
2789
- var REACT_MODULE_REFERENCE;
2790
- {
2791
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
2792
- }
2793
- function isValidElementType(type) {
2794
- if (typeof type === 'string' || typeof type === 'function') {
2795
- return true;
2796
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
2797
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
2798
- return true;
2799
- }
2800
- if ((typeof type === "undefined" ? "undefined" : _type_of(type)) === 'object' && type !== null) {
2801
- 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 || // This needs to include all possible module reference object
2802
- // types supported by any Flight configuration anywhere since
2803
- // we don't know which Flight build this will end up being used
2804
- // with.
2805
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
2806
- return true;
2807
- }
2808
- }
2809
- return false;
2810
- }
2811
- function getWrappedName(outerType, innerType, wrapperName) {
2812
- var displayName = outerType.displayName;
2813
- if (displayName) {
2814
- return displayName;
2815
- }
2816
- var functionName = innerType.displayName || innerType.name || '';
2817
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
2818
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
2819
- function getContextName(type) {
2820
- return type.displayName || 'Context';
2821
- } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
2822
- function getComponentNameFromType(type) {
2823
- if (type == null) {
2824
- // Host root, text node or just invalid type.
2825
- return null;
2826
- }
2827
- {
2828
- if (typeof type.tag === 'number') {
2829
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
2830
- }
2831
- }
2832
- if (typeof type === 'function') {
2833
- return type.displayName || type.name || null;
2834
- }
2835
- if (typeof type === 'string') {
2836
- return type;
2837
- }
2838
- switch(type){
2839
- case REACT_FRAGMENT_TYPE:
2840
- return 'Fragment';
2841
- case REACT_PORTAL_TYPE:
2842
- return 'Portal';
2843
- case REACT_PROFILER_TYPE:
2844
- return 'Profiler';
2845
- case REACT_STRICT_MODE_TYPE:
2846
- return 'StrictMode';
2847
- case REACT_SUSPENSE_TYPE:
2848
- return 'Suspense';
2849
- case REACT_SUSPENSE_LIST_TYPE:
2850
- return 'SuspenseList';
2851
- }
2852
- if ((typeof type === "undefined" ? "undefined" : _type_of(type)) === 'object') {
2853
- switch(type.$$typeof){
2854
- case REACT_CONTEXT_TYPE:
2855
- var context = type;
2856
- return getContextName(context) + '.Consumer';
2857
- case REACT_PROVIDER_TYPE:
2858
- var provider = type;
2859
- return getContextName(provider._context) + '.Provider';
2860
- case REACT_FORWARD_REF_TYPE:
2861
- return getWrappedName(type, type.render, 'ForwardRef');
2862
- case REACT_MEMO_TYPE:
2863
- var outerName = type.displayName || null;
2864
- if (outerName !== null) {
2865
- return outerName;
2866
- }
2867
- return getComponentNameFromType(type.type) || 'Memo';
2868
- case REACT_LAZY_TYPE:
2869
- {
2870
- var lazyComponent = type;
2871
- var payload = lazyComponent._payload;
2872
- var init = lazyComponent._init;
2873
- try {
2874
- return getComponentNameFromType(init(payload));
2875
- } catch (x) {
2876
- return null;
2877
- }
2878
- }
2879
- }
2880
- }
2881
- return null;
2882
- }
2883
- var assign = Object.assign;
2884
- // Helpers to patch console.logs to avoid logging during side-effect free
2885
- // replaying on render function. This currently only patches the object
2886
- // lazily which won't cover if the log function was extracted eagerly.
2887
- // We could also eagerly patch the method.
2888
- var disabledDepth = 0;
2889
- var prevLog;
2890
- var prevInfo;
2891
- var prevWarn;
2892
- var prevError;
2893
- var prevGroup;
2894
- var prevGroupCollapsed;
2895
- var prevGroupEnd;
2896
- function disabledLog() {}
2897
- disabledLog.__reactDisabledLog = true;
2898
- function disableLogs() {
2899
- {
2900
- if (disabledDepth === 0) {
2901
- /* eslint-disable react-internal/no-production-logging */ prevLog = console.log;
2902
- prevInfo = console.info;
2903
- prevWarn = console.warn;
2904
- prevError = console.error;
2905
- prevGroup = console.group;
2906
- prevGroupCollapsed = console.groupCollapsed;
2907
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
2908
- var props = {
2909
- configurable: true,
2910
- enumerable: true,
2911
- value: disabledLog,
2912
- writable: true
2913
- }; // $FlowFixMe Flow thinks console is immutable.
2914
- Object.defineProperties(console, {
2915
- info: props,
2916
- log: props,
2917
- warn: props,
2918
- error: props,
2919
- group: props,
2920
- groupCollapsed: props,
2921
- groupEnd: props
2922
- });
2923
- /* eslint-enable react-internal/no-production-logging */ }
2924
- disabledDepth++;
2925
- }
2926
- }
2927
- function reenableLogs() {
2928
- {
2929
- disabledDepth--;
2930
- if (disabledDepth === 0) {
2931
- /* eslint-disable react-internal/no-production-logging */ var props = {
2932
- configurable: true,
2933
- enumerable: true,
2934
- writable: true
2935
- }; // $FlowFixMe Flow thinks console is immutable.
2936
- Object.defineProperties(console, {
2937
- log: assign({}, props, {
2938
- value: prevLog
2939
- }),
2940
- info: assign({}, props, {
2941
- value: prevInfo
2942
- }),
2943
- warn: assign({}, props, {
2944
- value: prevWarn
2945
- }),
2946
- error: assign({}, props, {
2947
- value: prevError
2948
- }),
2949
- group: assign({}, props, {
2950
- value: prevGroup
2951
- }),
2952
- groupCollapsed: assign({}, props, {
2953
- value: prevGroupCollapsed
2954
- }),
2955
- groupEnd: assign({}, props, {
2956
- value: prevGroupEnd
2957
- })
2958
- });
2959
- /* eslint-enable react-internal/no-production-logging */ }
2960
- if (disabledDepth < 0) {
2961
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
2962
- }
2963
- }
2964
- }
2965
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
2966
- var prefix;
2967
- function describeBuiltInComponentFrame(name, source, ownerFn) {
2968
- {
2969
- if (prefix === undefined) {
2970
- // Extract the VM specific prefix used by each line.
2971
- try {
2972
- throw Error();
2973
- } catch (x) {
2974
- var match = x.stack.trim().match(/\n( *(at )?)/);
2975
- prefix = match && match[1] || '';
2976
- }
2977
- } // We use the prefix to ensure our stacks line up with native stack frames.
2978
- return '\n' + prefix + name;
2979
- }
2980
- }
2981
- var reentry = false;
2982
- var componentFrameCache;
2983
- {
2984
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
2985
- componentFrameCache = new PossiblyWeakMap();
2986
- }
2987
- function describeNativeComponentFrame(fn, construct) {
2988
- // If something asked for a stack inside a fake render, it should get ignored.
2989
- if (!fn || reentry) {
2990
- return '';
2991
- }
2992
- {
2993
- var frame = componentFrameCache.get(fn);
2994
- if (frame !== undefined) {
2995
- return frame;
2996
- }
2997
- }
2998
- var control;
2999
- reentry = true;
3000
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
3001
- Error.prepareStackTrace = undefined;
3002
- var previousDispatcher;
3003
- {
3004
- previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
3005
- // for warnings.
3006
- ReactCurrentDispatcher.current = null;
3007
- disableLogs();
3008
- }
3009
- try {
3010
- // This should throw.
3011
- if (construct) {
3012
- // Something should be setting the props in the constructor.
3013
- var Fake = function Fake() {
3014
- throw Error();
3015
- }; // $FlowFixMe
3016
- Object.defineProperty(Fake.prototype, 'props', {
3017
- set: function set() {
3018
- // We use a throwing setter instead of frozen or non-writable props
3019
- // because that won't throw in a non-strict mode function.
3020
- throw Error();
3021
- }
3022
- });
3023
- if ((typeof Reflect === "undefined" ? "undefined" : _type_of(Reflect)) === 'object' && Reflect.construct) {
3024
- // We construct a different control for this case to include any extra
3025
- // frames added by the construct call.
3026
- try {
3027
- Reflect.construct(Fake, []);
3028
- } catch (x) {
3029
- control = x;
3030
- }
3031
- Reflect.construct(fn, [], Fake);
3032
- } else {
3033
- try {
3034
- Fake.call();
3035
- } catch (x) {
3036
- control = x;
3037
- }
3038
- fn.call(Fake.prototype);
3039
- }
3040
- } else {
3041
- try {
3042
- throw Error();
3043
- } catch (x) {
3044
- control = x;
3045
- }
3046
- fn();
3047
- }
3048
- } catch (sample) {
3049
- // This is inlined manually because closure doesn't do it for us.
3050
- if (sample && control && typeof sample.stack === 'string') {
3051
- // This extracts the first frame from the sample that isn't also in the control.
3052
- // Skipping one frame that we assume is the frame that calls the two.
3053
- var sampleLines = sample.stack.split('\n');
3054
- var controlLines = control.stack.split('\n');
3055
- var s = sampleLines.length - 1;
3056
- var c = controlLines.length - 1;
3057
- while(s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]){
3058
- // We expect at least one stack frame to be shared.
3059
- // Typically this will be the root most one. However, stack frames may be
3060
- // cut off due to maximum stack limits. In this case, one maybe cut off
3061
- // earlier than the other. We assume that the sample is longer or the same
3062
- // and there for cut off earlier. So we should find the root most frame in
3063
- // the sample somewhere in the control.
3064
- c--;
3065
- }
3066
- for(; s >= 1 && c >= 0; s--, c--){
3067
- // Next we find the first one that isn't the same which should be the
3068
- // frame that called our sample function and the control.
3069
- if (sampleLines[s] !== controlLines[c]) {
3070
- // In V8, the first line is describing the message but other VMs don't.
3071
- // If we're about to return the first line, and the control is also on the same
3072
- // line, that's a pretty good indicator that our sample threw at same line as
3073
- // the control. I.e. before we entered the sample frame. So we ignore this result.
3074
- // This can happen if you passed a class to function component, or non-function.
3075
- if (s !== 1 || c !== 1) {
3076
- do {
3077
- s--;
3078
- c--; // We may still have similar intermediate frames from the construct call.
3079
- // The next one that isn't the same should be our match though.
3080
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
3081
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
3082
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
3083
- // but we have a user-provided "displayName"
3084
- // splice it in to make the stack more readable.
3085
- if (fn.displayName && _frame.includes('<anonymous>')) {
3086
- _frame = _frame.replace('<anonymous>', fn.displayName);
3087
- }
3088
- {
3089
- if (typeof fn === 'function') {
3090
- componentFrameCache.set(fn, _frame);
3091
- }
3092
- }
3093
- return _frame;
3094
- }
3095
- }while (s >= 1 && c >= 0);
3096
- }
3097
- break;
3098
- }
3099
- }
3100
- }
3101
- } finally{
3102
- reentry = false;
3103
- {
3104
- ReactCurrentDispatcher.current = previousDispatcher;
3105
- reenableLogs();
3106
- }
3107
- Error.prepareStackTrace = previousPrepareStackTrace;
3108
- } // Fallback to just using the name if we couldn't make it throw.
3109
- var name = fn ? fn.displayName || fn.name : '';
3110
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
3111
- {
3112
- if (typeof fn === 'function') {
3113
- componentFrameCache.set(fn, syntheticFrame);
3114
- }
3115
- }
3116
- return syntheticFrame;
3117
- }
3118
- function describeFunctionComponentFrame(fn, source, ownerFn) {
3119
- {
3120
- return describeNativeComponentFrame(fn, false);
3121
- }
3122
- }
3123
- function shouldConstruct(Component) {
3124
- var prototype = Component.prototype;
3125
- return !!(prototype && prototype.isReactComponent);
3126
- }
3127
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
3128
- if (type == null) {
3129
- return '';
3130
- }
3131
- if (typeof type === 'function') {
3132
- {
3133
- return describeNativeComponentFrame(type, shouldConstruct(type));
3134
- }
3135
- }
3136
- if (typeof type === 'string') {
3137
- return describeBuiltInComponentFrame(type);
3138
- }
3139
- switch(type){
3140
- case REACT_SUSPENSE_TYPE:
3141
- return describeBuiltInComponentFrame('Suspense');
3142
- case REACT_SUSPENSE_LIST_TYPE:
3143
- return describeBuiltInComponentFrame('SuspenseList');
3144
- }
3145
- if ((typeof type === "undefined" ? "undefined" : _type_of(type)) === 'object') {
3146
- switch(type.$$typeof){
3147
- case REACT_FORWARD_REF_TYPE:
3148
- return describeFunctionComponentFrame(type.render);
3149
- case REACT_MEMO_TYPE:
3150
- // Memo may contain any component type so we recursively resolve it.
3151
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
3152
- case REACT_LAZY_TYPE:
3153
- {
3154
- var lazyComponent = type;
3155
- var payload = lazyComponent._payload;
3156
- var init = lazyComponent._init;
3157
- try {
3158
- // Lazy may contain any component type so we recursively resolve it.
3159
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
3160
- } catch (x) {}
3161
- }
3162
- }
3163
- }
3164
- return '';
3165
- }
3166
- var hasOwnProperty = Object.prototype.hasOwnProperty;
3167
- var loggedTypeFailures = {};
3168
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
3169
- function setCurrentlyValidatingElement(element) {
3170
- {
3171
- if (element) {
3172
- var owner = element._owner;
3173
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
3174
- ReactDebugCurrentFrame.setExtraStackFrame(stack);
3175
- } else {
3176
- ReactDebugCurrentFrame.setExtraStackFrame(null);
3177
- }
3178
- }
3179
- }
3180
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
3181
- {
3182
- // $FlowFixMe This is okay but Flow doesn't know it.
3183
- var has = Function.call.bind(hasOwnProperty);
3184
- for(var typeSpecName in typeSpecs){
3185
- if (has(typeSpecs, typeSpecName)) {
3186
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
3187
- // fail the render phase where it didn't fail before. So we log it.
3188
- // After these have been cleaned up, we'll let them throw.
3189
- try {
3190
- // This is intentionally an invariant that gets caught. It's the same
3191
- // behavior as without this statement except with a better message.
3192
- if (typeof typeSpecs[typeSpecName] !== 'function') {
3193
- // eslint-disable-next-line react-internal/prod-error-codes
3194
- var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + _type_of(typeSpecs[typeSpecName]) + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
3195
- err.name = 'Invariant Violation';
3196
- throw err;
3197
- }
3198
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
3199
- } catch (ex) {
3200
- error$1 = ex;
3201
- }
3202
- if (error$1 && !_instanceof(error$1, Error)) {
3203
- setCurrentlyValidatingElement(element);
3204
- 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 === "undefined" ? "undefined" : _type_of(error$1));
3205
- setCurrentlyValidatingElement(null);
3206
- }
3207
- if (_instanceof(error$1, Error) && !(error$1.message in loggedTypeFailures)) {
3208
- // Only monitor this failure once because there tends to be a lot of the
3209
- // same error.
3210
- loggedTypeFailures[error$1.message] = true;
3211
- setCurrentlyValidatingElement(element);
3212
- error('Failed %s type: %s', location, error$1.message);
3213
- setCurrentlyValidatingElement(null);
3214
- }
3215
- }
3216
- }
3217
- }
3218
- }
3219
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
3220
- function isArray(a) {
3221
- return isArrayImpl(a);
3222
- }
3223
- /*
3224
- * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
3225
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
3226
- *
3227
- * The functions in this module will throw an easier-to-understand,
3228
- * easier-to-debug exception with a clear errors message message explaining the
3229
- * problem. (Instead of a confusing exception thrown inside the implementation
3230
- * of the `value` object).
3231
- */ // $FlowFixMe only called in DEV, so void return is not possible.
3232
- function typeName(value) {
3233
- {
3234
- // toStringTag is needed for namespaced types like Temporal.Instant
3235
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
3236
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
3237
- return type;
3238
- }
3239
- } // $FlowFixMe only called in DEV, so void return is not possible.
3240
- function willCoercionThrow(value) {
3241
- {
3242
- try {
3243
- testStringCoercion(value);
3244
- return false;
3245
- } catch (e) {
3246
- return true;
3247
- }
3248
- }
3249
- }
3250
- function testStringCoercion(value) {
3251
- // If you ended up here by following an exception call stack, here's what's
3252
- // happened: you supplied an object or symbol value to React (as a prop, key,
3253
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
3254
- // coerce it to a string using `'' + value`, an exception was thrown.
3255
- //
3256
- // The most common types that will cause this exception are `Symbol` instances
3257
- // and Temporal objects like `Temporal.Instant`. But any object that has a
3258
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
3259
- // exception. (Library authors do this to prevent users from using built-in
3260
- // numeric operators like `+` or comparison operators like `>=` because custom
3261
- // methods are needed to perform accurate arithmetic or comparison.)
3262
- //
3263
- // To fix the problem, coerce this object or symbol value to a string before
3264
- // passing it to React. The most reliable way is usually `String(value)`.
3265
- //
3266
- // To find which value is throwing, check the browser or debugger console.
3267
- // Before this exception was thrown, there should be `console.error` output
3268
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
3269
- // problem and how that type was used: key, atrribute, input value prop, etc.
3270
- // In most cases, this console output also shows the component and its
3271
- // ancestor components where the exception happened.
3272
- //
3273
- // eslint-disable-next-line react-internal/safe-string-coercion
3274
- return '' + value;
3275
- }
3276
- function checkKeyStringCoercion(value) {
3277
- {
3278
- if (willCoercionThrow(value)) {
3279
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
3280
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
3281
- }
3282
- }
3283
- }
3284
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
3285
- var RESERVED_PROPS = {
3286
- key: true,
3287
- ref: true,
3288
- __self: true,
3289
- __source: true
3290
- };
3291
- var specialPropKeyWarningShown;
3292
- var specialPropRefWarningShown;
3293
- var didWarnAboutStringRefs;
3294
- {
3295
- didWarnAboutStringRefs = {};
3296
- }
3297
- function hasValidRef(config) {
3298
- {
3299
- if (hasOwnProperty.call(config, 'ref')) {
3300
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
3301
- if (getter && getter.isReactWarning) {
3302
- return false;
3303
- }
3304
- }
3305
- }
3306
- return config.ref !== undefined;
3307
- }
3308
- function hasValidKey(config) {
3309
- {
3310
- if (hasOwnProperty.call(config, 'key')) {
3311
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
3312
- if (getter && getter.isReactWarning) {
3313
- return false;
3314
- }
3315
- }
3316
- }
3317
- return config.key !== undefined;
3318
- }
3319
- function warnIfStringRefCannotBeAutoConverted(config, self) {
3320
- {
3321
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
3322
- var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
3323
- if (!didWarnAboutStringRefs[componentName]) {
3324
- 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', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
3325
- didWarnAboutStringRefs[componentName] = true;
3326
- }
3327
- }
3328
- }
3329
- }
3330
- function defineKeyPropWarningGetter(props, displayName) {
3331
- {
3332
- var warnAboutAccessingKey = function warnAboutAccessingKey() {
3333
- if (!specialPropKeyWarningShown) {
3334
- specialPropKeyWarningShown = true;
3335
- 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);
3336
- }
3337
- };
3338
- warnAboutAccessingKey.isReactWarning = true;
3339
- Object.defineProperty(props, 'key', {
3340
- get: warnAboutAccessingKey,
3341
- configurable: true
3342
- });
3343
- }
3344
- }
3345
- function defineRefPropWarningGetter(props, displayName) {
3346
- {
3347
- var warnAboutAccessingRef = function warnAboutAccessingRef() {
3348
- if (!specialPropRefWarningShown) {
3349
- specialPropRefWarningShown = true;
3350
- 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);
3351
- }
3352
- };
3353
- warnAboutAccessingRef.isReactWarning = true;
3354
- Object.defineProperty(props, 'ref', {
3355
- get: warnAboutAccessingRef,
3356
- configurable: true
3357
- });
3358
- }
3359
- }
3360
- /**
3361
- * Factory method to create a new React element. This no longer adheres to
3362
- * the class pattern, so do not use new to call it. Also, instanceof check
3363
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
3364
- * if something is a React Element.
3365
- *
3366
- * @param {*} type
3367
- * @param {*} props
3368
- * @param {*} key
3369
- * @param {string|object} ref
3370
- * @param {*} owner
3371
- * @param {*} self A *temporary* helper to detect places where `this` is
3372
- * different from the `owner` when React.createElement is called, so that we
3373
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
3374
- * functions, and as long as `this` and owner are the same, there will be no
3375
- * change in behavior.
3376
- * @param {*} source An annotation object (added by a transpiler or otherwise)
3377
- * indicating filename, line number, and/or other information.
3378
- * @internal
3379
- */ var ReactElement = function ReactElement(type, key, ref, self, source, owner, props) {
3380
- var element = {
3381
- // This tag allows us to uniquely identify this as a React Element
3382
- $$typeof: REACT_ELEMENT_TYPE,
3383
- // Built-in properties that belong on the element
3384
- type: type,
3385
- key: key,
3386
- ref: ref,
3387
- props: props,
3388
- // Record the component responsible for creating this element.
3389
- _owner: owner
3390
- };
3391
- {
3392
- // The validation flag is currently mutative. We put it on
3393
- // an external backing store so that we can freeze the whole object.
3394
- // This can be replaced with a WeakMap once they are implemented in
3395
- // commonly used development environments.
3396
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
3397
- // the validation flag non-enumerable (where possible, which should
3398
- // include every environment we run tests in), so the test framework
3399
- // ignores it.
3400
- Object.defineProperty(element._store, 'validated', {
3401
- configurable: false,
3402
- enumerable: false,
3403
- writable: true,
3404
- value: false
3405
- }); // self and source are DEV only properties.
3406
- Object.defineProperty(element, '_self', {
3407
- configurable: false,
3408
- enumerable: false,
3409
- writable: false,
3410
- value: self
3411
- }); // Two elements created in two different places should be considered
3412
- // equal for testing purposes and therefore we hide it from enumeration.
3413
- Object.defineProperty(element, '_source', {
3414
- configurable: false,
3415
- enumerable: false,
3416
- writable: false,
3417
- value: source
3418
- });
3419
- if (Object.freeze) {
3420
- Object.freeze(element.props);
3421
- Object.freeze(element);
3422
- }
3423
- }
3424
- return element;
3425
- };
3426
- /**
3427
- * https://github.com/reactjs/rfcs/pull/107
3428
- * @param {*} type
3429
- * @param {object} props
3430
- * @param {string} key
3431
- */ function jsxDEV(type, config, maybeKey, source, self) {
3432
- {
3433
- var propName; // Reserved names are extracted
3434
- var props = {};
3435
- var key = null;
3436
- var ref = null; // Currently, key can be spread in as a prop. This causes a potential
3437
- // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
3438
- // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
3439
- // but as an intermediary step, we will use jsxDEV for everything except
3440
- // <div {...props} key="Hi" />, because we aren't currently able to tell if
3441
- // key is explicitly declared to be undefined or not.
3442
- if (maybeKey !== undefined) {
3443
- {
3444
- checkKeyStringCoercion(maybeKey);
3445
- }
3446
- key = '' + maybeKey;
3447
- }
3448
- if (hasValidKey(config)) {
3449
- {
3450
- checkKeyStringCoercion(config.key);
3451
- }
3452
- key = '' + config.key;
3453
- }
3454
- if (hasValidRef(config)) {
3455
- ref = config.ref;
3456
- warnIfStringRefCannotBeAutoConverted(config, self);
3457
- } // Remaining properties are added to a new props object
3458
- for(propName in config){
3459
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
3460
- props[propName] = config[propName];
3461
- }
3462
- } // Resolve default props
3463
- if (type && type.defaultProps) {
3464
- var defaultProps = type.defaultProps;
3465
- for(propName in defaultProps){
3466
- if (props[propName] === undefined) {
3467
- props[propName] = defaultProps[propName];
3468
- }
3469
- }
3470
- }
3471
- if (key || ref) {
3472
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
3473
- if (key) {
3474
- defineKeyPropWarningGetter(props, displayName);
3475
- }
3476
- if (ref) {
3477
- defineRefPropWarningGetter(props, displayName);
3478
- }
3479
- }
3480
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
3481
- }
3482
- }
3483
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
3484
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
3485
- function setCurrentlyValidatingElement$1(element) {
3486
- {
3487
- if (element) {
3488
- var owner = element._owner;
3489
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
3490
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
3491
- } else {
3492
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
3493
- }
3494
- }
3495
- }
3496
- var propTypesMisspellWarningShown;
3497
- {
3498
- propTypesMisspellWarningShown = false;
3499
- }
3500
- /**
3501
- * Verifies the object is a ReactElement.
3502
- * See https://reactjs.org/docs/react-api.html#isvalidelement
3503
- * @param {?object} object
3504
- * @return {boolean} True if `object` is a ReactElement.
3505
- * @final
3506
- */ function isValidElement(object) {
3507
- {
3508
- return (typeof object === "undefined" ? "undefined" : _type_of(object)) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
3509
- }
3510
- }
3511
- function getDeclarationErrorAddendum() {
3512
- {
3513
- if (ReactCurrentOwner$1.current) {
3514
- var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
3515
- if (name) {
3516
- return '\n\nCheck the render method of `' + name + '`.';
3517
- }
3518
- }
3519
- return '';
3520
- }
3521
- }
3522
- function getSourceInfoErrorAddendum(source) {
3523
- {
3524
- return '';
3525
- }
3526
- }
3527
- /**
3528
- * Warn if there's no key explicitly set on dynamic arrays of children or
3529
- * object keys are not valid. This allows us to keep track of children between
3530
- * updates.
3531
- */ var ownerHasKeyUseWarning = {};
3532
- function getCurrentComponentErrorInfo(parentType) {
3533
- {
3534
- var info = getDeclarationErrorAddendum();
3535
- if (!info) {
3536
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
3537
- if (parentName) {
3538
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
3539
- }
3540
- }
3541
- return info;
3542
- }
3543
- }
3544
- /**
3545
- * Warn if the element doesn't have an explicit key assigned to it.
3546
- * This element is in an array. The array could grow and shrink or be
3547
- * reordered. All children that haven't already been validated are required to
3548
- * have a "key" property assigned to it. Error statuses are cached so a warning
3549
- * will only be shown once.
3550
- *
3551
- * @internal
3552
- * @param {ReactElement} element Element that requires a key.
3553
- * @param {*} parentType element's parent's type.
3554
- */ function validateExplicitKey(element, parentType) {
3555
- {
3556
- if (!element._store || element._store.validated || element.key != null) {
3557
- return;
3558
- }
3559
- element._store.validated = true;
3560
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
3561
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
3562
- return;
3563
- }
3564
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
3565
- // property, it may be the creator of the child that's responsible for
3566
- // assigning it a key.
3567
- var childOwner = '';
3568
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
3569
- // Give the component that originally created this child.
3570
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
3571
- }
3572
- setCurrentlyValidatingElement$1(element);
3573
- 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);
3574
- setCurrentlyValidatingElement$1(null);
3575
- }
3576
- }
3577
- /**
3578
- * Ensure that every element either is passed in a static location, in an
3579
- * array with an explicit keys property defined, or in an object literal
3580
- * with valid key property.
3581
- *
3582
- * @internal
3583
- * @param {ReactNode} node Statically passed child of any type.
3584
- * @param {*} parentType node's parent's type.
3585
- */ function validateChildKeys(node, parentType) {
3586
- {
3587
- if ((typeof node === "undefined" ? "undefined" : _type_of(node)) !== 'object') {
3588
- return;
3589
- }
3590
- if (isArray(node)) {
3591
- for(var i = 0; i < node.length; i++){
3592
- var child = node[i];
3593
- if (isValidElement(child)) {
3594
- validateExplicitKey(child, parentType);
3595
- }
3596
- }
3597
- } else if (isValidElement(node)) {
3598
- // This element was passed in a valid location.
3599
- if (node._store) {
3600
- node._store.validated = true;
3601
- }
3602
- } else if (node) {
3603
- var iteratorFn = getIteratorFn(node);
3604
- if (typeof iteratorFn === 'function') {
3605
- // Entry iterators used to provide implicit keys,
3606
- // but now we print a separate warning for them later.
3607
- if (iteratorFn !== node.entries) {
3608
- var iterator = iteratorFn.call(node);
3609
- var step;
3610
- while(!(step = iterator.next()).done){
3611
- if (isValidElement(step.value)) {
3612
- validateExplicitKey(step.value, parentType);
3613
- }
3614
- }
3615
- }
3616
- }
3617
- }
3618
- }
3619
- }
3620
- /**
3621
- * Given an element, validate that its props follow the propTypes definition,
3622
- * provided by the type.
3623
- *
3624
- * @param {ReactElement} element
3625
- */ function validatePropTypes(element) {
3626
- {
3627
- var type = element.type;
3628
- if (type === null || type === undefined || typeof type === 'string') {
3629
- return;
3630
- }
3631
- var propTypes;
3632
- if (typeof type === 'function') {
3633
- propTypes = type.propTypes;
3634
- } else if ((typeof type === "undefined" ? "undefined" : _type_of(type)) === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
3635
- // Inner props are checked in the reconciler.
3636
- type.$$typeof === REACT_MEMO_TYPE)) {
3637
- propTypes = type.propTypes;
3638
- } else {
3639
- return;
3640
- }
3641
- if (propTypes) {
3642
- // Intentionally inside to avoid triggering lazy initializers:
3643
- var name = getComponentNameFromType(type);
3644
- checkPropTypes(propTypes, element.props, 'prop', name, element);
3645
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
3646
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
3647
- var _name = getComponentNameFromType(type);
3648
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
3649
- }
3650
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
3651
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
3652
- }
3653
- }
3654
- }
3655
- /**
3656
- * Given a fragment, validate that it can only be provided with fragment props
3657
- * @param {ReactElement} fragment
3658
- */ function validateFragmentProps(fragment) {
3659
- {
3660
- var keys = Object.keys(fragment.props);
3661
- for(var i = 0; i < keys.length; i++){
3662
- var key = keys[i];
3663
- if (key !== 'children' && key !== 'key') {
3664
- setCurrentlyValidatingElement$1(fragment);
3665
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
3666
- setCurrentlyValidatingElement$1(null);
3667
- break;
3668
- }
3669
- }
3670
- if (fragment.ref !== null) {
3671
- setCurrentlyValidatingElement$1(fragment);
3672
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
3673
- setCurrentlyValidatingElement$1(null);
3674
- }
3675
- }
3676
- }
3677
- var didWarnAboutKeySpread = {};
3678
- function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
3679
- {
3680
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
3681
- // succeed and there will likely be errors in render.
3682
- if (!validType) {
3683
- var info = '';
3684
- if (type === undefined || (typeof type === "undefined" ? "undefined" : _type_of(type)) === 'object' && type !== null && Object.keys(type).length === 0) {
3685
- 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.";
3686
- }
3687
- var sourceInfo = getSourceInfoErrorAddendum();
3688
- if (sourceInfo) {
3689
- info += sourceInfo;
3690
- } else {
3691
- info += getDeclarationErrorAddendum();
3692
- }
3693
- var typeString;
3694
- if (type === null) {
3695
- typeString = 'null';
3696
- } else if (isArray(type)) {
3697
- typeString = 'array';
3698
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
3699
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
3700
- info = ' Did you accidentally export a JSX literal instead of a component?';
3701
- } else {
3702
- typeString = typeof type === "undefined" ? "undefined" : _type_of(type);
3703
- }
3704
- error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
3705
- }
3706
- var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
3707
- // TODO: Drop this when these are no longer allowed as the type argument.
3708
- if (element == null) {
3709
- return element;
3710
- } // Skip key warning if the type isn't valid since our key validation logic
3711
- // doesn't expect a non-string/function type and can throw confusing errors.
3712
- // We don't want exception behavior to differ between dev and prod.
3713
- // (Rendering will throw with a helpful message and as soon as the type is
3714
- // fixed, the key warnings will appear.)
3715
- if (validType) {
3716
- var children = props.children;
3717
- if (children !== undefined) {
3718
- if (isStaticChildren) {
3719
- if (isArray(children)) {
3720
- for(var i = 0; i < children.length; i++){
3721
- validateChildKeys(children[i], type);
3722
- }
3723
- if (Object.freeze) {
3724
- Object.freeze(children);
3725
- }
3726
- } else {
3727
- error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
3728
- }
3729
- } else {
3730
- validateChildKeys(children, type);
3731
- }
3732
- }
3733
- }
3734
- {
3735
- if (hasOwnProperty.call(props, 'key')) {
3736
- var componentName = getComponentNameFromType(type);
3737
- var keys = Object.keys(props).filter(function(k) {
3738
- return k !== 'key';
3739
- });
3740
- var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
3741
- if (!didWarnAboutKeySpread[componentName + beforeExample]) {
3742
- var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
3743
- error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
3744
- didWarnAboutKeySpread[componentName + beforeExample] = true;
3745
- }
3746
- }
3747
- }
3748
- if (type === REACT_FRAGMENT_TYPE) {
3749
- validateFragmentProps(element);
3750
- } else {
3751
- validatePropTypes(element);
3752
- }
3753
- return element;
3754
- }
3755
- } // These two functions exist to still get child warnings in dev
3756
- // even with the prod transform. This means that jsxDEV is purely
3757
- // opt-in behavior for better messages but that we won't stop
3758
- // giving you warnings if you use production apis.
3759
- function jsxWithValidationStatic(type, props, key) {
3760
- {
3761
- return jsxWithValidation(type, props, key, true);
3762
- }
3763
- }
3764
- function jsxWithValidationDynamic(type, props, key) {
3765
- {
3766
- return jsxWithValidation(type, props, key, false);
3767
- }
3768
- }
3769
- var jsx = jsxWithValidationDynamic; // we may want to special case jsxs internally to take advantage of static children.
3770
- // for now we can ship identical prod functions
3771
- var jsxs = jsxWithValidationStatic;
3772
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
3773
- reactJsxRuntime_development.jsx = jsx;
3774
- reactJsxRuntime_development.jsxs = jsxs;
3775
- })();
3776
- }
3777
- return reactJsxRuntime_development;
3778
- }
3779
-
3780
- if (process.env.NODE_ENV === 'production') {
3781
- jsxRuntime.exports = requireReactJsxRuntime_production_min();
3782
- } else {
3783
- jsxRuntime.exports = requireReactJsxRuntime_development();
3784
- }
3785
-
3786
- var jsxRuntimeExports = jsxRuntime.exports;
3787
-
3788
- function _define_property(obj, key, value) {
9
+ function _define_property$1(obj, key, value) {
3789
10
  if (key in obj) {
3790
11
  Object.defineProperty(obj, key, {
3791
12
  value: value,
@@ -3798,7 +19,7 @@ function _define_property(obj, key, value) {
3798
19
  }
3799
20
  return obj;
3800
21
  }
3801
- function _object_spread(target) {
22
+ function _object_spread$1(target) {
3802
23
  for(var i = 1; i < arguments.length; i++){
3803
24
  var source = arguments[i] != null ? arguments[i] : {};
3804
25
  var ownKeys = Object.keys(source);
@@ -3808,12 +29,12 @@ function _object_spread(target) {
3808
29
  }));
3809
30
  }
3810
31
  ownKeys.forEach(function(key) {
3811
- _define_property(target, key, source[key]);
32
+ _define_property$1(target, key, source[key]);
3812
33
  });
3813
34
  }
3814
35
  return target;
3815
36
  }
3816
- function ownKeys(object, enumerableOnly) {
37
+ function ownKeys$1(object, enumerableOnly) {
3817
38
  var keys = Object.keys(object);
3818
39
  if (Object.getOwnPropertySymbols) {
3819
40
  var symbols = Object.getOwnPropertySymbols(object);
@@ -3821,20 +42,20 @@ function ownKeys(object, enumerableOnly) {
3821
42
  }
3822
43
  return keys;
3823
44
  }
3824
- function _object_spread_props(target, source) {
45
+ function _object_spread_props$1(target, source) {
3825
46
  source = source != null ? source : {};
3826
47
  if (Object.getOwnPropertyDescriptors) {
3827
48
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3828
49
  } else {
3829
- ownKeys(Object(source)).forEach(function(key) {
50
+ ownKeys$1(Object(source)).forEach(function(key) {
3830
51
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3831
52
  });
3832
53
  }
3833
54
  return target;
3834
55
  }
3835
- function _object_without_properties(source, excluded) {
56
+ function _object_without_properties$1(source, excluded) {
3836
57
  if (source == null) return {};
3837
- var target = _object_without_properties_loose(source, excluded);
58
+ var target = _object_without_properties_loose$1(source, excluded);
3838
59
  var key, i;
3839
60
  if (Object.getOwnPropertySymbols) {
3840
61
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3847,7 +68,7 @@ function _object_without_properties(source, excluded) {
3847
68
  }
3848
69
  return target;
3849
70
  }
3850
- function _object_without_properties_loose(source, excluded) {
71
+ function _object_without_properties_loose$1(source, excluded) {
3851
72
  if (source == null) return {};
3852
73
  var target = {};
3853
74
  var sourceKeys = Object.keys(source);
@@ -3864,7 +85,7 @@ function _type_of(obj) {
3864
85
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3865
86
  }
3866
87
  var Img = function(props) {
3867
- var src = props.src, width = props.width, height = props.height, _props_themeName = props.themeName, themeName = _props_themeName === void 0 ? 'img' : _props_themeName, tokens = props.tokens, customTheme = props.customTheme, rest = _object_without_properties(props, [
88
+ var src = props.src, width = props.width, height = props.height, _props_themeName = props.themeName, themeName = _props_themeName === void 0 ? 'img' : _props_themeName, tokens = props.tokens, customTheme = props.customTheme, rest = _object_without_properties$1(props, [
3868
89
  "src",
3869
90
  "width",
3870
91
  "height",
@@ -3874,7 +95,7 @@ var Img = function(props) {
3874
95
  ]);
3875
96
  var theme = useThemeContext(themeName, tokens, customTheme);
3876
97
  if ((typeof src === "undefined" ? "undefined" : _type_of(src)) === 'object') {
3877
- var blurWidth = src.blurWidth, blurHeight = src.blurHeight, srcWidth = src.width, srcHeight = src.height, withoutBlurDimensions = _object_without_properties(src, [
98
+ var blurWidth = src.blurWidth, blurHeight = src.blurHeight, srcWidth = src.width, srcHeight = src.height, withoutBlurDimensions = _object_without_properties$1(src, [
3878
99
  "blurWidth",
3879
100
  "blurHeight",
3880
101
  "width",
@@ -3884,14 +105,14 @@ var Img = function(props) {
3884
105
  blurwidth: blurWidth,
3885
106
  blurheight: blurHeight
3886
107
  };
3887
- return /*#__PURE__*/ jsxRuntimeExports.jsx(Image, _object_spread_props(_object_spread({
108
+ return /*#__PURE__*/ jsx(Image, _object_spread_props$1(_object_spread$1({
3888
109
  className: theme
3889
110
  }, withoutBlurDimensions, rest, blur), {
3890
111
  width: srcWidth !== null && srcWidth !== void 0 ? srcWidth : width,
3891
112
  height: srcHeight !== null && srcHeight !== void 0 ? srcHeight : height
3892
113
  }));
3893
114
  }
3894
- return /*#__PURE__*/ jsxRuntimeExports.jsx(Image, _object_spread({
115
+ return /*#__PURE__*/ jsx(Image, _object_spread$1({
3895
116
  width: width,
3896
117
  height: height,
3897
118
  className: theme,
@@ -3899,4 +120,261 @@ var Img = function(props) {
3899
120
  }, rest));
3900
121
  };
3901
122
 
3902
- export { Img };
123
+ function _array_like_to_array(arr, len) {
124
+ if (len == null || len > arr.length) len = arr.length;
125
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
126
+ return arr2;
127
+ }
128
+ function _array_with_holes(arr) {
129
+ if (Array.isArray(arr)) return arr;
130
+ }
131
+ function _iterable_to_array_limit(arr, i) {
132
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
133
+ if (_i == null) return;
134
+ var _arr = [];
135
+ var _n = true;
136
+ var _d = false;
137
+ var _s, _e;
138
+ try {
139
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
140
+ _arr.push(_s.value);
141
+ if (i && _arr.length === i) break;
142
+ }
143
+ } catch (err) {
144
+ _d = true;
145
+ _e = err;
146
+ } finally{
147
+ try {
148
+ if (!_n && _i["return"] != null) _i["return"]();
149
+ } finally{
150
+ if (_d) throw _e;
151
+ }
152
+ }
153
+ return _arr;
154
+ }
155
+ function _non_iterable_rest() {
156
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
157
+ }
158
+ function _sliced_to_array(arr, i) {
159
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
160
+ }
161
+ function _unsupported_iterable_to_array(o, minLen) {
162
+ if (!o) return;
163
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
164
+ var n = Object.prototype.toString.call(o).slice(8, -1);
165
+ if (n === "Object" && o.constructor) n = o.constructor.name;
166
+ if (n === "Map" || n === "Set") return Array.from(n);
167
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
168
+ }
169
+ function getHash() {
170
+ if (typeof window === 'undefined') return '';
171
+ return window.location.hash;
172
+ }
173
+ /**
174
+ * A hook that lets you read the current URL's hash.
175
+ *
176
+ * @returns The current `window.location.hash`, including the leading `#` character.
177
+ */ function useHash() {
178
+ var defaultHash = getHash();
179
+ var _useState = _sliced_to_array(useState(defaultHash), 2), hash = _useState[0], setHash = _useState[1];
180
+ var handleHashChangeEvent = function(param) {
181
+ var newURL = param.newURL;
182
+ if (!URL.canParse(newURL)) return;
183
+ var _ref = new URL(newURL), newHash = _ref.hash;
184
+ if (!newHash || newHash === hash) return;
185
+ setHash(newHash);
186
+ };
187
+ useEvent('hashchange', handleHashChangeEvent);
188
+ return hash;
189
+ }
190
+
191
+ function scrollToTop(behavior) {
192
+ var _window_scrollTo, _window;
193
+ (_window = window) === null || _window === void 0 ? void 0 : (_window_scrollTo = _window.scrollTo) === null || _window_scrollTo === void 0 ? void 0 : _window_scrollTo.call(_window, {
194
+ top: 0,
195
+ behavior: behavior
196
+ });
197
+ }
198
+ function getParamsLocale(params) {
199
+ var locale = params.locale;
200
+ if (Array.isArray(locale)) return locale[0];
201
+ return locale;
202
+ }
203
+ /**
204
+ * Tries to get the locale, in order of priority:
205
+ * 1. The locale prop. Still has priority even when set to `false`
206
+ * 2. The locale from react-aria `useLocale`
207
+ * 3. The locale from next/navigation `useParams`
208
+ * @returns The best matched locale
209
+ */ function useLinkLocale(props) {
210
+ var locale = props.locale;
211
+ var params = useParams();
212
+ var paramsLocale = getParamsLocale(params);
213
+ if (locale === false) return false;
214
+ var _ref;
215
+ return (_ref = locale !== null && locale !== void 0 ? locale : paramsLocale) !== null && _ref !== void 0 ? _ref : false;
216
+ }
217
+ /**
218
+ * @params {props.locale} - The direct locale prop always gets priority. If no `locale` prop is provided, the prop will try to fall back to react-aria `useLocale` and then next/navigation `useParams`. If a locale is found, it will be automatically prepended to the href. Otherwise, href will be returned as is.
219
+ */ function useLink(props) {
220
+ var _props_scroll = props.scroll, scroll = _props_scroll === void 0 ? true : _props_scroll, onMouseEnter = props.onMouseEnter, onTouchStart = props.onTouchStart, onClick = props.onClick, onPathnameChange = props.onPathnameChange, onHashChange = props.onHashChange, onSearchParamsChange = props.onSearchParamsChange, href = props.href, urlDecorator = props.urlDecorator, replace = props.replace, prefetch = props.prefetch, shallow = props.shallow, passHref = props.passHref, legacyBehavior = props.legacyBehavior, _props_behavior = props.behavior, behavior = _props_behavior === void 0 ? 'instant' : _props_behavior;
221
+ var locale = useLinkLocale(props);
222
+ var localizedHref = locale ? "/".concat(locale).concat(href) : href;
223
+ var pathname = usePathname();
224
+ var searchParams = useSearchParams();
225
+ var hash = useHash();
226
+ var isNextScroll = typeof scroll === 'boolean';
227
+ var nextScroll = isNextScroll ? scroll : false;
228
+ var handleScroll = useCallback(function() {
229
+ if (isNextScroll) return;
230
+ scrollToTop(behavior);
231
+ }, [
232
+ behavior,
233
+ isNextScroll
234
+ ]);
235
+ var handleClick = function(event) {
236
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
237
+ handleScroll();
238
+ };
239
+ var handleTouchStart = function(event) {
240
+ onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(event);
241
+ handleScroll();
242
+ };
243
+ useEffect(function() {
244
+ onPathnameChange === null || onPathnameChange === void 0 ? void 0 : onPathnameChange(pathname);
245
+ }, [
246
+ onPathnameChange,
247
+ pathname
248
+ ]);
249
+ useEffect(function() {
250
+ onSearchParamsChange === null || onSearchParamsChange === void 0 ? void 0 : onSearchParamsChange(searchParams);
251
+ }, [
252
+ onSearchParamsChange,
253
+ searchParams
254
+ ]);
255
+ useEffect(function() {
256
+ onHashChange === null || onHashChange === void 0 ? void 0 : onHashChange(hash);
257
+ }, [
258
+ onHashChange,
259
+ hash
260
+ ]);
261
+ return {
262
+ href: localizedHref.toString(),
263
+ as: urlDecorator,
264
+ replace: replace,
265
+ locale: locale,
266
+ prefetch: prefetch,
267
+ shallow: shallow,
268
+ onClick: handleClick,
269
+ onTouchStart: handleTouchStart,
270
+ onMouseEnter: onMouseEnter,
271
+ scroll: nextScroll,
272
+ passHref: passHref,
273
+ legacyBehavior: legacyBehavior
274
+ };
275
+ }
276
+
277
+ function _define_property(obj, key, value) {
278
+ if (key in obj) {
279
+ Object.defineProperty(obj, key, {
280
+ value: value,
281
+ enumerable: true,
282
+ configurable: true,
283
+ writable: true
284
+ });
285
+ } else {
286
+ obj[key] = value;
287
+ }
288
+ return obj;
289
+ }
290
+ function _object_spread(target) {
291
+ for(var i = 1; i < arguments.length; i++){
292
+ var source = arguments[i] != null ? arguments[i] : {};
293
+ var ownKeys = Object.keys(source);
294
+ if (typeof Object.getOwnPropertySymbols === "function") {
295
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
296
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
297
+ }));
298
+ }
299
+ ownKeys.forEach(function(key) {
300
+ _define_property(target, key, source[key]);
301
+ });
302
+ }
303
+ return target;
304
+ }
305
+ function ownKeys(object, enumerableOnly) {
306
+ var keys = Object.keys(object);
307
+ if (Object.getOwnPropertySymbols) {
308
+ var symbols = Object.getOwnPropertySymbols(object);
309
+ keys.push.apply(keys, symbols);
310
+ }
311
+ return keys;
312
+ }
313
+ function _object_spread_props(target, source) {
314
+ source = source != null ? source : {};
315
+ if (Object.getOwnPropertyDescriptors) {
316
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
317
+ } else {
318
+ ownKeys(Object(source)).forEach(function(key) {
319
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
320
+ });
321
+ }
322
+ return target;
323
+ }
324
+ function _object_without_properties(source, excluded) {
325
+ if (source == null) return {};
326
+ var target = _object_without_properties_loose(source, excluded);
327
+ var key, i;
328
+ if (Object.getOwnPropertySymbols) {
329
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
330
+ for(i = 0; i < sourceSymbolKeys.length; i++){
331
+ key = sourceSymbolKeys[i];
332
+ if (excluded.indexOf(key) >= 0) continue;
333
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
334
+ target[key] = source[key];
335
+ }
336
+ }
337
+ return target;
338
+ }
339
+ function _object_without_properties_loose(source, excluded) {
340
+ if (source == null) return {};
341
+ var target = {};
342
+ var sourceKeys = Object.keys(source);
343
+ var key, i;
344
+ for(i = 0; i < sourceKeys.length; i++){
345
+ key = sourceKeys[i];
346
+ if (excluded.indexOf(key) >= 0) continue;
347
+ target[key] = source[key];
348
+ }
349
+ return target;
350
+ }
351
+ var Link = /*#__PURE__*/ forwardRef(function(props, ref) {
352
+ var _props_themeName = props.themeName, themeName = _props_themeName === void 0 ? 'link' : _props_themeName, tokens = props.tokens, customTheme = props.customTheme, _props_as = props.as, as = _props_as === void 0 ? NextLink : _props_as, children = props.children; props.scroll; props.onPathnameChange; props.onSearchParamsChange; props.onHashChange; props.behavior; props.urlDecorator; props.href; var rest = _object_without_properties(props, [
353
+ "themeName",
354
+ "tokens",
355
+ "customTheme",
356
+ "as",
357
+ "children",
358
+ "scroll",
359
+ "onPathnameChange",
360
+ "onSearchParamsChange",
361
+ "onHashChange",
362
+ "behavior",
363
+ "urlDecorator",
364
+ "href"
365
+ ]);
366
+ var linkProps = useLink(props);
367
+ return /*#__PURE__*/ jsx(Anchor, _object_spread_props(_object_spread({
368
+ ref: ref
369
+ }, rest), {
370
+ nextLinkProps: linkProps,
371
+ as: as,
372
+ themeName: themeName,
373
+ tokens: tokens,
374
+ customTheme: customTheme,
375
+ children: children
376
+ }));
377
+ });
378
+ Link.displayName = 'Link';
379
+
380
+ export { Img, Link, useHash, useLink };