UNPKG

12 kBJavaScriptView Raw
1/** @license React v16.8.6
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,p){"object"===typeof exports&&"undefined"!==typeof module?module.exports=p(require("react")):"function"===typeof define&&define.amd?define(["react"],p):l.ReactShallowRenderer=p(l.React)})(this,function(l){function p(a,b,d,c,g,k,h,f){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var e=[d,c,g,k,h,f],M=0;a=Error(b.replace(/%s/g,function(){return e[M++]}));
10a.name="Invariant Violation"}a.framesToPop=1;throw a;}}function m(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);p(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d)}function q(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case N:switch(a=a.type,a){case O:case A:case B:case C:case D:case E:return a;
11default:switch(a=a&&a.$$typeof,a){case F:case r:case G:return a;default:return b}}case H:case n:case I:return b}}}function v(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 A:return"ConcurrentMode";case B:return"Fragment";case I:return"Portal";case C:return"Profiler";case D:return"StrictMode";case E:return"Suspense"}if("object"===typeof a)switch(a.$$typeof){case F:return"Context.Consumer";case G:return"Context.Provider";
12case r:var b=a.render;b=b.displayName||b.name||"";return a.displayName||(""!==b?"ForwardRef("+b+")":"ForwardRef");case n:return v(a.type);case H:if(a=1===a._status?a._result:null)return v(a)}return null}function w(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}function x(a,b){if(w(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var d=Object.keys(a),c=Object.keys(b);if(d.length!==c.length)return!1;for(c=0;c<d.length;c++)if(!P.call(b,d[c])||!w(a[d[c]],b[d[c]]))return!1;
13return!0}function J(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function K(){return{memoizedState:null,queue:null,next:null}}function L(a,b){return"function"===typeof b?b(a):b}var y=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,e="function"===typeof Symbol&&Symbol.for,N=e?Symbol.for("react.element"):60103,I=e?Symbol.for("react.portal"):60106,B=e?Symbol.for("react.fragment"):60107,D=e?Symbol.for("react.strict_mode"):60108,C=e?Symbol.for("react.profiler"):
1460114,G=e?Symbol.for("react.provider"):60109,F=e?Symbol.for("react.context"):60110,O=e?Symbol.for("react.async_mode"):60111,A=e?Symbol.for("react.concurrent_mode"):60111,r=e?Symbol.for("react.forward_ref"):60112,E=e?Symbol.for("react.suspense"):60113,n=e?Symbol.for("react.memo"):60115,H=e?Symbol.for("react.lazy"):60116,Q=r,P=Object.prototype.hasOwnProperty;e=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;e.hasOwnProperty("ReactCurrentDispatcher")||(e.ReactCurrentDispatcher={current:null});var z=
15e.ReactCurrentDispatcher,t={},R=function(){function a(b){J(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};a.prototype._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};a.prototype.isMounted=function(b){return!!this._renderer._element};a.prototype.enqueueForceUpdate=function(b,a,c){this._enqueueCallback(a,
16b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(b,a,c,g){this._enqueueCallback(c,b);this._renderer._newState=a;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(b,a,c,g){this._enqueueCallback(c,b);c=this._renderer._newState||b.state;"function"===typeof a&&(a=a.call(b,c,b.props));null!==a&&void 0!==a&&(this._renderer._newState=y({},c,a),this._renderer.render(this._renderer._element,
17this._renderer._context))};return a}(),u=function(){function a(){J(this,a);this._reset()}a.prototype._reset=function(){this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new R(this);this._dispatcher=this._createDispatcher();this._firstWorkInProgressHook=this._workInProgressHook=null;this._didScheduleRenderPhaseUpdate=this._isReRender=!1;this._renderPhaseUpdates=null;this._numberOfReRenders=0};a.prototype._validateCurrentlyRenderingComponent=
18function(){!this._rendering||this._instance?m("321"):void 0};a.prototype._createDispatcher=function(){var b=this,a=function(a,c,d){b._validateCurrentlyRenderingComponent();b._createWorkInProgressHook();var f=b._workInProgressHook;if(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,
19c]}}return[f.memoizedState,c]}g=f.memoizedState;var k=d.first;if(null!==k){do g=a(g,k.action),k=k.next;while(null!==k);d.first=null;f.memoizedState=g}return[g,c]}a=a===L?"function"===typeof c?c():c:void 0!==d?d(c):c;f.memoizedState=a;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();
20return a._currentValue},useDebugValue:c,useEffect:c,useImperativeHandle:c,useLayoutEffect:c,useMemo:function(a,c){b._validateCurrentlyRenderingComponent();b._createWorkInProgressHook();c=void 0!==c?c:null;if(null!==b._workInProgressHook&&null!==b._workInProgressHook.memoizedState){var d=b._workInProgressHook.memoizedState,f=d[1];if(null!==c){a:if(null===f)f=!1;else{for(var g=0;g<f.length&&g<c.length;g++)if(!w(c[g],f[g])){f=!1;break a}f=!0}if(f)return d[0]}}a=a();b._workInProgressHook.memoizedState=
21[a,c];return a},useReducer:a,useRef:function(a){b._validateCurrentlyRenderingComponent();b._createWorkInProgressHook();var c=b._workInProgressHook.memoizedState;return null===c?(a={current:a},b._workInProgressHook.memoizedState=a):c},useState:function(b){return a(L,b)}}};a.prototype._dispatchAction=function(b,a){25>this._numberOfReRenders?void 0:m("301");if(this._rendering){this._didScheduleRenderPhaseUpdate=!0;a={action:a,next:null};var c=this._renderPhaseUpdates;null===c&&(this._renderPhaseUpdates=
22c=new Map);var d=c.get(b);if(void 0===d)c.set(b,a);else{for(b=d;null!==b.next;)b=b.next;b.next=a}}else{a={action:a,next:null};c=b.first;if(null===c)b.first=a;else{for(;null!==c.next;)c=c.next;c.next=a}this.render(this._element,this._context)}};a.prototype._createWorkInProgressHook=function(){null===this._workInProgressHook?null===this._firstWorkInProgressHook?(this._isReRender=!1,this._firstWorkInProgressHook=this._workInProgressHook=K()):(this._isReRender=!0,this._workInProgressHook=this._firstWorkInProgressHook):
23null===this._workInProgressHook.next?(this._isReRender=!1,this._workInProgressHook=this._workInProgressHook.next=K()):(this._isReRender=!0,this._workInProgressHook=this._workInProgressHook.next);return this._workInProgressHook};a.prototype._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=null,this._numberOfReRenders=
240)};a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t;l.isValidElement(a)?void 0:m("12","function"===typeof a?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":"");"string"===typeof a.type?m("13",a.type):void 0;q(a)!==r&&"function"!==typeof a.type&&q(a.type)!==n?m("249",Array.isArray(a.type)?
25"array":null===a.type?"null":typeof a.type):void 0;if(!this._rendering){null!=this._element&&this._element.type!==a.type&&this._reset();var c=q(a.type)===n?a.type.type:a.type,g=this._element;this._rendering=!0;this._element=a;var e;if((e=c.contextTypes)&&b){var h={},f;for(f in e)h[f]=b[f];e=h}else e=t;this._context=e;q(a.type)===n&&c.propTypes&&v(c);if(this._instance)this._updateClassComponent(c,a,this._context);else if(c.prototype&&c.prototype.isReactComponent)this._instance=new c(a.props,this._context,
26this._updater),"function"===typeof c.getDerivedStateFromProps&&(b=c.getDerivedStateFromProps.call(null,a.props,this._instance.state),null!=b&&(this._instance.state=y({},this._instance.state,b))),this._mountClassComponent(c,a,this._context);else if(e=!0,q(a.type)===n&&null!==g&&(a.type.compare||x)(g.props,a.props)&&(e=!1),e){g=z.current;z.current=this._dispatcher;try{c.$$typeof===Q?("function"!==typeof c.render?m("322",typeof c.render):void 0,this._rendered=c.render.call(void 0,a.props,a.ref)):this._rendered=
27c(a.props,this._context)}finally{z.current=g}this._finishHooks(a,b)}this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};a.prototype.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._reset()};a.prototype._mountClassComponent=function(a,d,c){this._instance.context=c;this._instance.props=d.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;if("function"===
28typeof this._instance.UNSAFE_componentWillMount||"function"===typeof this._instance.componentWillMount)d=this._newState,"function"!==typeof a.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),d!==this._newState&&(this._instance.state=this._newState||t);this._rendered=
29this._instance.render()};a.prototype._updateClassComponent=function(a,d,c){d=d.props;var b=this._instance.state||t,e=this._instance.props;e!==d&&"function"!==typeof a.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(d,c),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(d,c));var h=this._newState||
30b;if("function"===typeof a.getDerivedStateFromProps){var f=a.getDerivedStateFromProps.call(null,d,h);null!=f&&(h=y({},h,f))}f=!0;this._forcedUpdate?(f=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?f=!!this._instance.shouldComponentUpdate(d,h,c):a.prototype&&a.prototype.isPureReactComponent&&(f=!x(e,d)||!x(b,h));f&&"function"!==typeof a.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&
31this._instance.componentWillUpdate(d,h,c),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(d,h,c));this._instance.context=c;this._instance.props=d;this._instance.state=h;this._newState=null;f&&(this._rendered=this._instance.render())};return a}();u.createRenderer=function(){return new u};e=(e={default:u},u)||e;return e.default||e});