import{useContext as r,useDebugValue as t,useReducer as n,useMemo as e,useRef as o}from"react";import{useReduxContext as u}from"./useReduxContext.js";import c from"../utils/Subscription.js";import{useIsomorphicLayoutEffect as i}from"../utils/useIsomorphicLayoutEffect.js";import{ReactReduxContext as s}from"../components/Context.js";var f=function(r,t){return r===t};function a(a){void 0===a&&(a=s);var p=a===s?u:function(){return r(a)};return function(r,u){if(void 0===u&&(u=f),"production"!==process.env.NODE_ENV){if(!r)throw new Error("You must pass a selector to useSelector");if("function"!=typeof r)throw new Error("You must pass a function as a selector to useSelector");if("function"!=typeof u)throw new Error("You must pass a function as an equality function to useSelector")}var s=p(),a=function(r,t,u,s){var f,a=n((function(r){return r+1}),0)[1],p=e((function(){return new c(u,s)}),[u,s]),m=o(),v=o(),h=o(),l=o(),w=u.getState();try{if(r!==v.current||w!==h.current||m.current){var y=r(w);f=void 0!==l.current&&t(y,l.current)?l.current:y}else f=l.current}catch(r){throw m.current&&(r.message+="\nThe error may be correlated with this previous error:\n"+m.current.stack+"\n\n"),r}return i((function(){v.current=r,h.current=w,l.current=f,m.current=void 0})),i((function(){function r(){try{var r=u.getState(),n=v.current(r);if(t(n,l.current))return;l.current=n,h.current=r}catch(r){m.current=r}a()}return p.onStateChange=r,p.trySubscribe(),r(),function(){return p.tryUnsubscribe()}}),[u,p]),f}(r,u,s.store,s.subscription);return t(a),a}}var p=a();export{a as createSelectorHook,p as useSelector};
//# sourceMappingURL=useSelector.js.map
