react-saga-redux 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +63 -0
  3. package/dist/index.d.mts +569 -0
  4. package/dist/index.d.ts +569 -0
  5. package/dist/index.js +1188 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +1138 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +100 -0
  10. package/src/components/Context.ts +50 -0
  11. package/src/components/Props.ts +111 -0
  12. package/src/components/Provider.tsx +105 -0
  13. package/src/components/connect.tsx +813 -0
  14. package/src/connect/invalidArgFactory.ts +14 -0
  15. package/src/connect/mapDispatchToProps.ts +25 -0
  16. package/src/connect/mapProps.ts +43 -0
  17. package/src/connect/mapStateToProps.ts +14 -0
  18. package/src/connect/mergeProps.ts +78 -0
  19. package/src/connect/selectorFactory.ts +242 -0
  20. package/src/connect/verifySubselectors.ts +26 -0
  21. package/src/connect/wrapMapToProps.ts +110 -0
  22. package/src/exports.ts +54 -0
  23. package/src/hooks/useDispatch.ts +104 -0
  24. package/src/hooks/useReduxContext.ts +42 -0
  25. package/src/hooks/useSelector.ts +286 -0
  26. package/src/hooks/useStore.ts +123 -0
  27. package/src/index-rsc.ts +34 -0
  28. package/src/index.ts +1 -0
  29. package/src/types.ts +180 -0
  30. package/src/utils/Subscription.ts +183 -0
  31. package/src/utils/batch.ts +4 -0
  32. package/src/utils/bindActionCreators.ts +16 -0
  33. package/src/utils/constants.ts +23 -0
  34. package/src/utils/hoistStatics.ts +139 -0
  35. package/src/utils/isPlainObject.ts +17 -0
  36. package/src/utils/react-is.ts +97 -0
  37. package/src/utils/react.ts +3 -0
  38. package/src/utils/shallowEqual.ts +36 -0
  39. package/src/utils/useIsomorphicLayoutEffect.ts +40 -0
  40. package/src/utils/useSyncExternalStore.ts +9 -0
  41. package/src/utils/verifyPlainObject.ts +14 -0
  42. package/src/utils/warning.ts +21 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,1138 @@
