UNPKG

161 kBJavaScriptView Raw
1'use strict';
2
3var ReactFiberReconciler = require('react-reconciler');
4
5function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
7var ReactFiberReconciler__default = /*#__PURE__*/_interopDefaultLegacy(ReactFiberReconciler);
8
9var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10
11function createCommonjsModule(fn, module) {
12 return module = { exports: {} }, fn(module, module.exports), module.exports;
13}
14
15/*
16object-assign
17(c) Sindre Sorhus
18@license MIT
19*/
20/* eslint-disable no-unused-vars */
21var getOwnPropertySymbols = Object.getOwnPropertySymbols;
22var hasOwnProperty = Object.prototype.hasOwnProperty;
23var propIsEnumerable = Object.prototype.propertyIsEnumerable;
24
25function toObject(val) {
26 if (val === null || val === undefined) {
27 throw new TypeError('Object.assign cannot be called with null or undefined');
28 }
29
30 return Object(val);
31}
32
33function shouldUseNative() {
34 try {
35 if (!Object.assign) {
36 return false;
37 }
38
39 // Detect buggy property enumeration order in older V8 versions.
40
41 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
42 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
43 test1[5] = 'de';
44 if (Object.getOwnPropertyNames(test1)[0] === '5') {
45 return false;
46 }
47
48 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
49 var test2 = {};
50 for (var i = 0; i < 10; i++) {
51 test2['_' + String.fromCharCode(i)] = i;
52 }
53 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
54 return test2[n];
55 });
56 if (order2.join('') !== '0123456789') {
57 return false;
58 }
59
60 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
61 var test3 = {};
62 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
63 test3[letter] = letter;
64 });
65 if (Object.keys(Object.assign({}, test3)).join('') !==
66 'abcdefghijklmnopqrst') {
67 return false;
68 }
69
70 return true;
71 } catch (err) {
72 // We don't expect any of the above to throw, but better to be safe.
73 return false;
74 }
75}
76
77var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
78 var from;
79 var to = toObject(target);
80 var symbols;
81
82 for (var s = 1; s < arguments.length; s++) {
83 from = Object(arguments[s]);
84
85 for (var key in from) {
86 if (hasOwnProperty.call(from, key)) {
87 to[key] = from[key];
88 }
89 }
90
91 if (getOwnPropertySymbols) {
92 symbols = getOwnPropertySymbols(from);
93 for (var i = 0; i < symbols.length; i++) {
94 if (propIsEnumerable.call(from, symbols[i])) {
95 to[symbols[i]] = from[symbols[i]];
96 }
97 }
98 }
99 }
100
101 return to;
102};
103
104var react_production_min = createCommonjsModule(function (module, exports) {
105var n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116;
106if("function"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w("react.element");p=w("react.portal");exports.Fragment=w("react.fragment");exports.StrictMode=w("react.strict_mode");exports.Profiler=w("react.profiler");q=w("react.provider");r=w("react.context");t=w("react.forward_ref");exports.Suspense=w("react.suspense");u=w("react.memo");v=w("react.lazy");}var x="function"===typeof Symbol&&Symbol.iterator;
107function y(a){if(null===a||"object"!==typeof a)return null;a=x&&a[x]||a["@@iterator"];return "function"===typeof a?a:null}function z(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return "Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}
108var A={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B={};function C(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A;}C.prototype.isReactComponent={};C.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error(z(85));this.updater.enqueueSetState(this,a,b,"setState");};C.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};
109function D(){}D.prototype=C.prototype;function E(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A;}var F=E.prototype=new D;F.constructor=E;objectAssign(F,C.prototype);F.isPureReactComponent=!0;var G={current:null},H=Object.prototype.hasOwnProperty,I={key:!0,ref:!0,__self:!0,__source:!0};
110function J(a,b,c){var e,d={},k=null,h=null;if(null!=b)for(e in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)H.call(b,e)&&!I.hasOwnProperty(e)&&(d[e]=b[e]);var g=arguments.length-2;if(1===g)d.children=c;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];d.children=f;}if(a&&a.defaultProps)for(e in g=a.defaultProps,g)void 0===d[e]&&(d[e]=g[e]);return {$$typeof:n,type:a,key:k,ref:h,props:d,_owner:G.current}}
111function K(a,b){return {$$typeof:n,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function L(a){return "object"===typeof a&&null!==a&&a.$$typeof===n}function escape(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var M=/\/+/g;function N(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
112function O(a,b,c,e,d){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case n:case p:h=!0;}}if(h)return h=a,d=d(h),a=""===e?"."+N(h,0):e,Array.isArray(d)?(c="",null!=a&&(c=a.replace(M,"$&/")+"/"),O(d,b,c,"",function(a){return a})):null!=d&&(L(d)&&(d=K(d,c+(!d.key||h&&h.key===d.key?"":(""+d.key).replace(M,"$&/")+"/")+a)),b.push(d)),1;h=0;e=""===e?".":e+":";if(Array.isArray(a))for(var g=
1130;g<a.length;g++){k=a[g];var f=e+N(k,g);h+=O(k,b,c,f,d);}else if(f=y(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=e+N(k,g++),h+=O(k,b,c,f,d);else if("object"===k)throw b=""+a,Error(z(31,"[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b));return h}function P(a,b,c){if(null==a)return a;var e=[],d=0;O(a,e,"","",function(a){return b.call(c,a,d++)});return e}
114function Q(a){if(-1===a._status){var b=a._result;b=b();a._status=0;a._result=b;b.then(function(b){0===a._status&&(b=b.default,a._status=1,a._result=b);},function(b){0===a._status&&(a._status=2,a._result=b);});}if(1===a._status)return a._result;throw a._result;}var R={current:null};function S(){var a=R.current;if(null===a)throw Error(z(321));return a}var T={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:G,IsSomeRendererActing:{current:!1},assign:objectAssign};
115exports.Children={map:P,forEach:function(a,b,c){P(a,function(){b.apply(this,arguments);},c);},count:function(a){var b=0;P(a,function(){b++;});return b},toArray:function(a){return P(a,function(a){return a})||[]},only:function(a){if(!L(a))throw Error(z(143));return a}};exports.Component=C;exports.PureComponent=E;exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T;
116exports.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(z(267,a));var e=objectAssign({},a.props),d=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=G.current);void 0!==b.key&&(d=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)H.call(b,f)&&!I.hasOwnProperty(f)&&(e[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)e.children=c;else if(1<f){g=Array(f);for(var m=0;m<f;m++)g[m]=arguments[m+2];e.children=g;}return {$$typeof:n,type:a.type,
117key:d,ref:k,props:e,_owner:h}};exports.createContext=function(a,b){void 0===b&&(b=null);a={$$typeof:r,_calculateChangedBits:b,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:q,_context:a};return a.Consumer=a};exports.createElement=J;exports.createFactory=function(a){var b=J.bind(null,a);b.type=a;return b};exports.createRef=function(){return {current:null}};exports.forwardRef=function(a){return {$$typeof:t,render:a}};exports.isValidElement=L;
118exports.lazy=function(a){return {$$typeof:v,_payload:{_status:-1,_result:a},_init:Q}};exports.memo=function(a,b){return {$$typeof:u,type:a,compare:void 0===b?null:b}};exports.useCallback=function(a,b){return S().useCallback(a,b)};exports.useContext=function(a,b){return S().useContext(a,b)};exports.useDebugValue=function(){};exports.useEffect=function(a,b){return S().useEffect(a,b)};exports.useImperativeHandle=function(a,b,c){return S().useImperativeHandle(a,b,c)};
119exports.useLayoutEffect=function(a,b){return S().useLayoutEffect(a,b)};exports.useMemo=function(a,b){return S().useMemo(a,b)};exports.useReducer=function(a,b,c){return S().useReducer(a,b,c)};exports.useRef=function(a){return S().useRef(a)};exports.useState=function(a){return S().useState(a)};exports.version="17.0.1";
120});
121react_production_min.Fragment;
122react_production_min.StrictMode;
123react_production_min.Profiler;
124react_production_min.Suspense;
125react_production_min.Children;
126react_production_min.Component;
127react_production_min.PureComponent;
128react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
129react_production_min.cloneElement;
130react_production_min.createContext;
131react_production_min.createElement;
132react_production_min.createFactory;
133react_production_min.createRef;
134react_production_min.forwardRef;
135react_production_min.isValidElement;
136react_production_min.lazy;
137react_production_min.memo;
138react_production_min.useCallback;
139react_production_min.useContext;
140react_production_min.useDebugValue;
141react_production_min.useEffect;
142react_production_min.useImperativeHandle;
143react_production_min.useLayoutEffect;
144react_production_min.useMemo;
145react_production_min.useReducer;
146react_production_min.useRef;
147react_production_min.useState;
148react_production_min.version;
149
150var react_development = createCommonjsModule(function (module, exports) {
151
152if (process.env.NODE_ENV !== "production") {
153 (function() {
154
155var _assign = objectAssign;
156
157// TODO: this is special because it gets imported during build.
158var ReactVersion = '17.0.1';
159
160// ATTENTION
161// When adding new symbols to this file,
162// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
163// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
164// nor polyfill, then a plain number is used for performance.
165var REACT_ELEMENT_TYPE = 0xeac7;
166var REACT_PORTAL_TYPE = 0xeaca;
167exports.Fragment = 0xeacb;
168exports.StrictMode = 0xeacc;
169exports.Profiler = 0xead2;
170var REACT_PROVIDER_TYPE = 0xeacd;
171var REACT_CONTEXT_TYPE = 0xeace;
172var REACT_FORWARD_REF_TYPE = 0xead0;
173exports.Suspense = 0xead1;
174var REACT_SUSPENSE_LIST_TYPE = 0xead8;
175var REACT_MEMO_TYPE = 0xead3;
176var REACT_LAZY_TYPE = 0xead4;
177var REACT_BLOCK_TYPE = 0xead9;
178var REACT_SERVER_BLOCK_TYPE = 0xeada;
179var REACT_FUNDAMENTAL_TYPE = 0xead5;
180var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
181var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
182
183if (typeof Symbol === 'function' && Symbol.for) {
184 var symbolFor = Symbol.for;
185 REACT_ELEMENT_TYPE = symbolFor('react.element');
186 REACT_PORTAL_TYPE = symbolFor('react.portal');
187 exports.Fragment = symbolFor('react.fragment');
188 exports.StrictMode = symbolFor('react.strict_mode');
189 exports.Profiler = symbolFor('react.profiler');
190 REACT_PROVIDER_TYPE = symbolFor('react.provider');
191 REACT_CONTEXT_TYPE = symbolFor('react.context');
192 REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
193 exports.Suspense = symbolFor('react.suspense');
194 REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
195 REACT_MEMO_TYPE = symbolFor('react.memo');
196 REACT_LAZY_TYPE = symbolFor('react.lazy');
197 REACT_BLOCK_TYPE = symbolFor('react.block');
198 REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
199 REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
200 symbolFor('react.scope');
201 symbolFor('react.opaque.id');
202 REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
203 symbolFor('react.offscreen');
204 REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
205}
206
207var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
208var FAUX_ITERATOR_SYMBOL = '@@iterator';
209function getIteratorFn(maybeIterable) {
210 if (maybeIterable === null || typeof maybeIterable !== 'object') {
211 return null;
212 }
213
214 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
215
216 if (typeof maybeIterator === 'function') {
217 return maybeIterator;
218 }
219
220 return null;
221}
222
223/**
224 * Keeps track of the current dispatcher.
225 */
226var ReactCurrentDispatcher = {
227 /**
228 * @internal
229 * @type {ReactComponent}
230 */
231 current: null
232};
233
234/**
235 * Keeps track of the current batch's configuration such as how long an update
236 * should suspend for if it needs to.
237 */
238var ReactCurrentBatchConfig = {
239 transition: 0
240};
241
242/**
243 * Keeps track of the current owner.
244 *
245 * The current owner is the component who should own any components that are
246 * currently being constructed.
247 */
248var ReactCurrentOwner = {
249 /**
250 * @internal
251 * @type {ReactComponent}
252 */
253 current: null
254};
255
256var ReactDebugCurrentFrame = {};
257var currentExtraStackFrame = null;
258function setExtraStackFrame(stack) {
259 {
260 currentExtraStackFrame = stack;
261 }
262}
263
264{
265 ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
266 {
267 currentExtraStackFrame = stack;
268 }
269 }; // Stack implementation injected by the current renderer.
270
271
272 ReactDebugCurrentFrame.getCurrentStack = null;
273
274 ReactDebugCurrentFrame.getStackAddendum = function () {
275 var stack = ''; // Add an extra top frame while an element is being validated
276
277 if (currentExtraStackFrame) {
278 stack += currentExtraStackFrame;
279 } // Delegate to the injected renderer-specific implementation
280
281
282 var impl = ReactDebugCurrentFrame.getCurrentStack;
283
284 if (impl) {
285 stack += impl() || '';
286 }
287
288 return stack;
289 };
290}
291
292/**
293 * Used by act() to track whether you're inside an act() scope.
294 */
295var IsSomeRendererActing = {
296 current: false
297};
298
299var ReactSharedInternals = {
300 ReactCurrentDispatcher: ReactCurrentDispatcher,
301 ReactCurrentBatchConfig: ReactCurrentBatchConfig,
302 ReactCurrentOwner: ReactCurrentOwner,
303 IsSomeRendererActing: IsSomeRendererActing,
304 // Used by renderers to avoid bundling object-assign twice in UMD bundles:
305 assign: _assign
306};
307
308{
309 ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
310}
311
312// by calls to these methods by a Babel plugin.
313//
314// In PROD (or in packages without access to React internals),
315// they are left as they are instead.
316
317function warn(format) {
318 {
319 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
320 args[_key - 1] = arguments[_key];
321 }
322
323 printWarning('warn', format, args);
324 }
325}
326function error(format) {
327 {
328 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
329 args[_key2 - 1] = arguments[_key2];
330 }
331
332 printWarning('error', format, args);
333 }
334}
335
336function printWarning(level, format, args) {
337 // When changing this logic, you might want to also
338 // update consoleWithStackDev.www.js as well.
339 {
340 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
341 var stack = ReactDebugCurrentFrame.getStackAddendum();
342
343 if (stack !== '') {
344 format += '%s';
345 args = args.concat([stack]);
346 }
347
348 var argsWithFormat = args.map(function (item) {
349 return '' + item;
350 }); // Careful: RN currently depends on this prefix
351
352 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
353 // breaks IE9: https://github.com/facebook/react/issues/13610
354 // eslint-disable-next-line react-internal/no-production-logging
355
356 Function.prototype.apply.call(console[level], console, argsWithFormat);
357 }
358}
359
360var didWarnStateUpdateForUnmountedComponent = {};
361
362function warnNoop(publicInstance, callerName) {
363 {
364 var _constructor = publicInstance.constructor;
365 var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
366 var warningKey = componentName + "." + callerName;
367
368 if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
369 return;
370 }
371
372 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);
373
374 didWarnStateUpdateForUnmountedComponent[warningKey] = true;
375 }
376}
377/**
378 * This is the abstract API for an update queue.
379 */
380
381
382var ReactNoopUpdateQueue = {
383 /**
384 * Checks whether or not this composite component is mounted.
385 * @param {ReactClass} publicInstance The instance we want to test.
386 * @return {boolean} True if mounted, false otherwise.
387 * @protected
388 * @final
389 */
390 isMounted: function (publicInstance) {
391 return false;
392 },
393
394 /**
395 * Forces an update. This should only be invoked when it is known with
396 * certainty that we are **not** in a DOM transaction.
397 *
398 * You may want to call this when you know that some deeper aspect of the
399 * component's state has changed but `setState` was not called.
400 *
401 * This will not invoke `shouldComponentUpdate`, but it will invoke
402 * `componentWillUpdate` and `componentDidUpdate`.
403 *
404 * @param {ReactClass} publicInstance The instance that should rerender.
405 * @param {?function} callback Called after component is updated.
406 * @param {?string} callerName name of the calling function in the public API.
407 * @internal
408 */
409 enqueueForceUpdate: function (publicInstance, callback, callerName) {
410 warnNoop(publicInstance, 'forceUpdate');
411 },
412
413 /**
414 * Replaces all of the state. Always use this or `setState` to mutate state.
415 * You should treat `this.state` as immutable.
416 *
417 * There is no guarantee that `this.state` will be immediately updated, so
418 * accessing `this.state` after calling this method may return the old value.
419 *
420 * @param {ReactClass} publicInstance The instance that should rerender.
421 * @param {object} completeState Next state.
422 * @param {?function} callback Called after component is updated.
423 * @param {?string} callerName name of the calling function in the public API.
424 * @internal
425 */
426 enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
427 warnNoop(publicInstance, 'replaceState');
428 },
429
430 /**
431 * Sets a subset of the state. This only exists because _pendingState is
432 * internal. This provides a merging strategy that is not available to deep
433 * properties which is confusing. TODO: Expose pendingState or don't use it
434 * during the merge.
435 *
436 * @param {ReactClass} publicInstance The instance that should rerender.
437 * @param {object} partialState Next partial state to be merged with state.
438 * @param {?function} callback Called after component is updated.
439 * @param {?string} Name of the calling function in the public API.
440 * @internal
441 */
442 enqueueSetState: function (publicInstance, partialState, callback, callerName) {
443 warnNoop(publicInstance, 'setState');
444 }
445};
446
447var emptyObject = {};
448
449{
450 Object.freeze(emptyObject);
451}
452/**
453 * Base class helpers for the updating state of a component.
454 */
455
456
457function Component(props, context, updater) {
458 this.props = props;
459 this.context = context; // If a component has string refs, we will assign a different object later.
460
461 this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
462 // renderer.
463
464 this.updater = updater || ReactNoopUpdateQueue;
465}
466
467Component.prototype.isReactComponent = {};
468/**
469 * Sets a subset of the state. Always use this to mutate
470 * state. You should treat `this.state` as immutable.
471 *
472 * There is no guarantee that `this.state` will be immediately updated, so
473 * accessing `this.state` after calling this method may return the old value.
474 *
475 * There is no guarantee that calls to `setState` will run synchronously,
476 * as they may eventually be batched together. You can provide an optional
477 * callback that will be executed when the call to setState is actually
478 * completed.
479 *
480 * When a function is provided to setState, it will be called at some point in
481 * the future (not synchronously). It will be called with the up to date
482 * component arguments (state, props, context). These values can be different
483 * from this.* because your function may be called after receiveProps but before
484 * shouldComponentUpdate, and this new state, props, and context will not yet be
485 * assigned to this.
486 *
487 * @param {object|function} partialState Next partial state or function to
488 * produce next partial state to be merged with current state.
489 * @param {?function} callback Called after state is updated.
490 * @final
491 * @protected
492 */
493
494Component.prototype.setState = function (partialState, callback) {
495 if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
496 {
497 throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
498 }
499 }
500
501 this.updater.enqueueSetState(this, partialState, callback, 'setState');
502};
503/**
504 * Forces an update. This should only be invoked when it is known with
505 * certainty that we are **not** in a DOM transaction.
506 *
507 * You may want to call this when you know that some deeper aspect of the
508 * component's state has changed but `setState` was not called.
509 *
510 * This will not invoke `shouldComponentUpdate`, but it will invoke
511 * `componentWillUpdate` and `componentDidUpdate`.
512 *
513 * @param {?function} callback Called after update is complete.
514 * @final
515 * @protected
516 */
517
518
519Component.prototype.forceUpdate = function (callback) {
520 this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
521};
522/**
523 * Deprecated APIs. These APIs used to exist on classic React classes but since
524 * we would like to deprecate them, we're not going to move them over to this
525 * modern base class. Instead, we define a getter that warns if it's accessed.
526 */
527
528
529{
530 var deprecatedAPIs = {
531 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
532 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
533 };
534
535 var defineDeprecationWarning = function (methodName, info) {
536 Object.defineProperty(Component.prototype, methodName, {
537 get: function () {
538 warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
539
540 return undefined;
541 }
542 });
543 };
544
545 for (var fnName in deprecatedAPIs) {
546 if (deprecatedAPIs.hasOwnProperty(fnName)) {
547 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
548 }
549 }
550}
551
552function ComponentDummy() {}
553
554ComponentDummy.prototype = Component.prototype;
555/**
556 * Convenience component with default shallow equality check for sCU.
557 */
558
559function PureComponent(props, context, updater) {
560 this.props = props;
561 this.context = context; // If a component has string refs, we will assign a different object later.
562
563 this.refs = emptyObject;
564 this.updater = updater || ReactNoopUpdateQueue;
565}
566
567var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
568pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
569
570_assign(pureComponentPrototype, Component.prototype);
571
572pureComponentPrototype.isPureReactComponent = true;
573
574// an immutable object with a single mutable value
575function createRef() {
576 var refObject = {
577 current: null
578 };
579
580 {
581 Object.seal(refObject);
582 }
583
584 return refObject;
585}
586
587function getWrappedName(outerType, innerType, wrapperName) {
588 var functionName = innerType.displayName || innerType.name || '';
589 return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
590}
591
592function getContextName(type) {
593 return type.displayName || 'Context';
594}
595
596function getComponentName(type) {
597 if (type == null) {
598 // Host root, text node or just invalid type.
599 return null;
600 }
601
602 {
603 if (typeof type.tag === 'number') {
604 error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
605 }
606 }
607
608 if (typeof type === 'function') {
609 return type.displayName || type.name || null;
610 }
611
612 if (typeof type === 'string') {
613 return type;
614 }
615
616 switch (type) {
617 case exports.Fragment:
618 return 'Fragment';
619
620 case REACT_PORTAL_TYPE:
621 return 'Portal';
622
623 case exports.Profiler:
624 return 'Profiler';
625
626 case exports.StrictMode:
627 return 'StrictMode';
628
629 case exports.Suspense:
630 return 'Suspense';
631
632 case REACT_SUSPENSE_LIST_TYPE:
633 return 'SuspenseList';
634 }
635
636 if (typeof type === 'object') {
637 switch (type.$$typeof) {
638 case REACT_CONTEXT_TYPE:
639 var context = type;
640 return getContextName(context) + '.Consumer';
641
642 case REACT_PROVIDER_TYPE:
643 var provider = type;
644 return getContextName(provider._context) + '.Provider';
645
646 case REACT_FORWARD_REF_TYPE:
647 return getWrappedName(type, type.render, 'ForwardRef');
648
649 case REACT_MEMO_TYPE:
650 return getComponentName(type.type);
651
652 case REACT_BLOCK_TYPE:
653 return getComponentName(type._render);
654
655 case REACT_LAZY_TYPE:
656 {
657 var lazyComponent = type;
658 var payload = lazyComponent._payload;
659 var init = lazyComponent._init;
660
661 try {
662 return getComponentName(init(payload));
663 } catch (x) {
664 return null;
665 }
666 }
667 }
668 }
669
670 return null;
671}
672
673var hasOwnProperty = Object.prototype.hasOwnProperty;
674var RESERVED_PROPS = {
675 key: true,
676 ref: true,
677 __self: true,
678 __source: true
679};
680var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
681
682{
683 didWarnAboutStringRefs = {};
684}
685
686function hasValidRef(config) {
687 {
688 if (hasOwnProperty.call(config, 'ref')) {
689 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
690
691 if (getter && getter.isReactWarning) {
692 return false;
693 }
694 }
695 }
696
697 return config.ref !== undefined;
698}
699
700function hasValidKey(config) {
701 {
702 if (hasOwnProperty.call(config, 'key')) {
703 var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
704
705 if (getter && getter.isReactWarning) {
706 return false;
707 }
708 }
709 }
710
711 return config.key !== undefined;
712}
713
714function defineKeyPropWarningGetter(props, displayName) {
715 var warnAboutAccessingKey = function () {
716 {
717 if (!specialPropKeyWarningShown) {
718 specialPropKeyWarningShown = true;
719
720 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);
721 }
722 }
723 };
724
725 warnAboutAccessingKey.isReactWarning = true;
726 Object.defineProperty(props, 'key', {
727 get: warnAboutAccessingKey,
728 configurable: true
729 });
730}
731
732function defineRefPropWarningGetter(props, displayName) {
733 var warnAboutAccessingRef = function () {
734 {
735 if (!specialPropRefWarningShown) {
736 specialPropRefWarningShown = true;
737
738 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);
739 }
740 }
741 };
742
743 warnAboutAccessingRef.isReactWarning = true;
744 Object.defineProperty(props, 'ref', {
745 get: warnAboutAccessingRef,
746 configurable: true
747 });
748}
749
750function warnIfStringRefCannotBeAutoConverted(config) {
751 {
752 if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
753 var componentName = getComponentName(ReactCurrentOwner.current.type);
754
755 if (!didWarnAboutStringRefs[componentName]) {
756 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);
757
758 didWarnAboutStringRefs[componentName] = true;
759 }
760 }
761 }
762}
763/**
764 * Factory method to create a new React element. This no longer adheres to
765 * the class pattern, so do not use new to call it. Also, instanceof check
766 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
767 * if something is a React Element.
768 *
769 * @param {*} type
770 * @param {*} props
771 * @param {*} key
772 * @param {string|object} ref
773 * @param {*} owner
774 * @param {*} self A *temporary* helper to detect places where `this` is
775 * different from the `owner` when React.createElement is called, so that we
776 * can warn. We want to get rid of owner and replace string `ref`s with arrow
777 * functions, and as long as `this` and owner are the same, there will be no
778 * change in behavior.
779 * @param {*} source An annotation object (added by a transpiler or otherwise)
780 * indicating filename, line number, and/or other information.
781 * @internal
782 */
783
784
785var ReactElement = function (type, key, ref, self, source, owner, props) {
786 var element = {
787 // This tag allows us to uniquely identify this as a React Element
788 $$typeof: REACT_ELEMENT_TYPE,
789 // Built-in properties that belong on the element
790 type: type,
791 key: key,
792 ref: ref,
793 props: props,
794 // Record the component responsible for creating this element.
795 _owner: owner
796 };
797
798 {
799 // The validation flag is currently mutative. We put it on
800 // an external backing store so that we can freeze the whole object.
801 // This can be replaced with a WeakMap once they are implemented in
802 // commonly used development environments.
803 element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
804 // the validation flag non-enumerable (where possible, which should
805 // include every environment we run tests in), so the test framework
806 // ignores it.
807
808 Object.defineProperty(element._store, 'validated', {
809 configurable: false,
810 enumerable: false,
811 writable: true,
812 value: false
813 }); // self and source are DEV only properties.
814
815 Object.defineProperty(element, '_self', {
816 configurable: false,
817 enumerable: false,
818 writable: false,
819 value: self
820 }); // Two elements created in two different places should be considered
821 // equal for testing purposes and therefore we hide it from enumeration.
822
823 Object.defineProperty(element, '_source', {
824 configurable: false,
825 enumerable: false,
826 writable: false,
827 value: source
828 });
829
830 if (Object.freeze) {
831 Object.freeze(element.props);
832 Object.freeze(element);
833 }
834 }
835
836 return element;
837};
838/**
839 * Create and return a new ReactElement of the given type.
840 * See https://reactjs.org/docs/react-api.html#createelement
841 */
842
843function createElement(type, config, children) {
844 var propName; // Reserved names are extracted
845
846 var props = {};
847 var key = null;
848 var ref = null;
849 var self = null;
850 var source = null;
851
852 if (config != null) {
853 if (hasValidRef(config)) {
854 ref = config.ref;
855
856 {
857 warnIfStringRefCannotBeAutoConverted(config);
858 }
859 }
860
861 if (hasValidKey(config)) {
862 key = '' + config.key;
863 }
864
865 self = config.__self === undefined ? null : config.__self;
866 source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
867
868 for (propName in config) {
869 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
870 props[propName] = config[propName];
871 }
872 }
873 } // Children can be more than one argument, and those are transferred onto
874 // the newly allocated props object.
875
876
877 var childrenLength = arguments.length - 2;
878
879 if (childrenLength === 1) {
880 props.children = children;
881 } else if (childrenLength > 1) {
882 var childArray = Array(childrenLength);
883
884 for (var i = 0; i < childrenLength; i++) {
885 childArray[i] = arguments[i + 2];
886 }
887
888 {
889 if (Object.freeze) {
890 Object.freeze(childArray);
891 }
892 }
893
894 props.children = childArray;
895 } // Resolve default props
896
897
898 if (type && type.defaultProps) {
899 var defaultProps = type.defaultProps;
900
901 for (propName in defaultProps) {
902 if (props[propName] === undefined) {
903 props[propName] = defaultProps[propName];
904 }
905 }
906 }
907
908 {
909 if (key || ref) {
910 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
911
912 if (key) {
913 defineKeyPropWarningGetter(props, displayName);
914 }
915
916 if (ref) {
917 defineRefPropWarningGetter(props, displayName);
918 }
919 }
920 }
921
922 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
923}
924function cloneAndReplaceKey(oldElement, newKey) {
925 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
926 return newElement;
927}
928/**
929 * Clone and return a new ReactElement using element as the starting point.
930 * See https://reactjs.org/docs/react-api.html#cloneelement
931 */
932
933function cloneElement(element, config, children) {
934 if (!!(element === null || element === undefined)) {
935 {
936 throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
937 }
938 }
939
940 var propName; // Original props are copied
941
942 var props = _assign({}, element.props); // Reserved names are extracted
943
944
945 var key = element.key;
946 var ref = element.ref; // Self is preserved since the owner is preserved.
947
948 var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
949 // transpiler, and the original source is probably a better indicator of the
950 // true owner.
951
952 var source = element._source; // Owner will be preserved, unless ref is overridden
953
954 var owner = element._owner;
955
956 if (config != null) {
957 if (hasValidRef(config)) {
958 // Silently steal the ref from the parent.
959 ref = config.ref;
960 owner = ReactCurrentOwner.current;
961 }
962
963 if (hasValidKey(config)) {
964 key = '' + config.key;
965 } // Remaining properties override existing props
966
967
968 var defaultProps;
969
970 if (element.type && element.type.defaultProps) {
971 defaultProps = element.type.defaultProps;
972 }
973
974 for (propName in config) {
975 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
976 if (config[propName] === undefined && defaultProps !== undefined) {
977 // Resolve default props
978 props[propName] = defaultProps[propName];
979 } else {
980 props[propName] = config[propName];
981 }
982 }
983 }
984 } // Children can be more than one argument, and those are transferred onto
985 // the newly allocated props object.
986
987
988 var childrenLength = arguments.length - 2;
989
990 if (childrenLength === 1) {
991 props.children = children;
992 } else if (childrenLength > 1) {
993 var childArray = Array(childrenLength);
994
995 for (var i = 0; i < childrenLength; i++) {
996 childArray[i] = arguments[i + 2];
997 }
998
999 props.children = childArray;
1000 }
1001
1002 return ReactElement(element.type, key, ref, self, source, owner, props);
1003}
1004/**
1005 * Verifies the object is a ReactElement.
1006 * See https://reactjs.org/docs/react-api.html#isvalidelement
1007 * @param {?object} object
1008 * @return {boolean} True if `object` is a ReactElement.
1009 * @final
1010 */
1011
1012function isValidElement(object) {
1013 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1014}
1015
1016var SEPARATOR = '.';
1017var SUBSEPARATOR = ':';
1018/**
1019 * Escape and wrap key so it is safe to use as a reactid
1020 *
1021 * @param {string} key to be escaped.
1022 * @return {string} the escaped key.
1023 */
1024
1025function escape(key) {
1026 var escapeRegex = /[=:]/g;
1027 var escaperLookup = {
1028 '=': '=0',
1029 ':': '=2'
1030 };
1031 var escapedString = key.replace(escapeRegex, function (match) {
1032 return escaperLookup[match];
1033 });
1034 return '$' + escapedString;
1035}
1036/**
1037 * TODO: Test that a single child and an array with one item have the same key
1038 * pattern.
1039 */
1040
1041
1042var didWarnAboutMaps = false;
1043var userProvidedKeyEscapeRegex = /\/+/g;
1044
1045function escapeUserProvidedKey(text) {
1046 return text.replace(userProvidedKeyEscapeRegex, '$&/');
1047}
1048/**
1049 * Generate a key string that identifies a element within a set.
1050 *
1051 * @param {*} element A element that could contain a manual key.
1052 * @param {number} index Index that is used if a manual key is not provided.
1053 * @return {string}
1054 */
1055
1056
1057function getElementKey(element, index) {
1058 // Do some typechecking here since we call this blindly. We want to ensure
1059 // that we don't block potential future ES APIs.
1060 if (typeof element === 'object' && element !== null && element.key != null) {
1061 // Explicit key
1062 return escape('' + element.key);
1063 } // Implicit key determined by the index in the set
1064
1065
1066 return index.toString(36);
1067}
1068
1069function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
1070 var type = typeof children;
1071
1072 if (type === 'undefined' || type === 'boolean') {
1073 // All of the above are perceived as null.
1074 children = null;
1075 }
1076
1077 var invokeCallback = false;
1078
1079 if (children === null) {
1080 invokeCallback = true;
1081 } else {
1082 switch (type) {
1083 case 'string':
1084 case 'number':
1085 invokeCallback = true;
1086 break;
1087
1088 case 'object':
1089 switch (children.$$typeof) {
1090 case REACT_ELEMENT_TYPE:
1091 case REACT_PORTAL_TYPE:
1092 invokeCallback = true;
1093 }
1094
1095 }
1096 }
1097
1098 if (invokeCallback) {
1099 var _child = children;
1100 var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
1101 // so that it's consistent if the number of children grows:
1102
1103 var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
1104
1105 if (Array.isArray(mappedChild)) {
1106 var escapedChildKey = '';
1107
1108 if (childKey != null) {
1109 escapedChildKey = escapeUserProvidedKey(childKey) + '/';
1110 }
1111
1112 mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
1113 return c;
1114 });
1115 } else if (mappedChild != null) {
1116 if (isValidElement(mappedChild)) {
1117 mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
1118 // traverseAllChildren used to do for objects as children
1119 escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
1120 mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
1121 escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
1122 }
1123
1124 array.push(mappedChild);
1125 }
1126
1127 return 1;
1128 }
1129
1130 var child;
1131 var nextName;
1132 var subtreeCount = 0; // Count of children found in the current subtree.
1133
1134 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1135
1136 if (Array.isArray(children)) {
1137 for (var i = 0; i < children.length; i++) {
1138 child = children[i];
1139 nextName = nextNamePrefix + getElementKey(child, i);
1140 subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1141 }
1142 } else {
1143 var iteratorFn = getIteratorFn(children);
1144
1145 if (typeof iteratorFn === 'function') {
1146 var iterableChildren = children;
1147
1148 {
1149 // Warn about using Maps as children
1150 if (iteratorFn === iterableChildren.entries) {
1151 if (!didWarnAboutMaps) {
1152 warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
1153 }
1154
1155 didWarnAboutMaps = true;
1156 }
1157 }
1158
1159 var iterator = iteratorFn.call(iterableChildren);
1160 var step;
1161 var ii = 0;
1162
1163 while (!(step = iterator.next()).done) {
1164 child = step.value;
1165 nextName = nextNamePrefix + getElementKey(child, ii++);
1166 subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1167 }
1168 } else if (type === 'object') {
1169 var childrenString = '' + children;
1170
1171 {
1172 {
1173 throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." );
1174 }
1175 }
1176 }
1177 }
1178
1179 return subtreeCount;
1180}
1181
1182/**
1183 * Maps children that are typically specified as `props.children`.
1184 *
1185 * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1186 *
1187 * The provided mapFunction(child, index) will be called for each
1188 * leaf child.
1189 *
1190 * @param {?*} children Children tree container.
1191 * @param {function(*, int)} func The map function.
1192 * @param {*} context Context for mapFunction.
1193 * @return {object} Object containing the ordered map of results.
1194 */
1195function mapChildren(children, func, context) {
1196 if (children == null) {
1197 return children;
1198 }
1199
1200 var result = [];
1201 var count = 0;
1202 mapIntoArray(children, result, '', '', function (child) {
1203 return func.call(context, child, count++);
1204 });
1205 return result;
1206}
1207/**
1208 * Count the number of children that are typically specified as
1209 * `props.children`.
1210 *
1211 * See https://reactjs.org/docs/react-api.html#reactchildrencount
1212 *
1213 * @param {?*} children Children tree container.
1214 * @return {number} The number of children.
1215 */
1216
1217
1218function countChildren(children) {
1219 var n = 0;
1220 mapChildren(children, function () {
1221 n++; // Don't return anything
1222 });
1223 return n;
1224}
1225
1226/**
1227 * Iterates through children that are typically specified as `props.children`.
1228 *
1229 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1230 *
1231 * The provided forEachFunc(child, index) will be called for each
1232 * leaf child.
1233 *
1234 * @param {?*} children Children tree container.
1235 * @param {function(*, int)} forEachFunc
1236 * @param {*} forEachContext Context for forEachContext.
1237 */
1238function forEachChildren(children, forEachFunc, forEachContext) {
1239 mapChildren(children, function () {
1240 forEachFunc.apply(this, arguments); // Don't return anything.
1241 }, forEachContext);
1242}
1243/**
1244 * Flatten a children object (typically specified as `props.children`) and
1245 * return an array with appropriately re-keyed children.
1246 *
1247 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1248 */
1249
1250
1251function toArray(children) {
1252 return mapChildren(children, function (child) {
1253 return child;
1254 }) || [];
1255}
1256/**
1257 * Returns the first child in a collection of children and verifies that there
1258 * is only one child in the collection.
1259 *
1260 * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1261 *
1262 * The current implementation of this function assumes that a single child gets
1263 * passed without a wrapper, but the purpose of this helper function is to
1264 * abstract away the particular structure of children.
1265 *
1266 * @param {?object} children Child collection structure.
1267 * @return {ReactElement} The first and only `ReactElement` contained in the
1268 * structure.
1269 */
1270
1271
1272function onlyChild(children) {
1273 if (!isValidElement(children)) {
1274 {
1275 throw Error( "React.Children.only expected to receive a single React element child." );
1276 }
1277 }
1278
1279 return children;
1280}
1281
1282function createContext(defaultValue, calculateChangedBits) {
1283 if (calculateChangedBits === undefined) {
1284 calculateChangedBits = null;
1285 } else {
1286 {
1287 if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
1288 error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
1289 }
1290 }
1291 }
1292
1293 var context = {
1294 $$typeof: REACT_CONTEXT_TYPE,
1295 _calculateChangedBits: calculateChangedBits,
1296 // As a workaround to support multiple concurrent renderers, we categorize
1297 // some renderers as primary and others as secondary. We only expect
1298 // there to be two concurrent renderers at most: React Native (primary) and
1299 // Fabric (secondary); React DOM (primary) and React ART (secondary).
1300 // Secondary renderers store their context values on separate fields.
1301 _currentValue: defaultValue,
1302 _currentValue2: defaultValue,
1303 // Used to track how many concurrent renderers this context currently
1304 // supports within in a single renderer. Such as parallel server rendering.
1305 _threadCount: 0,
1306 // These are circular
1307 Provider: null,
1308 Consumer: null
1309 };
1310 context.Provider = {
1311 $$typeof: REACT_PROVIDER_TYPE,
1312 _context: context
1313 };
1314 var hasWarnedAboutUsingNestedContextConsumers = false;
1315 var hasWarnedAboutUsingConsumerProvider = false;
1316 var hasWarnedAboutDisplayNameOnConsumer = false;
1317
1318 {
1319 // A separate object, but proxies back to the original context object for
1320 // backwards compatibility. It has a different $$typeof, so we can properly
1321 // warn for the incorrect usage of Context as a Consumer.
1322 var Consumer = {
1323 $$typeof: REACT_CONTEXT_TYPE,
1324 _context: context,
1325 _calculateChangedBits: context._calculateChangedBits
1326 }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1327
1328 Object.defineProperties(Consumer, {
1329 Provider: {
1330 get: function () {
1331 if (!hasWarnedAboutUsingConsumerProvider) {
1332 hasWarnedAboutUsingConsumerProvider = true;
1333
1334 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?');
1335 }
1336
1337 return context.Provider;
1338 },
1339 set: function (_Provider) {
1340 context.Provider = _Provider;
1341 }
1342 },
1343 _currentValue: {
1344 get: function () {
1345 return context._currentValue;
1346 },
1347 set: function (_currentValue) {
1348 context._currentValue = _currentValue;
1349 }
1350 },
1351 _currentValue2: {
1352 get: function () {
1353 return context._currentValue2;
1354 },
1355 set: function (_currentValue2) {
1356 context._currentValue2 = _currentValue2;
1357 }
1358 },
1359 _threadCount: {
1360 get: function () {
1361 return context._threadCount;
1362 },
1363 set: function (_threadCount) {
1364 context._threadCount = _threadCount;
1365 }
1366 },
1367 Consumer: {
1368 get: function () {
1369 if (!hasWarnedAboutUsingNestedContextConsumers) {
1370 hasWarnedAboutUsingNestedContextConsumers = true;
1371
1372 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?');
1373 }
1374
1375 return context.Consumer;
1376 }
1377 },
1378 displayName: {
1379 get: function () {
1380 return context.displayName;
1381 },
1382 set: function (displayName) {
1383 if (!hasWarnedAboutDisplayNameOnConsumer) {
1384 warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
1385
1386 hasWarnedAboutDisplayNameOnConsumer = true;
1387 }
1388 }
1389 }
1390 }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1391
1392 context.Consumer = Consumer;
1393 }
1394
1395 {
1396 context._currentRenderer = null;
1397 context._currentRenderer2 = null;
1398 }
1399
1400 return context;
1401}
1402
1403var Uninitialized = -1;
1404var Pending = 0;
1405var Resolved = 1;
1406var Rejected = 2;
1407
1408function lazyInitializer(payload) {
1409 if (payload._status === Uninitialized) {
1410 var ctor = payload._result;
1411 var thenable = ctor(); // Transition to the next state.
1412
1413 var pending = payload;
1414 pending._status = Pending;
1415 pending._result = thenable;
1416 thenable.then(function (moduleObject) {
1417 if (payload._status === Pending) {
1418 var defaultExport = moduleObject.default;
1419
1420 {
1421 if (defaultExport === undefined) {
1422 error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
1423 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
1424 }
1425 } // Transition to the next state.
1426
1427
1428 var resolved = payload;
1429 resolved._status = Resolved;
1430 resolved._result = defaultExport;
1431 }
1432 }, function (error) {
1433 if (payload._status === Pending) {
1434 // Transition to the next state.
1435 var rejected = payload;
1436 rejected._status = Rejected;
1437 rejected._result = error;
1438 }
1439 });
1440 }
1441
1442 if (payload._status === Resolved) {
1443 return payload._result;
1444 } else {
1445 throw payload._result;
1446 }
1447}
1448
1449function lazy(ctor) {
1450 var payload = {
1451 // We use these fields to store the result.
1452 _status: -1,
1453 _result: ctor
1454 };
1455 var lazyType = {
1456 $$typeof: REACT_LAZY_TYPE,
1457 _payload: payload,
1458 _init: lazyInitializer
1459 };
1460
1461 {
1462 // In production, this would just set it on the object.
1463 var defaultProps;
1464 var propTypes; // $FlowFixMe
1465
1466 Object.defineProperties(lazyType, {
1467 defaultProps: {
1468 configurable: true,
1469 get: function () {
1470 return defaultProps;
1471 },
1472 set: function (newDefaultProps) {
1473 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.');
1474
1475 defaultProps = newDefaultProps; // Match production behavior more closely:
1476 // $FlowFixMe
1477
1478 Object.defineProperty(lazyType, 'defaultProps', {
1479 enumerable: true
1480 });
1481 }
1482 },
1483 propTypes: {
1484 configurable: true,
1485 get: function () {
1486 return propTypes;
1487 },
1488 set: function (newPropTypes) {
1489 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.');
1490
1491 propTypes = newPropTypes; // Match production behavior more closely:
1492 // $FlowFixMe
1493
1494 Object.defineProperty(lazyType, 'propTypes', {
1495 enumerable: true
1496 });
1497 }
1498 }
1499 });
1500 }
1501
1502 return lazyType;
1503}
1504
1505function forwardRef(render) {
1506 {
1507 if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1508 error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1509 } else if (typeof render !== 'function') {
1510 error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1511 } else {
1512 if (render.length !== 0 && render.length !== 2) {
1513 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.');
1514 }
1515 }
1516
1517 if (render != null) {
1518 if (render.defaultProps != null || render.propTypes != null) {
1519 error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
1520 }
1521 }
1522 }
1523
1524 var elementType = {
1525 $$typeof: REACT_FORWARD_REF_TYPE,
1526 render: render
1527 };
1528
1529 {
1530 var ownName;
1531 Object.defineProperty(elementType, 'displayName', {
1532 enumerable: false,
1533 configurable: true,
1534 get: function () {
1535 return ownName;
1536 },
1537 set: function (name) {
1538 ownName = name;
1539
1540 if (render.displayName == null) {
1541 render.displayName = name;
1542 }
1543 }
1544 });
1545 }
1546
1547 return elementType;
1548}
1549
1550// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1551
1552var enableScopeAPI = false; // Experimental Create Event Handle API.
1553
1554function isValidElementType(type) {
1555 if (typeof type === 'string' || typeof type === 'function') {
1556 return true;
1557 } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1558
1559
1560 if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
1561 return true;
1562 }
1563
1564 if (typeof type === 'object' && type !== null) {
1565 if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
1566 return true;
1567 }
1568 }
1569
1570 return false;
1571}
1572
1573function memo(type, compare) {
1574 {
1575 if (!isValidElementType(type)) {
1576 error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1577 }
1578 }
1579
1580 var elementType = {
1581 $$typeof: REACT_MEMO_TYPE,
1582 type: type,
1583 compare: compare === undefined ? null : compare
1584 };
1585
1586 {
1587 var ownName;
1588 Object.defineProperty(elementType, 'displayName', {
1589 enumerable: false,
1590 configurable: true,
1591 get: function () {
1592 return ownName;
1593 },
1594 set: function (name) {
1595 ownName = name;
1596
1597 if (type.displayName == null) {
1598 type.displayName = name;
1599 }
1600 }
1601 });
1602 }
1603
1604 return elementType;
1605}
1606
1607function resolveDispatcher() {
1608 var dispatcher = ReactCurrentDispatcher.current;
1609
1610 if (!(dispatcher !== null)) {
1611 {
1612 throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
1613 }
1614 }
1615
1616 return dispatcher;
1617}
1618
1619function useContext(Context, unstable_observedBits) {
1620 var dispatcher = resolveDispatcher();
1621
1622 {
1623 if (unstable_observedBits !== undefined) {
1624 error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : '');
1625 } // TODO: add a more generic warning for invalid values.
1626
1627
1628 if (Context._context !== undefined) {
1629 var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
1630 // and nobody should be using this in existing code.
1631
1632 if (realContext.Consumer === Context) {
1633 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?');
1634 } else if (realContext.Provider === Context) {
1635 error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1636 }
1637 }
1638 }
1639
1640 return dispatcher.useContext(Context, unstable_observedBits);
1641}
1642function useState(initialState) {
1643 var dispatcher = resolveDispatcher();
1644 return dispatcher.useState(initialState);
1645}
1646function useReducer(reducer, initialArg, init) {
1647 var dispatcher = resolveDispatcher();
1648 return dispatcher.useReducer(reducer, initialArg, init);
1649}
1650function useRef(initialValue) {
1651 var dispatcher = resolveDispatcher();
1652 return dispatcher.useRef(initialValue);
1653}
1654function useEffect(create, deps) {
1655 var dispatcher = resolveDispatcher();
1656 return dispatcher.useEffect(create, deps);
1657}
1658function useLayoutEffect(create, deps) {
1659 var dispatcher = resolveDispatcher();
1660 return dispatcher.useLayoutEffect(create, deps);
1661}
1662function useCallback(callback, deps) {
1663 var dispatcher = resolveDispatcher();
1664 return dispatcher.useCallback(callback, deps);
1665}
1666function useMemo(create, deps) {
1667 var dispatcher = resolveDispatcher();
1668 return dispatcher.useMemo(create, deps);
1669}
1670function useImperativeHandle(ref, create, deps) {
1671 var dispatcher = resolveDispatcher();
1672 return dispatcher.useImperativeHandle(ref, create, deps);
1673}
1674function useDebugValue(value, formatterFn) {
1675 {
1676 var dispatcher = resolveDispatcher();
1677 return dispatcher.useDebugValue(value, formatterFn);
1678 }
1679}
1680
1681// Helpers to patch console.logs to avoid logging during side-effect free
1682// replaying on render function. This currently only patches the object
1683// lazily which won't cover if the log function was extracted eagerly.
1684// We could also eagerly patch the method.
1685var disabledDepth = 0;
1686var prevLog;
1687var prevInfo;
1688var prevWarn;
1689var prevError;
1690var prevGroup;
1691var prevGroupCollapsed;
1692var prevGroupEnd;
1693
1694function disabledLog() {}
1695
1696disabledLog.__reactDisabledLog = true;
1697function disableLogs() {
1698 {
1699 if (disabledDepth === 0) {
1700 /* eslint-disable react-internal/no-production-logging */
1701 prevLog = console.log;
1702 prevInfo = console.info;
1703 prevWarn = console.warn;
1704 prevError = console.error;
1705 prevGroup = console.group;
1706 prevGroupCollapsed = console.groupCollapsed;
1707 prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
1708
1709 var props = {
1710 configurable: true,
1711 enumerable: true,
1712 value: disabledLog,
1713 writable: true
1714 }; // $FlowFixMe Flow thinks console is immutable.
1715
1716 Object.defineProperties(console, {
1717 info: props,
1718 log: props,
1719 warn: props,
1720 error: props,
1721 group: props,
1722 groupCollapsed: props,
1723 groupEnd: props
1724 });
1725 /* eslint-enable react-internal/no-production-logging */
1726 }
1727
1728 disabledDepth++;
1729 }
1730}
1731function reenableLogs() {
1732 {
1733 disabledDepth--;
1734
1735 if (disabledDepth === 0) {
1736 /* eslint-disable react-internal/no-production-logging */
1737 var props = {
1738 configurable: true,
1739 enumerable: true,
1740 writable: true
1741 }; // $FlowFixMe Flow thinks console is immutable.
1742
1743 Object.defineProperties(console, {
1744 log: _assign({}, props, {
1745 value: prevLog
1746 }),
1747 info: _assign({}, props, {
1748 value: prevInfo
1749 }),
1750 warn: _assign({}, props, {
1751 value: prevWarn
1752 }),
1753 error: _assign({}, props, {
1754 value: prevError
1755 }),
1756 group: _assign({}, props, {
1757 value: prevGroup
1758 }),
1759 groupCollapsed: _assign({}, props, {
1760 value: prevGroupCollapsed
1761 }),
1762 groupEnd: _assign({}, props, {
1763 value: prevGroupEnd
1764 })
1765 });
1766 /* eslint-enable react-internal/no-production-logging */
1767 }
1768
1769 if (disabledDepth < 0) {
1770 error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
1771 }
1772 }
1773}
1774
1775var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1776var prefix;
1777function describeBuiltInComponentFrame(name, source, ownerFn) {
1778 {
1779 if (prefix === undefined) {
1780 // Extract the VM specific prefix used by each line.
1781 try {
1782 throw Error();
1783 } catch (x) {
1784 var match = x.stack.trim().match(/\n( *(at )?)/);
1785 prefix = match && match[1] || '';
1786 }
1787 } // We use the prefix to ensure our stacks line up with native stack frames.
1788
1789
1790 return '\n' + prefix + name;
1791 }
1792}
1793var reentry = false;
1794var componentFrameCache;
1795
1796{
1797 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
1798 componentFrameCache = new PossiblyWeakMap();
1799}
1800
1801function describeNativeComponentFrame(fn, construct) {
1802 // If something asked for a stack inside a fake render, it should get ignored.
1803 if (!fn || reentry) {
1804 return '';
1805 }
1806
1807 {
1808 var frame = componentFrameCache.get(fn);
1809
1810 if (frame !== undefined) {
1811 return frame;
1812 }
1813 }
1814
1815 var control;
1816 reentry = true;
1817 var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
1818
1819 Error.prepareStackTrace = undefined;
1820 var previousDispatcher;
1821
1822 {
1823 previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
1824 // for warnings.
1825
1826 ReactCurrentDispatcher$1.current = null;
1827 disableLogs();
1828 }
1829
1830 try {
1831 // This should throw.
1832 if (construct) {
1833 // Something should be setting the props in the constructor.
1834 var Fake = function () {
1835 throw Error();
1836 }; // $FlowFixMe
1837
1838
1839 Object.defineProperty(Fake.prototype, 'props', {
1840 set: function () {
1841 // We use a throwing setter instead of frozen or non-writable props
1842 // because that won't throw in a non-strict mode function.
1843 throw Error();
1844 }
1845 });
1846
1847 if (typeof Reflect === 'object' && Reflect.construct) {
1848 // We construct a different control for this case to include any extra
1849 // frames added by the construct call.
1850 try {
1851 Reflect.construct(Fake, []);
1852 } catch (x) {
1853 control = x;
1854 }
1855
1856 Reflect.construct(fn, [], Fake);
1857 } else {
1858 try {
1859 Fake.call();
1860 } catch (x) {
1861 control = x;
1862 }
1863
1864 fn.call(Fake.prototype);
1865 }
1866 } else {
1867 try {
1868 throw Error();
1869 } catch (x) {
1870 control = x;
1871 }
1872
1873 fn();
1874 }
1875 } catch (sample) {
1876 // This is inlined manually because closure doesn't do it for us.
1877 if (sample && control && typeof sample.stack === 'string') {
1878 // This extracts the first frame from the sample that isn't also in the control.
1879 // Skipping one frame that we assume is the frame that calls the two.
1880 var sampleLines = sample.stack.split('\n');
1881 var controlLines = control.stack.split('\n');
1882 var s = sampleLines.length - 1;
1883 var c = controlLines.length - 1;
1884
1885 while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
1886 // We expect at least one stack frame to be shared.
1887 // Typically this will be the root most one. However, stack frames may be
1888 // cut off due to maximum stack limits. In this case, one maybe cut off
1889 // earlier than the other. We assume that the sample is longer or the same
1890 // and there for cut off earlier. So we should find the root most frame in
1891 // the sample somewhere in the control.
1892 c--;
1893 }
1894
1895 for (; s >= 1 && c >= 0; s--, c--) {
1896 // Next we find the first one that isn't the same which should be the
1897 // frame that called our sample function and the control.
1898 if (sampleLines[s] !== controlLines[c]) {
1899 // In V8, the first line is describing the message but other VMs don't.
1900 // If we're about to return the first line, and the control is also on the same
1901 // line, that's a pretty good indicator that our sample threw at same line as
1902 // the control. I.e. before we entered the sample frame. So we ignore this result.
1903 // This can happen if you passed a class to function component, or non-function.
1904 if (s !== 1 || c !== 1) {
1905 do {
1906 s--;
1907 c--; // We may still have similar intermediate frames from the construct call.
1908 // The next one that isn't the same should be our match though.
1909
1910 if (c < 0 || sampleLines[s] !== controlLines[c]) {
1911 // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
1912 var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
1913
1914 {
1915 if (typeof fn === 'function') {
1916 componentFrameCache.set(fn, _frame);
1917 }
1918 } // Return the line we found.
1919
1920
1921 return _frame;
1922 }
1923 } while (s >= 1 && c >= 0);
1924 }
1925
1926 break;
1927 }
1928 }
1929 }
1930 } finally {
1931 reentry = false;
1932
1933 {
1934 ReactCurrentDispatcher$1.current = previousDispatcher;
1935 reenableLogs();
1936 }
1937
1938 Error.prepareStackTrace = previousPrepareStackTrace;
1939 } // Fallback to just using the name if we couldn't make it throw.
1940
1941
1942 var name = fn ? fn.displayName || fn.name : '';
1943 var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
1944
1945 {
1946 if (typeof fn === 'function') {
1947 componentFrameCache.set(fn, syntheticFrame);
1948 }
1949 }
1950
1951 return syntheticFrame;
1952}
1953function describeFunctionComponentFrame(fn, source, ownerFn) {
1954 {
1955 return describeNativeComponentFrame(fn, false);
1956 }
1957}
1958
1959function shouldConstruct(Component) {
1960 var prototype = Component.prototype;
1961 return !!(prototype && prototype.isReactComponent);
1962}
1963
1964function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
1965
1966 if (type == null) {
1967 return '';
1968 }
1969
1970 if (typeof type === 'function') {
1971 {
1972 return describeNativeComponentFrame(type, shouldConstruct(type));
1973 }
1974 }
1975
1976 if (typeof type === 'string') {
1977 return describeBuiltInComponentFrame(type);
1978 }
1979
1980 switch (type) {
1981 case exports.Suspense:
1982 return describeBuiltInComponentFrame('Suspense');
1983
1984 case REACT_SUSPENSE_LIST_TYPE:
1985 return describeBuiltInComponentFrame('SuspenseList');
1986 }
1987
1988 if (typeof type === 'object') {
1989 switch (type.$$typeof) {
1990 case REACT_FORWARD_REF_TYPE:
1991 return describeFunctionComponentFrame(type.render);
1992
1993 case REACT_MEMO_TYPE:
1994 // Memo may contain any component type so we recursively resolve it.
1995 return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
1996
1997 case REACT_BLOCK_TYPE:
1998 return describeFunctionComponentFrame(type._render);
1999
2000 case REACT_LAZY_TYPE:
2001 {
2002 var lazyComponent = type;
2003 var payload = lazyComponent._payload;
2004 var init = lazyComponent._init;
2005
2006 try {
2007 // Lazy may contain any component type so we recursively resolve it.
2008 return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
2009 } catch (x) {}
2010 }
2011 }
2012 }
2013
2014 return '';
2015}
2016
2017var loggedTypeFailures = {};
2018var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
2019
2020function setCurrentlyValidatingElement(element) {
2021 {
2022 if (element) {
2023 var owner = element._owner;
2024 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2025 ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
2026 } else {
2027 ReactDebugCurrentFrame$1.setExtraStackFrame(null);
2028 }
2029 }
2030}
2031
2032function checkPropTypes(typeSpecs, values, location, componentName, element) {
2033 {
2034 // $FlowFixMe This is okay but Flow doesn't know it.
2035 var has = Function.call.bind(Object.prototype.hasOwnProperty);
2036
2037 for (var typeSpecName in typeSpecs) {
2038 if (has(typeSpecs, typeSpecName)) {
2039 var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
2040 // fail the render phase where it didn't fail before. So we log it.
2041 // After these have been cleaned up, we'll let them throw.
2042
2043 try {
2044 // This is intentionally an invariant that gets caught. It's the same
2045 // behavior as without this statement except with a better message.
2046 if (typeof typeSpecs[typeSpecName] !== 'function') {
2047 var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
2048 err.name = 'Invariant Violation';
2049 throw err;
2050 }
2051
2052 error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
2053 } catch (ex) {
2054 error$1 = ex;
2055 }
2056
2057 if (error$1 && !(error$1 instanceof Error)) {
2058 setCurrentlyValidatingElement(element);
2059
2060 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);
2061
2062 setCurrentlyValidatingElement(null);
2063 }
2064
2065 if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
2066 // Only monitor this failure once because there tends to be a lot of the
2067 // same error.
2068 loggedTypeFailures[error$1.message] = true;
2069 setCurrentlyValidatingElement(element);
2070
2071 error('Failed %s type: %s', location, error$1.message);
2072
2073 setCurrentlyValidatingElement(null);
2074 }
2075 }
2076 }
2077 }
2078}
2079
2080function setCurrentlyValidatingElement$1(element) {
2081 {
2082 if (element) {
2083 var owner = element._owner;
2084 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2085 setExtraStackFrame(stack);
2086 } else {
2087 setExtraStackFrame(null);
2088 }
2089 }
2090}
2091
2092var propTypesMisspellWarningShown;
2093
2094{
2095 propTypesMisspellWarningShown = false;
2096}
2097
2098function getDeclarationErrorAddendum() {
2099 if (ReactCurrentOwner.current) {
2100 var name = getComponentName(ReactCurrentOwner.current.type);
2101
2102 if (name) {
2103 return '\n\nCheck the render method of `' + name + '`.';
2104 }
2105 }
2106
2107 return '';
2108}
2109
2110function getSourceInfoErrorAddendum(source) {
2111 if (source !== undefined) {
2112 var fileName = source.fileName.replace(/^.*[\\\/]/, '');
2113 var lineNumber = source.lineNumber;
2114 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
2115 }
2116
2117 return '';
2118}
2119
2120function getSourceInfoErrorAddendumForProps(elementProps) {
2121 if (elementProps !== null && elementProps !== undefined) {
2122 return getSourceInfoErrorAddendum(elementProps.__source);
2123 }
2124
2125 return '';
2126}
2127/**
2128 * Warn if there's no key explicitly set on dynamic arrays of children or
2129 * object keys are not valid. This allows us to keep track of children between
2130 * updates.
2131 */
2132
2133
2134var ownerHasKeyUseWarning = {};
2135
2136function getCurrentComponentErrorInfo(parentType) {
2137 var info = getDeclarationErrorAddendum();
2138
2139 if (!info) {
2140 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
2141
2142 if (parentName) {
2143 info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2144 }
2145 }
2146
2147 return info;
2148}
2149/**
2150 * Warn if the element doesn't have an explicit key assigned to it.
2151 * This element is in an array. The array could grow and shrink or be
2152 * reordered. All children that haven't already been validated are required to
2153 * have a "key" property assigned to it. Error statuses are cached so a warning
2154 * will only be shown once.
2155 *
2156 * @internal
2157 * @param {ReactElement} element Element that requires a key.
2158 * @param {*} parentType element's parent's type.
2159 */
2160
2161
2162function validateExplicitKey(element, parentType) {
2163 if (!element._store || element._store.validated || element.key != null) {
2164 return;
2165 }
2166
2167 element._store.validated = true;
2168 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2169
2170 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2171 return;
2172 }
2173
2174 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2175 // property, it may be the creator of the child that's responsible for
2176 // assigning it a key.
2177
2178 var childOwner = '';
2179
2180 if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2181 // Give the component that originally created this child.
2182 childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
2183 }
2184
2185 {
2186 setCurrentlyValidatingElement$1(element);
2187
2188 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);
2189
2190 setCurrentlyValidatingElement$1(null);
2191 }
2192}
2193/**
2194 * Ensure that every element either is passed in a static location, in an
2195 * array with an explicit keys property defined, or in an object literal
2196 * with valid key property.
2197 *
2198 * @internal
2199 * @param {ReactNode} node Statically passed child of any type.
2200 * @param {*} parentType node's parent's type.
2201 */
2202
2203
2204function validateChildKeys(node, parentType) {
2205 if (typeof node !== 'object') {
2206 return;
2207 }
2208
2209 if (Array.isArray(node)) {
2210 for (var i = 0; i < node.length; i++) {
2211 var child = node[i];
2212
2213 if (isValidElement(child)) {
2214 validateExplicitKey(child, parentType);
2215 }
2216 }
2217 } else if (isValidElement(node)) {
2218 // This element was passed in a valid location.
2219 if (node._store) {
2220 node._store.validated = true;
2221 }
2222 } else if (node) {
2223 var iteratorFn = getIteratorFn(node);
2224
2225 if (typeof iteratorFn === 'function') {
2226 // Entry iterators used to provide implicit keys,
2227 // but now we print a separate warning for them later.
2228 if (iteratorFn !== node.entries) {
2229 var iterator = iteratorFn.call(node);
2230 var step;
2231
2232 while (!(step = iterator.next()).done) {
2233 if (isValidElement(step.value)) {
2234 validateExplicitKey(step.value, parentType);
2235 }
2236 }
2237 }
2238 }
2239 }
2240}
2241/**
2242 * Given an element, validate that its props follow the propTypes definition,
2243 * provided by the type.
2244 *
2245 * @param {ReactElement} element
2246 */
2247
2248
2249function validatePropTypes(element) {
2250 {
2251 var type = element.type;
2252
2253 if (type === null || type === undefined || typeof type === 'string') {
2254 return;
2255 }
2256
2257 var propTypes;
2258
2259 if (typeof type === 'function') {
2260 propTypes = type.propTypes;
2261 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2262 // Inner props are checked in the reconciler.
2263 type.$$typeof === REACT_MEMO_TYPE)) {
2264 propTypes = type.propTypes;
2265 } else {
2266 return;
2267 }
2268
2269 if (propTypes) {
2270 // Intentionally inside to avoid triggering lazy initializers:
2271 var name = getComponentName(type);
2272 checkPropTypes(propTypes, element.props, 'prop', name, element);
2273 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2274 propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2275
2276 var _name = getComponentName(type);
2277
2278 error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2279 }
2280
2281 if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2282 error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2283 }
2284 }
2285}
2286/**
2287 * Given a fragment, validate that it can only be provided with fragment props
2288 * @param {ReactElement} fragment
2289 */
2290
2291
2292function validateFragmentProps(fragment) {
2293 {
2294 var keys = Object.keys(fragment.props);
2295
2296 for (var i = 0; i < keys.length; i++) {
2297 var key = keys[i];
2298
2299 if (key !== 'children' && key !== 'key') {
2300 setCurrentlyValidatingElement$1(fragment);
2301
2302 error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2303
2304 setCurrentlyValidatingElement$1(null);
2305 break;
2306 }
2307 }
2308
2309 if (fragment.ref !== null) {
2310 setCurrentlyValidatingElement$1(fragment);
2311
2312 error('Invalid attribute `ref` supplied to `React.Fragment`.');
2313
2314 setCurrentlyValidatingElement$1(null);
2315 }
2316 }
2317}
2318function createElementWithValidation(type, props, children) {
2319 var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2320 // succeed and there will likely be errors in render.
2321
2322 if (!validType) {
2323 var info = '';
2324
2325 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2326 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.";
2327 }
2328
2329 var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2330
2331 if (sourceInfo) {
2332 info += sourceInfo;
2333 } else {
2334 info += getDeclarationErrorAddendum();
2335 }
2336
2337 var typeString;
2338
2339 if (type === null) {
2340 typeString = 'null';
2341 } else if (Array.isArray(type)) {
2342 typeString = 'array';
2343 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2344 typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
2345 info = ' Did you accidentally export a JSX literal instead of a component?';
2346 } else {
2347 typeString = typeof type;
2348 }
2349
2350 {
2351 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);
2352 }
2353 }
2354
2355 var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
2356 // TODO: Drop this when these are no longer allowed as the type argument.
2357
2358 if (element == null) {
2359 return element;
2360 } // Skip key warning if the type isn't valid since our key validation logic
2361 // doesn't expect a non-string/function type and can throw confusing errors.
2362 // We don't want exception behavior to differ between dev and prod.
2363 // (Rendering will throw with a helpful message and as soon as the type is
2364 // fixed, the key warnings will appear.)
2365
2366
2367 if (validType) {
2368 for (var i = 2; i < arguments.length; i++) {
2369 validateChildKeys(arguments[i], type);
2370 }
2371 }
2372
2373 if (type === exports.Fragment) {
2374 validateFragmentProps(element);
2375 } else {
2376 validatePropTypes(element);
2377 }
2378
2379 return element;
2380}
2381var didWarnAboutDeprecatedCreateFactory = false;
2382function createFactoryWithValidation(type) {
2383 var validatedFactory = createElementWithValidation.bind(null, type);
2384 validatedFactory.type = type;
2385
2386 {
2387 if (!didWarnAboutDeprecatedCreateFactory) {
2388 didWarnAboutDeprecatedCreateFactory = true;
2389
2390 warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
2391 } // Legacy hook: remove it
2392
2393
2394 Object.defineProperty(validatedFactory, 'type', {
2395 enumerable: false,
2396 get: function () {
2397 warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2398
2399 Object.defineProperty(this, 'type', {
2400 value: type
2401 });
2402 return type;
2403 }
2404 });
2405 }
2406
2407 return validatedFactory;
2408}
2409function cloneElementWithValidation(element, props, children) {
2410 var newElement = cloneElement.apply(this, arguments);
2411
2412 for (var i = 2; i < arguments.length; i++) {
2413 validateChildKeys(arguments[i], newElement.type);
2414 }
2415
2416 validatePropTypes(newElement);
2417 return newElement;
2418}
2419
2420{
2421
2422 try {
2423 var frozenObject = Object.freeze({});
2424 /* eslint-disable no-new */
2425
2426 new Map([[frozenObject, null]]);
2427 new Set([frozenObject]);
2428 /* eslint-enable no-new */
2429 } catch (e) {
2430 }
2431}
2432
2433var createElement$1 = createElementWithValidation ;
2434var cloneElement$1 = cloneElementWithValidation ;
2435var createFactory = createFactoryWithValidation ;
2436var Children = {
2437 map: mapChildren,
2438 forEach: forEachChildren,
2439 count: countChildren,
2440 toArray: toArray,
2441 only: onlyChild
2442};
2443
2444exports.Children = Children;
2445exports.Component = Component;
2446exports.PureComponent = PureComponent;
2447exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2448exports.cloneElement = cloneElement$1;
2449exports.createContext = createContext;
2450exports.createElement = createElement$1;
2451exports.createFactory = createFactory;
2452exports.createRef = createRef;
2453exports.forwardRef = forwardRef;
2454exports.isValidElement = isValidElement;
2455exports.lazy = lazy;
2456exports.memo = memo;
2457exports.useCallback = useCallback;
2458exports.useContext = useContext;
2459exports.useDebugValue = useDebugValue;
2460exports.useEffect = useEffect;
2461exports.useImperativeHandle = useImperativeHandle;
2462exports.useLayoutEffect = useLayoutEffect;
2463exports.useMemo = useMemo;
2464exports.useReducer = useReducer;
2465exports.useRef = useRef;
2466exports.useState = useState;
2467exports.version = ReactVersion;
2468 })();
2469}
2470});
2471react_development.Fragment;
2472react_development.StrictMode;
2473react_development.Profiler;
2474react_development.Suspense;
2475react_development.Children;
2476react_development.Component;
2477react_development.PureComponent;
2478react_development.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2479react_development.cloneElement;
2480react_development.createContext;
2481react_development.createElement;
2482react_development.createFactory;
2483react_development.createRef;
2484react_development.forwardRef;
2485react_development.isValidElement;
2486react_development.lazy;
2487react_development.memo;
2488react_development.useCallback;
2489react_development.useContext;
2490react_development.useDebugValue;
2491react_development.useEffect;
2492react_development.useImperativeHandle;
2493react_development.useLayoutEffect;
2494react_development.useMemo;
2495react_development.useReducer;
2496react_development.useRef;
2497react_development.useState;
2498react_development.version;
2499
2500var react = createCommonjsModule(function (module) {
2501
2502if (process.env.NODE_ENV === 'production') {
2503 module.exports = react_production_min;
2504} else {
2505 module.exports = react_development;
2506}
2507});
2508
2509/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
2510var devtools = {
2511 version: react.version
2512};
2513
2514try {
2515 require.resolve('react-devtools-core');
2516
2517 const defineProperty = Object.defineProperty;
2518 defineProperty(commonjsGlobal, 'WebSocket', {
2519 value: require('ws')
2520 });
2521 defineProperty(commonjsGlobal, 'window', {
2522 value: commonjsGlobal
2523 });
2524
2525 const {
2526 connectToDevTools
2527 } = require('react-devtools-core');
2528
2529 connectToDevTools({
2530 isAppActive() {
2531 // Don't steal the DevTools from currently active app.
2532 return true;
2533 },
2534
2535 host: 'localhost',
2536 port: 8097,
2537 resolveRNStyle: null // TODO maybe: require('flattenStyle')
2538
2539 });
2540} catch (err) {// no devtools installed...
2541}
2542
2543function _defineProperty(obj, key, value) {
2544 if (key in obj) {
2545 Object.defineProperty(obj, key, {
2546 value: value,
2547 enumerable: true,
2548 configurable: true,
2549 writable: true
2550 });
2551 } else {
2552 obj[key] = value;
2553 }
2554
2555 return obj;
2556}
2557
2558function ownKeys(object, enumerableOnly) {
2559 var keys = Object.keys(object);
2560
2561 if (Object.getOwnPropertySymbols) {
2562 var symbols = Object.getOwnPropertySymbols(object);
2563 if (enumerableOnly) symbols = symbols.filter(function (sym) {
2564 return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2565 });
2566 keys.push.apply(keys, symbols);
2567 }
2568
2569 return keys;
2570}
2571
2572function _objectSpread2(target) {
2573 for (var i = 1; i < arguments.length; i++) {
2574 var source = arguments[i] != null ? arguments[i] : {};
2575
2576 if (i % 2) {
2577 ownKeys(Object(source), true).forEach(function (key) {
2578 _defineProperty(target, key, source[key]);
2579 });
2580 } else if (Object.getOwnPropertyDescriptors) {
2581 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2582 } else {
2583 ownKeys(Object(source)).forEach(function (key) {
2584 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2585 });
2586 }
2587 }
2588
2589 return target;
2590}
2591
2592function _objectWithoutPropertiesLoose(source, excluded) {
2593 if (source == null) return {};
2594 var target = {};
2595 var sourceKeys = Object.keys(source);
2596 var key, i;
2597
2598 for (i = 0; i < sourceKeys.length; i++) {
2599 key = sourceKeys[i];
2600 if (excluded.indexOf(key) >= 0) continue;
2601 target[key] = source[key];
2602 }
2603
2604 return target;
2605}
2606
2607function _objectWithoutProperties(source, excluded) {
2608 if (source == null) return {};
2609
2610 var target = _objectWithoutPropertiesLoose(source, excluded);
2611
2612 var key, i;
2613
2614 if (Object.getOwnPropertySymbols) {
2615 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2616
2617 for (i = 0; i < sourceSymbolKeys.length; i++) {
2618 key = sourceSymbolKeys[i];
2619 if (excluded.indexOf(key) >= 0) continue;
2620 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2621 target[key] = source[key];
2622 }
2623 }
2624
2625 return target;
2626}
2627
2628const startCase = string => string.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match) {
2629 return +match === 0 ? '' : match.toUpperCase();
2630}).replace(/[^A-Za-z0-9 ]+/, '');
2631
2632const eventName = event => `on${startCase(event)}`;
2633
2634const eventListener = (node, event, ...args) => {
2635 if (node._updating) return;
2636 const handler = node.props[eventName(event)];
2637 /*
2638 if (blacklist.indexOf(event) === -1) {
2639 if (handler) {
2640 console.log(event, ': ', startCase(event).replace(/ /g, ''));
2641 }
2642 }
2643 */
2644
2645 if (typeof handler === 'function') {
2646 if (event === 'focus' || event === 'blur') {
2647 args[0] = node;
2648 }
2649
2650 handler(...args);
2651 }
2652};
2653
2654/**
2655 * Removes all key-value entries from the list cache.
2656 *
2657 * @private
2658 * @name clear
2659 * @memberOf ListCache
2660 */
2661function listCacheClear() {
2662 this.__data__ = [];
2663 this.size = 0;
2664}
2665
2666var _listCacheClear = listCacheClear;
2667
2668/**
2669 * Performs a
2670 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2671 * comparison between two values to determine if they are equivalent.
2672 *
2673 * @static
2674 * @memberOf _
2675 * @since 4.0.0
2676 * @category Lang
2677 * @param {*} value The value to compare.
2678 * @param {*} other The other value to compare.
2679 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2680 * @example
2681 *
2682 * var object = { 'a': 1 };
2683 * var other = { 'a': 1 };
2684 *
2685 * _.eq(object, object);
2686 * // => true
2687 *
2688 * _.eq(object, other);
2689 * // => false
2690 *
2691 * _.eq('a', 'a');
2692 * // => true
2693 *
2694 * _.eq('a', Object('a'));
2695 * // => false
2696 *
2697 * _.eq(NaN, NaN);
2698 * // => true
2699 */
2700function eq(value, other) {
2701 return value === other || (value !== value && other !== other);
2702}
2703
2704var eq_1 = eq;
2705
2706/**
2707 * Gets the index at which the `key` is found in `array` of key-value pairs.
2708 *
2709 * @private
2710 * @param {Array} array The array to inspect.
2711 * @param {*} key The key to search for.
2712 * @returns {number} Returns the index of the matched value, else `-1`.
2713 */
2714function assocIndexOf(array, key) {
2715 var length = array.length;
2716 while (length--) {
2717 if (eq_1(array[length][0], key)) {
2718 return length;
2719 }
2720 }
2721 return -1;
2722}
2723
2724var _assocIndexOf = assocIndexOf;
2725
2726/** Used for built-in method references. */
2727var arrayProto = Array.prototype;
2728
2729/** Built-in value references. */
2730var splice = arrayProto.splice;
2731
2732/**
2733 * Removes `key` and its value from the list cache.
2734 *
2735 * @private
2736 * @name delete
2737 * @memberOf ListCache
2738 * @param {string} key The key of the value to remove.
2739 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2740 */
2741function listCacheDelete(key) {
2742 var data = this.__data__,
2743 index = _assocIndexOf(data, key);
2744
2745 if (index < 0) {
2746 return false;
2747 }
2748 var lastIndex = data.length - 1;
2749 if (index == lastIndex) {
2750 data.pop();
2751 } else {
2752 splice.call(data, index, 1);
2753 }
2754 --this.size;
2755 return true;
2756}
2757
2758var _listCacheDelete = listCacheDelete;
2759
2760/**
2761 * Gets the list cache value for `key`.
2762 *
2763 * @private
2764 * @name get
2765 * @memberOf ListCache
2766 * @param {string} key The key of the value to get.
2767 * @returns {*} Returns the entry value.
2768 */
2769function listCacheGet(key) {
2770 var data = this.__data__,
2771 index = _assocIndexOf(data, key);
2772
2773 return index < 0 ? undefined : data[index][1];
2774}
2775
2776var _listCacheGet = listCacheGet;
2777
2778/**
2779 * Checks if a list cache value for `key` exists.
2780 *
2781 * @private
2782 * @name has
2783 * @memberOf ListCache
2784 * @param {string} key The key of the entry to check.
2785 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2786 */
2787function listCacheHas(key) {
2788 return _assocIndexOf(this.__data__, key) > -1;
2789}
2790
2791var _listCacheHas = listCacheHas;
2792
2793/**
2794 * Sets the list cache `key` to `value`.
2795 *
2796 * @private
2797 * @name set
2798 * @memberOf ListCache
2799 * @param {string} key The key of the value to set.
2800 * @param {*} value The value to set.
2801 * @returns {Object} Returns the list cache instance.
2802 */
2803function listCacheSet(key, value) {
2804 var data = this.__data__,
2805 index = _assocIndexOf(data, key);
2806
2807 if (index < 0) {
2808 ++this.size;
2809 data.push([key, value]);
2810 } else {
2811 data[index][1] = value;
2812 }
2813 return this;
2814}
2815
2816var _listCacheSet = listCacheSet;
2817
2818/**
2819 * Creates an list cache object.
2820 *
2821 * @private
2822 * @constructor
2823 * @param {Array} [entries] The key-value pairs to cache.
2824 */
2825function ListCache(entries) {
2826 var index = -1,
2827 length = entries == null ? 0 : entries.length;
2828
2829 this.clear();
2830 while (++index < length) {
2831 var entry = entries[index];
2832 this.set(entry[0], entry[1]);
2833 }
2834}
2835
2836// Add methods to `ListCache`.
2837ListCache.prototype.clear = _listCacheClear;
2838ListCache.prototype['delete'] = _listCacheDelete;
2839ListCache.prototype.get = _listCacheGet;
2840ListCache.prototype.has = _listCacheHas;
2841ListCache.prototype.set = _listCacheSet;
2842
2843var _ListCache = ListCache;
2844
2845/**
2846 * Removes all key-value entries from the stack.
2847 *
2848 * @private
2849 * @name clear
2850 * @memberOf Stack
2851 */
2852function stackClear() {
2853 this.__data__ = new _ListCache;
2854 this.size = 0;
2855}
2856
2857var _stackClear = stackClear;
2858
2859/**
2860 * Removes `key` and its value from the stack.
2861 *
2862 * @private
2863 * @name delete
2864 * @memberOf Stack
2865 * @param {string} key The key of the value to remove.
2866 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2867 */
2868function stackDelete(key) {
2869 var data = this.__data__,
2870 result = data['delete'](key);
2871
2872 this.size = data.size;
2873 return result;
2874}
2875
2876var _stackDelete = stackDelete;
2877
2878/**
2879 * Gets the stack value for `key`.
2880 *
2881 * @private
2882 * @name get
2883 * @memberOf Stack
2884 * @param {string} key The key of the value to get.
2885 * @returns {*} Returns the entry value.
2886 */
2887function stackGet(key) {
2888 return this.__data__.get(key);
2889}
2890
2891var _stackGet = stackGet;
2892
2893/**
2894 * Checks if a stack value for `key` exists.
2895 *
2896 * @private
2897 * @name has
2898 * @memberOf Stack
2899 * @param {string} key The key of the entry to check.
2900 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2901 */
2902function stackHas(key) {
2903 return this.__data__.has(key);
2904}
2905
2906var _stackHas = stackHas;
2907
2908/** Detect free variable `global` from Node.js. */
2909var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
2910
2911var _freeGlobal = freeGlobal;
2912
2913/** Detect free variable `self`. */
2914var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
2915
2916/** Used as a reference to the global object. */
2917var root = _freeGlobal || freeSelf || Function('return this')();
2918
2919var _root = root;
2920
2921/** Built-in value references. */
2922var Symbol$1 = _root.Symbol;
2923
2924var _Symbol = Symbol$1;
2925
2926/** Used for built-in method references. */
2927var objectProto = Object.prototype;
2928
2929/** Used to check objects for own properties. */
2930var hasOwnProperty$1 = objectProto.hasOwnProperty;
2931
2932/**
2933 * Used to resolve the
2934 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
2935 * of values.
2936 */
2937var nativeObjectToString = objectProto.toString;
2938
2939/** Built-in value references. */
2940var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
2941
2942/**
2943 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
2944 *
2945 * @private
2946 * @param {*} value The value to query.
2947 * @returns {string} Returns the raw `toStringTag`.
2948 */
2949function getRawTag(value) {
2950 var isOwn = hasOwnProperty$1.call(value, symToStringTag),
2951 tag = value[symToStringTag];
2952
2953 try {
2954 value[symToStringTag] = undefined;
2955 var unmasked = true;
2956 } catch (e) {}
2957
2958 var result = nativeObjectToString.call(value);
2959 if (unmasked) {
2960 if (isOwn) {
2961 value[symToStringTag] = tag;
2962 } else {
2963 delete value[symToStringTag];
2964 }
2965 }
2966 return result;
2967}
2968
2969var _getRawTag = getRawTag;
2970
2971/** Used for built-in method references. */
2972var objectProto$1 = Object.prototype;
2973
2974/**
2975 * Used to resolve the
2976 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
2977 * of values.
2978 */
2979var nativeObjectToString$1 = objectProto$1.toString;
2980
2981/**
2982 * Converts `value` to a string using `Object.prototype.toString`.
2983 *
2984 * @private
2985 * @param {*} value The value to convert.
2986 * @returns {string} Returns the converted string.
2987 */
2988function objectToString(value) {
2989 return nativeObjectToString$1.call(value);
2990}
2991
2992var _objectToString = objectToString;
2993
2994/** `Object#toString` result references. */
2995var nullTag = '[object Null]',
2996 undefinedTag = '[object Undefined]';
2997
2998/** Built-in value references. */
2999var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
3000
3001/**
3002 * The base implementation of `getTag` without fallbacks for buggy environments.
3003 *
3004 * @private
3005 * @param {*} value The value to query.
3006 * @returns {string} Returns the `toStringTag`.
3007 */
3008function baseGetTag(value) {
3009 if (value == null) {
3010 return value === undefined ? undefinedTag : nullTag;
3011 }
3012 return (symToStringTag$1 && symToStringTag$1 in Object(value))
3013 ? _getRawTag(value)
3014 : _objectToString(value);
3015}
3016
3017var _baseGetTag = baseGetTag;
3018
3019/**
3020 * Checks if `value` is the
3021 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
3022 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
3023 *
3024 * @static
3025 * @memberOf _
3026 * @since 0.1.0
3027 * @category Lang
3028 * @param {*} value The value to check.
3029 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
3030 * @example
3031 *
3032 * _.isObject({});
3033 * // => true
3034 *
3035 * _.isObject([1, 2, 3]);
3036 * // => true
3037 *
3038 * _.isObject(_.noop);
3039 * // => true
3040 *
3041 * _.isObject(null);
3042 * // => false
3043 */
3044function isObject(value) {
3045 var type = typeof value;
3046 return value != null && (type == 'object' || type == 'function');
3047}
3048
3049var isObject_1 = isObject;
3050
3051/** `Object#toString` result references. */
3052var asyncTag = '[object AsyncFunction]',
3053 funcTag = '[object Function]',
3054 genTag = '[object GeneratorFunction]',
3055 proxyTag = '[object Proxy]';
3056
3057/**
3058 * Checks if `value` is classified as a `Function` object.
3059 *
3060 * @static
3061 * @memberOf _
3062 * @since 0.1.0
3063 * @category Lang
3064 * @param {*} value The value to check.
3065 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
3066 * @example
3067 *
3068 * _.isFunction(_);
3069 * // => true
3070 *
3071 * _.isFunction(/abc/);
3072 * // => false
3073 */
3074function isFunction(value) {
3075 if (!isObject_1(value)) {
3076 return false;
3077 }
3078 // The use of `Object#toString` avoids issues with the `typeof` operator
3079 // in Safari 9 which returns 'object' for typed arrays and other constructors.
3080 var tag = _baseGetTag(value);
3081 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
3082}
3083
3084var isFunction_1 = isFunction;
3085
3086/** Used to detect overreaching core-js shims. */
3087var coreJsData = _root['__core-js_shared__'];
3088
3089var _coreJsData = coreJsData;
3090
3091/** Used to detect methods masquerading as native. */
3092var maskSrcKey = (function() {
3093 var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
3094 return uid ? ('Symbol(src)_1.' + uid) : '';
3095}());
3096
3097/**
3098 * Checks if `func` has its source masked.
3099 *
3100 * @private
3101 * @param {Function} func The function to check.
3102 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
3103 */
3104function isMasked(func) {
3105 return !!maskSrcKey && (maskSrcKey in func);
3106}
3107
3108var _isMasked = isMasked;
3109
3110/** Used for built-in method references. */
3111var funcProto = Function.prototype;
3112
3113/** Used to resolve the decompiled source of functions. */
3114var funcToString = funcProto.toString;
3115
3116/**
3117 * Converts `func` to its source code.
3118 *
3119 * @private
3120 * @param {Function} func The function to convert.
3121 * @returns {string} Returns the source code.
3122 */
3123function toSource(func) {
3124 if (func != null) {
3125 try {
3126 return funcToString.call(func);
3127 } catch (e) {}
3128 try {
3129 return (func + '');
3130 } catch (e) {}
3131 }
3132 return '';
3133}
3134
3135var _toSource = toSource;
3136
3137/**
3138 * Used to match `RegExp`
3139 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
3140 */
3141var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
3142
3143/** Used to detect host constructors (Safari). */
3144var reIsHostCtor = /^\[object .+?Constructor\]$/;
3145
3146/** Used for built-in method references. */
3147var funcProto$1 = Function.prototype,
3148 objectProto$2 = Object.prototype;
3149
3150/** Used to resolve the decompiled source of functions. */
3151var funcToString$1 = funcProto$1.toString;
3152
3153/** Used to check objects for own properties. */
3154var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
3155
3156/** Used to detect if a method is native. */
3157var reIsNative = RegExp('^' +
3158 funcToString$1.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
3159 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
3160);
3161
3162/**
3163 * The base implementation of `_.isNative` without bad shim checks.
3164 *
3165 * @private
3166 * @param {*} value The value to check.
3167 * @returns {boolean} Returns `true` if `value` is a native function,
3168 * else `false`.
3169 */
3170function baseIsNative(value) {
3171 if (!isObject_1(value) || _isMasked(value)) {
3172 return false;
3173 }
3174 var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
3175 return pattern.test(_toSource(value));
3176}
3177
3178var _baseIsNative = baseIsNative;
3179
3180/**
3181 * Gets the value at `key` of `object`.
3182 *
3183 * @private
3184 * @param {Object} [object] The object to query.
3185 * @param {string} key The key of the property to get.
3186 * @returns {*} Returns the property value.
3187 */
3188function getValue(object, key) {
3189 return object == null ? undefined : object[key];
3190}
3191
3192var _getValue = getValue;
3193
3194/**
3195 * Gets the native function at `key` of `object`.
3196 *
3197 * @private
3198 * @param {Object} object The object to query.
3199 * @param {string} key The key of the method to get.
3200 * @returns {*} Returns the function if it's native, else `undefined`.
3201 */
3202function getNative(object, key) {
3203 var value = _getValue(object, key);
3204 return _baseIsNative(value) ? value : undefined;
3205}
3206
3207var _getNative = getNative;
3208
3209/* Built-in method references that are verified to be native. */
3210var Map$1 = _getNative(_root, 'Map');
3211
3212var _Map = Map$1;
3213
3214/* Built-in method references that are verified to be native. */
3215var nativeCreate = _getNative(Object, 'create');
3216
3217var _nativeCreate = nativeCreate;
3218
3219/**
3220 * Removes all key-value entries from the hash.
3221 *
3222 * @private
3223 * @name clear
3224 * @memberOf Hash
3225 */
3226function hashClear() {
3227 this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
3228 this.size = 0;
3229}
3230
3231var _hashClear = hashClear;
3232
3233/**
3234 * Removes `key` and its value from the hash.
3235 *
3236 * @private
3237 * @name delete
3238 * @memberOf Hash
3239 * @param {Object} hash The hash to modify.
3240 * @param {string} key The key of the value to remove.
3241 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3242 */
3243function hashDelete(key) {
3244 var result = this.has(key) && delete this.__data__[key];
3245 this.size -= result ? 1 : 0;
3246 return result;
3247}
3248
3249var _hashDelete = hashDelete;
3250
3251/** Used to stand-in for `undefined` hash values. */
3252var HASH_UNDEFINED = '__lodash_hash_undefined__';
3253
3254/** Used for built-in method references. */
3255var objectProto$3 = Object.prototype;
3256
3257/** Used to check objects for own properties. */
3258var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
3259
3260/**
3261 * Gets the hash value for `key`.
3262 *
3263 * @private
3264 * @name get
3265 * @memberOf Hash
3266 * @param {string} key The key of the value to get.
3267 * @returns {*} Returns the entry value.
3268 */
3269function hashGet(key) {
3270 var data = this.__data__;
3271 if (_nativeCreate) {
3272 var result = data[key];
3273 return result === HASH_UNDEFINED ? undefined : result;
3274 }
3275 return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
3276}
3277
3278var _hashGet = hashGet;
3279
3280/** Used for built-in method references. */
3281var objectProto$4 = Object.prototype;
3282
3283/** Used to check objects for own properties. */
3284var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
3285
3286/**
3287 * Checks if a hash value for `key` exists.
3288 *
3289 * @private
3290 * @name has
3291 * @memberOf Hash
3292 * @param {string} key The key of the entry to check.
3293 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3294 */
3295function hashHas(key) {
3296 var data = this.__data__;
3297 return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$4.call(data, key);
3298}
3299
3300var _hashHas = hashHas;
3301
3302/** Used to stand-in for `undefined` hash values. */
3303var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
3304
3305/**
3306 * Sets the hash `key` to `value`.
3307 *
3308 * @private
3309 * @name set
3310 * @memberOf Hash
3311 * @param {string} key The key of the value to set.
3312 * @param {*} value The value to set.
3313 * @returns {Object} Returns the hash instance.
3314 */
3315function hashSet(key, value) {
3316 var data = this.__data__;
3317 this.size += this.has(key) ? 0 : 1;
3318 data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
3319 return this;
3320}
3321
3322var _hashSet = hashSet;
3323
3324/**
3325 * Creates a hash object.
3326 *
3327 * @private
3328 * @constructor
3329 * @param {Array} [entries] The key-value pairs to cache.
3330 */
3331function Hash(entries) {
3332 var index = -1,
3333 length = entries == null ? 0 : entries.length;
3334
3335 this.clear();
3336 while (++index < length) {
3337 var entry = entries[index];
3338 this.set(entry[0], entry[1]);
3339 }
3340}
3341
3342// Add methods to `Hash`.
3343Hash.prototype.clear = _hashClear;
3344Hash.prototype['delete'] = _hashDelete;
3345Hash.prototype.get = _hashGet;
3346Hash.prototype.has = _hashHas;
3347Hash.prototype.set = _hashSet;
3348
3349var _Hash = Hash;
3350
3351/**
3352 * Removes all key-value entries from the map.
3353 *
3354 * @private
3355 * @name clear
3356 * @memberOf MapCache
3357 */
3358function mapCacheClear() {
3359 this.size = 0;
3360 this.__data__ = {
3361 'hash': new _Hash,
3362 'map': new (_Map || _ListCache),
3363 'string': new _Hash
3364 };
3365}
3366
3367var _mapCacheClear = mapCacheClear;
3368
3369/**
3370 * Checks if `value` is suitable for use as unique object key.
3371 *
3372 * @private
3373 * @param {*} value The value to check.
3374 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
3375 */
3376function isKeyable(value) {
3377 var type = typeof value;
3378 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
3379 ? (value !== '__proto__')
3380 : (value === null);
3381}
3382
3383var _isKeyable = isKeyable;
3384
3385/**
3386 * Gets the data for `map`.
3387 *
3388 * @private
3389 * @param {Object} map The map to query.
3390 * @param {string} key The reference key.
3391 * @returns {*} Returns the map data.
3392 */
3393function getMapData(map, key) {
3394 var data = map.__data__;
3395 return _isKeyable(key)
3396 ? data[typeof key == 'string' ? 'string' : 'hash']
3397 : data.map;
3398}
3399
3400var _getMapData = getMapData;
3401
3402/**
3403 * Removes `key` and its value from the map.
3404 *
3405 * @private
3406 * @name delete
3407 * @memberOf MapCache
3408 * @param {string} key The key of the value to remove.
3409 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3410 */
3411function mapCacheDelete(key) {
3412 var result = _getMapData(this, key)['delete'](key);
3413 this.size -= result ? 1 : 0;
3414 return result;
3415}
3416
3417var _mapCacheDelete = mapCacheDelete;
3418
3419/**
3420 * Gets the map value for `key`.
3421 *
3422 * @private
3423 * @name get
3424 * @memberOf MapCache
3425 * @param {string} key The key of the value to get.
3426 * @returns {*} Returns the entry value.
3427 */
3428function mapCacheGet(key) {
3429 return _getMapData(this, key).get(key);
3430}
3431
3432var _mapCacheGet = mapCacheGet;
3433
3434/**
3435 * Checks if a map value for `key` exists.
3436 *
3437 * @private
3438 * @name has
3439 * @memberOf MapCache
3440 * @param {string} key The key of the entry to check.
3441 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3442 */
3443function mapCacheHas(key) {
3444 return _getMapData(this, key).has(key);
3445}
3446
3447var _mapCacheHas = mapCacheHas;
3448
3449/**
3450 * Sets the map `key` to `value`.
3451 *
3452 * @private
3453 * @name set
3454 * @memberOf MapCache
3455 * @param {string} key The key of the value to set.
3456 * @param {*} value The value to set.
3457 * @returns {Object} Returns the map cache instance.
3458 */
3459function mapCacheSet(key, value) {
3460 var data = _getMapData(this, key),
3461 size = data.size;
3462
3463 data.set(key, value);
3464 this.size += data.size == size ? 0 : 1;
3465 return this;
3466}
3467
3468var _mapCacheSet = mapCacheSet;
3469
3470/**
3471 * Creates a map cache object to store key-value pairs.
3472 *
3473 * @private
3474 * @constructor
3475 * @param {Array} [entries] The key-value pairs to cache.
3476 */
3477function MapCache(entries) {
3478 var index = -1,
3479 length = entries == null ? 0 : entries.length;
3480
3481 this.clear();
3482 while (++index < length) {
3483 var entry = entries[index];
3484 this.set(entry[0], entry[1]);
3485 }
3486}
3487
3488// Add methods to `MapCache`.
3489MapCache.prototype.clear = _mapCacheClear;
3490MapCache.prototype['delete'] = _mapCacheDelete;
3491MapCache.prototype.get = _mapCacheGet;
3492MapCache.prototype.has = _mapCacheHas;
3493MapCache.prototype.set = _mapCacheSet;
3494
3495var _MapCache = MapCache;
3496
3497/** Used as the size to enable large array optimizations. */
3498var LARGE_ARRAY_SIZE = 200;
3499
3500/**
3501 * Sets the stack `key` to `value`.
3502 *
3503 * @private
3504 * @name set
3505 * @memberOf Stack
3506 * @param {string} key The key of the value to set.
3507 * @param {*} value The value to set.
3508 * @returns {Object} Returns the stack cache instance.
3509 */
3510function stackSet(key, value) {
3511 var data = this.__data__;
3512 if (data instanceof _ListCache) {
3513 var pairs = data.__data__;
3514 if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
3515 pairs.push([key, value]);
3516 this.size = ++data.size;
3517 return this;
3518 }
3519 data = this.__data__ = new _MapCache(pairs);
3520 }
3521 data.set(key, value);
3522 this.size = data.size;
3523 return this;
3524}
3525
3526var _stackSet = stackSet;
3527
3528/**
3529 * Creates a stack cache object to store key-value pairs.
3530 *
3531 * @private
3532 * @constructor
3533 * @param {Array} [entries] The key-value pairs to cache.
3534 */
3535function Stack(entries) {
3536 var data = this.__data__ = new _ListCache(entries);
3537 this.size = data.size;
3538}
3539
3540// Add methods to `Stack`.
3541Stack.prototype.clear = _stackClear;
3542Stack.prototype['delete'] = _stackDelete;
3543Stack.prototype.get = _stackGet;
3544Stack.prototype.has = _stackHas;
3545Stack.prototype.set = _stackSet;
3546
3547var _Stack = Stack;
3548
3549var defineProperty = (function() {
3550 try {
3551 var func = _getNative(Object, 'defineProperty');
3552 func({}, '', {});
3553 return func;
3554 } catch (e) {}
3555}());
3556
3557var _defineProperty$1 = defineProperty;
3558
3559/**
3560 * The base implementation of `assignValue` and `assignMergeValue` without
3561 * value checks.
3562 *
3563 * @private
3564 * @param {Object} object The object to modify.
3565 * @param {string} key The key of the property to assign.
3566 * @param {*} value The value to assign.
3567 */
3568function baseAssignValue(object, key, value) {
3569 if (key == '__proto__' && _defineProperty$1) {
3570 _defineProperty$1(object, key, {
3571 'configurable': true,
3572 'enumerable': true,
3573 'value': value,
3574 'writable': true
3575 });
3576 } else {
3577 object[key] = value;
3578 }
3579}
3580
3581var _baseAssignValue = baseAssignValue;
3582
3583/**
3584 * This function is like `assignValue` except that it doesn't assign
3585 * `undefined` values.
3586 *
3587 * @private
3588 * @param {Object} object The object to modify.
3589 * @param {string} key The key of the property to assign.
3590 * @param {*} value The value to assign.
3591 */
3592function assignMergeValue(object, key, value) {
3593 if ((value !== undefined && !eq_1(object[key], value)) ||
3594 (value === undefined && !(key in object))) {
3595 _baseAssignValue(object, key, value);
3596 }
3597}
3598
3599var _assignMergeValue = assignMergeValue;
3600
3601/**
3602 * Creates a base function for methods like `_.forIn` and `_.forOwn`.
3603 *
3604 * @private
3605 * @param {boolean} [fromRight] Specify iterating from right to left.
3606 * @returns {Function} Returns the new base function.
3607 */
3608function createBaseFor(fromRight) {
3609 return function(object, iteratee, keysFunc) {
3610 var index = -1,
3611 iterable = Object(object),
3612 props = keysFunc(object),
3613 length = props.length;
3614
3615 while (length--) {
3616 var key = props[fromRight ? length : ++index];
3617 if (iteratee(iterable[key], key, iterable) === false) {
3618 break;
3619 }
3620 }
3621 return object;
3622 };
3623}
3624
3625var _createBaseFor = createBaseFor;
3626
3627/**
3628 * The base implementation of `baseForOwn` which iterates over `object`
3629 * properties returned by `keysFunc` and invokes `iteratee` for each property.
3630 * Iteratee functions may exit iteration early by explicitly returning `false`.
3631 *
3632 * @private
3633 * @param {Object} object The object to iterate over.
3634 * @param {Function} iteratee The function invoked per iteration.
3635 * @param {Function} keysFunc The function to get the keys of `object`.
3636 * @returns {Object} Returns `object`.
3637 */
3638var baseFor = _createBaseFor();
3639
3640var _baseFor = baseFor;
3641
3642var _cloneBuffer = createCommonjsModule(function (module, exports) {
3643/** Detect free variable `exports`. */
3644var freeExports = exports && !exports.nodeType && exports;
3645
3646/** Detect free variable `module`. */
3647var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
3648
3649/** Detect the popular CommonJS extension `module.exports`. */
3650var moduleExports = freeModule && freeModule.exports === freeExports;
3651
3652/** Built-in value references. */
3653var Buffer = moduleExports ? _root.Buffer : undefined,
3654 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
3655
3656/**
3657 * Creates a clone of `buffer`.
3658 *
3659 * @private
3660 * @param {Buffer} buffer The buffer to clone.
3661 * @param {boolean} [isDeep] Specify a deep clone.
3662 * @returns {Buffer} Returns the cloned buffer.
3663 */
3664function cloneBuffer(buffer, isDeep) {
3665 if (isDeep) {
3666 return buffer.slice();
3667 }
3668 var length = buffer.length,
3669 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
3670
3671 buffer.copy(result);
3672 return result;
3673}
3674
3675module.exports = cloneBuffer;
3676});
3677
3678/** Built-in value references. */
3679var Uint8Array = _root.Uint8Array;
3680
3681var _Uint8Array = Uint8Array;
3682
3683/**
3684 * Creates a clone of `arrayBuffer`.
3685 *
3686 * @private
3687 * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
3688 * @returns {ArrayBuffer} Returns the cloned array buffer.
3689 */
3690function cloneArrayBuffer(arrayBuffer) {
3691 var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
3692 new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
3693 return result;
3694}
3695
3696var _cloneArrayBuffer = cloneArrayBuffer;
3697
3698/**
3699 * Creates a clone of `typedArray`.
3700 *
3701 * @private
3702 * @param {Object} typedArray The typed array to clone.
3703 * @param {boolean} [isDeep] Specify a deep clone.
3704 * @returns {Object} Returns the cloned typed array.
3705 */
3706function cloneTypedArray(typedArray, isDeep) {
3707 var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
3708 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
3709}
3710
3711var _cloneTypedArray = cloneTypedArray;
3712
3713/**
3714 * Copies the values of `source` to `array`.
3715 *
3716 * @private
3717 * @param {Array} source The array to copy values from.
3718 * @param {Array} [array=[]] The array to copy values to.
3719 * @returns {Array} Returns `array`.
3720 */
3721function copyArray(source, array) {
3722 var index = -1,
3723 length = source.length;
3724
3725 array || (array = Array(length));
3726 while (++index < length) {
3727 array[index] = source[index];
3728 }
3729 return array;
3730}
3731
3732var _copyArray = copyArray;
3733
3734/** Built-in value references. */
3735var objectCreate = Object.create;
3736
3737/**
3738 * The base implementation of `_.create` without support for assigning
3739 * properties to the created object.
3740 *
3741 * @private
3742 * @param {Object} proto The object to inherit from.
3743 * @returns {Object} Returns the new object.
3744 */
3745var baseCreate = (function() {
3746 function object() {}
3747 return function(proto) {
3748 if (!isObject_1(proto)) {
3749 return {};
3750 }
3751 if (objectCreate) {
3752 return objectCreate(proto);
3753 }
3754 object.prototype = proto;
3755 var result = new object;
3756 object.prototype = undefined;
3757 return result;
3758 };
3759}());
3760
3761var _baseCreate = baseCreate;
3762
3763/**
3764 * Creates a unary function that invokes `func` with its argument transformed.
3765 *
3766 * @private
3767 * @param {Function} func The function to wrap.
3768 * @param {Function} transform The argument transform.
3769 * @returns {Function} Returns the new function.
3770 */
3771function overArg(func, transform) {
3772 return function(arg) {
3773 return func(transform(arg));
3774 };
3775}
3776
3777var _overArg = overArg;
3778
3779/** Built-in value references. */
3780var getPrototype = _overArg(Object.getPrototypeOf, Object);
3781
3782var _getPrototype = getPrototype;
3783
3784/** Used for built-in method references. */
3785var objectProto$5 = Object.prototype;
3786
3787/**
3788 * Checks if `value` is likely a prototype object.
3789 *
3790 * @private
3791 * @param {*} value The value to check.
3792 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
3793 */
3794function isPrototype(value) {
3795 var Ctor = value && value.constructor,
3796 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5;
3797
3798 return value === proto;
3799}
3800
3801var _isPrototype = isPrototype;
3802
3803/**
3804 * Initializes an object clone.
3805 *
3806 * @private
3807 * @param {Object} object The object to clone.
3808 * @returns {Object} Returns the initialized clone.
3809 */
3810function initCloneObject(object) {
3811 return (typeof object.constructor == 'function' && !_isPrototype(object))
3812 ? _baseCreate(_getPrototype(object))
3813 : {};
3814}
3815
3816var _initCloneObject = initCloneObject;
3817
3818/**
3819 * Checks if `value` is object-like. A value is object-like if it's not `null`
3820 * and has a `typeof` result of "object".
3821 *
3822 * @static
3823 * @memberOf _
3824 * @since 4.0.0
3825 * @category Lang
3826 * @param {*} value The value to check.
3827 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
3828 * @example
3829 *
3830 * _.isObjectLike({});
3831 * // => true
3832 *
3833 * _.isObjectLike([1, 2, 3]);
3834 * // => true
3835 *
3836 * _.isObjectLike(_.noop);
3837 * // => false
3838 *
3839 * _.isObjectLike(null);
3840 * // => false
3841 */
3842function isObjectLike(value) {
3843 return value != null && typeof value == 'object';
3844}
3845
3846var isObjectLike_1 = isObjectLike;
3847
3848/** `Object#toString` result references. */
3849var argsTag = '[object Arguments]';
3850
3851/**
3852 * The base implementation of `_.isArguments`.
3853 *
3854 * @private
3855 * @param {*} value The value to check.
3856 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
3857 */
3858function baseIsArguments(value) {
3859 return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
3860}
3861
3862var _baseIsArguments = baseIsArguments;
3863
3864/** Used for built-in method references. */
3865var objectProto$6 = Object.prototype;
3866
3867/** Used to check objects for own properties. */
3868var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
3869
3870/** Built-in value references. */
3871var propertyIsEnumerable = objectProto$6.propertyIsEnumerable;
3872
3873/**
3874 * Checks if `value` is likely an `arguments` object.
3875 *
3876 * @static
3877 * @memberOf _
3878 * @since 0.1.0
3879 * @category Lang
3880 * @param {*} value The value to check.
3881 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
3882 * else `false`.
3883 * @example
3884 *
3885 * _.isArguments(function() { return arguments; }());
3886 * // => true
3887 *
3888 * _.isArguments([1, 2, 3]);
3889 * // => false
3890 */
3891var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
3892 return isObjectLike_1(value) && hasOwnProperty$5.call(value, 'callee') &&
3893 !propertyIsEnumerable.call(value, 'callee');
3894};
3895
3896var isArguments_1 = isArguments;
3897
3898/**
3899 * Checks if `value` is classified as an `Array` object.
3900 *
3901 * @static
3902 * @memberOf _
3903 * @since 0.1.0
3904 * @category Lang
3905 * @param {*} value The value to check.
3906 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
3907 * @example
3908 *
3909 * _.isArray([1, 2, 3]);
3910 * // => true
3911 *
3912 * _.isArray(document.body.children);
3913 * // => false
3914 *
3915 * _.isArray('abc');
3916 * // => false
3917 *
3918 * _.isArray(_.noop);
3919 * // => false
3920 */
3921var isArray = Array.isArray;
3922
3923var isArray_1 = isArray;
3924
3925/** Used as references for various `Number` constants. */
3926var MAX_SAFE_INTEGER = 9007199254740991;
3927
3928/**
3929 * Checks if `value` is a valid array-like length.
3930 *
3931 * **Note:** This method is loosely based on
3932 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
3933 *
3934 * @static
3935 * @memberOf _
3936 * @since 4.0.0
3937 * @category Lang
3938 * @param {*} value The value to check.
3939 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
3940 * @example
3941 *
3942 * _.isLength(3);
3943 * // => true
3944 *
3945 * _.isLength(Number.MIN_VALUE);
3946 * // => false
3947 *
3948 * _.isLength(Infinity);
3949 * // => false
3950 *
3951 * _.isLength('3');
3952 * // => false
3953 */
3954function isLength(value) {
3955 return typeof value == 'number' &&
3956 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
3957}
3958
3959var isLength_1 = isLength;
3960
3961/**
3962 * Checks if `value` is array-like. A value is considered array-like if it's
3963 * not a function and has a `value.length` that's an integer greater than or
3964 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
3965 *
3966 * @static
3967 * @memberOf _
3968 * @since 4.0.0
3969 * @category Lang
3970 * @param {*} value The value to check.
3971 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
3972 * @example
3973 *
3974 * _.isArrayLike([1, 2, 3]);
3975 * // => true
3976 *
3977 * _.isArrayLike(document.body.children);
3978 * // => true
3979 *
3980 * _.isArrayLike('abc');
3981 * // => true
3982 *
3983 * _.isArrayLike(_.noop);
3984 * // => false
3985 */
3986function isArrayLike(value) {
3987 return value != null && isLength_1(value.length) && !isFunction_1(value);
3988}
3989
3990var isArrayLike_1 = isArrayLike;
3991
3992/**
3993 * This method is like `_.isArrayLike` except that it also checks if `value`
3994 * is an object.
3995 *
3996 * @static
3997 * @memberOf _
3998 * @since 4.0.0
3999 * @category Lang
4000 * @param {*} value The value to check.
4001 * @returns {boolean} Returns `true` if `value` is an array-like object,
4002 * else `false`.
4003 * @example
4004 *
4005 * _.isArrayLikeObject([1, 2, 3]);
4006 * // => true
4007 *
4008 * _.isArrayLikeObject(document.body.children);
4009 * // => true
4010 *
4011 * _.isArrayLikeObject('abc');
4012 * // => false
4013 *
4014 * _.isArrayLikeObject(_.noop);
4015 * // => false
4016 */
4017function isArrayLikeObject(value) {
4018 return isObjectLike_1(value) && isArrayLike_1(value);
4019}
4020
4021var isArrayLikeObject_1 = isArrayLikeObject;
4022
4023/**
4024 * This method returns `false`.
4025 *
4026 * @static
4027 * @memberOf _
4028 * @since 4.13.0
4029 * @category Util
4030 * @returns {boolean} Returns `false`.
4031 * @example
4032 *
4033 * _.times(2, _.stubFalse);
4034 * // => [false, false]
4035 */
4036function stubFalse() {
4037 return false;
4038}
4039
4040var stubFalse_1 = stubFalse;
4041
4042var isBuffer_1 = createCommonjsModule(function (module, exports) {
4043/** Detect free variable `exports`. */
4044var freeExports = exports && !exports.nodeType && exports;
4045
4046/** Detect free variable `module`. */
4047var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
4048
4049/** Detect the popular CommonJS extension `module.exports`. */
4050var moduleExports = freeModule && freeModule.exports === freeExports;
4051
4052/** Built-in value references. */
4053var Buffer = moduleExports ? _root.Buffer : undefined;
4054
4055/* Built-in method references for those with the same name as other `lodash` methods. */
4056var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
4057
4058/**
4059 * Checks if `value` is a buffer.
4060 *
4061 * @static
4062 * @memberOf _
4063 * @since 4.3.0
4064 * @category Lang
4065 * @param {*} value The value to check.
4066 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
4067 * @example
4068 *
4069 * _.isBuffer(new Buffer(2));
4070 * // => true
4071 *
4072 * _.isBuffer(new Uint8Array(2));
4073 * // => false
4074 */
4075var isBuffer = nativeIsBuffer || stubFalse_1;
4076
4077module.exports = isBuffer;
4078});
4079
4080/** `Object#toString` result references. */
4081var objectTag = '[object Object]';
4082
4083/** Used for built-in method references. */
4084var funcProto$2 = Function.prototype,
4085 objectProto$7 = Object.prototype;
4086
4087/** Used to resolve the decompiled source of functions. */
4088var funcToString$2 = funcProto$2.toString;
4089
4090/** Used to check objects for own properties. */
4091var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
4092
4093/** Used to infer the `Object` constructor. */
4094var objectCtorString = funcToString$2.call(Object);
4095
4096/**
4097 * Checks if `value` is a plain object, that is, an object created by the
4098 * `Object` constructor or one with a `[[Prototype]]` of `null`.
4099 *
4100 * @static
4101 * @memberOf _
4102 * @since 0.8.0
4103 * @category Lang
4104 * @param {*} value The value to check.
4105 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
4106 * @example
4107 *
4108 * function Foo() {
4109 * this.a = 1;
4110 * }
4111 *
4112 * _.isPlainObject(new Foo);
4113 * // => false
4114 *
4115 * _.isPlainObject([1, 2, 3]);
4116 * // => false
4117 *
4118 * _.isPlainObject({ 'x': 0, 'y': 0 });
4119 * // => true
4120 *
4121 * _.isPlainObject(Object.create(null));
4122 * // => true
4123 */
4124function isPlainObject(value) {
4125 if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag) {
4126 return false;
4127 }
4128 var proto = _getPrototype(value);
4129 if (proto === null) {
4130 return true;
4131 }
4132 var Ctor = hasOwnProperty$6.call(proto, 'constructor') && proto.constructor;
4133 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
4134 funcToString$2.call(Ctor) == objectCtorString;
4135}
4136
4137var isPlainObject_1 = isPlainObject;
4138
4139/** `Object#toString` result references. */
4140var argsTag$1 = '[object Arguments]',
4141 arrayTag = '[object Array]',
4142 boolTag = '[object Boolean]',
4143 dateTag = '[object Date]',
4144 errorTag = '[object Error]',
4145 funcTag$1 = '[object Function]',
4146 mapTag = '[object Map]',
4147 numberTag = '[object Number]',
4148 objectTag$1 = '[object Object]',
4149 regexpTag = '[object RegExp]',
4150 setTag = '[object Set]',
4151 stringTag = '[object String]',
4152 weakMapTag = '[object WeakMap]';
4153
4154var arrayBufferTag = '[object ArrayBuffer]',
4155 dataViewTag = '[object DataView]',
4156 float32Tag = '[object Float32Array]',
4157 float64Tag = '[object Float64Array]',
4158 int8Tag = '[object Int8Array]',
4159 int16Tag = '[object Int16Array]',
4160 int32Tag = '[object Int32Array]',
4161 uint8Tag = '[object Uint8Array]',
4162 uint8ClampedTag = '[object Uint8ClampedArray]',
4163 uint16Tag = '[object Uint16Array]',
4164 uint32Tag = '[object Uint32Array]';
4165
4166/** Used to identify `toStringTag` values of typed arrays. */
4167var typedArrayTags = {};
4168typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
4169typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
4170typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
4171typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
4172typedArrayTags[uint32Tag] = true;
4173typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
4174typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
4175typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
4176typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
4177typedArrayTags[mapTag] = typedArrayTags[numberTag] =
4178typedArrayTags[objectTag$1] = typedArrayTags[regexpTag] =
4179typedArrayTags[setTag] = typedArrayTags[stringTag] =
4180typedArrayTags[weakMapTag] = false;
4181
4182/**
4183 * The base implementation of `_.isTypedArray` without Node.js optimizations.
4184 *
4185 * @private
4186 * @param {*} value The value to check.
4187 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
4188 */
4189function baseIsTypedArray(value) {
4190 return isObjectLike_1(value) &&
4191 isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
4192}
4193
4194var _baseIsTypedArray = baseIsTypedArray;
4195
4196/**
4197 * The base implementation of `_.unary` without support for storing metadata.
4198 *
4199 * @private
4200 * @param {Function} func The function to cap arguments for.
4201 * @returns {Function} Returns the new capped function.
4202 */
4203function baseUnary(func) {
4204 return function(value) {
4205 return func(value);
4206 };
4207}
4208
4209var _baseUnary = baseUnary;
4210
4211var _nodeUtil = createCommonjsModule(function (module, exports) {
4212/** Detect free variable `exports`. */
4213var freeExports = exports && !exports.nodeType && exports;
4214
4215/** Detect free variable `module`. */
4216var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
4217
4218/** Detect the popular CommonJS extension `module.exports`. */
4219var moduleExports = freeModule && freeModule.exports === freeExports;
4220
4221/** Detect free variable `process` from Node.js. */
4222var freeProcess = moduleExports && _freeGlobal.process;
4223
4224/** Used to access faster Node.js helpers. */
4225var nodeUtil = (function() {
4226 try {
4227 // Use `util.types` for Node.js 10+.
4228 var types = freeModule && freeModule.require && freeModule.require('util').types;
4229
4230 if (types) {
4231 return types;
4232 }
4233
4234 // Legacy `process.binding('util')` for Node.js < 10.
4235 return freeProcess && freeProcess.binding && freeProcess.binding('util');
4236 } catch (e) {}
4237}());
4238
4239module.exports = nodeUtil;
4240});
4241
4242/* Node.js helper references. */
4243var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
4244
4245/**
4246 * Checks if `value` is classified as a typed array.
4247 *
4248 * @static
4249 * @memberOf _
4250 * @since 3.0.0
4251 * @category Lang
4252 * @param {*} value The value to check.
4253 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
4254 * @example
4255 *
4256 * _.isTypedArray(new Uint8Array);
4257 * // => true
4258 *
4259 * _.isTypedArray([]);
4260 * // => false
4261 */
4262var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
4263
4264var isTypedArray_1 = isTypedArray;
4265
4266/**
4267 * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
4268 *
4269 * @private
4270 * @param {Object} object The object to query.
4271 * @param {string} key The key of the property to get.
4272 * @returns {*} Returns the property value.
4273 */
4274function safeGet(object, key) {
4275 if (key === 'constructor' && typeof object[key] === 'function') {
4276 return;
4277 }
4278
4279 if (key == '__proto__') {
4280 return;
4281 }
4282
4283 return object[key];
4284}
4285
4286var _safeGet = safeGet;
4287
4288/** Used for built-in method references. */
4289var objectProto$8 = Object.prototype;
4290
4291/** Used to check objects for own properties. */
4292var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
4293
4294/**
4295 * Assigns `value` to `key` of `object` if the existing value is not equivalent
4296 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
4297 * for equality comparisons.
4298 *
4299 * @private
4300 * @param {Object} object The object to modify.
4301 * @param {string} key The key of the property to assign.
4302 * @param {*} value The value to assign.
4303 */
4304function assignValue(object, key, value) {
4305 var objValue = object[key];
4306 if (!(hasOwnProperty$7.call(object, key) && eq_1(objValue, value)) ||
4307 (value === undefined && !(key in object))) {
4308 _baseAssignValue(object, key, value);
4309 }
4310}
4311
4312var _assignValue = assignValue;
4313
4314/**
4315 * Copies properties of `source` to `object`.
4316 *
4317 * @private
4318 * @param {Object} source The object to copy properties from.
4319 * @param {Array} props The property identifiers to copy.
4320 * @param {Object} [object={}] The object to copy properties to.
4321 * @param {Function} [customizer] The function to customize copied values.
4322 * @returns {Object} Returns `object`.
4323 */
4324function copyObject(source, props, object, customizer) {
4325 var isNew = !object;
4326 object || (object = {});
4327
4328 var index = -1,
4329 length = props.length;
4330
4331 while (++index < length) {
4332 var key = props[index];
4333
4334 var newValue = customizer
4335 ? customizer(object[key], source[key], key, object, source)
4336 : undefined;
4337
4338 if (newValue === undefined) {
4339 newValue = source[key];
4340 }
4341 if (isNew) {
4342 _baseAssignValue(object, key, newValue);
4343 } else {
4344 _assignValue(object, key, newValue);
4345 }
4346 }
4347 return object;
4348}
4349
4350var _copyObject = copyObject;
4351
4352/**
4353 * The base implementation of `_.times` without support for iteratee shorthands
4354 * or max array length checks.
4355 *
4356 * @private
4357 * @param {number} n The number of times to invoke `iteratee`.
4358 * @param {Function} iteratee The function invoked per iteration.
4359 * @returns {Array} Returns the array of results.
4360 */
4361function baseTimes(n, iteratee) {
4362 var index = -1,
4363 result = Array(n);
4364
4365 while (++index < n) {
4366 result[index] = iteratee(index);
4367 }
4368 return result;
4369}
4370
4371var _baseTimes = baseTimes;
4372
4373/** Used as references for various `Number` constants. */
4374var MAX_SAFE_INTEGER$1 = 9007199254740991;
4375
4376/** Used to detect unsigned integer values. */
4377var reIsUint = /^(?:0|[1-9]\d*)$/;
4378
4379/**
4380 * Checks if `value` is a valid array-like index.
4381 *
4382 * @private
4383 * @param {*} value The value to check.
4384 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
4385 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
4386 */
4387function isIndex(value, length) {
4388 var type = typeof value;
4389 length = length == null ? MAX_SAFE_INTEGER$1 : length;
4390
4391 return !!length &&
4392 (type == 'number' ||
4393 (type != 'symbol' && reIsUint.test(value))) &&
4394 (value > -1 && value % 1 == 0 && value < length);
4395}
4396
4397var _isIndex = isIndex;
4398
4399/** Used for built-in method references. */
4400var objectProto$9 = Object.prototype;
4401
4402/** Used to check objects for own properties. */
4403var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
4404
4405/**
4406 * Creates an array of the enumerable property names of the array-like `value`.
4407 *
4408 * @private
4409 * @param {*} value The value to query.
4410 * @param {boolean} inherited Specify returning inherited property names.
4411 * @returns {Array} Returns the array of property names.
4412 */
4413function arrayLikeKeys(value, inherited) {
4414 var isArr = isArray_1(value),
4415 isArg = !isArr && isArguments_1(value),
4416 isBuff = !isArr && !isArg && isBuffer_1(value),
4417 isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
4418 skipIndexes = isArr || isArg || isBuff || isType,
4419 result = skipIndexes ? _baseTimes(value.length, String) : [],
4420 length = result.length;
4421
4422 for (var key in value) {
4423 if ((inherited || hasOwnProperty$8.call(value, key)) &&
4424 !(skipIndexes && (
4425 // Safari 9 has enumerable `arguments.length` in strict mode.
4426 key == 'length' ||
4427 // Node.js 0.10 has enumerable non-index properties on buffers.
4428 (isBuff && (key == 'offset' || key == 'parent')) ||
4429 // PhantomJS 2 has enumerable non-index properties on typed arrays.
4430 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
4431 // Skip index properties.
4432 _isIndex(key, length)
4433 ))) {
4434 result.push(key);
4435 }
4436 }
4437 return result;
4438}
4439
4440var _arrayLikeKeys = arrayLikeKeys;
4441
4442/**
4443 * This function is like
4444 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
4445 * except that it includes inherited enumerable properties.
4446 *
4447 * @private
4448 * @param {Object} object The object to query.
4449 * @returns {Array} Returns the array of property names.
4450 */
4451function nativeKeysIn(object) {
4452 var result = [];
4453 if (object != null) {
4454 for (var key in Object(object)) {
4455 result.push(key);
4456 }
4457 }
4458 return result;
4459}
4460
4461var _nativeKeysIn = nativeKeysIn;
4462
4463/** Used for built-in method references. */
4464var objectProto$a = Object.prototype;
4465
4466/** Used to check objects for own properties. */
4467var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
4468
4469/**
4470 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
4471 *
4472 * @private
4473 * @param {Object} object The object to query.
4474 * @returns {Array} Returns the array of property names.
4475 */
4476function baseKeysIn(object) {
4477 if (!isObject_1(object)) {
4478 return _nativeKeysIn(object);
4479 }
4480 var isProto = _isPrototype(object),
4481 result = [];
4482
4483 for (var key in object) {
4484 if (!(key == 'constructor' && (isProto || !hasOwnProperty$9.call(object, key)))) {
4485 result.push(key);
4486 }
4487 }
4488 return result;
4489}
4490
4491var _baseKeysIn = baseKeysIn;
4492
4493/**
4494 * Creates an array of the own and inherited enumerable property names of `object`.
4495 *
4496 * **Note:** Non-object values are coerced to objects.
4497 *
4498 * @static
4499 * @memberOf _
4500 * @since 3.0.0
4501 * @category Object
4502 * @param {Object} object The object to query.
4503 * @returns {Array} Returns the array of property names.
4504 * @example
4505 *
4506 * function Foo() {
4507 * this.a = 1;
4508 * this.b = 2;
4509 * }
4510 *
4511 * Foo.prototype.c = 3;
4512 *
4513 * _.keysIn(new Foo);
4514 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
4515 */
4516function keysIn(object) {
4517 return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
4518}
4519
4520var keysIn_1 = keysIn;
4521
4522/**
4523 * Converts `value` to a plain object flattening inherited enumerable string
4524 * keyed properties of `value` to own properties of the plain object.
4525 *
4526 * @static
4527 * @memberOf _
4528 * @since 3.0.0
4529 * @category Lang
4530 * @param {*} value The value to convert.
4531 * @returns {Object} Returns the converted plain object.
4532 * @example
4533 *
4534 * function Foo() {
4535 * this.b = 2;
4536 * }
4537 *
4538 * Foo.prototype.c = 3;
4539 *
4540 * _.assign({ 'a': 1 }, new Foo);
4541 * // => { 'a': 1, 'b': 2 }
4542 *
4543 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
4544 * // => { 'a': 1, 'b': 2, 'c': 3 }
4545 */
4546function toPlainObject(value) {
4547 return _copyObject(value, keysIn_1(value));
4548}
4549
4550var toPlainObject_1 = toPlainObject;
4551
4552/**
4553 * A specialized version of `baseMerge` for arrays and objects which performs
4554 * deep merges and tracks traversed objects enabling objects with circular
4555 * references to be merged.
4556 *
4557 * @private
4558 * @param {Object} object The destination object.
4559 * @param {Object} source The source object.
4560 * @param {string} key The key of the value to merge.
4561 * @param {number} srcIndex The index of `source`.
4562 * @param {Function} mergeFunc The function to merge values.
4563 * @param {Function} [customizer] The function to customize assigned values.
4564 * @param {Object} [stack] Tracks traversed source values and their merged
4565 * counterparts.
4566 */
4567function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
4568 var objValue = _safeGet(object, key),
4569 srcValue = _safeGet(source, key),
4570 stacked = stack.get(srcValue);
4571
4572 if (stacked) {
4573 _assignMergeValue(object, key, stacked);
4574 return;
4575 }
4576 var newValue = customizer
4577 ? customizer(objValue, srcValue, (key + ''), object, source, stack)
4578 : undefined;
4579
4580 var isCommon = newValue === undefined;
4581
4582 if (isCommon) {
4583 var isArr = isArray_1(srcValue),
4584 isBuff = !isArr && isBuffer_1(srcValue),
4585 isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);
4586
4587 newValue = srcValue;
4588 if (isArr || isBuff || isTyped) {
4589 if (isArray_1(objValue)) {
4590 newValue = objValue;
4591 }
4592 else if (isArrayLikeObject_1(objValue)) {
4593 newValue = _copyArray(objValue);
4594 }
4595 else if (isBuff) {
4596 isCommon = false;
4597 newValue = _cloneBuffer(srcValue, true);
4598 }
4599 else if (isTyped) {
4600 isCommon = false;
4601 newValue = _cloneTypedArray(srcValue, true);
4602 }
4603 else {
4604 newValue = [];
4605 }
4606 }
4607 else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {
4608 newValue = objValue;
4609 if (isArguments_1(objValue)) {
4610 newValue = toPlainObject_1(objValue);
4611 }
4612 else if (!isObject_1(objValue) || isFunction_1(objValue)) {
4613 newValue = _initCloneObject(srcValue);
4614 }
4615 }
4616 else {
4617 isCommon = false;
4618 }
4619 }
4620 if (isCommon) {
4621 // Recursively merge objects and arrays (susceptible to call stack limits).
4622 stack.set(srcValue, newValue);
4623 mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
4624 stack['delete'](srcValue);
4625 }
4626 _assignMergeValue(object, key, newValue);
4627}
4628
4629var _baseMergeDeep = baseMergeDeep;
4630
4631/**
4632 * The base implementation of `_.merge` without support for multiple sources.
4633 *
4634 * @private
4635 * @param {Object} object The destination object.
4636 * @param {Object} source The source object.
4637 * @param {number} srcIndex The index of `source`.
4638 * @param {Function} [customizer] The function to customize merged values.
4639 * @param {Object} [stack] Tracks traversed source values and their merged
4640 * counterparts.
4641 */
4642function baseMerge(object, source, srcIndex, customizer, stack) {
4643 if (object === source) {
4644 return;
4645 }
4646 _baseFor(source, function(srcValue, key) {
4647 stack || (stack = new _Stack);
4648 if (isObject_1(srcValue)) {
4649 _baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
4650 }
4651 else {
4652 var newValue = customizer
4653 ? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack)
4654 : undefined;
4655
4656 if (newValue === undefined) {
4657 newValue = srcValue;
4658 }
4659 _assignMergeValue(object, key, newValue);
4660 }
4661 }, keysIn_1);
4662}
4663
4664var _baseMerge = baseMerge;
4665
4666/**
4667 * This method returns the first argument it receives.
4668 *
4669 * @static
4670 * @since 0.1.0
4671 * @memberOf _
4672 * @category Util
4673 * @param {*} value Any value.
4674 * @returns {*} Returns `value`.
4675 * @example
4676 *
4677 * var object = { 'a': 1 };
4678 *
4679 * console.log(_.identity(object) === object);
4680 * // => true
4681 */
4682function identity(value) {
4683 return value;
4684}
4685
4686var identity_1 = identity;
4687
4688/**
4689 * A faster alternative to `Function#apply`, this function invokes `func`
4690 * with the `this` binding of `thisArg` and the arguments of `args`.
4691 *
4692 * @private
4693 * @param {Function} func The function to invoke.
4694 * @param {*} thisArg The `this` binding of `func`.
4695 * @param {Array} args The arguments to invoke `func` with.
4696 * @returns {*} Returns the result of `func`.
4697 */
4698function apply(func, thisArg, args) {
4699 switch (args.length) {
4700 case 0: return func.call(thisArg);
4701 case 1: return func.call(thisArg, args[0]);
4702 case 2: return func.call(thisArg, args[0], args[1]);
4703 case 3: return func.call(thisArg, args[0], args[1], args[2]);
4704 }
4705 return func.apply(thisArg, args);
4706}
4707
4708var _apply = apply;
4709
4710/* Built-in method references for those with the same name as other `lodash` methods. */
4711var nativeMax = Math.max;
4712
4713/**
4714 * A specialized version of `baseRest` which transforms the rest array.
4715 *
4716 * @private
4717 * @param {Function} func The function to apply a rest parameter to.
4718 * @param {number} [start=func.length-1] The start position of the rest parameter.
4719 * @param {Function} transform The rest array transform.
4720 * @returns {Function} Returns the new function.
4721 */
4722function overRest(func, start, transform) {
4723 start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
4724 return function() {
4725 var args = arguments,
4726 index = -1,
4727 length = nativeMax(args.length - start, 0),
4728 array = Array(length);
4729
4730 while (++index < length) {
4731 array[index] = args[start + index];
4732 }
4733 index = -1;
4734 var otherArgs = Array(start + 1);
4735 while (++index < start) {
4736 otherArgs[index] = args[index];
4737 }
4738 otherArgs[start] = transform(array);
4739 return _apply(func, this, otherArgs);
4740 };
4741}
4742
4743var _overRest = overRest;
4744
4745/**
4746 * Creates a function that returns `value`.
4747 *
4748 * @static
4749 * @memberOf _
4750 * @since 2.4.0
4751 * @category Util
4752 * @param {*} value The value to return from the new function.
4753 * @returns {Function} Returns the new constant function.
4754 * @example
4755 *
4756 * var objects = _.times(2, _.constant({ 'a': 1 }));
4757 *
4758 * console.log(objects);
4759 * // => [{ 'a': 1 }, { 'a': 1 }]
4760 *
4761 * console.log(objects[0] === objects[1]);
4762 * // => true
4763 */
4764function constant(value) {
4765 return function() {
4766 return value;
4767 };
4768}
4769
4770var constant_1 = constant;
4771
4772/**
4773 * The base implementation of `setToString` without support for hot loop shorting.
4774 *
4775 * @private
4776 * @param {Function} func The function to modify.
4777 * @param {Function} string The `toString` result.
4778 * @returns {Function} Returns `func`.
4779 */
4780var baseSetToString = !_defineProperty$1 ? identity_1 : function(func, string) {
4781 return _defineProperty$1(func, 'toString', {
4782 'configurable': true,
4783 'enumerable': false,
4784 'value': constant_1(string),
4785 'writable': true
4786 });
4787};
4788
4789var _baseSetToString = baseSetToString;
4790
4791/** Used to detect hot functions by number of calls within a span of milliseconds. */
4792var HOT_COUNT = 800,
4793 HOT_SPAN = 16;
4794
4795/* Built-in method references for those with the same name as other `lodash` methods. */
4796var nativeNow = Date.now;
4797
4798/**
4799 * Creates a function that'll short out and invoke `identity` instead
4800 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
4801 * milliseconds.
4802 *
4803 * @private
4804 * @param {Function} func The function to restrict.
4805 * @returns {Function} Returns the new shortable function.
4806 */
4807function shortOut(func) {
4808 var count = 0,
4809 lastCalled = 0;
4810
4811 return function() {
4812 var stamp = nativeNow(),
4813 remaining = HOT_SPAN - (stamp - lastCalled);
4814
4815 lastCalled = stamp;
4816 if (remaining > 0) {
4817 if (++count >= HOT_COUNT) {
4818 return arguments[0];
4819 }
4820 } else {
4821 count = 0;
4822 }
4823 return func.apply(undefined, arguments);
4824 };
4825}
4826
4827var _shortOut = shortOut;
4828
4829/**
4830 * Sets the `toString` method of `func` to return `string`.
4831 *
4832 * @private
4833 * @param {Function} func The function to modify.
4834 * @param {Function} string The `toString` result.
4835 * @returns {Function} Returns `func`.
4836 */
4837var setToString = _shortOut(_baseSetToString);
4838
4839var _setToString = setToString;
4840
4841/**
4842 * The base implementation of `_.rest` which doesn't validate or coerce arguments.
4843 *
4844 * @private
4845 * @param {Function} func The function to apply a rest parameter to.
4846 * @param {number} [start=func.length-1] The start position of the rest parameter.
4847 * @returns {Function} Returns the new function.
4848 */
4849function baseRest(func, start) {
4850 return _setToString(_overRest(func, start, identity_1), func + '');
4851}
4852
4853var _baseRest = baseRest;
4854
4855/**
4856 * Checks if the given arguments are from an iteratee call.
4857 *
4858 * @private
4859 * @param {*} value The potential iteratee value argument.
4860 * @param {*} index The potential iteratee index or key argument.
4861 * @param {*} object The potential iteratee object argument.
4862 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
4863 * else `false`.
4864 */
4865function isIterateeCall(value, index, object) {
4866 if (!isObject_1(object)) {
4867 return false;
4868 }
4869 var type = typeof index;
4870 if (type == 'number'
4871 ? (isArrayLike_1(object) && _isIndex(index, object.length))
4872 : (type == 'string' && index in object)
4873 ) {
4874 return eq_1(object[index], value);
4875 }
4876 return false;
4877}
4878
4879var _isIterateeCall = isIterateeCall;
4880
4881/**
4882 * Creates a function like `_.assign`.
4883 *
4884 * @private
4885 * @param {Function} assigner The function to assign values.
4886 * @returns {Function} Returns the new assigner function.
4887 */
4888function createAssigner(assigner) {
4889 return _baseRest(function(object, sources) {
4890 var index = -1,
4891 length = sources.length,
4892 customizer = length > 1 ? sources[length - 1] : undefined,
4893 guard = length > 2 ? sources[2] : undefined;
4894
4895 customizer = (assigner.length > 3 && typeof customizer == 'function')
4896 ? (length--, customizer)
4897 : undefined;
4898
4899 if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
4900 customizer = length < 3 ? undefined : customizer;
4901 length = 1;
4902 }
4903 object = Object(object);
4904 while (++index < length) {
4905 var source = sources[index];
4906 if (source) {
4907 assigner(object, source, index, customizer);
4908 }
4909 }
4910 return object;
4911 });
4912}
4913
4914var _createAssigner = createAssigner;
4915
4916/**
4917 * This method is like `_.assign` except that it recursively merges own and
4918 * inherited enumerable string keyed properties of source objects into the
4919 * destination object. Source properties that resolve to `undefined` are
4920 * skipped if a destination value exists. Array and plain object properties
4921 * are merged recursively. Other objects and value types are overridden by
4922 * assignment. Source objects are applied from left to right. Subsequent
4923 * sources overwrite property assignments of previous sources.
4924 *
4925 * **Note:** This method mutates `object`.
4926 *
4927 * @static
4928 * @memberOf _
4929 * @since 0.5.0
4930 * @category Object
4931 * @param {Object} object The destination object.
4932 * @param {...Object} [sources] The source objects.
4933 * @returns {Object} Returns `object`.
4934 * @example
4935 *
4936 * var object = {
4937 * 'a': [{ 'b': 2 }, { 'd': 4 }]
4938 * };
4939 *
4940 * var other = {
4941 * 'a': [{ 'c': 3 }, { 'e': 5 }]
4942 * };
4943 *
4944 * _.merge(object, other);
4945 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
4946 */
4947var merge = _createAssigner(function(object, source, srcIndex) {
4948 _baseMerge(object, source, srcIndex);
4949});
4950
4951var merge_1 = merge;
4952
4953/**
4954 * React Blessed Update Schemes
4955 * =============================
4956 *
4957 * Applying updates to blessed nodes correctly.
4958 */
4959const RAW_ATTRIBUTES = new Set([// Alignment, Orientation & Presentation
4960'align', 'valign', 'orientation', 'shrink', 'padding', 'tags', 'shadow', // Font-related
4961'font', 'fontBold', 'fch', 'ch', 'bold', 'underline', // Flags
4962'clickable', 'input', 'keyable', 'hidden', 'visible', 'scrollable', 'draggable', 'interactive', // Position
4963'left', 'right', 'top', 'bottom', 'aleft', 'aright', 'atop', 'abottom', // Size
4964'width', 'height', // Checkbox
4965'checked', // Misc
4966'name']);
4967/**
4968 * Updates the given blessed node.
4969 *
4970 * @param {BlessedNode} node - Node to update.
4971 * @param {object} options - Props of the component without children.
4972 */
4973
4974function update(node, options) {
4975 // TODO: enforce some kind of shallow equality?
4976 // TODO: handle position
4977 const selectQue = [];
4978
4979 for (let key in options) {
4980 let value = options[key];
4981 if (key === 'selected' && node.select) selectQue.push({
4982 node,
4983 value: typeof value === 'string' ? +value : value
4984 }); // Setting label
4985 else if (key === 'label') node.setLabel(value); // Removing hoverText
4986 else if (key === 'hoverText' && !value) node.removeHover(); // Setting hoverText
4987 else if (key === 'hoverText' && value) node.setHover(value); // Setting content
4988 else if (key === 'content') node.setContent(value); // Updating style
4989 else if (key === 'style') node.style = merge_1({}, node.style, value); // Updating items
4990 else if (key === 'items') node.setItems(value); // Border edge case
4991 else if (key === 'border') node.border = merge_1({}, node.border, value); // Textarea value
4992 else if (key === 'value' && node.setValue) node.setValue(value); // Progress bar
4993 else if (key === 'filled' && node.filled !== value) node.setProgress(value); // Table / ListTable rows / data
4994 else if ((key === 'rows' || key === 'data') && node.setData) node.setData(value);else if (key === 'focused' && value && !node[key]) node.focus(); // Raw attributes
4995 else if (RAW_ATTRIBUTES.has(key)) node[key] = value;
4996 }
4997
4998 selectQue.forEach(({
4999 node,
5000 value
5001 }) => node.select(value));
5002}
5003
5004const emptyArray = [];
5005/**
5006 * Solves the given props by applying classes.
5007 *
5008 * @param {object} props - The component's props.
5009 * @return {object} - The solved props.
5010 */
5011
5012function solveClass(props) {
5013 let {
5014 class: classes
5015 } = props,
5016 rest = _objectWithoutProperties(props, ["class"]);
5017
5018 const args = [{}];
5019 if (classes) args.push.apply(args, emptyArray.concat(classes));
5020 args.push(rest);
5021 return merge_1.apply(null, args);
5022}
5023
5024/**
5025 * Gets the timestamp of the number of milliseconds that have elapsed since
5026 * the Unix epoch (1 January 1970 00:00:00 UTC).
5027 *
5028 * @static
5029 * @memberOf _
5030 * @since 2.4.0
5031 * @category Date
5032 * @returns {number} Returns the timestamp.
5033 * @example
5034 *
5035 * _.defer(function(stamp) {
5036 * console.log(_.now() - stamp);
5037 * }, _.now());
5038 * // => Logs the number of milliseconds it took for the deferred invocation.
5039 */
5040var now = function() {
5041 return _root.Date.now();
5042};
5043
5044var now_1 = now;
5045
5046/** `Object#toString` result references. */
5047var symbolTag = '[object Symbol]';
5048
5049/**
5050 * Checks if `value` is classified as a `Symbol` primitive or object.
5051 *
5052 * @static
5053 * @memberOf _
5054 * @since 4.0.0
5055 * @category Lang
5056 * @param {*} value The value to check.
5057 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
5058 * @example
5059 *
5060 * _.isSymbol(Symbol.iterator);
5061 * // => true
5062 *
5063 * _.isSymbol('abc');
5064 * // => false
5065 */
5066function isSymbol(value) {
5067 return typeof value == 'symbol' ||
5068 (isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
5069}
5070
5071var isSymbol_1 = isSymbol;
5072
5073/** Used as references for various `Number` constants. */
5074var NAN = 0 / 0;
5075
5076/** Used to match leading and trailing whitespace. */
5077var reTrim = /^\s+|\s+$/g;
5078
5079/** Used to detect bad signed hexadecimal string values. */
5080var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
5081
5082/** Used to detect binary string values. */
5083var reIsBinary = /^0b[01]+$/i;
5084
5085/** Used to detect octal string values. */
5086var reIsOctal = /^0o[0-7]+$/i;
5087
5088/** Built-in method references without a dependency on `root`. */
5089var freeParseInt = parseInt;
5090
5091/**
5092 * Converts `value` to a number.
5093 *
5094 * @static
5095 * @memberOf _
5096 * @since 4.0.0
5097 * @category Lang
5098 * @param {*} value The value to process.
5099 * @returns {number} Returns the number.
5100 * @example
5101 *
5102 * _.toNumber(3.2);
5103 * // => 3.2
5104 *
5105 * _.toNumber(Number.MIN_VALUE);
5106 * // => 5e-324
5107 *
5108 * _.toNumber(Infinity);
5109 * // => Infinity
5110 *
5111 * _.toNumber('3.2');
5112 * // => 3.2
5113 */
5114function toNumber(value) {
5115 if (typeof value == 'number') {
5116 return value;
5117 }
5118 if (isSymbol_1(value)) {
5119 return NAN;
5120 }
5121 if (isObject_1(value)) {
5122 var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
5123 value = isObject_1(other) ? (other + '') : other;
5124 }
5125 if (typeof value != 'string') {
5126 return value === 0 ? value : +value;
5127 }
5128 value = value.replace(reTrim, '');
5129 var isBinary = reIsBinary.test(value);
5130 return (isBinary || reIsOctal.test(value))
5131 ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
5132 : (reIsBadHex.test(value) ? NAN : +value);
5133}
5134
5135var toNumber_1 = toNumber;
5136
5137/** Error message constants. */
5138var FUNC_ERROR_TEXT = 'Expected a function';
5139
5140/* Built-in method references for those with the same name as other `lodash` methods. */
5141var nativeMax$1 = Math.max,
5142 nativeMin = Math.min;
5143
5144/**
5145 * Creates a debounced function that delays invoking `func` until after `wait`
5146 * milliseconds have elapsed since the last time the debounced function was
5147 * invoked. The debounced function comes with a `cancel` method to cancel
5148 * delayed `func` invocations and a `flush` method to immediately invoke them.
5149 * Provide `options` to indicate whether `func` should be invoked on the
5150 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
5151 * with the last arguments provided to the debounced function. Subsequent
5152 * calls to the debounced function return the result of the last `func`
5153 * invocation.
5154 *
5155 * **Note:** If `leading` and `trailing` options are `true`, `func` is
5156 * invoked on the trailing edge of the timeout only if the debounced function
5157 * is invoked more than once during the `wait` timeout.
5158 *
5159 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
5160 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
5161 *
5162 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
5163 * for details over the differences between `_.debounce` and `_.throttle`.
5164 *
5165 * @static
5166 * @memberOf _
5167 * @since 0.1.0
5168 * @category Function
5169 * @param {Function} func The function to debounce.
5170 * @param {number} [wait=0] The number of milliseconds to delay.
5171 * @param {Object} [options={}] The options object.
5172 * @param {boolean} [options.leading=false]
5173 * Specify invoking on the leading edge of the timeout.
5174 * @param {number} [options.maxWait]
5175 * The maximum time `func` is allowed to be delayed before it's invoked.
5176 * @param {boolean} [options.trailing=true]
5177 * Specify invoking on the trailing edge of the timeout.
5178 * @returns {Function} Returns the new debounced function.
5179 * @example
5180 *
5181 * // Avoid costly calculations while the window size is in flux.
5182 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
5183 *
5184 * // Invoke `sendMail` when clicked, debouncing subsequent calls.
5185 * jQuery(element).on('click', _.debounce(sendMail, 300, {
5186 * 'leading': true,
5187 * 'trailing': false
5188 * }));
5189 *
5190 * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
5191 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
5192 * var source = new EventSource('/stream');
5193 * jQuery(source).on('message', debounced);
5194 *
5195 * // Cancel the trailing debounced invocation.
5196 * jQuery(window).on('popstate', debounced.cancel);
5197 */
5198function debounce(func, wait, options) {
5199 var lastArgs,
5200 lastThis,
5201 maxWait,
5202 result,
5203 timerId,
5204 lastCallTime,
5205 lastInvokeTime = 0,
5206 leading = false,
5207 maxing = false,
5208 trailing = true;
5209
5210 if (typeof func != 'function') {
5211 throw new TypeError(FUNC_ERROR_TEXT);
5212 }
5213 wait = toNumber_1(wait) || 0;
5214 if (isObject_1(options)) {
5215 leading = !!options.leading;
5216 maxing = 'maxWait' in options;
5217 maxWait = maxing ? nativeMax$1(toNumber_1(options.maxWait) || 0, wait) : maxWait;
5218 trailing = 'trailing' in options ? !!options.trailing : trailing;
5219 }
5220
5221 function invokeFunc(time) {
5222 var args = lastArgs,
5223 thisArg = lastThis;
5224
5225 lastArgs = lastThis = undefined;
5226 lastInvokeTime = time;
5227 result = func.apply(thisArg, args);
5228 return result;
5229 }
5230
5231 function leadingEdge(time) {
5232 // Reset any `maxWait` timer.
5233 lastInvokeTime = time;
5234 // Start the timer for the trailing edge.
5235 timerId = setTimeout(timerExpired, wait);
5236 // Invoke the leading edge.
5237 return leading ? invokeFunc(time) : result;
5238 }
5239
5240 function remainingWait(time) {
5241 var timeSinceLastCall = time - lastCallTime,
5242 timeSinceLastInvoke = time - lastInvokeTime,
5243 timeWaiting = wait - timeSinceLastCall;
5244
5245 return maxing
5246 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
5247 : timeWaiting;
5248 }
5249
5250 function shouldInvoke(time) {
5251 var timeSinceLastCall = time - lastCallTime,
5252 timeSinceLastInvoke = time - lastInvokeTime;
5253
5254 // Either this is the first call, activity has stopped and we're at the
5255 // trailing edge, the system time has gone backwards and we're treating
5256 // it as the trailing edge, or we've hit the `maxWait` limit.
5257 return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
5258 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
5259 }
5260
5261 function timerExpired() {
5262 var time = now_1();
5263 if (shouldInvoke(time)) {
5264 return trailingEdge(time);
5265 }
5266 // Restart the timer.
5267 timerId = setTimeout(timerExpired, remainingWait(time));
5268 }
5269
5270 function trailingEdge(time) {
5271 timerId = undefined;
5272
5273 // Only invoke if we have `lastArgs` which means `func` has been
5274 // debounced at least once.
5275 if (trailing && lastArgs) {
5276 return invokeFunc(time);
5277 }
5278 lastArgs = lastThis = undefined;
5279 return result;
5280 }
5281
5282 function cancel() {
5283 if (timerId !== undefined) {
5284 clearTimeout(timerId);
5285 }
5286 lastInvokeTime = 0;
5287 lastArgs = lastCallTime = lastThis = timerId = undefined;
5288 }
5289
5290 function flush() {
5291 return timerId === undefined ? result : trailingEdge(now_1());
5292 }
5293
5294 function debounced() {
5295 var time = now_1(),
5296 isInvoking = shouldInvoke(time);
5297
5298 lastArgs = arguments;
5299 lastThis = this;
5300 lastCallTime = time;
5301
5302 if (isInvoking) {
5303 if (timerId === undefined) {
5304 return leadingEdge(lastCallTime);
5305 }
5306 if (maxing) {
5307 // Handle invocations in a tight loop.
5308 clearTimeout(timerId);
5309 timerId = setTimeout(timerExpired, wait);
5310 return invokeFunc(lastCallTime);
5311 }
5312 }
5313 if (timerId === undefined) {
5314 timerId = setTimeout(timerExpired, wait);
5315 }
5316 return result;
5317 }
5318 debounced.cancel = cancel;
5319 debounced.flush = flush;
5320 return debounced;
5321}
5322
5323var debounce_1 = debounce;
5324
5325const emptyObject = {};
5326
5327const createBlessedRenderer = function (blessed) {
5328 let screenRef = null;
5329 const BlessedReconciler = ReactFiberReconciler__default['default']({
5330 supportsMutation: true,
5331 supportsPersistence: false,
5332
5333 getRootHostContext(rootContainerInstance) {
5334 return emptyObject;
5335 },
5336
5337 getChildHostContext(parentHostContext, type) {
5338 return emptyObject;
5339 },
5340
5341 getPublicInstance(instance) {
5342 return instance;
5343 },
5344
5345 createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
5346 const _solveClass = solveClass(props),
5347 appliedProps = _objectWithoutProperties(_solveClass, ["children"]);
5348
5349 const blessedTypePrefix = 'blessed-';
5350
5351 if (type.startsWith(blessedTypePrefix)) {
5352 type = type.slice(blessedTypePrefix.length);
5353 }
5354
5355 const instance = blessed[type](_objectSpread2(_objectSpread2({}, appliedProps), {}, {
5356 screen: screenRef
5357 }));
5358 instance.props = props;
5359
5360 instance._eventListener = (...args) => eventListener(instance, ...args);
5361
5362 instance.on('event', instance._eventListener);
5363 return instance;
5364 },
5365
5366 appendInitialChild(parentInstance, child) {
5367 parentInstance.append(child);
5368 },
5369
5370 finalizeInitialChildren(instance, type, props, rootContainerInstance) {
5371 const _solveClass2 = solveClass(props),
5372 appliedProps = _objectWithoutProperties(_solveClass2, ["children"]);
5373
5374 update(instance, appliedProps);
5375 instance.props = props;
5376 return false;
5377 },
5378
5379 prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, hostContext) {
5380 return solveClass(newProps);
5381 },
5382
5383 shouldSetTextContent(props) {
5384 return false;
5385 },
5386
5387 now: Date.now,
5388
5389 createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
5390 return blessed.text({
5391 content: text,
5392 screen: screenRef
5393 });
5394 },
5395
5396 prepareForCommit() {
5397 // noop but must return `null` to avoid issues related to node removal
5398 return null;
5399 },
5400
5401 resetAfterCommit() {// noop
5402 },
5403
5404 commitMount(instance, type, newProps, internalInstanceHandle) {
5405 throw new Error('commitMount not implemented. Please post a reproducible use case that calls this method at https://github.com/Yomguithereal/react-blessed/issues/new');
5406 },
5407
5408 commitUpdate(instance, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
5409 instance._updating = true;
5410 update(instance, updatePayload); // update event handler pointers
5411
5412 instance.props = newProps;
5413 instance._updating = false;
5414 instance.screen.debouncedRender();
5415 },
5416
5417 commitTextUpdate(textInstance, oldText, newText) {
5418 textInstance.setContent(newText);
5419 textInstance.screen.debouncedRender();
5420 },
5421
5422 appendChild(parentInstance, child) {
5423 parentInstance.append(child);
5424 },
5425
5426 appendChildToContainer(parentInstance, child) {
5427 parentInstance.append(child);
5428 },
5429
5430 insertBefore(parentInstance, child, beforeChild) {
5431 // pretty sure everything is absolutely positioned so insertBefore ~= append
5432 parentInstance.append(child);
5433 },
5434
5435 insertInContainerBefore(parentInstance, child, beforeChild) {
5436 // pretty sure everything is absolutely positioned so insertBefore ~= append
5437 parentInstance.append(child);
5438 },
5439
5440 removeChild(parentInstance, child) {
5441 parentInstance.remove(child);
5442 child.off('event', child._eventListener);
5443 child.forDescendants(function (el) {
5444 el.off('event', child._eventListener);
5445 });
5446 child.destroy();
5447 },
5448
5449 removeChildFromContainer(parentInstance, child) {
5450 parentInstance.remove(child);
5451 child.off('event', child._eventListener);
5452 child.forDescendants(function (el) {
5453 el.off('event', child._eventListener);
5454 });
5455 child.destroy();
5456 },
5457
5458 resetTextContent(instance) {
5459 instance.setContent('');
5460 },
5461
5462 clearContainer(container) {
5463 container.render();
5464 }
5465
5466 });
5467 BlessedReconciler.injectIntoDevTools(devtools);
5468 const roots = new Map();
5469 return function render(element, screen, callback) {
5470 screenRef = screen;
5471 let root = roots.get(screen);
5472
5473 if (!root) {
5474 root = BlessedReconciler.createContainer(screen);
5475 roots.set(screen, root);
5476 }
5477
5478 screen.once('destroy', () => {
5479 console.log('screen was destroyed!');
5480 }); // render at most every 16ms. Should sync this with the screen refresh rate
5481 // probably if possible
5482
5483 screen.debouncedRender = debounce_1(() => screen.render(), 16);
5484 BlessedReconciler.updateContainer(element, root, null, callback);
5485 screen.debouncedRender();
5486 return BlessedReconciler.getPublicRootInstance(root);
5487 };
5488};
5489
5490module.exports = {
5491 render: function render(element, screen, callback) {
5492 const blessed = require('blessed');
5493
5494 const renderer = createBlessedRenderer(blessed);
5495 return renderer(element, screen, callback);
5496 },
5497 createBlessedRenderer: createBlessedRenderer
5498};
5499//# sourceMappingURL=index.js.map