UNPKG

11.9 kBJavaScriptView Raw
1/** @license React v16.13.0
2 * react-test-renderer-shallow.production.min.js
3 *
4 * Copyright (c) Facebook, Inc. and its affiliates.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the root directory of this source tree.
8 */
9'use strict';(function(l,k){"object"===typeof exports&&"undefined"!==typeof module?module.exports=k(require("react")):"function"===typeof define&&define.amd?define(["react"],k):(l=l||self,l.ReactShallowRenderer=k(l.React))})(this,function(l){function k(a){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+a,b=1;b<arguments.length;b++)c+="&args[]="+encodeURIComponent(arguments[b]);return"Minified React error #"+a+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}
10function n(a){if("object"===typeof a&&null!==a){var c=a.$$typeof;switch(c){case K:switch(a=a.type,a){case L:case M:case z:case A:case B:case C:return a;default:switch(a=a&&a.$$typeof,a){case D:case q:case E:case m:case F:return a;default:return c}}case G:return c}}}function r(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case z:return"Fragment";case G:return"Portal";case A:return"Profiler";case B:return"StrictMode";
11case C:return"Suspense";case N:return"SuspenseList"}if("object"===typeof a)switch(a.$$typeof){case D:return"Context.Consumer";case F:return"Context.Provider";case q:var c=a.render;c=c.displayName||c.name||"";return a.displayName||(""!==c?"ForwardRef("+c+")":"ForwardRef");case m:return r(a.type);case O:return r(a.render);case E:if(a=1===a._status?a._result:null)return r(a)}return null}function P(a,c){return a===c&&(0!==a||1/a===1/c)||a!==a&&c!==c}function v(a,c){if(w(a,c))return!0;if("object"!==typeof a||
12null===a||"object"!==typeof c||null===c)return!1;var b=Object.keys(a),d=Object.keys(c);if(b.length!==d.length)return!1;for(d=0;d<b.length;d++)if(!Q.call(c,b[d])||!w(a[b[d]],c[b[d]]))return!1;return!0}function H(){return{memoizedState:null,queue:null,next:null}}function I(a,c){return"function"===typeof c?c(a):c}var x=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,e="function"===typeof Symbol&&Symbol.for,K=e?Symbol.for("react.element"):60103,G=e?Symbol.for("react.portal"):60106,z=e?Symbol.for("react.fragment"):
1360107,B=e?Symbol.for("react.strict_mode"):60108,A=e?Symbol.for("react.profiler"):60114,F=e?Symbol.for("react.provider"):60109,D=e?Symbol.for("react.context"):60110,L=e?Symbol.for("react.async_mode"):60111,M=e?Symbol.for("react.concurrent_mode"):60111,q=e?Symbol.for("react.forward_ref"):60112,C=e?Symbol.for("react.suspense"):60113,N=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,E=e?Symbol.for("react.lazy"):60116,O=e?Symbol.for("react.block"):60121,R=q,w="function"===
14typeof Object.is?Object.is:P,Q=Object.prototype.hasOwnProperty;e=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;e.hasOwnProperty("ReactCurrentDispatcher")||(e.ReactCurrentDispatcher={current:null});e.hasOwnProperty("ReactCurrentBatchConfig")||(e.ReactCurrentBatchConfig={suspense:null});var y=e.ReactCurrentDispatcher,t={},S=function(){function a(b){this._renderer=b;this._callbacks=[]}var c=a.prototype;c._enqueueCallback=function(b,d){"function"===typeof b&&d&&this._callbacks.push({callback:b,
15publicInstance:d})};c._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};c.isMounted=function(b){return!!this._renderer._element};c.enqueueForceUpdate=function(b,d,a){this._enqueueCallback(d,b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};c.enqueueReplaceState=function(b,d,a,c){this._enqueueCallback(a,b);this._renderer._newState=d;this._renderer.render(this._renderer._element,
16this._renderer._context)};c.enqueueSetState=function(b,d,a,c){this._enqueueCallback(a,b);a=this._renderer._newState||b.state;"function"===typeof d&&(d=d.call(b,a,b.props));null!==d&&void 0!==d&&(this._renderer._newState=x({},a,{},d),this._renderer.render(this._renderer._element,this._renderer._context))};return a}(),u=function(){function a(){this._reset()}var c=a.prototype;c._reset=function(){this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=
17!1;this._updater=new S(this);this._dispatcher=this._createDispatcher();this._firstWorkInProgressHook=this._workInProgressHook=null;this._didScheduleRenderPhaseUpdate=this._isReRender=!1;this._renderPhaseUpdates=null;this._numberOfReRenders=0};c._validateCurrentlyRenderingComponent=function(){if(!this._rendering||this._instance)throw Error(k(321));};c._createDispatcher=function(){var b=this,a=function(a,c,d){b._validateCurrentlyRenderingComponent();b._createWorkInProgressHook();var f=b._workInProgressHook;
18if(b._isReRender){d=f.queue;c=d.dispatch;if(0<b._numberOfReRenders){if(null!==b._renderPhaseUpdates){var g=b._renderPhaseUpdates.get(d);if(void 0!==g){b._renderPhaseUpdates.delete(d);d=f.memoizedState;do d=a(d,g.action),g=g.next;while(null!==g);f.memoizedState=d;return[d,c]}}return[f.memoizedState,c]}g=f.memoizedState;var p=d.first;if(null!==p){do g=a(g,p.action),p=p.next;while(null!==p);d.first=null;f.memoizedState=g}return[g,c]}a=a===I?"function"===typeof c?c():c:void 0!==d?d(c):c;f.memoizedState=
19a;a=f.queue={first:null,dispatch:null};a=a.dispatch=b._dispatchAction.bind(b,a);return[f.memoizedState,a]},c=function(){b._validateCurrentlyRenderingComponent()};return{readContext:function(b,a){return b._currentValue},useCallback:function(b){return b},useContext:function(a){b._validateCurrentlyRenderingComponent();return a._currentValue},useDebugValue:c,useEffect:c,useImperativeHandle:c,useLayoutEffect:c,useMemo:function(a,d){b._validateCurrentlyRenderingComponent();b._createWorkInProgressHook();
20d=void 0!==d?d:null;if(null!==b._workInProgressHook&&null!==b._workInProgressHook.memoizedState){var c=b._workInProgressHook.memoizedState,f=c[1];if(null!==d){a:if(null===f)f=!1;else{for(var g=0;g<f.length&&g<d.length;g++)if(!w(d[g],f[g])){f=!1;break a}f=!0}if(f)return c[0]}}a=a();b._workInProgressHook.memoizedState=[a,d];return a},useReducer:a,useRef:function(a){b._validateCurrentlyRenderingComponent();b._createWorkInProgressHook();var d=b._workInProgressHook.memoizedState;return null===d?(a={current:a},
21b._workInProgressHook.memoizedState=a):d},useState:function(b){return a(I,b)},useResponder:function(b,a){return{props:a,responder:b}},useTransition:function(a){b._validateCurrentlyRenderingComponent();return[function(b){b()},!1]},useDeferredValue:function(a,d){b._validateCurrentlyRenderingComponent();return a}}};c._dispatchAction=function(b,a){if(!(25>this._numberOfReRenders))throw Error(k(301));if(this._rendering){this._didScheduleRenderPhaseUpdate=!0;a={action:a,next:null};var d=this._renderPhaseUpdates;
22null===d&&(this._renderPhaseUpdates=d=new Map);var c=d.get(b);if(void 0===c)d.set(b,a);else{for(b=c;null!==b.next;)b=b.next;b.next=a}}else{a={action:a,next:null};d=b.first;if(null===d)b.first=a;else{for(;null!==d.next;)d=d.next;d.next=a}this.render(this._element,this._context)}};c._createWorkInProgressHook=function(){null===this._workInProgressHook?null===this._firstWorkInProgressHook?(this._isReRender=!1,this._firstWorkInProgressHook=this._workInProgressHook=H()):(this._isReRender=!0,this._workInProgressHook=
23this._firstWorkInProgressHook):null===this._workInProgressHook.next?(this._isReRender=!1,this._workInProgressHook=this._workInProgressHook.next=H()):(this._isReRender=!0,this._workInProgressHook=this._workInProgressHook.next);return this._workInProgressHook};c._finishHooks=function(b,a){this._didScheduleRenderPhaseUpdate?(this._didScheduleRenderPhaseUpdate=!1,this._numberOfReRenders+=1,this._workInProgressHook=null,this._rendering=!1,this.render(b,a)):(this._renderPhaseUpdates=this._workInProgressHook=
24null,this._numberOfReRenders=0)};c.getMountedInstance=function(){return this._instance};c.getRenderOutput=function(){return this._rendered};c.render=function(b){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t;if(!l.isValidElement(b))throw Error(k(12,"function"===typeof b?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":""));if("string"===typeof b.type)throw Error(k(13,b.type));if(n(b)!==q&&"function"!==typeof b.type&&n(b)!==
25m)throw Error(k(249,Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type));if(!this._rendering){null!=this._element&&this._element.type!==b.type&&this._reset();var c=n(b)===m?b.type.type:b.type,g=this._element;this._rendering=!0;this._element=b;var e;if((e=c.contextTypes)&&a){var J={},h;for(h in e)J[h]=a[h];e=J}else e=t;this._context=e;n(b)===m&&c.propTypes&&r(c);if(this._instance)this._updateClassComponent(c,b,this._context);else if(c.prototype&&c.prototype.isReactComponent)this._instance=
26new c(b.props,this._context,this._updater),"function"===typeof c.getDerivedStateFromProps&&(a=c.getDerivedStateFromProps.call(null,b.props,this._instance.state),null!=a&&(this._instance.state=x({},this._instance.state,a))),this._mountClassComponent(c,b,this._context);else if(e=!0,n(b)===m&&null!==g&&(b.type.compare||v)(g.props,b.props)&&(e=!1),e){g=y.current;y.current=this._dispatcher;try{if(c.$$typeof===R){if("function"!==typeof c.render)throw Error(k(322,typeof c.render));this._rendered=c.render.call(void 0,
27b.props,b.ref)}else this._rendered=c(b.props,this._context)}finally{y.current=g}this._finishHooks(b,a)}this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};c.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._reset()};c._mountClassComponent=function(b,a,c){this._instance.context=c;this._instance.props=a.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;
28if("function"===typeof this._instance.UNSAFE_componentWillMount||"function"===typeof this._instance.componentWillMount)a=this._newState,"function"!==typeof b.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),a!==this._newState&&(this._instance.state=this._newState||t);
29this._rendered=this._instance.render()};c._updateClassComponent=function(a,c,e){c=c.props;var b=this._instance.state||t,d=this._instance.props;d!==c&&"function"!==typeof a.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(c,e),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(c,e));var f=this._newState||
30b;if("function"===typeof a.getDerivedStateFromProps){var h=a.getDerivedStateFromProps.call(null,c,f);null!=h&&(f=x({},f,h))}h=!0;this._forcedUpdate?(h=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?h=!!this._instance.shouldComponentUpdate(c,f,e):a.prototype&&a.prototype.isPureReactComponent&&(h=!v(d,c)||!v(b,f));h&&"function"!==typeof a.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&
31this._instance.componentWillUpdate(c,f,e),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(c,f,e));this._instance.context=e;this._instance.props=c;this._instance.state=f;this._newState=null;h&&(this._rendered=this._instance.render())};return a}();u.createRenderer=function(){return new u};return u.default||u});