use-typed-reducer 3.3.7 → 4.0.0

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.
package/README.md CHANGED
@@ -1,46 +1,56 @@
1
1
  # use-typed-reducer
2
2
 
3
- Another way to use [useReducer](https://reactjs.org/docs/hooks-reference.html#usereducer) hook, with strongly type rules defined by you.
3
+ Another way to use [useReducer](https://reactjs.org/docs/hooks-reference.html#usereducer) hook, with strongly type rules
4
+ defined by you.
4
5
 
5
- **Now you can control your local state or global state using the same API**. Check the [createGlobalReducer](#createglobalreducer) for global state.
6
+ **Now you can control your local state or global state using the same API**. Check
7
+ the [createGlobalReducer](#createglobalreducer) for global state.
6
8
 
7
9
  <!-- TOC -->
10
+
8
11
  * [use-typed-reducer](#use-typed-reducer)
9
12
  * [Install](#install)
10
13
  * [Why use *use-typed-reducer*](#why-use-use-typed-reducer)
11
14
  * [Using](#using)
12
- * [useReducer (default import) or `useTypedReducer`](#usereducer-default-import-or-usetypedreducer)
13
- * [useReducerWithProps](#usereducerwithprops)
15
+ * [useReducer (default import) or `useTypedReducer`](#usereducer-default-import-or-usetypedreducer)
16
+ * [useReducerWithProps](#usereducerwithprops)
14
17
  * [useReducer](#usereducer)
15
18
  * [createGlobalReducer](#createglobalreducer)
19
+
16
20
  <!-- TOC -->
17
21
 
18
22
  # Install
19
23
 
20
24
  With npm:
25
+
21
26
  ```bash
22
27
  npm install use-typed-reducer
23
28
  ```
24
29
 
25
30
  With yarn:
31
+
26
32
  ```bash
27
33
  yarn add use-typed-reducer
28
34
  ```
29
35
 
30
36
  # Why use *use-typed-reducer*
31
37
 
32
- The original useReducer forces you to use the well-known redux pattern. We need to pass the parameters in an object and a mandatory "type" to identify the action being performed.
38
+ The original useReducer forces you to use the well-known redux pattern. We need to pass the parameters in an object and
39
+ a mandatory "type" to identify the action being performed.
33
40
 
34
- With useTypedReducer, you can use your function the way you prefer, it will infer the parameters and return a new function with the current state so that you can make the changes you want to the new state
41
+ With useTypedReducer, you can use your function the way you prefer, it will infer the parameters and return a new
42
+ function with the current state so that you can make the changes you want to the new state
35
43
 
36
44
  # Using
37
45
 
38
46
  ## useReducer (default import) or `useTypedReducer`
39
47
 
40
- `useTypedReducer` receive the initialState and dictionary/object with all reducers and return tuple with state and dispatch. Dispatch has the same key and functions of given dictionary in `useTypedReducer`, but return a new function to update state. This void `dispatch({ type: "ACTION" })`
48
+ `useTypedReducer` receive the initialState and dictionary/object with all reducers and return tuple with state and
49
+ dispatch. Dispatch has the same key and functions of given dictionary in `useTypedReducer`, but return a new function to
50
+ update state. This void `dispatch({ type: "ACTION" })`
41
51
 
42
52
  ```tsx
43
- import { useTypedReducer, UseReducer } from "./index";
53
+ import {useTypedReducer, UseReducer} from "./index";
44
54
 
45
55
  const initialState = {
46
56
  numbers: 0,
@@ -56,12 +66,12 @@ type Reducers = {
56
66
  };
57
67
 
58
68
  const reducers: Reducers = {
59
- increment: () => (state) => ({ ...state, numbers: state.numbers + 1 }),
69
+ increment: () => (state) => ({...state, numbers: state.numbers + 1}),
60
70
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => {
61
71
  const value = e.target.valueAsNumber
62
- return (state) => ({ ...state, numbers: value })
72
+ return (state) => ({...state, numbers: value})
63
73
  },
64
- reset: () => (state) => ({ ...state, numbers: 0 })
74
+ reset: () => (state) => ({...state, numbers: 0})
65
75
  };
66
76
 
67
77
 
@@ -71,83 +81,84 @@ const Component = () => {
71
81
  return (
72
82
  <>
73
83
  <button onClick={dispatch.increment}>+Increment</button>
74
- <input onChange={dispatch.onChange} value={state.numbers} />
84
+ <input onChange={dispatch.onChange} value={state.numbers}/>
75
85
  <button onClick={dispatch.reset}>Reset</button>
76
86
  </>
77
87
  )
78
88
  }
79
89
  ```
80
90
 
81
-
82
91
  ## useReducerWithProps
83
92
 
84
93
  The same of useTypedReducer, but receive a `getProps` as second argument in the second function.
85
94
 
86
-
87
95
  ```typescript jsx
88
- import { useReducerWithProps, UseReducer } from "./index";
96
+ import {useReducerWithProps, UseReducer} from "./index";
89
97
 
90
- const initialState = { numbers: 0, something: "" };
98
+ const initialState = {numbers: 0, something: ""};
91
99
 
92
100
  type State = typeof initialState;
93
101
 
94
102
  type Reducers = {
95
- reset: UseReducer.Reducer<State, () => any>;
96
- onChange: UseReducer.Reducer<State, (e: React.ChangeEvent<HTMLInputElement>) => any>;
97
- increment: UseReducer.Reducer<State, () => any>;
103
+ reset: UseReducer.Reducer<State, () => any>;
104
+ onChange: UseReducer.Reducer<State, (e: React.ChangeEvent<HTMLInputElement>) => any>;
105
+ increment: UseReducer.Reducer<State, () => any>;
98
106
  };
99
107
 
100
108
  type Props = {
101
- list: number[];
109
+ list: number[];
102
110
  }
103
111
 
104
112
  const reducers: Reducers = {
105
- increment: () => (state) => ({ ...state, numbers: state.numbers + 1 }),
106
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => {
107
- const value = e.target.valueAsNumber;
108
- return (state, props) => {
109
- const find = props.list.find(x => x === value);
110
- return find === undefined ? ({ ...state, numbers: value }) : ({ ...state, numbers: find * 2 });
111
- };
112
- },
113
- reset: () => (state) => ({ ...state, numbers: 0 })
113
+ increment: () => (state) => ({...state, numbers: state.numbers + 1}),
114
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => {
115
+ const value = e.target.valueAsNumber;
116
+ return (state, props) => {
117
+ const find = props.list.find(x => x === value);
118
+ return find === undefined ? ({...state, numbers: value}) : ({...state, numbers: find * 2});
119
+ };
120
+ },
121
+ reset: () => (state) => ({...state, numbers: 0})
114
122
  };
115
123
 
116
124
 
117
125
  const Component = (props: Props) => {
118
- const [state, dispatch] = useReducerWithProps(initialState, props, reducers);
119
-
120
- return (
121
- <Fragment>
122
- <button onClick={dispatch.increment}>+Increment</button>
123
- <input onChange={dispatch.onChange} value={state.numbers} />
124
- <button onClick={dispatch.reset}>Reset</button>
125
- </Fragment>
126
- );
126
+ const [state, dispatch] = useReducerWithProps(initialState, props, reducers);
127
+
128
+ return (
129
+ <Fragment>
130
+ <button onClick={dispatch.increment}>+Increment</button>
131
+ <input onChange={dispatch.onChange} value={state.numbers}/>
132
+ <button onClick={dispatch.reset}>Reset</button>
133
+ </Fragment>
134
+ );
127
135
  };
128
136
  ```
129
137
 
130
138
  # useReducer
131
139
 
132
- This is the new way to control your state, but with the old way of use-typed-reducer. Now you have a function to getState and a function to get the props. With this you can avoid to take a function that return a function to update state.
140
+ This is the new way to control your state, but with the old way of use-typed-reducer. Now you have a function to
141
+ getState and a function to get the props. With this you can avoid to take a function that return a function to update
142
+ state.
133
143
 
134
144
  ```typescript
135
145
  export const useMath = () => {
136
- return useReducer({ count: 0 }, (getState) => ({
137
- sum: (n: number) => ({ count: n + getState().count }),
138
- diff: (n: number) => ({ count: n - getState().count })
139
- }));
146
+ return useReducer({count: 0}, (getState) => ({
147
+ sum: (n: number) => ({count: n + getState().count}),
148
+ diff: (n: number) => ({count: n - getState().count})
149
+ }));
140
150
  };
141
151
  ```
142
152
 
143
153
  # createGlobalReducer
144
154
 
145
- If you need a way to create a global state, you can use this function. This enables you to create a global state without a Context provider. The API is the same API of `useReducer`, but returns a hook to use the global context.
155
+ If you need a way to create a global state, you can use this function. This enables you to create a global state without
156
+ a Context provider. The API is the same API of `useReducer`, but returns a hook to use the global context.
146
157
 
147
158
  ```typescript jsx
148
- const useStore = createGlobalReducer({ count: 0 }, (arg) => ({
149
- increment: () => ({ count: arg.state().count + 1 }),
150
- decrement: () => ({ count: arg.state().count - 1 }),
159
+ const useStore = createGlobalReducer({count: 0}, (arg) => ({
160
+ increment: () => ({count: arg.state().count + 1}),
161
+ decrement: () => ({count: arg.state().count - 1}),
151
162
  }));
152
163
 
153
164
  export default function App() {
@@ -162,12 +173,13 @@ export default function App() {
162
173
  }
163
174
  ```
164
175
 
165
- You can pass a selector to `useStore` to get only the part of state that you need. This will optimize your components render, doing the re-render only when the selector get a different value from the previous state.
176
+ You can pass a selector to `useStore` to get only the part of state that you need. This will optimize your components
177
+ render, doing the re-render only when the selector get a different value from the previous state.
166
178
 
167
179
  ```typescript jsx
168
- const useStore = createGlobalReducer({ count: 0 }, (arg) => ({
169
- increment: () => ({ count: arg.state().count + 1 }),
170
- decrement: () => ({ count: arg.state().count - 1 }),
180
+ const useStore = createGlobalReducer({count: 0}, (arg) => ({
181
+ increment: () => ({count: arg.state().count + 1}),
182
+ decrement: () => ({count: arg.state().count - 1}),
171
183
  }));
172
184
 
173
185
  export default function App() {
@@ -181,3 +193,70 @@ export default function App() {
181
193
  );
182
194
  }
183
195
  ```
196
+
197
+ # Tips and Tricks
198
+
199
+ You need to store your state at LocalStorage? Do you need a logger for each change in state? Okay, let's go
200
+
201
+ ## Save at LocalStorage
202
+
203
+ ````typescript
204
+ import * as React from "react";
205
+ import {useReducer} from "use-typed-reducer"
206
+
207
+ const App = () => {
208
+ const [state, dispatch] = useReducer(
209
+ {name: "", topics: [] as string []},
210
+ (get) => ({
211
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => {
212
+ const value = e.target.value;
213
+ const name = e.target.name;
214
+ return {...get.state(), [name]: value}
215
+ }
216
+ }),
217
+ undefined, // no props used,
218
+ // this is your middleware to store state at localStorage
219
+ [
220
+ (state) => {
221
+ localStorage.setItem("myState", state);
222
+ return state;
223
+ }
224
+ ]
225
+ );
226
+ }
227
+ ````
228
+
229
+ ## State logger
230
+
231
+ Maybe you miss the `redux-logger` behaviour. I you help you to recovery this behaviour using use-typed-reducer
232
+
233
+ ````typescript
234
+ import * as React from "react";
235
+ import {useReducer} from "use-typed-reducer"
236
+
237
+ const App = () => {
238
+ const [state, dispatch] = useReducer(
239
+ {name: "", topics: [] as string []},
240
+ (get) => ({
241
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => {
242
+ const value = e.target.value;
243
+ const name = e.target.name;
244
+ return {...get.state(), [name]: value}
245
+ }
246
+ }),
247
+ undefined, // no props used,
248
+ // this is your middleware to log your state
249
+ [
250
+ (state, key, previousState) => {
251
+ console.group("My State");
252
+ // the method that updated your state
253
+ console.info("Update by", method);
254
+ console.info("Previous state", prev);
255
+ console.info(state);
256
+ console.groupEnd();
257
+ return state;
258
+ }
259
+ ]
260
+ );
261
+ }
262
+ ````
@@ -0,0 +1,4 @@
1
+ import { MutableRefObject } from "react";
2
+ export declare const useMutable: <T extends {}>(state: T) => MutableRefObject<T>;
3
+ export declare const usePrevious: <V>(value: V) => V;
4
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,OAAO,CAAC;AAE5D,eAAO,MAAM,UAAU,iDAItB,CAAC;AAEF,eAAO,MAAM,WAAW,oBAMvB,CAAC"}
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("react");var H={exports:{}},I={},D={exports:{}},W={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react");var K={exports:{}},W={},D={exports:{}},B={};/**
2
2
  * @license React
3
3
  * use-sync-external-store-shim.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var N;function Z(){if(N)return W;N=1;var e=A;function t(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var v=typeof Object.is=="function"?Object.is:t,_=e.useState,S=e.useEffect,f=e.useLayoutEffect,p=e.useDebugValue;function L(r,o){var i=o(),u=_({inst:{value:i,getSnapshot:o}}),s=u[0].inst,l=u[1];return f(function(){s.value=i,s.getSnapshot=o,y(s)&&l({inst:s})},[r,i,o]),S(function(){return y(s)&&l({inst:s}),r(function(){y(s)&&l({inst:s})})},[r]),p(i),i}function y(r){var o=r.getSnapshot;r=r.value;try{var i=o();return!v(r,i)}catch{return!0}}function O(r,o){return o()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?O:L;return W.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,W}var B={};/**
9
+ */var z;function ee(){if(z)return B;z=1;var e=y;function t(r,u){return r===u&&(r!==0||1/r===1/u)||r!==r&&u!==u}var o=typeof Object.is=="function"?Object.is:t,f=e.useState,S=e.useEffect,v=e.useLayoutEffect,E=e.useDebugValue;function h(r,u){var s=u(),c=f({inst:{value:s,getSnapshot:u}}),a=c[0].inst,p=c[1];return v(function(){a.value=s,a.getSnapshot=u,_(a)&&p({inst:a})},[r,s,u]),S(function(){return _(a)&&p({inst:a}),r(function(){_(a)&&p({inst:a})})},[r]),E(s),s}function _(r){var u=r.getSnapshot;r=r.value;try{var s=u();return!o(r,s)}catch{return!0}}function d(r,u){return u()}var n=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:h;return B.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:n,B}var P={};/**
10
10
  * @license React
11
11
  * use-sync-external-store-shim.development.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var q;function ee(){return q||(q=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=A,t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(c){{for(var n=arguments.length,E=new Array(n>1?n-1:0),a=1;a<n;a++)E[a-1]=arguments[a];_("error",c,E)}}function _(c,n,E){{var a=t.ReactDebugCurrentFrame,h=a.getStackAddendum();h!==""&&(n+="%s",E=E.concat([h]));var w=E.map(function(g){return String(g)});w.unshift("Warning: "+n),Function.prototype.apply.call(console[c],console,w)}}function S(c,n){return c===n&&(c!==0||1/c===1/n)||c!==c&&n!==n}var f=typeof Object.is=="function"?Object.is:S,p=e.useState,L=e.useEffect,y=e.useLayoutEffect,O=e.useDebugValue,d=!1,r=!1;function o(c,n,E){d||e.startTransition!==void 0&&(d=!0,v("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var a=n();if(!r){var h=n();f(a,h)||(v("The result of getSnapshot should be cached to avoid an infinite loop"),r=!0)}var w=p({inst:{value:a,getSnapshot:n}}),g=w[0].inst,b=w[1];return y(function(){g.value=a,g.getSnapshot=n,i(g)&&b({inst:g})},[c,a,n]),L(function(){i(g)&&b({inst:g});var j=function(){i(g)&&b({inst:g})};return c(j)},[c]),O(a),a}function i(c){var n=c.getSnapshot,E=c.value;try{var a=n();return!f(E,a)}catch{return!0}}function u(c,n,E){return n()}var s=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",l=!s,m=l?u:o,R=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m;B.useSyncExternalStore=R,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),B}var U;function F(){return U||(U=1,process.env.NODE_ENV==="production"?D.exports=Z():D.exports=ee()),D.exports}/**
17
+ */var F;function te(){return F||(F=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=y,t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function o(O){{for(var i=arguments.length,L=new Array(i>1?i-1:0),l=1;l<i;l++)L[l-1]=arguments[l];f("error",O,L)}}function f(O,i,L){{var l=t.ReactDebugCurrentFrame,m=l.getStackAddendum();m!==""&&(i+="%s",L=L.concat([m]));var w=L.map(function(g){return String(g)});w.unshift("Warning: "+i),Function.prototype.apply.call(console[O],console,w)}}function S(O,i){return O===i&&(O!==0||1/O===1/i)||O!==O&&i!==i}var v=typeof Object.is=="function"?Object.is:S,E=e.useState,h=e.useEffect,_=e.useLayoutEffect,d=e.useDebugValue,n=!1,r=!1;function u(O,i,L){n||e.startTransition!==void 0&&(n=!0,o("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var l=i();if(!r){var m=i();v(l,m)||(o("The result of getSnapshot should be cached to avoid an infinite loop"),r=!0)}var w=E({inst:{value:l,getSnapshot:i}}),g=w[0].inst,T=w[1];return _(function(){g.value=l,g.getSnapshot=i,s(g)&&T({inst:g})},[O,l,i]),h(function(){s(g)&&T({inst:g});var x=function(){s(g)&&T({inst:g})};return O(x)},[O]),d(l),l}function s(O){var i=O.getSnapshot,L=O.value;try{var l=i();return!v(L,l)}catch{return!0}}function c(O,i,L){return i()}var a=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",p=!a,R=p?c:u,b=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:R;P.useSyncExternalStore=b,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),P}var $;function Q(){return $||($=1,process.env.NODE_ENV==="production"?D.exports=ee():D.exports=te()),D.exports}/**
18
18
  * @license React
19
19
  * use-sync-external-store-shim/with-selector.production.min.js
20
20
  *
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var k;function te(){if(k)return I;k=1;var e=A,t=F();function v(O,d){return O===d&&(O!==0||1/O===1/d)||O!==O&&d!==d}var _=typeof Object.is=="function"?Object.is:v,S=t.useSyncExternalStore,f=e.useRef,p=e.useEffect,L=e.useMemo,y=e.useDebugValue;return I.useSyncExternalStoreWithSelector=function(O,d,r,o,i){var u=f(null);if(u.current===null){var s={hasValue:!1,value:null};u.current=s}else s=u.current;u=L(function(){function m(a){if(!R){if(R=!0,c=a,a=o(a),i!==void 0&&s.hasValue){var h=s.value;if(i(h,a))return n=h}return n=a}if(h=n,_(c,a))return h;var w=o(a);return i!==void 0&&i(h,w)?h:(c=a,n=w)}var R=!1,c,n,E=r===void 0?null:r;return[function(){return m(d())},E===null?void 0:function(){return m(E())}]},[d,r,o,i]);var l=S(O,u[0],u[1]);return p(function(){s.hasValue=!0,s.value=l},[l]),y(l),l},I}var P={};/**
25
+ */var Y;function re(){if(Y)return W;Y=1;var e=y,t=Q();function o(d,n){return d===n&&(d!==0||1/d===1/n)||d!==d&&n!==n}var f=typeof Object.is=="function"?Object.is:o,S=t.useSyncExternalStore,v=e.useRef,E=e.useEffect,h=e.useMemo,_=e.useDebugValue;return W.useSyncExternalStoreWithSelector=function(d,n,r,u,s){var c=v(null);if(c.current===null){var a={hasValue:!1,value:null};c.current=a}else a=c.current;c=h(function(){function R(l){if(!b){if(b=!0,O=l,l=u(l),s!==void 0&&a.hasValue){var m=a.value;if(s(m,l))return i=m}return i=l}if(m=i,f(O,l))return m;var w=u(l);return s!==void 0&&s(m,w)?m:(O=l,i=w)}var b=!1,O,i,L=r===void 0?null:r;return[function(){return R(n())},L===null?void 0:function(){return R(L())}]},[n,r,u,s]);var p=S(d,c[0],c[1]);return E(function(){a.hasValue=!0,a.value=p},[p]),_(p),p},W}var H={};/**
26
26
  * @license React
27
27
  * use-sync-external-store-shim/with-selector.development.js
28
28
  *
@@ -30,5 +30,5 @@
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var $;function re(){return $||($=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=A,t=F();function v(d,r){return d===r&&(d!==0||1/d===1/r)||d!==d&&r!==r}var _=typeof Object.is=="function"?Object.is:v,S=t.useSyncExternalStore,f=e.useRef,p=e.useEffect,L=e.useMemo,y=e.useDebugValue;function O(d,r,o,i,u){var s=f(null),l;s.current===null?(l={hasValue:!1,value:null},s.current=l):l=s.current;var m=L(function(){var E=!1,a,h,w=function(V){if(!E){E=!0,a=V;var x=i(V);if(u!==void 0&&l.hasValue){var C=l.value;if(u(C,x))return h=C,C}return h=x,x}var X=a,M=h;if(_(X,V))return M;var G=i(V);return u!==void 0&&u(M,G)?M:(a=V,h=G,G)},g=o===void 0?null:o,b=function(){return w(r())},j=g===null?void 0:function(){return w(g())};return[b,j]},[r,o,i,u]),R=m[0],c=m[1],n=S(d,R,c);return p(function(){l.hasValue=!0,l.value=n},[n]),y(n),n}P.useSyncExternalStoreWithSelector=O,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),P}process.env.NODE_ENV==="production"?H.exports=te():H.exports=re();var ne=H.exports;const K=e=>Object.entries(e),Y=e=>e instanceof Promise,z=e=>{const t=typeof e;return t==="string"||t==="number"||t==="bigint"||t==="boolean"||t==="undefined"||t===null},ue=(e,t)=>{if(e===t||Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t)&&e.length!==t.length)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();const v=Object.keys(e);if(length=v.length,length!==Object.keys(t).length)return!1;let _=length;for(;_--!==0;)if(!Object.prototype.hasOwnProperty.call(t,v[_]))return!1;_=length;for(let S=length;S--!==0;){const f=v[S];if(!(z(e[f])&&z(t[f])&&t[f]===e[f]))return!1}return!0}return e!==e&&t!==t},oe=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),e),J=(e,t,v)=>{const[_,S]=A.useState(e),f=T(v??{}),p=A.useCallback(()=>f.current,[f]),L=A.useMemo(()=>K(t).reduce((y,[O,d])=>({...y,[O]:async(...r)=>{const o=await d(...r);return S(i=>o(i,p()))}}),t),[t,p]);return[_,L]},T=e=>{const t=A.useRef(e??{});return A.useEffect(()=>void(t.current=e),[e]),t},se=(e,t)=>typeof t=="function"?t(e):t,Q=(e,t,v,_)=>{const S=Array.isArray(e)?e:e.constructor.name===Object.name?{...t,...e}:e;return v.reduce((f,p)=>p(f,_,t),S)},ce=(e,t,v,_)=>{const[S,f]=A.useState(()=>e),p=T(S),L=T(v??{}),y=T(t),O=T(_??[]),d=A.useRef(e),r=A.useMemo(()=>{const o=y.current({state:()=>p.current,props:()=>L.current,initialState:d.current});return K(o).reduce((i,[u,s])=>({...i,[u]:(...l)=>{const m=s(...l),R=c=>f(n=>Q(c,n,O.current,u));return Y(m)?void m.then(R):R(m)}}),{})},[L,y,p]);return[S,r]},ae=()=>e=>e,ie=(e,t,v,_)=>{let S=e;const f=()=>S,p=new Set,L=u=>(p.add(u),()=>p.delete(u)),y=u=>{const s={...S},l=u(S);S=l,p.forEach(m=>m(l,s))},d={state:f,props:()=>v||{},initialState:e},r=_||[],o=K(t(d)).reduce((u,[s,l])=>({...u,[s]:(...m)=>{const R=l(...m),c=n=>y(E=>Q(n,E,r,s));return Y(R)?R.then(c):c(R)}}),{}),i=u=>u;return Object.assign(function(s,l=ue){return[ne.useSyncExternalStoreWithSelector(L,f,f,s||i,l),o]},{dispatchers:o})},le=e=>{const[t,v]=A.useState(new Proxy(e,Object.assign({},Reflect,{set:(_,S,f)=>(_[S]=f,v(oe(_)),!0)})));return t};exports.createGlobalReducer=ie;exports.createReducer=ae;exports.default=J;exports.dispatchCallback=se;exports.useClassReducer=le;exports.useMutable=T;exports.useReducer=ce;exports.useTypedReducer=J;
33
+ */var J;function ne(){return J||(J=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=y,t=Q();function o(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var f=typeof Object.is=="function"?Object.is:o,S=t.useSyncExternalStore,v=e.useRef,E=e.useEffect,h=e.useMemo,_=e.useDebugValue;function d(n,r,u,s,c){var a=v(null),p;a.current===null?(p={hasValue:!1,value:null},a.current=p):p=a.current;var R=h(function(){var L=!1,l,m,w=function(V){if(!L){L=!0,l=V;var C=s(V);if(c!==void 0&&p.hasValue){var M=p.value;if(c(M,C))return m=M,M}return m=C,C}var Z=l,G=m;if(f(Z,V))return G;var I=s(V);return c!==void 0&&c(G,I)?G:(l=V,m=I,I)},g=u===void 0?null:u,T=function(){return w(r())},x=g===null?void 0:function(){return w(g())};return[T,x]},[r,u,s,c]),b=R[0],O=R[1],i=S(n,b,O);return E(function(){p.hasValue=!0,p.value=i},[i]),_(i),i}H.useSyncExternalStoreWithSelector=d,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),H}process.env.NODE_ENV==="production"?K.exports=re():K.exports=ne();var ue=K.exports;const q=e=>Object.entries(e),j=e=>e instanceof Promise,N=e=>{const t=typeof e;return t==="string"||t==="number"||t==="bigint"||t==="boolean"||t==="undefined"||t===null},X=(e,t)=>{if(e===t||Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t)&&e.length!==t.length)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();const o=Object.keys(e);if(length=o.length,length!==Object.keys(t).length)return!1;let f=length;for(;f--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[f]))return!1;f=length;for(let S=length;S--!==0;){const v=o[S];if(!(N(e[v])&&N(t[v])&&t[v]===e[v]))return!1}return!0}return e!==e&&t!==t},oe=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),e),ce=(e,t)=>typeof t=="function"?t(e):t,A=e=>{const t=y.useRef(e??{});return y.useEffect(()=>void(t.current=e),[e]),t},U=e=>{const t=y.useRef();return y.useEffect(()=>{t.current=e},[e]),t.current},se=(e,t,o)=>{const[f,S]=y.useState(e),v=A(o??{}),E=y.useCallback(()=>v.current,[v]),h=y.useMemo(()=>q(t).reduce((_,[d,n])=>({..._,[d]:async(...r)=>{const u=await n(...r);return S(s=>u(s,E()))}}),t),[t,E]);return[f,h]},k=(e,t)=>t===e?e:e.constructor.name===Object.name?{...t,...e}:e,ae=(e,t,o,f,S)=>(...v)=>{const E=performance.now(),h=t(...v),_=d=>o(n=>k(d,n));if(j(h))return h.then(d=>{_(d),S.current={method:e,props:f(),time:performance.now()-E}});_(h),S.current={method:e,props:f(),time:performance.now()-E}},ie=(e,t,o,f,S)=>(...v)=>{S.current={method:e,time:0,props:f()};const E=t(...v),h=_=>o(d=>k(_,d));return j(E)?E.then(_=>h(_)):h(E)},fe=(e,t,o)=>{const[f,S]=y.useState(()=>e),v=A(f),E=A((o==null?void 0:o.props)??{}),h=A(t),_=A((o==null?void 0:o.middlewares)??[]),d=y.useRef(e),n=U(f),r=A(n),u=y.useRef(null);y.useEffect(()=>{if(u.current===null)return;const c=u.current;_.current.forEach(a=>{a(f,n,c)})},[f,_,n]);const[s]=y.useState(()=>{const c=()=>E.current,a=h.current({props:c,state:()=>v.current,initialState:d.current,previousState:()=>r.current});return q(a).reduce((p,[R,b])=>({...p,[R]:o!=null&&o.debug?ae(R,b,S,c,u):ie(R,b,S,c,u)}),{})});return[f,s]},le=(e,t)=>{let o=e;const f=()=>o,S=new Set,v=n=>(S.add(n),()=>S.delete(n)),E=n=>{const r={...o},u=n(o);o=u,S.forEach(s=>s(u,r))},_=q(t({initialState:e,props:{},state:f,previousState:f})).reduce((n,[r,u])=>({...n,[r]:(...s)=>{const c=u(...s),a=p=>E(R=>k(p,R));return j(c)?c.then(a):a(c)}}),{}),d=n=>n;return Object.assign(function(r,u=X,s){const c=ue.useSyncExternalStoreWithSelector(v,f,f,r||d,u),a=U(c);return y.useEffect(()=>{s&&s.forEach(p=>{p(c,a,{method:"@globalState@",time:-1,props:{}})})},[c,a]),[c,_]},{dispatchers:_})};exports.clone=oe;exports.createGlobalReducer=le;exports.dispatchCallback=ce;exports.isPrimitive=N;exports.isPromise=j;exports.shallowCompare=X;exports.useLegacyReducer=se;exports.useMutable=A;exports.usePrevious=U;exports.useReducer=fe;
34
34
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js","../node_modules/use-sync-external-store/shim/index.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js","../node_modules/use-sync-external-store/shim/with-selector.js","../src/lib.ts","../src/index.ts"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","export const isObject = <T>(obj: T) => obj && typeof obj === \"object\";\n\nexport const keys = Object.keys as <T>(t: T) => Array<keyof T>;\n\ntype MapArray<T, F> = { [K in keyof T]: [K, F] };\nexport const entries = <T extends {}, F>(t: T): MapArray<T[], F> =>\n Object.entries(t) as any;\n\nexport const isPromise = <T>(promise: any): promise is Promise<T> =>\n promise instanceof Promise;\n\n// https://gist.github.com/ahtcx/0cd94e62691f539160b32ecda18af3d6?permalink_comment_id=2930530#gistcomment-2930530\nexport const merge = <T>(currentState: T, previous: T) => {\n if (!isObject(previous) || !isObject(currentState)) {\n return currentState;\n }\n keys(currentState).forEach((key) => {\n const targetValue = previous[key];\n const sourceValue = currentState[key];\n if (Array.isArray(targetValue) && Array.isArray(sourceValue))\n return ((previous as any)[key] = targetValue.concat(sourceValue));\n if (isObject(targetValue) && isObject(sourceValue))\n return (previous[key] = merge(\n Object.assign({}, targetValue),\n sourceValue,\n ));\n return (previous[key] = sourceValue);\n });\n return previous;\n};\n\nexport const isPrimitive = (a: any): a is string | number | boolean => {\n const type = typeof a;\n return (\n type === \"string\" ||\n type === \"number\" ||\n type === \"bigint\" ||\n type === \"boolean\" ||\n type === \"undefined\" ||\n type === null\n );\n};\n\nexport const shallowCompare = (left: any, right: any): boolean => {\n if (left === right || Object.is(left, right)) return true;\n if (Array.isArray(left) && Array.isArray(right)) {\n if (left.length !== right.length) return false;\n }\n if (left && right && typeof left === \"object\" && typeof right === \"object\") {\n if (left.constructor !== right.constructor) return false;\n if (left.valueOf !== Object.prototype.valueOf)\n return left.valueOf() === right.valueOf();\n const keys = Object.keys(left);\n length = keys.length;\n if (length !== Object.keys(right).length) {\n return false;\n }\n let i = length;\n for (; i-- !== 0; ) {\n if (!Object.prototype.hasOwnProperty.call(right, keys[i])) {\n return false;\n }\n }\n i = length;\n for (let i = length; i-- !== 0; ) {\n const key = keys[i];\n if (\n !(\n isPrimitive(left[key]) &&\n isPrimitive(right[key]) &&\n right[key] === left[key]\n )\n )\n return false;\n }\n return true;\n }\n return left !== left && right !== right;\n};\n\n\nexport const clone = <O>(instance: O) =>\n Object.assign(Object.create(Object.getPrototypeOf(instance)), instance);\n\n\n","import { MutableRefObject, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useSyncExternalStoreWithSelector } from \"use-sync-external-store/shim/with-selector\";\nimport { clone, entries, isPromise, shallowCompare } from \"./lib\";\nimport {\n Dispatch,\n MapReducers,\n FnMap,\n Action,\n Callback,\n Listener,\n UseReducer,\n ReducerArgs,\n MappedReducers,\n ReducerActions,\n MapReducerReturn,\n ReducerMiddleware\n} from \"./types\";\n\nexport * from \"./types\";\n\nexport const useTypedReducer = <State extends {}, Reducers extends Dispatch<State, Props, Reducers>, Props extends {}>(\n initialState: State,\n reducers: Reducers,\n props?: Props\n): [state: State, dispatch: MapReducers<State, Props, Reducers>] => {\n const [state, setState] = useState(initialState);\n const refProps = useMutable<Props>((props as never) ?? {});\n const getProps = useCallback(() => refProps.current, [refProps]);\n\n const dispatches = useMemo<any>(\n () =>\n entries<Reducers, Action<State, Props>>(reducers).reduce(\n (acc, [name, dispatch]) => ({\n ...acc,\n [name]: async (...params: unknown[]) => {\n const dispatcher = await dispatch(...params);\n return setState((previousState: State) => dispatcher(previousState, getProps()));\n }\n }),\n reducers\n ),\n [reducers, getProps]\n );\n return [state, dispatches];\n};\n\nexport const useMutable = <T extends {}>(state: T): MutableRefObject<T> => {\n const mutable = useRef(state ?? {});\n useEffect(() => void (mutable.current = state), [state]);\n return mutable;\n};\n\nexport const dispatchCallback = <Prev extends any, T extends Callback<Prev>>(prev: Prev, setter: T) =>\n typeof setter === \"function\" ? setter(prev) : setter;\n\nconst reduce = <State extends {}, Middlewares extends Array<(state: State, key: string, prev: State) => State>>(\n state: State,\n prev: State,\n middleware: Middlewares,\n key: string\n) => {\n const initial = Array.isArray(state)\n ? state\n : state.constructor.name === Object.name\n ? { ...prev, ...state }\n : state;\n return middleware.reduce<State>((acc, fn) => fn(acc, key, prev), initial);\n};\n\nexport const useReducer = <\n State extends {},\n Reducers extends ReducerActions<State, Props>,\n Props extends object,\n Middlewares extends ReducerMiddleware<State, Props, Reducers>\n>(\n initialState: State,\n reducer: Reducers,\n props?: Props,\n middlewares?: Middlewares\n): UseReducer<State, State, Props, Reducers> => {\n const [state, setState] = useState<State>(() => initialState);\n const mutableState = useMutable(state);\n const mutableProps = useMutable(props ?? ({} as Props));\n const mutableReducer = useMutable(reducer);\n const middleware = useMutable<Middlewares>(middlewares ?? ([] as unknown as Middlewares));\n const savedInitialState = useRef(initialState);\n\n const dispatchers = useMemo<MapReducerReturn<State, ReturnType<Reducers>>>(() => {\n const reducers = mutableReducer.current({\n state: () => mutableState.current,\n props: () => mutableProps.current,\n initialState: savedInitialState.current\n });\n\n return entries<string, any>(reducers as any).reduce(\n (acc, [name, dispatch]: any) => ({\n ...acc,\n [name]: (...params: any[]) => {\n const result = dispatch(...params);\n const set = (newState: State) =>\n setState((prev) => reduce(newState, prev, middleware.current, name));\n return isPromise<State>(result) ? void result.then(set) : set(result);\n }\n }),\n {} as MapReducerReturn<State, ReturnType<Reducers>>\n );\n }, [mutableProps, mutableReducer, mutableState]);\n return [state, dispatchers] as const;\n};\n\nexport const createReducer =\n <State extends {} = {}, Props extends object = {}>() =>\n <Reducer extends (args: ReducerArgs<State, Props>) => MappedReducers<State, FnMap<State>>>(reducer: Reducer) =>\n reducer;\n\nexport const createGlobalReducer = <\n State extends {},\n Reducers extends ReducerActions<State, Props>,\n Props extends object,\n Middlewares extends ReducerMiddleware<State, Props, Reducers>\n>(\n initialState: State,\n reducer: Reducers,\n props?: Props,\n middlewares?: Middlewares\n): (<Selector extends (state: State) => any>(\n selector?: Selector,\n comparator?: (a: any, b: any) => boolean\n) => UseReducer<Selector extends (state: State) => State ? State : ReturnType<Selector>, State, Props, Reducers>) & {\n dispatchers: MapReducerReturn<State, ReturnType<Reducers>>;\n} => {\n let state = initialState;\n const getSnapshot = () => state;\n const listeners = new Set<Listener<State>>();\n const addListener = (listener: Listener<State>) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const setState = (callback: (arg: State) => State) => {\n const previousState = { ...state };\n const newState = callback(state);\n state = newState;\n listeners.forEach((exec) => exec(newState, previousState));\n };\n\n const getProps = () => (props as Props) || ({} as Props);\n const args = { state: getSnapshot, props: getProps, initialState };\n const middlewareList: Middlewares = middlewares || ([] as unknown as Middlewares);\n const dispatchers: MapReducerReturn<State, ReturnType<Reducers>> = entries(reducer(args)).reduce<any>(\n (acc, [name, fn]: any) => ({\n ...acc,\n [name]: (...args: any[]) => {\n const result = fn(...args);\n const set = (newState: State) => setState((prev) => reduce(newState, prev, middlewareList, name));\n return isPromise<State>(result) ? result.then(set) : set(result);\n }\n }),\n {}\n );\n\n const defaultSelector = (state: State) => state;\n\n return Object.assign(\n function useStore<Selector extends (state: State) => any>(selector?: Selector, comparator = shallowCompare) {\n const state = useSyncExternalStoreWithSelector(\n addListener,\n getSnapshot,\n getSnapshot,\n selector || defaultSelector,\n comparator\n );\n return [state, dispatchers] as const;\n },\n { dispatchers }\n );\n};\n\nexport const useClassReducer = <T extends object>(instance: T) => {\n const [proxy, setProxy] = useState(\n new Proxy(\n instance,\n Object.assign({}, Reflect, {\n set: (obj: any, prop: any, value: any) => {\n (obj as any)[prop] = value;\n setProxy(clone(obj));\n return true;\n }\n })\n )\n );\n return proxy;\n};\n\nexport default useTypedReducer;\n"],"names":["require$$0","h","a","b","k","l","m","n","q","d","f","c","g","r","t","u","useSyncExternalStoreShim_production_min","React","ReactSharedInternals","error","format","_len2","args","_key2","printWarning","level","ReactDebugCurrentFrame","stack","argsWithFormat","item","is","x","y","objectIs","useState","useEffect","useLayoutEffect","useDebugValue","didWarnOld18Alpha","didWarnUncachedGetSnapshot","useSyncExternalStore","subscribe","getSnapshot","getServerSnapshot","value","cachedValue","_useState","inst","forceUpdate","checkIfSnapshotChanged","handleStoreChange","latestGetSnapshot","prevValue","nextValue","useSyncExternalStore$1","canUseDOM","isServerEnvironment","shim","useSyncExternalStore$2","useSyncExternalStoreShim_development","shimModule","require$$1","p","v","w","withSelector_production_min","e","useRef","useMemo","useSyncExternalStoreWithSelector","selector","isEqual","instRef","_useMemo","hasMemo","memoizedSnapshot","memoizedSelection","memoizedSelector","nextSnapshot","_nextSelection","currentSelection","prevSnapshot","prevSelection","nextSelection","maybeGetServerSnapshot","getSnapshotWithSelector","getServerSnapshotWithSelector","getSelection","getServerSelection","withSelector_development","withSelectorModule","entries","isPromise","promise","isPrimitive","type","shallowCompare","left","right","keys","i","key","clone","instance","useTypedReducer","initialState","reducers","props","state","setState","refProps","useMutable","getProps","useCallback","dispatches","acc","name","dispatch","params","dispatcher","previousState","mutable","dispatchCallback","prev","setter","reduce","middleware","initial","fn","useReducer","reducer","middlewares","mutableState","mutableProps","mutableReducer","savedInitialState","dispatchers","result","set","newState","createReducer","createGlobalReducer","listeners","addListener","listener","callback","exec","middlewareList","defaultSelector","comparator","useClassReducer","proxy","setProxy","obj","prop"],"mappings":";;;;;;;;wCASa,IAAI,EAAEA,EAAiB,SAASC,EAAEC,EAAEC,EAAE,CAAC,OAAOD,IAAIC,IAAQD,IAAJ,GAAO,EAAEA,IAAI,EAAEC,IAAID,IAAIA,GAAGC,IAAIA,CAAC,CAAC,IAAIC,EAAe,OAAO,OAAO,IAA3B,WAA8B,OAAO,GAAGH,EAAEI,EAAE,EAAE,SAASC,EAAE,EAAE,UAAUC,EAAE,EAAE,gBAAgB,EAAE,EAAE,cAAc,SAASC,EAAEN,EAAEC,EAAE,CAAC,IAAIM,EAAEN,EAAC,EAAGO,EAAEL,EAAE,CAAC,KAAK,CAAC,MAAMI,EAAE,YAAYN,CAAC,CAAC,CAAC,EAAEQ,EAAED,EAAE,CAAC,EAAE,KAAKE,EAAEF,EAAE,CAAC,EAAE,OAAAH,EAAE,UAAU,CAACI,EAAE,MAAMF,EAAEE,EAAE,YAAYR,EAAEU,EAAEF,CAAC,GAAGC,EAAE,CAAC,KAAKD,CAAC,CAAC,CAAC,EAAE,CAACT,EAAEO,EAAEN,CAAC,CAAC,EAAEG,EAAE,UAAU,CAAC,OAAAO,EAAEF,CAAC,GAAGC,EAAE,CAAC,KAAKD,CAAC,CAAC,EAAST,EAAE,UAAU,CAACW,EAAEF,CAAC,GAAGC,EAAE,CAAC,KAAKD,CAAC,C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,OAAAF,CACX","x_google_ignoreList":[0,1,2,3,4,5]}
1
+ {"version":3,"file":"index.cjs","sources":["../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js","../node_modules/use-sync-external-store/shim/index.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js","../node_modules/use-sync-external-store/shim/with-selector.js","../src/lib.ts","../src/hooks.ts","../src/use-typed-reducer.ts"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\n\nvar ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n\nfunction error(format) {\n {\n {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n printWarning('error', format, args);\n }\n }\n}\n\nfunction printWarning(level, format, args) {\n // When changing this logic, you might want to also\n // update consoleWithStackDev.www.js as well.\n {\n var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;\n var stack = ReactDebugCurrentFrame.getStackAddendum();\n\n if (stack !== '') {\n format += '%s';\n args = args.concat([stack]);\n } // eslint-disable-next-line react-internal/safe-string-coercion\n\n\n var argsWithFormat = args.map(function (item) {\n return String(item);\n }); // Careful: RN currently depends on this prefix\n\n argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it\n // breaks IE9: https://github.com/facebook/react/issues/13610\n // eslint-disable-next-line react-internal/no-production-logging\n\n Function.prototype.apply.call(console[level], console, argsWithFormat);\n }\n}\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\n// dispatch for CommonJS interop named imports.\n\nvar useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nvar didWarnOld18Alpha = false;\nvar didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works\n// because of a very particular set of implementation details and assumptions\n// -- change any one of them and it will break. The most important assumption\n// is that updates are always synchronous, because concurrent rendering is\n// only available in versions of React that also have a built-in\n// useSyncExternalStore API. And we only use this shim when the built-in API\n// does not exist.\n//\n// Do not assume that the clever hacks used by this hook also work in general.\n// The point of this shim is to replace the need for hacks by other libraries.\n\nfunction useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n// React do not expose a way to check if we're hydrating. So users of the shim\n// will need to track that themselves and return the correct value\n// from `getSnapshot`.\ngetServerSnapshot) {\n {\n if (!didWarnOld18Alpha) {\n if (React.startTransition !== undefined) {\n didWarnOld18Alpha = true;\n\n error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');\n }\n }\n } // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n\n\n var value = getSnapshot();\n\n {\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n\n if (!objectIs(value, cachedValue)) {\n error('The result of getSnapshot should be cached to avoid an infinite loop');\n\n didWarnUncachedGetSnapshot = true;\n }\n }\n } // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n\n\n var _useState = useState({\n inst: {\n value: value,\n getSnapshot: getSnapshot\n }\n }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n\n\n useLayoutEffect(function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }, [subscribe, value, getSnapshot]);\n useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n\n var handleStoreChange = function () {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({\n inst: inst\n });\n }\n }; // Subscribe to the store and return a clean-up function.\n\n\n return subscribe(handleStoreChange);\n }, [subscribe]);\n useDebugValue(value);\n return value;\n}\n\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n var prevValue = inst.value;\n\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(prevValue, nextValue);\n } catch (error) {\n return true;\n }\n}\n\nfunction useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {\n // Note: The shim does not use getServerSnapshot, because pre-18 versions of\n // React do not expose a way to check if we're hydrating. So users of the shim\n // will need to track that themselves and return the correct value\n // from `getSnapshot`.\n return getSnapshot();\n}\n\nvar canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');\n\nvar isServerEnvironment = !canUseDOM;\n\nvar shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;\nvar useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;\n\nexports.useSyncExternalStore = useSyncExternalStore$2;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n\n 'use strict';\n\n/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());\n}\n var React = require('react');\nvar shim = require('use-sync-external-store/shim');\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare\n ;\n}\n\nvar objectIs = typeof Object.is === 'function' ? Object.is : is;\n\nvar useSyncExternalStore = shim.useSyncExternalStore;\n\n// for CommonJS interop.\n\nvar useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.\n\nfunction useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {\n // Use this to track the rendered snapshot.\n var instRef = useRef(null);\n var inst;\n\n if (instRef.current === null) {\n inst = {\n hasValue: false,\n value: null\n };\n instRef.current = inst;\n } else {\n inst = instRef.current;\n }\n\n var _useMemo = useMemo(function () {\n // Track the memoized state using closure variables that are local to this\n // memoized instance of a getSnapshot function. Intentionally not using a\n // useRef hook, because that state would be shared across all concurrent\n // copies of the hook/component.\n var hasMemo = false;\n var memoizedSnapshot;\n var memoizedSelection;\n\n var memoizedSelector = function (nextSnapshot) {\n if (!hasMemo) {\n // The first time the hook is called, there is no memoized result.\n hasMemo = true;\n memoizedSnapshot = nextSnapshot;\n\n var _nextSelection = selector(nextSnapshot);\n\n if (isEqual !== undefined) {\n // Even if the selector has changed, the currently rendered selection\n // may be equal to the new selection. We should attempt to reuse the\n // current value if possible, to preserve downstream memoizations.\n if (inst.hasValue) {\n var currentSelection = inst.value;\n\n if (isEqual(currentSelection, _nextSelection)) {\n memoizedSelection = currentSelection;\n return currentSelection;\n }\n }\n }\n\n memoizedSelection = _nextSelection;\n return _nextSelection;\n } // We may be able to reuse the previous invocation's result.\n\n\n // We may be able to reuse the previous invocation's result.\n var prevSnapshot = memoizedSnapshot;\n var prevSelection = memoizedSelection;\n\n if (objectIs(prevSnapshot, nextSnapshot)) {\n // The snapshot is the same as last time. Reuse the previous selection.\n return prevSelection;\n } // The snapshot has changed, so we need to compute a new selection.\n\n\n // The snapshot has changed, so we need to compute a new selection.\n var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n\n // If a custom isEqual function is provided, use that to check if the data\n // has changed. If it hasn't, return the previous selection. That signals\n // to React that the selections are conceptually equal, and we can bail\n // out of rendering.\n if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {\n return prevSelection;\n }\n\n memoizedSnapshot = nextSnapshot;\n memoizedSelection = nextSelection;\n return nextSelection;\n }; // Assigning this to a constant so that Flow knows it can't change.\n\n\n // Assigning this to a constant so that Flow knows it can't change.\n var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;\n\n var getSnapshotWithSelector = function () {\n return memoizedSelector(getSnapshot());\n };\n\n var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n };\n return [getSnapshotWithSelector, getServerSnapshotWithSelector];\n }, [getSnapshot, getServerSnapshot, selector, isEqual]),\n getSelection = _useMemo[0],\n getServerSelection = _useMemo[1];\n\n var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);\n useEffect(function () {\n inst.hasValue = true;\n inst.value = value;\n }, [value]);\n useDebugValue(value);\n return value;\n}\n\nexports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\nif (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===\n 'function'\n) {\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());\n}\n \n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","import { Callback } from \"./types\";\n\nexport const isObject = <T>(obj: T) => obj && typeof obj === \"object\";\n\nexport const keys = Object.keys as <T>(t: T) => Array<keyof T>;\n\ntype MapArray<T, F> = { [K in keyof T]: [K, F] };\nexport const entries = <T extends {}, F>(t: T): MapArray<T[], F> => Object.entries(t) as any;\n\nexport const isPromise = <T>(promise: any): promise is Promise<T> => promise instanceof Promise;\n\nexport const isPrimitive = (a: any): a is string | number | boolean => {\n const type = typeof a;\n return (\n type === \"string\" ||\n type === \"number\" ||\n type === \"bigint\" ||\n type === \"boolean\" ||\n type === \"undefined\" ||\n type === null\n );\n};\n\nexport const shallowCompare = (left: any, right: any): boolean => {\n if (left === right || Object.is(left, right)) return true;\n if (Array.isArray(left) && Array.isArray(right)) {\n if (left.length !== right.length) return false;\n }\n if (left && right && typeof left === \"object\" && typeof right === \"object\") {\n if (left.constructor !== right.constructor) return false;\n if (left.valueOf !== Object.prototype.valueOf) return left.valueOf() === right.valueOf();\n const keys = Object.keys(left);\n length = keys.length;\n if (length !== Object.keys(right).length) {\n return false;\n }\n let i = length;\n for (; i-- !== 0; ) {\n if (!Object.prototype.hasOwnProperty.call(right, keys[i])) {\n return false;\n }\n }\n i = length;\n for (let i = length; i-- !== 0; ) {\n const key = keys[i];\n if (!(isPrimitive(left[key]) && isPrimitive(right[key]) && right[key] === left[key])) return false;\n }\n return true;\n }\n return left !== left && right !== right;\n};\n\nexport const clone = <O>(instance: O) => Object.assign(Object.create(Object.getPrototypeOf(instance)), instance);\n\nexport const dispatchCallback = <Prev extends any, T extends Callback<Prev>>(prev: Prev, setter: T) =>\n typeof setter === \"function\" ? setter(prev) : setter;\n","import { MutableRefObject, useEffect, useRef } from \"react\";\n\nexport const useMutable = <T extends {}>(state: T): MutableRefObject<T> => {\n const mutable = useRef<T>(state ?? {});\n useEffect(() => void (mutable.current = state), [state]);\n return mutable;\n};\n\nexport const usePrevious = <V>(value: V): V => {\n const ref = useRef<V>();\n useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current!;\n};\n","import React, { SetStateAction, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useSyncExternalStoreWithSelector } from \"use-sync-external-store/shim/with-selector\";\nimport { entries, isPromise, shallowCompare } from \"./lib\";\nimport {\n Dispatch,\n MapReducers,\n Action,\n Listener,\n UseReducer,\n ReducerActions,\n MapReducerReturn,\n ReducerMiddleware,\n Debug\n} from \"./types\";\nimport { useMutable, usePrevious } from \"./hooks\";\n\nexport const useLegacyReducer = <State extends {}, Reducers extends Dispatch<State, Props, Reducers>, Props extends {}>(\n initialState: State,\n reducers: Reducers,\n props?: Props\n): [state: State, dispatch: MapReducers<State, Props, Reducers>] => {\n const [state, setState] = useState(initialState);\n const refProps = useMutable<Props>((props as never) ?? {});\n const getProps = useCallback(() => refProps.current, [refProps]);\n\n const dispatches = useMemo<any>(\n () =>\n entries<Reducers, Action<State, Props>>(reducers).reduce(\n (acc, [name, dispatch]) => ({\n ...acc,\n [name]: async (...params: unknown[]) => {\n const dispatcher = await dispatch(...params);\n return setState((previousState: State) => dispatcher(previousState, getProps()));\n }\n }),\n reducers\n ),\n [reducers, getProps]\n );\n return [state, dispatches];\n};\n\n\nconst reduce = <State extends {}>(state: State, prev: State) => {\n if (prev === state) return state;\n return state.constructor.name === Object.name ? { ...prev, ...state } : state;\n};\n\nconst debugFunc =\n <State extends {}, Props extends object>(\n name: string,\n dispatch: (...args: any[]) => any,\n setState: React.Dispatch<SetStateAction<State>>,\n getProps: () => Props,\n debug: React.MutableRefObject<Debug<Props> | null>\n ) =>\n (...params: any[]) => {\n const now = performance.now();\n const result = dispatch(...params);\n const set = (newState: State) => setState((prev) => reduce(newState, prev));\n if (isPromise<State>(result)) {\n return result.then((resolved) => {\n set(resolved);\n debug.current = {\n method: name,\n props: getProps(),\n time: performance.now() - now\n };\n });\n }\n set(result);\n debug.current = {\n method: name,\n props: getProps(),\n time: performance.now() - now\n };\n return;\n };\n\nconst optimizedFunc =\n <State extends {}, Props extends object>(\n name: string,\n dispatch: (...args: any[]) => any,\n setState: React.Dispatch<SetStateAction<State>>,\n getProps: () => Props,\n debug: React.MutableRefObject<Debug<Props> | null>\n ) =>\n (...params: any[]) => {\n debug.current = { method: name, time: 0, props: getProps() };\n const result = dispatch(...params);\n const set = (newState: State) => setState((prev) => reduce(newState, prev));\n if (isPromise<State>(result)) {\n return result.then((resolved) => set(resolved));\n }\n return set(result);\n };\n\nexport const useReducer = <\n State extends {},\n Reducers extends ReducerActions<State, Props>,\n Props extends object,\n Middlewares extends ReducerMiddleware<State, Props>,\n UseDebug extends boolean\n>(\n initialState: State,\n reducer: Reducers,\n options?: Partial<{\n middlewares: Middlewares;\n props: Props;\n debug: UseDebug;\n }>\n): UseReducer<State, State, Props, Reducers> => {\n const [state, setState] = useState<State>(() => initialState);\n const mutableState = useMutable(state);\n const mutableProps = useMutable(options?.props ?? ({} as Props));\n const mutableReducer = useMutable(reducer);\n const middleware = useMutable<Middlewares>(options?.middlewares ?? ([] as unknown as Middlewares));\n const savedInitialState = useRef(initialState);\n const previous = usePrevious(state);\n const previousRef = useMutable(previous);\n const debug = useRef<Debug<Props> | null>(null);\n\n useEffect(() => {\n if (debug.current === null) return;\n const d = debug.current!;\n middleware.current.forEach((middle) => {\n middle(state, previous, d);\n });\n }, [state, middleware, previous]);\n\n const [dispatchers] = useState<MapReducerReturn<State, ReturnType<Reducers>>>(() => {\n const getProps = () => mutableProps.current;\n const reducers = mutableReducer.current({\n props: getProps,\n state: () => mutableState.current,\n initialState: savedInitialState.current,\n previousState: () => previousRef.current\n });\n return entries<string, any>(reducers as any).reduce(\n (acc, [name, dispatch]: any) => ({\n ...acc,\n [name]: options?.debug\n ? debugFunc(name, dispatch, setState, getProps, debug)\n : optimizedFunc(name, dispatch, setState, getProps, debug)\n }),\n {} as MapReducerReturn<State, ReturnType<Reducers>>\n );\n });\n return [state, dispatchers] as const;\n};\n\nexport const createGlobalReducer = <State extends {}, Reducers extends ReducerActions<State, {}>>(\n initialState: State,\n reducer: Reducers\n): (<Selector extends (state: State) => any, Middlewares extends ReducerMiddleware<State, {}>>(\n selector?: Selector,\n comparator?: (a: any, b: any) => boolean,\n middleware?: Middlewares\n) => UseReducer<Selector extends (state: State) => State ? State : ReturnType<Selector>, State, {}, Reducers>) & {\n dispatchers: MapReducerReturn<State, ReturnType<Reducers>>;\n} => {\n let state = initialState;\n const getSnapshot = () => state;\n const listeners = new Set<Listener<State>>();\n const addListener = (listener: Listener<State>) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const setState = (callback: (arg: State) => State) => {\n const previousState = { ...state };\n const newState = callback(state);\n state = newState;\n listeners.forEach((exec) => exec(newState, previousState));\n };\n\n const args = {\n initialState,\n props: {} as any,\n state: getSnapshot,\n previousState: getSnapshot\n };\n\n const dispatchers: MapReducerReturn<State, ReturnType<Reducers>> = entries(reducer(args)).reduce<any>(\n (acc, [name, fn]: any) => ({\n ...acc,\n [name]: (...args: any[]) => {\n const result = fn(...args);\n const set = (newState: State) => setState((prev) => reduce(newState, prev));\n return isPromise<State>(result) ? result.then(set) : set(result);\n }\n }),\n {}\n );\n\n const defaultSelector = (state: State) => state;\n\n return Object.assign(\n function useStore<Selector extends (state: State) => any, Middlewares extends ReducerMiddleware<State, {}>>(\n selector?: Selector,\n comparator = shallowCompare,\n middleware?: Middlewares\n ) {\n const state = useSyncExternalStoreWithSelector(\n addListener,\n getSnapshot,\n getSnapshot,\n selector || defaultSelector,\n comparator\n );\n const previous = usePrevious(state);\n useEffect(() => {\n if (!middleware) return;\n middleware.forEach((middle) => {\n middle(state, previous, { method: \"@globalState@\", time: -1, props: {} });\n });\n }, [state, previous]);\n return [state, dispatchers] as const;\n },\n { dispatchers }\n );\n};\n\n"],"names":["require$$0","h","a","b","k","l","m","n","p","q","d","f","c","g","r","t","u","useSyncExternalStoreShim_production_min","React","ReactSharedInternals","error","format","_len2","args","_key2","printWarning","level","ReactDebugCurrentFrame","stack","argsWithFormat","item","is","x","y","objectIs","useState","useEffect","useLayoutEffect","useDebugValue","didWarnOld18Alpha","didWarnUncachedGetSnapshot","useSyncExternalStore","subscribe","getSnapshot","getServerSnapshot","value","cachedValue","_useState","inst","forceUpdate","checkIfSnapshotChanged","handleStoreChange","latestGetSnapshot","prevValue","nextValue","useSyncExternalStore$1","canUseDOM","isServerEnvironment","shim","useSyncExternalStore$2","useSyncExternalStoreShim_development","shimModule","require$$1","v","w","withSelector_production_min","e","useRef","useMemo","useSyncExternalStoreWithSelector","selector","isEqual","instRef","_useMemo","hasMemo","memoizedSnapshot","memoizedSelection","memoizedSelector","nextSnapshot","_nextSelection","currentSelection","prevSnapshot","prevSelection","nextSelection","maybeGetServerSnapshot","getSnapshotWithSelector","getServerSnapshotWithSelector","getSelection","getServerSelection","withSelector_development","withSelectorModule","entries","isPromise","promise","isPrimitive","type","shallowCompare","left","right","keys","i","key","clone","instance","dispatchCallback","prev","setter","useMutable","state","mutable","usePrevious","ref","useLegacyReducer","initialState","reducers","props","setState","refProps","getProps","useCallback","dispatches","acc","name","dispatch","params","dispatcher","previousState","reduce","debugFunc","debug","now","result","set","newState","resolved","optimizedFunc","useReducer","reducer","options","mutableState","mutableProps","mutableReducer","middleware","savedInitialState","previous","previousRef","middle","dispatchers","createGlobalReducer","listeners","addListener","listener","callback","exec","fn","defaultSelector","comparator"],"mappings":";;;;;;;;yCASa,IAAI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