"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("./Context.js"),r=require("../utils/Subscription.js"),o=require("../utils/useIsomorphicLayoutEffect.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=s(e);exports.default=function(s){let{store:n,context:i,children:c,serverState:a}=s;const f=e.useMemo((()=>{const e=r.createSubscription(n);return{store:n,subscription:e,getServerState:a?()=>a:void 0}}),[n,a]),d=e.useMemo((()=>n.getState()),[n]);o.useIsomorphicLayoutEffect((()=>{const{subscription:e}=f;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),d!==n.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}}),[f,d]);const b=i||t.ReactReduxContext;return u.default.createElement(b.Provider,{value:f},c)};
//# sourceMappingURL=Provider.js.map