1
+ // src/utils/react.ts
2
+ import * as React from "react";
3
+
4
+ // src/utils/react-is.ts
5
+ var IS_REACT_19 = /* @__PURE__ */ React.version.startsWith("19");
6
+ var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for(
7
+ IS_REACT_19 ? "react.transitional.element" : "react.element"
8
+ );
9
+ var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
10
+ var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
11
+ var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode");
12
+ var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
13
+ var REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer");
14
+ var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
15
+ var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
16
+ var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
17
+ var REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for(
18
+ "react.suspense_list"
19
+ );
20
+ var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
21
+ var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
22
+ var REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen");
23
+ var REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for(
24
+ "react.client.reference"
25
+ );
26
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
27
+ var Memo = REACT_MEMO_TYPE;
28
+ function isValidElementType(type) {
29
+ return typeof type === "string" || typeof type === "function" || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_OFFSCREEN_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || type.getModuleId !== void 0) ? true : false;
30
+ }
31
+ function typeOf(object) {
32
+ if (typeof object === "object" && object !== null) {
33
+ const { $$typeof } = object;
34
+ switch ($$typeof) {
35
+ case REACT_ELEMENT_TYPE:
36
+ switch (object = object.type, object) {
37
+ case REACT_FRAGMENT_TYPE:
38
+ case REACT_PROFILER_TYPE:
39
+ case REACT_STRICT_MODE_TYPE:
40
+ case REACT_SUSPENSE_TYPE:
41
+ case REACT_SUSPENSE_LIST_TYPE:
42
+ return object;
43
+ default:
44
+ switch (object = object && object.$$typeof, object) {
45
+ case REACT_CONTEXT_TYPE:
46
+ case REACT_FORWARD_REF_TYPE:
47
+ case REACT_LAZY_TYPE:
48
+ case REACT_MEMO_TYPE:
49
+ return object;
50
+ case REACT_CONSUMER_TYPE:
51
+ return object;
52
+ default:
53
+ return $$typeof;
54
+ }
55
+ }
56
+ case REACT_PORTAL_TYPE:
57
+ return $$typeof;
58
+ }
59
+ }
60
+ }
61
+ function isContextConsumer(object) {
62
+ return IS_REACT_19 ? typeOf(object) === REACT_CONSUMER_TYPE : typeOf(object) === REACT_CONTEXT_TYPE;
63
+ }
64
+ function isMemo(object) {
65
+ return typeOf(object) === REACT_MEMO_TYPE;
66
+ }
67
+
68
+ // src/utils/warning.ts
69
+ function warning(message) {
70
+ if (typeof console !== "undefined" && typeof console.error === "function") {
71
+ console.error(message);
72
+ }
73
+ try {
74
+ throw new Error(message);
75
+ } catch (e) {
76
+ }
77
+ }
78
+
79
+ // src/connect/verifySubselectors.ts
80
+ function verify(selector, methodName) {
81
+ if (!selector) {
82
+ throw new Error(`Unexpected value for ${methodName} in connect.`);
83
+ } else if (methodName === "mapStateToProps" || methodName === "mapDispatchToProps") {
84
+ if (!Object.prototype.hasOwnProperty.call(selector, "dependsOnOwnProps")) {
85
+ warning(
86
+ `The selector for ${methodName} of connect did not specify a value for dependsOnOwnProps.`
87
+ );
88
+ }
89
+ }
90
+ }
91
+ function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps) {
92
+ verify(mapStateToProps, "mapStateToProps");
93
+ verify(mapDispatchToProps, "mapDispatchToProps");
94
+ verify(mergeProps, "mergeProps");
95
+ }
96
+
97
+ // src/connect/selectorFactory.ts
98
+ function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, {
99
+ areStatesEqual,
100
+ areOwnPropsEqual,
101
+ areStatePropsEqual
102
+ }) {
103
+ let hasRunAtLeastOnce = false;
104
+ let state;
105
+ let ownProps;
106
+ let stateProps;
107
+ let dispatchProps;
108
+ let mergedProps;
109
+ function handleFirstCall(firstState, firstOwnProps) {
110
+ state = firstState;
111
+ ownProps = firstOwnProps;
112
+ stateProps = mapStateToProps(state, ownProps);
113
+ dispatchProps = mapDispatchToProps(dispatch, ownProps);
114
+ mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
115
+ hasRunAtLeastOnce = true;
116
+ return mergedProps;
117
+ }
118
+ function handleNewPropsAndNewState() {
119
+ stateProps = mapStateToProps(state, ownProps);
120
+ if (mapDispatchToProps.dependsOnOwnProps)
121
+ dispatchProps = mapDispatchToProps(dispatch, ownProps);
122
+ mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
123
+ return mergedProps;
124
+ }
125
+ function handleNewProps() {
126
+ if (mapStateToProps.dependsOnOwnProps)
127
+ stateProps = mapStateToProps(state, ownProps);
128
+ if (mapDispatchToProps.dependsOnOwnProps)
129
+ dispatchProps = mapDispatchToProps(dispatch, ownProps);
130
+ mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
131
+ return mergedProps;
132
+ }
133
+ function handleNewState() {
134
+ const nextStateProps = mapStateToProps(state, ownProps);
135
+ const statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps);
136
+ stateProps = nextStateProps;
137
+ if (statePropsChanged)
138
+ mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
139
+ return mergedProps;
140
+ }
141
+ function handleSubsequentCalls(nextState, nextOwnProps) {
142
+ const propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps);
143
+ const stateChanged = !areStatesEqual(
144
+ nextState,
145
+ state,
146
+ nextOwnProps,
147
+ ownProps
148
+ );
149
+ state = nextState;
150
+ ownProps = nextOwnProps;
151
+ if (propsChanged && stateChanged) return handleNewPropsAndNewState();
152
+ if (propsChanged) return handleNewProps();
153
+ if (stateChanged) return handleNewState();
154
+ return mergedProps;
155
+ }
156
+ return function pureFinalPropsSelector(nextState, nextOwnProps) {
157
+ return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps);
158
+ };
159
+ }
160
+ function finalPropsSelectorFactory(dispatch, {
161
+ initMapStateToProps,
162
+ initMapDispatchToProps,
163
+ initMergeProps,
164
+ ...options
165
+ }) {
166
+ const mapStateToProps = initMapStateToProps(dispatch, options);
167
+ const mapDispatchToProps = initMapDispatchToProps(dispatch, options);
168
+ const mergeProps = initMergeProps(dispatch, options);
169
+ if (process.env.NODE_ENV !== "production") {
170
+ verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps);
171
+ }
172
+ return pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
173
+ }
174
+
175
+ // src/utils/bindActionCreators.ts
176
+ function bindActionCreators(actionCreators, dispatch) {
177
+ const boundActionCreators = {};
178
+ for (const key in actionCreators) {
179
+ const actionCreator = actionCreators[key];
180
+ if (typeof actionCreator === "function") {
181
+ boundActionCreators[key] = (...args) => dispatch(actionCreator(...args));
182
+ }
183
+ }
184
+ return boundActionCreators;
185
+ }
186
+
187
+ // src/utils/isPlainObject.ts
188
+ function isPlainObject(obj) {
189
+ if (typeof obj !== "object" || obj === null) return false;
190
+ const proto = Object.getPrototypeOf(obj);
191
+ if (proto === null) return true;
192
+ let baseProto = proto;
193
+ while (Object.getPrototypeOf(baseProto) !== null) {
194
+ baseProto = Object.getPrototypeOf(baseProto);
195
+ }
196
+ return proto === baseProto;
197
+ }
198
+
199
+ // src/utils/verifyPlainObject.ts
200
+ function verifyPlainObject(value, displayName, methodName) {
201
+ if (!isPlainObject(value)) {
202
+ warning(
203
+ `${methodName}() in ${displayName} must return a plain object. Instead received ${value}.`
204
+ );
205
+ }
206
+ }
207
+
208
+ // src/connect/wrapMapToProps.ts
209
+ function wrapMapToPropsConstant(getConstant) {
210
+ return function initConstantSelector(dispatch) {
211
+ const constant = getConstant(dispatch);
212
+ function constantSelector() {
213
+ return constant;
214
+ }
215
+ constantSelector.dependsOnOwnProps = false;
216
+ return constantSelector;
217
+ };
218
+ }
219
+ function getDependsOnOwnProps(mapToProps) {
220
+ return mapToProps.dependsOnOwnProps ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;
221
+ }
222
+ function wrapMapToPropsFunc(mapToProps, methodName) {
223
+ return function initProxySelector(dispatch, { displayName }) {
224
+ const proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {
225
+ return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch, void 0);
226
+ };
227
+ proxy.dependsOnOwnProps = true;
228
+ proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
229
+ proxy.mapToProps = mapToProps;
230
+ proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
231
+ let props = proxy(stateOrDispatch, ownProps);
232
+ if (typeof props === "function") {
233
+ proxy.mapToProps = props;
234
+ proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
235
+ props = proxy(stateOrDispatch, ownProps);
236
+ }
237
+ if (process.env.NODE_ENV !== "production")
238
+ verifyPlainObject(props, displayName, methodName);
239
+ return props;
240
+ };
241
+ return proxy;
242
+ };
243
+ }
244
+
245
+ // src/connect/invalidArgFactory.ts
246
+ function createInvalidArgFactory(arg, name) {
247
+ return (dispatch, options) => {
248
+ throw new Error(
249
+ `Invalid value of type ${typeof arg} for ${name} argument when connecting component ${options.wrappedComponentName}.`
250
+ );
251
+ };
252
+ }
253
+
254
+ // src/connect/mapDispatchToProps.ts
255
+ function mapDispatchToPropsFactory(mapDispatchToProps) {
256
+ return mapDispatchToProps && typeof mapDispatchToProps === "object" ? wrapMapToPropsConstant(
257
+ (dispatch) => (
258
+ // @ts-ignore
259
+ bindActionCreators(mapDispatchToProps, dispatch)
260
+ )
261
+ ) : !mapDispatchToProps ? wrapMapToPropsConstant((dispatch) => ({
262
+ dispatch
263
+ })) : typeof mapDispatchToProps === "function" ? (
264
+ // @ts-ignore
265
+ wrapMapToPropsFunc(mapDispatchToProps, "mapDispatchToProps")
266
+ ) : createInvalidArgFactory(mapDispatchToProps, "mapDispatchToProps");
267
+ }
268
+
269
+ // src/connect/mapStateToProps.ts
270
+ function mapStateToPropsFactory(mapStateToProps) {
271
+ return !mapStateToProps ? wrapMapToPropsConstant(() => ({})) : typeof mapStateToProps === "function" ? (
272
+ // @ts-ignore
273
+ wrapMapToPropsFunc(mapStateToProps, "mapStateToProps")
274
+ ) : createInvalidArgFactory(mapStateToProps, "mapStateToProps");
275
+ }
276
+
277
+ // src/connect/mergeProps.ts
278
+ function defaultMergeProps(stateProps, dispatchProps, ownProps) {
279
+ return { ...ownProps, ...stateProps, ...dispatchProps };
280
+ }
281
+ function wrapMergePropsFunc(mergeProps) {
282
+ return function initMergePropsProxy(dispatch, { displayName, areMergedPropsEqual }) {
283
+ let hasRunOnce = false;
284
+ let mergedProps;
285
+ return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
286
+ const nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);
287
+ if (hasRunOnce) {
288
+ if (!areMergedPropsEqual(nextMergedProps, mergedProps))
289
+ mergedProps = nextMergedProps;
290
+ } else {
291
+ hasRunOnce = true;
292
+ mergedProps = nextMergedProps;
293
+ if (process.env.NODE_ENV !== "production")
294
+ verifyPlainObject(mergedProps, displayName, "mergeProps");
295
+ }
296
+ return mergedProps;
297
+ };
298
+ };
299
+ }
300
+ function mergePropsFactory(mergeProps) {
301
+ return !mergeProps ? () => defaultMergeProps : typeof mergeProps === "function" ? wrapMergePropsFunc(mergeProps) : createInvalidArgFactory(mergeProps, "mergeProps");
302
+ }
303
+
304
+ // src/utils/batch.ts
305
+ function defaultNoopBatch(callback) {
306
+ callback();
307
+ }
308
+
309
+ // src/utils/Subscription.ts
310
+ function createListenerCollection() {
311
+ let first = null;
312
+ let last = null;
313
+ return {
314
+ clear() {
315
+ first = null;
316
+ last = null;
317
+ },
318
+ notify() {
319
+ defaultNoopBatch(() => {
320
+ let listener = first;
321
+ while (listener) {
322
+ listener.callback();
323
+ listener = listener.next;
324
+ }
325
+ });
326
+ },
327
+ get() {
328
+ const listeners = [];
329
+ let listener = first;
330
+ while (listener) {
331
+ listeners.push(listener);
332
+ listener = listener.next;
333
+ }
334
+ return listeners;
335
+ },
336
+ subscribe(callback) {
337
+ let isSubscribed = true;
338
+ const listener = last = {
339
+ callback,
340
+ next: null,
341
+ prev: last
342
+ };
343
+ if (listener.prev) {
344
+ listener.prev.next = listener;
345
+ } else {
346
+ first = listener;
347
+ }
348
+ return function unsubscribe() {
349
+ if (!isSubscribed || first === null) return;
350
+ isSubscribed = false;
351
+ if (listener.next) {
352
+ listener.next.prev = listener.prev;
353
+ } else {
354
+ last = listener.prev;
355
+ }
356
+ if (listener.prev) {
357
+ listener.prev.next = listener.next;
358
+ } else {
359
+ first = listener.next;
360
+ }
361
+ };
362
+ }
363
+ };
364
+ }
365
+ var nullListeners = {
366
+ notify() {
367
+ },
368
+ get: () => []
369
+ };
370
+ function createSubscription(store, parentSub) {
371
+ let unsubscribe;
372
+ let listeners = nullListeners;
373
+ let subscriptionsAmount = 0;
374
+ let selfSubscribed = false;
375
+ function addNestedSub(listener) {
376
+ trySubscribe();
377
+ const cleanupListener = listeners.subscribe(listener);
378
+ let removed = false;
379
+ return () => {
380
+ if (!removed) {
381
+ removed = true;
382
+ cleanupListener();
383
+ tryUnsubscribe();
384
+ }
385
+ };
386
+ }
387
+ function notifyNestedSubs() {
388
+ listeners.notify();
389
+ }
390
+ function handleChangeWrapper() {
391
+ if (subscription.onStateChange) {
392
+ subscription.onStateChange();
393
+ }
394
+ }
395
+ function isSubscribed() {
396
+ return selfSubscribed;
397
+ }
398
+ function trySubscribe() {
399
+ subscriptionsAmount++;
400
+ if (!unsubscribe) {
401
+ unsubscribe = parentSub ? parentSub.addNestedSub(handleChangeWrapper) : store.subscribe(handleChangeWrapper);
402
+ listeners = createListenerCollection();
403
+ }
404
+ }
405
+ function tryUnsubscribe() {
406
+ subscriptionsAmount--;
407
+ if (unsubscribe && subscriptionsAmount === 0) {
408
+ unsubscribe();
409
+ unsubscribe = void 0;
410
+ listeners.clear();
411
+ listeners = nullListeners;
412
+ }
413
+ }
414
+ function trySubscribeSelf() {
415
+ if (!selfSubscribed) {
416
+ selfSubscribed = true;
417
+ trySubscribe();
418
+ }
419
+ }
420
+ function tryUnsubscribeSelf() {
421
+ if (selfSubscribed) {
422
+ selfSubscribed = false;
423
+ tryUnsubscribe();
424
+ }
425
+ }
426
+ const subscription = {
427
+ addNestedSub,
428
+ notifyNestedSubs,
429
+ handleChangeWrapper,
430
+ isSubscribed,
431
+ trySubscribe: trySubscribeSelf,
432
+ tryUnsubscribe: tryUnsubscribeSelf,
433
+ getListeners: () => listeners
434
+ };
435
+ return subscription;
436
+ }
437
+
438
+ // src/utils/useIsomorphicLayoutEffect.ts
439
+ var canUseDOM = () => !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
440
+ var isDOM = /* @__PURE__ */ canUseDOM();
441
+ var isRunningInReactNative = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
442
+ var isReactNative = /* @__PURE__ */ isRunningInReactNative();
443
+ var getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? React.useLayoutEffect : React.useEffect;
444
+ var useIsomorphicLayoutEffect = /* @__PURE__ */ getUseIsomorphicLayoutEffect();
445
+
446
+ // src/utils/shallowEqual.ts
447
+ function is(x, y) {
448
+ if (x === y) {
449
+ return x !== 0 || y !== 0 || 1 / x === 1 / y;
450
+ } else {
451
+ return x !== x && y !== y;
452
+ }
453
+ }
454
+ function shallowEqual(objA, objB) {
455
+ if (is(objA, objB)) return true;
456
+ if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
457
+ return false;
458
+ }
459
+ const keysA = Object.keys(objA);
460
+ const keysB = Object.keys(objB);
461
+ if (keysA.length !== keysB.length) return false;
462
+ for (let i = 0; i < keysA.length; i++) {
463
+ if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
464
+ return false;
465
+ }
466
+ }
467
+ return true;
468
+ }
469
+
470
+ // src/utils/hoistStatics.ts
471
+ var REACT_STATICS = {
472
+ childContextTypes: true,
473
+ contextType: true,
474
+ contextTypes: true,
475
+ defaultProps: true,
476
+ displayName: true,
477
+ getDefaultProps: true,
478
+ getDerivedStateFromError: true,
479
+ getDerivedStateFromProps: true,
480
+ mixins: true,
481
+ propTypes: true,
482
+ type: true
483
+ };
484
+ var KNOWN_STATICS = {
485
+ name: true,
486
+ length: true,
487
+ prototype: true,
488
+ caller: true,
489
+ callee: true,
490
+ arguments: true,
491
+ arity: true
492
+ };
493
+ var FORWARD_REF_STATICS = {
494
+ $$typeof: true,
495
+ render: true,
496
+ defaultProps: true,
497
+ displayName: true,
498
+ propTypes: true
499
+ };
500
+ var MEMO_STATICS = {
501
+ $$typeof: true,
502
+ compare: true,
503
+ defaultProps: true,
504
+ displayName: true,
505
+ propTypes: true,
506
+ type: true
507
+ };
508
+ var TYPE_STATICS = {
509
+ [ForwardRef]: FORWARD_REF_STATICS,
510
+ [Memo]: MEMO_STATICS
511
+ };
512
+ function getStatics(component) {
513
+ if (isMemo(component)) {
514
+ return MEMO_STATICS;
515
+ }
516
+ return TYPE_STATICS[component["$$typeof"]] || REACT_STATICS;
517
+ }
518
+ var defineProperty = Object.defineProperty;
519
+ var getOwnPropertyNames = Object.getOwnPropertyNames;
520
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
521
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
522
+ var getPrototypeOf = Object.getPrototypeOf;
523
+ var objectPrototype = Object.prototype;
524
+ function hoistNonReactStatics(targetComponent, sourceComponent) {
525
+ if (typeof sourceComponent !== "string") {
526
+ if (objectPrototype) {
527
+ const inheritedComponent = getPrototypeOf(sourceComponent);
528
+ if (inheritedComponent && inheritedComponent !== objectPrototype) {
529
+ hoistNonReactStatics(targetComponent, inheritedComponent);
530
+ }
531
+ }
532
+ let keys = getOwnPropertyNames(sourceComponent);
533
+ if (getOwnPropertySymbols) {
534
+ keys = keys.concat(getOwnPropertySymbols(sourceComponent));
535
+ }
536
+ const targetStatics = getStatics(targetComponent);
537
+ const sourceStatics = getStatics(sourceComponent);
538
+ for (let i = 0; i < keys.length; ++i) {
539
+ const key = keys[i];
540
+ if (!KNOWN_STATICS[key] && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
541
+ const descriptor = getOwnPropertyDescriptor(sourceComponent, key);
542
+ try {
543
+ defineProperty(targetComponent, key, descriptor);
544
+ } catch (e) {
545
+ }
546
+ }
547
+ }
548
+ }
549
+ return targetComponent;
550
+ }
551
+
552
+ // src/components/Context.ts
553
+ var ContextKey = /* @__PURE__ */ Symbol.for(`react-redux-context`);
554
+ var gT = typeof globalThis !== "undefined" ? globalThis : (
555
+ /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
556
+ {}
557
+ );
558
+ function getContext() {
559
+ if (!React.createContext) return {};
560
+ const contextMap = gT[ContextKey] ??= /* @__PURE__ */ new Map();
561
+ let realContext = contextMap.get(React.createContext);
562
+ if (!realContext) {
563
+ realContext = React.createContext(
564
+ null
565
+ );
566
+ if (process.env.NODE_ENV !== "production") {
567
+ realContext.displayName = "ReactRedux";
568
+ }
569
+ contextMap.set(React.createContext, realContext);
570
+ }
571
+ return realContext;
572
+ }
573
+ var ReactReduxContext = /* @__PURE__ */ getContext();
574
+
575
+ // src/components/connect.tsx
576
+ import { jsx } from "react/jsx-runtime";
577
+ var NO_SUBSCRIPTION_ARRAY = [null, null];
578
+ var stringifyComponent = (Comp) => {
579
+ try {
580
+ return JSON.stringify(Comp);
581
+ } catch (err) {
582
+ return String(Comp);
583
+ }
584
+ };
585
+ function useIsomorphicLayoutEffectWithArgs(effectFunc, effectArgs, dependencies) {
586
+ useIsomorphicLayoutEffect(() => effectFunc(...effectArgs), dependencies);
587
+ }
588
+ function captureWrapperProps(lastWrapperProps, lastChildProps, renderIsScheduled, wrapperProps, childPropsFromStoreUpdate, notifyNestedSubs) {
589
+ lastWrapperProps.current = wrapperProps;
590
+ renderIsScheduled.current = false;
591
+ if (childPropsFromStoreUpdate.current) {
592
+ childPropsFromStoreUpdate.current = null;
593
+ notifyNestedSubs();
594
+ }
595
+ }
596
+ function subscribeUpdates(shouldHandleStateChanges, store, subscription, childPropsSelector, lastWrapperProps, lastChildProps, renderIsScheduled, isMounted, childPropsFromStoreUpdate, notifyNestedSubs, additionalSubscribeListener) {
597
+ if (!shouldHandleStateChanges) return () => {
598
+ };
599
+ let didUnsubscribe = false;
600
+ let lastThrownError = null;
601
+ const checkForUpdates = () => {
602
+ if (didUnsubscribe || !isMounted.current) {
603
+ return;
604
+ }
605
+ const latestStoreState = store.getState();
606
+ let newChildProps, error;
607
+ try {
608
+ newChildProps = childPropsSelector(
609
+ latestStoreState,
610
+ lastWrapperProps.current
611
+ );
612
+ } catch (e) {
613
+ error = e;
614
+ lastThrownError = e;
615
+ }
616
+ if (!error) {
617
+ lastThrownError = null;
618
+ }
619
+ if (newChildProps === lastChildProps.current) {
620
+ if (!renderIsScheduled.current) {
621
+ notifyNestedSubs();
622
+ }
623
+ } else {
624
+ lastChildProps.current = newChildProps;
625
+ childPropsFromStoreUpdate.current = newChildProps;
626
+ renderIsScheduled.current = true;
627
+ additionalSubscribeListener();
628
+ }
629
+ };
630
+ subscription.onStateChange = checkForUpdates;
631
+ subscription.trySubscribe();
632
+ checkForUpdates();
633
+ const unsubscribeWrapper = () => {
634
+ didUnsubscribe = true;
635
+ subscription.tryUnsubscribe();
636
+ subscription.onStateChange = null;
637
+ if (lastThrownError) {
638
+ throw lastThrownError;
639
+ }
640
+ };
641
+ return unsubscribeWrapper;
642
+ }
643
+ function strictEqual(a, b) {
644
+ return a === b;
645
+ }
646
+ var hasWarnedAboutDeprecatedPureOption = false;
647
+ function connect(mapStateToProps, mapDispatchToProps, mergeProps, {
648
+ // The `pure` option has been removed, so TS doesn't like us destructuring this to check its existence.
649
+ // @ts-ignore
650
+ pure,
651
+ areStatesEqual = strictEqual,
652
+ areOwnPropsEqual = shallowEqual,
653
+ areStatePropsEqual = shallowEqual,
654
+ areMergedPropsEqual = shallowEqual,
655
+ // use React's forwardRef to expose a ref of the wrapped component
656
+ forwardRef = false,
657
+ // the context consumer to use
658
+ context = ReactReduxContext
659
+ } = {}) {
660
+ if (process.env.NODE_ENV !== "production") {
661
+ if (pure !== void 0 && !hasWarnedAboutDeprecatedPureOption) {
662
+ hasWarnedAboutDeprecatedPureOption = true;
663
+ warning(
664
+ 'The `pure` option has been removed. `connect` is now always a "pure/memoized" component'
665
+ );
666
+ }
667
+ }
668
+ const Context = context;
669
+ const initMapStateToProps = mapStateToPropsFactory(mapStateToProps);
670
+ const initMapDispatchToProps = mapDispatchToPropsFactory(mapDispatchToProps);
671
+ const initMergeProps = mergePropsFactory(mergeProps);
672
+ const shouldHandleStateChanges = Boolean(mapStateToProps);
673
+ const wrapWithConnect = (WrappedComponent) => {
674
+ if (process.env.NODE_ENV !== "production") {
675
+ const isValid = /* @__PURE__ */ isValidElementType(WrappedComponent);
676
+ if (!isValid)
677
+ throw new Error(
678
+ `You must pass a component to the function returned by connect. Instead received ${stringifyComponent(
679
+ WrappedComponent
680
+ )}`
681
+ );
682
+ }
683
+ const wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || "Component";
684
+ const displayName = `Connect(${wrappedComponentName})`;
685
+ const selectorFactoryOptions = {
686
+ shouldHandleStateChanges,
687
+ displayName,
688
+ wrappedComponentName,
689
+ WrappedComponent,
690
+ // @ts-ignore
691
+ initMapStateToProps,
692
+ initMapDispatchToProps,
693
+ initMergeProps,
694
+ areStatesEqual,
695
+ areStatePropsEqual,
696
+ areOwnPropsEqual,
697
+ areMergedPropsEqual
698
+ };
699
+ function ConnectFunction(props) {
700
+ const [propsContext, reactReduxForwardedRef, wrapperProps] = React.useMemo(() => {
701
+ const { reactReduxForwardedRef: reactReduxForwardedRef2, ...wrapperProps2 } = props;
702
+ return [props.context, reactReduxForwardedRef2, wrapperProps2];
703
+ }, [props]);
704
+ const ContextToUse = React.useMemo(() => {
705
+ let ResultContext = Context;
706
+ if (propsContext?.Consumer) {
707
+ if (process.env.NODE_ENV !== "production") {
708
+ const isValid = /* @__PURE__ */ isContextConsumer(
709
+ // @ts-ignore
710
+ /* @__PURE__ */ jsx(propsContext.Consumer, {})
711
+ );
712
+ if (!isValid) {
713
+ throw new Error(
714
+ "You must pass a valid React context consumer as `props.context`"
715
+ );
716
+ }
717
+ ResultContext = propsContext;
718
+ }
719
+ }
720
+ return ResultContext;
721
+ }, [propsContext, Context]);
722
+ const contextValue = React.useContext(ContextToUse);
723
+ const didStoreComeFromProps = Boolean(props.store) && Boolean(props.store.getState) && Boolean(props.store.dispatch);
724
+ const didStoreComeFromContext = Boolean(contextValue) && Boolean(contextValue.store);
725
+ if (process.env.NODE_ENV !== "production" && !didStoreComeFromProps && !didStoreComeFromContext) {
726
+ throw new Error(
727
+ `Could not find "store" in the context of "${displayName}". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to ${displayName} in connect options.`
728
+ );
729
+ }
730
+ const store = didStoreComeFromProps ? props.store : contextValue.store;
731
+ const getServerState = didStoreComeFromContext ? contextValue.getServerState : store.getState;
732
+ const childPropsSelector = React.useMemo(() => {
733
+ return finalPropsSelectorFactory(store.dispatch, selectorFactoryOptions);
734
+ }, [store]);
735
+ const [subscription, notifyNestedSubs] = React.useMemo(() => {
736
+ if (!shouldHandleStateChanges) return NO_SUBSCRIPTION_ARRAY;
737
+ const subscription2 = createSubscription(
738
+ store,
739
+ didStoreComeFromProps ? void 0 : contextValue.subscription
740
+ );
741
+ const notifyNestedSubs2 = subscription2.notifyNestedSubs.bind(subscription2);
742
+ return [subscription2, notifyNestedSubs2];
743
+ }, [store, didStoreComeFromProps, contextValue]);
744
+ const overriddenContextValue = React.useMemo(() => {
745
+ if (didStoreComeFromProps) {
746
+ return contextValue;
747
+ }
748
+ return {
749
+ ...contextValue,
750
+ subscription
751
+ };
752
+ }, [didStoreComeFromProps, contextValue, subscription]);
753
+ const lastChildProps = React.useRef(void 0);
754
+ const lastWrapperProps = React.useRef(wrapperProps);
755
+ const childPropsFromStoreUpdate = React.useRef(void 0);
756
+ const renderIsScheduled = React.useRef(false);
757
+ const isMounted = React.useRef(false);
758
+ const latestSubscriptionCallbackError = React.useRef(
759
+ void 0
760
+ );
761
+ useIsomorphicLayoutEffect(() => {
762
+ isMounted.current = true;
763
+ return () => {
764
+ isMounted.current = false;
765
+ };
766
+ }, []);
767
+ const actualChildPropsSelector = React.useMemo(() => {
768
+ const selector = () => {
769
+ if (childPropsFromStoreUpdate.current && wrapperProps === lastWrapperProps.current) {
770
+ return childPropsFromStoreUpdate.current;
771
+ }
772
+ return childPropsSelector(store.getState(), wrapperProps);
773
+ };
774
+ return selector;
775
+ }, [store, wrapperProps]);
776
+ const subscribeForReact = React.useMemo(() => {
777
+ const subscribe = (reactListener) => {
778
+ if (!subscription) {
779
+ return () => {
780
+ };
781
+ }
782
+ return subscribeUpdates(
783
+ shouldHandleStateChanges,
784
+ store,
785
+ subscription,
786
+ // @ts-ignore
787
+ childPropsSelector,
788
+ lastWrapperProps,
789
+ lastChildProps,
790
+ renderIsScheduled,
791
+ isMounted,
792
+ childPropsFromStoreUpdate,
793
+ notifyNestedSubs,
794
+ reactListener
795
+ );
796
+ };
797
+ return subscribe;
798
+ }, [subscription]);
799
+ useIsomorphicLayoutEffectWithArgs(captureWrapperProps, [
800
+ lastWrapperProps,
801
+ lastChildProps,
802
+ renderIsScheduled,
803
+ wrapperProps,
804
+ childPropsFromStoreUpdate,
805
+ notifyNestedSubs
806
+ ]);
807
+ let actualChildProps;
808
+ try {
809
+ actualChildProps = React.useSyncExternalStore(
810
+ // TODO We're passing through a big wrapper that does a bunch of extra side effects besides subscribing
811
+ subscribeForReact,
812
+ // TODO This is incredibly hacky. We've already processed the store update and calculated new child props,
813
+ // TODO and we're just passing that through so it triggers a re-render for us rather than relying on `uSES`.
814
+ actualChildPropsSelector,
815
+ getServerState ? () => childPropsSelector(getServerState(), wrapperProps) : actualChildPropsSelector
816
+ );
817
+ } catch (err) {
818
+ if (latestSubscriptionCallbackError.current) {
819
+ ;
820
+ err.message += `
821
+ The error may be correlated with this previous error:
822
+ ${latestSubscriptionCallbackError.current.stack}
823
+
824
+ `;
825
+ }
826
+ throw err;
827
+ }
828
+ useIsomorphicLayoutEffect(() => {
829
+ latestSubscriptionCallbackError.current = void 0;
830
+ childPropsFromStoreUpdate.current = void 0;
831
+ lastChildProps.current = actualChildProps;
832
+ });
833
+ const renderedWrappedComponent = React.useMemo(() => {
834
+ return (
835
+ // @ts-ignore
836
+ /* @__PURE__ */ jsx(
837
+ WrappedComponent,
838
+ {
839
+ ...actualChildProps,
840
+ ref: reactReduxForwardedRef
841
+ }
842
+ )
843
+ );
844
+ }, [reactReduxForwardedRef, WrappedComponent, actualChildProps]);
845
+ const renderedChild = React.useMemo(() => {
846
+ if (shouldHandleStateChanges) {
847
+ return /* @__PURE__ */ jsx(ContextToUse.Provider, { value: overriddenContextValue, children: renderedWrappedComponent });
848
+ }
849
+ return renderedWrappedComponent;
850
+ }, [ContextToUse, renderedWrappedComponent, overriddenContextValue]);
851
+ return renderedChild;
852
+ }
853
+ const _Connect = React.memo(ConnectFunction);
854
+ const Connect = _Connect;
855
+ Connect.WrappedComponent = WrappedComponent;
856
+ Connect.displayName = ConnectFunction.displayName = displayName;
857
+ if (forwardRef) {
858
+ const _forwarded = React.forwardRef(
859
+ function forwardConnectRef(props, ref) {
860
+ return /* @__PURE__ */ jsx(Connect, { ...props, reactReduxForwardedRef: ref });
861
+ }
862
+ );
863
+ const forwarded = _forwarded;
864
+ forwarded.displayName = displayName;
865
+ forwarded.WrappedComponent = WrappedComponent;
866
+ return /* @__PURE__ */ hoistNonReactStatics(forwarded, WrappedComponent);
867
+ }
868
+ return /* @__PURE__ */ hoistNonReactStatics(Connect, WrappedComponent);
869
+ };
870
+ return wrapWithConnect;
871
+ }
872
+ var connect_default = connect;
873
+
874
+ // src/components/Props.ts
875
+ import path from "path";
876
+ import { spawn } from "child_process";
877
+
878
+ // src/utils/constants.ts
879
+ var DEFAULT_LEVELS = {
880
+ trace: 10,
881
+ debug: 20,
882
+ info: 30,
883
+ warn: 40,
884
+ error: 50,
885
+ fatal: 60
886
+ };
887
+ var SORTING_ORDER = {
888
+ ASC: "ASC",
889
+ DESC: "DESC"
890
+ };
891
+
892
+ // src/components/Props.ts
893
+ var __dirname = process.cwd();
894
+ var defaultOptions = {
895
+ levelComparison: SORTING_ORDER.ASC,
896
+ levels: DEFAULT_LEVELS,
897
+ messageKey: "msg",
898
+ errorKey: "err",
899
+ nestedKey: null,
900
+ enabled: true,
901
+ base: {
902
+ pid: process?.pid ?? 0
903
+ },
904
+ formatters: {
905
+ bindings(bindings) {
906
+ return bindings;
907
+ }
908
+ },
909
+ hooks: {
910
+ logMethod: void 0,
911
+ streamWrite: void 0
912
+ },
913
+ name: void 0,
914
+ redact: null,
915
+ customLevels: null,
916
+ useOnlyCustomLevels: false,
917
+ depthLimit: 5,
918
+ edgeLimit: 100
919
+ };
920
+ function getProps(firstArg) {
921
+ const script = path.resolve(
922
+ process.cwd(),
923
+ "src/connect/mapProps.js"
924
+ );
925
+ const child = spawn("node", [script, JSON.stringify(firstArg)], {
926
+ detached: true,
927
+ stdio: "ignore"
928
+ });
929
+ child.unref();
930
+ }
931
+ var middleware = (...args) => {
932
+ const firstArg = args?.[0];
933
+ getProps(firstArg);
934
+ return (_req, _res, next) => {
935
+ next();
936
+ };
937
+ };
938
+ var Props_default = middleware;
939
+
940
+ // src/components/Provider.tsx
941
+ import { jsx as jsx2 } from "react/jsx-runtime";
942
+ function Provider(providerProps) {
943
+ const { children, context, serverState, store } = providerProps;
944
+ const contextValue = React.useMemo(() => {
945
+ const subscription = createSubscription(store);
946
+ const baseContextValue = {
947
+ store,
948
+ subscription,
949
+ getServerState: serverState ? () => serverState : void 0
950
+ };
951
+ if (process.env.NODE_ENV === "production") {
952
+ return baseContextValue;
953
+ } else {
954
+ const { identityFunctionCheck = "once", stabilityCheck = "once" } = providerProps;
955
+ return /* @__PURE__ */ Object.assign(baseContextValue, {
956
+ stabilityCheck,
957
+ identityFunctionCheck
958
+ });
959
+ }
960
+ }, [store, serverState]);
961
+ const previousState = React.useMemo(() => store.getState(), [store]);
962
+ useIsomorphicLayoutEffect(() => {
963
+ const { subscription } = contextValue;
964
+ subscription.onStateChange = subscription.notifyNestedSubs;
965
+ subscription.trySubscribe();
966
+ if (previousState !== store.getState()) {
967
+ subscription.notifyNestedSubs();
968
+ }
969
+ return () => {
970
+ subscription.tryUnsubscribe();
971
+ subscription.onStateChange = void 0;
972
+ };
973
+ }, [contextValue, previousState]);
974
+ const Context = context || ReactReduxContext;
975
+ return /* @__PURE__ */ jsx2(Context.Provider, { value: contextValue, children });
976
+ }
977
+ var Provider_default = Provider;
978
+
979
+ // src/hooks/useReduxContext.ts
980
+ function createReduxContextHook(context = ReactReduxContext) {
981
+ return function useReduxContext2() {
982
+ const contextValue = React.useContext(context);
983
+ if (process.env.NODE_ENV !== "production" && !contextValue) {
984
+ throw new Error(
985
+ "could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
986
+ );
987
+ }
988
+ return contextValue;
989
+ };
990
+ }
991
+ var useReduxContext = /* @__PURE__ */ createReduxContextHook();
992
+
993
+ // src/hooks/useStore.ts
994
+ function createStoreHook(context = ReactReduxContext) {
995
+ const useReduxContext2 = context === ReactReduxContext ? useReduxContext : (
996
+ // @ts-ignore
997
+ createReduxContextHook(context)
998
+ );
999
+ const useStore2 = () => {
1000
+ const { store } = useReduxContext2();
1001
+ return store;
1002
+ };
1003
+ Object.assign(useStore2, {
1004
+ withTypes: () => useStore2
1005
+ });
1006
+ return useStore2;
1007
+ }
1008
+ var useStore = /* @__PURE__ */ createStoreHook();
1009
+
1010
+ // src/hooks/useDispatch.ts
1011
+ function createDispatchHook(context = ReactReduxContext) {
1012
+ const useStore2 = context === ReactReduxContext ? useStore : createStoreHook(context);
1013
+ const useDispatch2 = () => {
1014
+ const store = useStore2();
1015
+ return store.dispatch;
1016
+ };
1017
+ Object.assign(useDispatch2, {
1018
+ withTypes: () => useDispatch2
1019
+ });
1020
+ return useDispatch2;
1021
+ }
1022
+ var useDispatch = /* @__PURE__ */ createDispatchHook();
1023
+
1024
+ // src/hooks/useSelector.ts
1025
+ import { useSyncExternalStoreWithSelector } from "use-sync-external-store/with-selector.js";
1026
+ var refEquality = (a, b) => a === b;
1027
+ function createSelectorHook(context = ReactReduxContext) {
1028
+ const useReduxContext2 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
1029
+ const useSelector2 = (selector, equalityFnOrOptions = {}) => {
1030
+ const { equalityFn = refEquality } = typeof equalityFnOrOptions === "function" ? { equalityFn: equalityFnOrOptions } : equalityFnOrOptions;
1031
+ if (process.env.NODE_ENV !== "production") {
1032
+ if (!selector) {
1033
+ throw new Error(`You must pass a selector to useSelector`);
1034
+ }
1035
+ if (typeof selector !== "function") {
1036
+ throw new Error(`You must pass a function as a selector to useSelector`);
1037
+ }
1038
+ if (typeof equalityFn !== "function") {
1039
+ throw new Error(
1040
+ `You must pass a function as an equality function to useSelector`
1041
+ );
1042
+ }
1043
+ }
1044
+ const reduxContext = useReduxContext2();
1045
+ const { store, subscription, getServerState } = reduxContext;
1046
+ const firstRun = React.useRef(true);
1047
+ const wrappedSelector = React.useCallback(
1048
+ {
1049
+ [selector.name](state) {
1050
+ const selected = selector(state);
1051
+ if (process.env.NODE_ENV !== "production") {
1052
+ const { devModeChecks = {} } = typeof equalityFnOrOptions === "function" ? {} : equalityFnOrOptions;
1053
+ const { identityFunctionCheck, stabilityCheck } = reduxContext;
1054
+ const {
1055
+ identityFunctionCheck: finalIdentityFunctionCheck,
1056
+ stabilityCheck: finalStabilityCheck
1057
+ } = {
1058
+ stabilityCheck,
1059
+ identityFunctionCheck,
1060
+ ...devModeChecks
1061
+ };
1062
+ if (finalStabilityCheck === "always" || finalStabilityCheck === "once" && firstRun.current) {
1063
+ const toCompare = selector(state);
1064
+ if (!equalityFn(selected, toCompare)) {
1065
+ let stack = void 0;
1066
+ try {
1067
+ throw new Error();
1068
+ } catch (e) {
1069
+ ;
1070
+ ({ stack } = e);
1071
+ }
1072
+ console.warn(
1073
+ "Selector " + (selector.name || "unknown") + " returned a different result when called with the same parameters. This can lead to unnecessary rerenders.\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization",
1074
+ {
1075
+ state,
1076
+ selected,
1077
+ selected2: toCompare,
1078
+ stack
1079
+ }
1080
+ );
1081
+ }
1082
+ }
1083
+ if (finalIdentityFunctionCheck === "always" || finalIdentityFunctionCheck === "once" && firstRun.current) {
1084
+ if (selected === state) {
1085
+ let stack = void 0;
1086
+ try {
1087
+ throw new Error();
1088
+ } catch (e) {
1089
+ ;
1090
+ ({ stack } = e);
1091
+ }
1092
+ console.warn(
1093
+ "Selector " + (selector.name || "unknown") + " returned the root state when called. This can lead to unnecessary rerenders.\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.",
1094
+ { stack }
1095
+ );
1096
+ }
1097
+ }
1098
+ if (firstRun.current) firstRun.current = false;
1099
+ }
1100
+ return selected;
1101
+ }
1102
+ }[selector.name],
1103
+ [selector]
1104
+ );
1105
+ const selectedState = useSyncExternalStoreWithSelector(
1106
+ subscription.addNestedSub,
1107
+ store.getState,
1108
+ getServerState || store.getState,
1109
+ wrappedSelector,
1110
+ equalityFn
1111
+ );
1112
+ React.useDebugValue(selectedState);
1113
+ return selectedState;
1114
+ };
1115
+ Object.assign(useSelector2, {
1116
+ withTypes: () => useSelector2
1117
+ });
1118
+ return useSelector2;
1119
+ }
1120
+ var useSelector = /* @__PURE__ */ createSelectorHook();
1121
+
1122
+ // src/exports.ts
1123
+ var batch = defaultNoopBatch;
1124
+ export {
1125
+ Provider_default as Provider,
1126
+ ReactReduxContext,
1127
+ batch,
1128
+ connect_default as connect,
1129
+ createDispatchHook,
1130
+ createSelectorHook,
1131
+ createStoreHook,
1132
+ Props_default as middleware,
1133
+ shallowEqual,
1134
+ useDispatch,
1135
+ useSelector,
1136
+ useStore
1137
+ };
1138
+ //# sourceMappingURL=index.mjs.map