1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | 'use strict';(function(m,k){"object"===typeof exports&&"undefined"!==typeof module?module.exports=k(require("react")):"function"===typeof define&&define.amd?define(["react"],k):m.ReactShallowRenderer=k(m.React)})(this,function(m){function k(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,d=1;d<arguments.length;d++)b+="&args[]="+encodeURIComponent(arguments[d]);return Error("Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ")}
|
10 | function p(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case L:switch(a=a.type,a){case M:case z:case A:case B:case C:case D:return a;default:switch(a=a&&a.$$typeof,a){case E:case q:case F:return a;default:return b}}case G:case n:case H:return b}}}function u(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"ConcurrentMode";case A:return"Fragment";case H:return"Portal";case B:return"Profiler";
|
11 | case C:return"StrictMode";case D:return"Suspense"}if("object"===typeof a)switch(a.$$typeof){case E:return"Context.Consumer";case F:return"Context.Provider";case q:var b=a.render;b=b.displayName||b.name||"";return a.displayName||(""!==b?"ForwardRef("+b+")":"ForwardRef");case n:return u(a.type);case G:if(a=1===a._status?a._result:null)return u(a);break;case N:a=a.displayName;if(void 0!==a)return a;break;case O:if(a.type===P)return"TouchHitTarget";a=a.displayName;if(void 0!==a)return a}return null}function v(a,
|
12 | b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}function w(a,b){if(v(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(!Q.call(b,d[c])||!v(a[d[c]],b[d[c]]))return!1;return!0}function I(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function J(){return{memoizedState:null,queue:null,next:null}}function K(a,b){return"function"===typeof b?
|
13 | b(a):b}var x=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,e="function"===typeof Symbol&&Symbol.for,L=e?Symbol.for("react.element"):60103,H=e?Symbol.for("react.portal"):60106,A=e?Symbol.for("react.fragment"):60107,C=e?Symbol.for("react.strict_mode"):60108,B=e?Symbol.for("react.profiler"):60114,F=e?Symbol.for("react.provider"):60109,E=e?Symbol.for("react.context"):60110,M=e?Symbol.for("react.async_mode"):60111,z=e?Symbol.for("react.concurrent_mode"):60111,q=e?Symbol.for("react.forward_ref"):
|
14 | 60112,D=e?Symbol.for("react.suspense"):60113,n=e?Symbol.for("react.memo"):60115,G=e?Symbol.for("react.lazy"):60116,N=e?Symbol.for("react.event_component"):60117,O=e?Symbol.for("react.event_target"):60118,P=e?Symbol.for("react.event_target.touch_hit"):60119,R=q,Q=Object.prototype.hasOwnProperty;e=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;e.hasOwnProperty("ReactCurrentDispatcher")||(e.ReactCurrentDispatcher={current:null});var y=e.ReactCurrentDispatcher,r={},S=function(){function a(b){I(this,
|
15 | 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,b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,
|
16 | 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=x({},c,a),this._renderer.render(this._renderer._element,this._renderer._context))};return a}(),
|
17 | t=function(){function a(){I(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 S(this);this._dispatcher=this._createDispatcher();this._firstWorkInProgressHook=this._workInProgressHook=null;this._didScheduleRenderPhaseUpdate=this._isReRender=!1;this._renderPhaseUpdates=null;this._numberOfReRenders=0};a.prototype._validateCurrentlyRenderingComponent=function(){if(!this._rendering||
|
18 | this._instance)throw k(321);};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,c]}}return[f.memoizedState,c]}g=
|
19 | f.memoizedState;var e=d.first;if(null!==e){do g=a(g,e.action),e=e.next;while(null!==e);d.first=null;f.memoizedState=g}return[g,c]}a=a===K?"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();
|
20 | return 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,e=d[1];if(null!==c){a:if(null===e)e=!1;else{for(var g=0;g<e.length&&g<c.length;g++)if(!v(c[g],e[g])){e=!1;break a}e=!0}if(e)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(K,b)}}};a.prototype._dispatchAction=function(b,a){if(!(25>this._numberOfReRenders))throw k(301);if(this._rendering){this._didScheduleRenderPhaseUpdate=!0;a={action:a,next:null};var c=this._renderPhaseUpdates;null===c&&(this._renderPhaseUpdates=
|
22 | c=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=J()):(this._isReRender=!0,this._workInProgressHook=this._firstWorkInProgressHook):
|
23 | null===this._workInProgressHook.next?(this._isReRender=!1,this._workInProgressHook=this._workInProgressHook.next=J()):(this._isReRender=!0,this._workInProgressHook=this._workInProgressHook.next);return this._workInProgressHook};a.prototype._finishHooks=function(a,d){this._didScheduleRenderPhaseUpdate?(this._didScheduleRenderPhaseUpdate=!1,this._numberOfReRenders+=1,this._workInProgressHook=null,this._rendering=!1,this.render(a,d)):(this._renderPhaseUpdates=this._workInProgressHook=null,this._numberOfReRenders=
|
24 | 0)};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]:r;if(!m.isValidElement(a))throw k(12,"function"===typeof a?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":"");if("string"===typeof a.type)throw k(13,a.type);if(p(a)!==q&&"function"!==typeof a.type&&p(a.type)!==n)throw k(249,
|
25 | Array.isArray(a.type)?"array":null===a.type?"null":typeof a.type);if(!this._rendering){null!=this._element&&this._element.type!==a.type&&this._reset();var c=p(a.type)===n?a.type.type:a.type,e=this._element;this._rendering=!0;this._element=a;var l;if((l=c.contextTypes)&&b){var h={},f;for(f in l)h[f]=b[f];l=h}else l=r;this._context=l;p(a.type)===n&&c.propTypes&&u(c);if(this._instance)this._updateClassComponent(c,a,this._context);else if(c.prototype&&c.prototype.isReactComponent)this._instance=new c(a.props,
|
26 | this._context,this._updater),"function"===typeof c.getDerivedStateFromProps&&(b=c.getDerivedStateFromProps.call(null,a.props,this._instance.state),null!=b&&(this._instance.state=x({},this._instance.state,b))),this._mountClassComponent(c,a,this._context);else if(l=!0,p(a.type)===n&&null!==e&&(a.type.compare||w)(e.props,a.props)&&(l=!1),l){e=y.current;y.current=this._dispatcher;try{if(c.$$typeof===R){if("function"!==typeof c.render)throw k(322,typeof c.render);this._rendered=c.render.call(void 0,a.props,
|
27 | a.ref)}else this._rendered=c(a.props,this._context)}finally{y.current=e}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=
|
28 | this._updater;if("function"===typeof 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||
|
29 | r);this._rendered=this._instance.render()};a.prototype._updateClassComponent=function(a,d,c){d=d.props;var b=this._instance.state||r,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));
|
30 | var h=this._newState||b;if("function"===typeof a.getDerivedStateFromProps){var f=a.getDerivedStateFromProps.call(null,d,h);null!=f&&(h=x({},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=!w(e,d)||!w(b,h));f&&"function"!==typeof a.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&
|
31 | this._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}();t.createRenderer=function(){return new t};e=(e={default:t},t)||e;return e.default||e});
|