use-typed-reducer 4.2.1 → 4.2.3

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/dist/hooks.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { MutableRefObject } from 'react';
2
-
3
2
  export declare const useMutable: <T extends {}>(state: T) => MutableRefObject<T>;
4
3
  export declare const usePrevious: <V>(value: V) => V;
5
4
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +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,wBAAyB,CAAC,KAAG,iBAAiB,CAAC,CAIrE,CAAC;AAEF,eAAO,MAAM,WAAW,aAAc,CAAC,KAAG,CAMzC,CAAC"}
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,GAAI,CAAC,SAAS,EAAE,SAAS,CAAC,KAAG,gBAAgB,CAAC,CAAC,CAIrE,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,CAAC,KAAG,CAMzC,CAAC"}
package/dist/index.cjs CHANGED
@@ -1,38 +1,38 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react");var N={exports:{}},W={},j={exports:{}},B={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react");var A={exports:{}},D={},j={exports:{}},P={};/**
2
2
  * @license React
3
- * use-sync-external-store-shim.production.min.js
3
+ * use-sync-external-store-shim.production.js
4
4
  *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
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 z;function re(){if(z)return B;z=1;var e=g;function r(n,u){return n===u&&(n!==0||1/n===1/u)||n!==n&&u!==u}var t=typeof Object.is=="function"?Object.is:r,o=e.useState,l=e.useEffect,a=e.useLayoutEffect,E=e.useDebugValue;function m(n,u){var c=u(),p=o({inst:{value:c,getSnapshot:u}}),s=p[0].inst,d=p[1];return a(function(){s.value=c,s.getSnapshot=u,O(s)&&d({inst:s})},[n,c,u]),l(function(){return O(s)&&d({inst:s}),n(function(){O(s)&&d({inst:s})})},[n]),E(c),c}function O(n){var u=n.getSnapshot;n=n.value;try{var c=u();return!t(n,c)}catch{return!0}}function _(n,u){return u()}var i=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?_:m;return B.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:i,B}var H={};/**
9
+ */var H;function x(){if(H)return P;H=1;var e=y;function r(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var n=typeof Object.is=="function"?Object.is:r,c=e.useState,a=e.useEffect,l=e.useLayoutEffect,v=e.useDebugValue;function p(i,s){var t=s(),o=c({inst:{value:t,getSnapshot:s}}),u=o[0].inst,S=o[1];return l(function(){u.value=t,u.getSnapshot=s,O(u)&&S({inst:u})},[i,t,s]),a(function(){return O(u)&&S({inst:u}),i(function(){O(u)&&S({inst:u})})},[i]),v(t),t}function O(i){var s=i.getSnapshot;i=i.value;try{var t=s();return!n(i,t)}catch{return!0}}function f(i,s){return s()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:p;return P.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,P}var M={};/**
10
10
  * @license React
11
11
  * use-sync-external-store-shim.development.js
12
12
  *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
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 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=g,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(S){{for(var f=arguments.length,L=new Array(f>1?f-1:0),v=1;v<f;v++)L[v-1]=arguments[v];o("error",S,L)}}function o(S,f,L){{var v=r.ReactDebugCurrentFrame,y=v.getStackAddendum();y!==""&&(f+="%s",L=L.concat([y]));var A=L.map(function(w){return String(w)});A.unshift("Warning: "+f),Function.prototype.apply.call(console[S],console,A)}}function l(S,f){return S===f&&(S!==0||1/S===1/f)||S!==S&&f!==f}var a=typeof Object.is=="function"?Object.is:l,E=e.useState,m=e.useEffect,O=e.useLayoutEffect,_=e.useDebugValue,i=!1,n=!1;function u(S,f,L){i||e.startTransition!==void 0&&(i=!0,t("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 v=f();if(!n){var y=f();a(v,y)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),n=!0)}var A=E({inst:{value:v,getSnapshot:f}}),w=A[0].inst,T=A[1];return O(function(){w.value=v,w.getSnapshot=f,c(w)&&T({inst:w})},[S,v,f]),m(function(){c(w)&&T({inst:w});var C=function(){c(w)&&T({inst:w})};return S(C)},[S]),_(v),v}function c(S){var f=S.getSnapshot,L=S.value;try{var v=f();return!a(L,v)}catch{return!0}}function p(S,f,L){return f()}var s=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",d=!s,h=d?p:u,R=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h;H.useSyncExternalStore=R,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),H}var Y;function X(){return Y||(Y=1,process.env.NODE_ENV==="production"?j.exports=re():j.exports=te()),j.exports}/**
17
+ */var K;function F(){return K||(K=1,process.env.NODE_ENV!=="production"&&function(){function e(t,o){return t===o&&(t!==0||1/t===1/o)||t!==t&&o!==o}function r(t,o){d||a.startTransition===void 0||(d=!0,console.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."));var u=o();if(!i){var S=o();l(u,S)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),i=!0)}S=v({inst:{value:u,getSnapshot:o}});var _=S[0].inst,E=S[1];return O(function(){_.value=u,_.getSnapshot=o,n(_)&&E({inst:_})},[t,u,o]),p(function(){return n(_)&&E({inst:_}),t(function(){n(_)&&E({inst:_})})},[t]),f(u),u}function n(t){var o=t.getSnapshot;t=t.value;try{var u=o();return!l(t,u)}catch{return!0}}function c(t,o){return o()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=y,l=typeof Object.is=="function"?Object.is:e,v=a.useState,p=a.useEffect,O=a.useLayoutEffect,f=a.useDebugValue,d=!1,i=!1,s=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:r;M.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:s,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),M}var W;function z(){return W||(W=1,process.env.NODE_ENV==="production"?j.exports=x():j.exports=F()),j.exports}/**
18
18
  * @license React
19
- * use-sync-external-store-shim/with-selector.production.min.js
19
+ * use-sync-external-store-shim/with-selector.production.js
20
20
  *
21
- * Copyright (c) Facebook, Inc. and its affiliates.
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
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 J;function ne(){if(J)return W;J=1;var e=g,r=X();function t(_,i){return _===i&&(_!==0||1/_===1/i)||_!==_&&i!==i}var o=typeof Object.is=="function"?Object.is:t,l=r.useSyncExternalStore,a=e.useRef,E=e.useEffect,m=e.useMemo,O=e.useDebugValue;return W.useSyncExternalStoreWithSelector=function(_,i,n,u,c){var p=a(null);if(p.current===null){var s={hasValue:!1,value:null};p.current=s}else s=p.current;p=m(function(){function h(v){if(!R){if(R=!0,S=v,v=u(v),c!==void 0&&s.hasValue){var y=s.value;if(c(y,v))return f=y}return f=v}if(y=f,o(S,v))return y;var A=u(v);return c!==void 0&&c(y,A)?y:(S=v,f=A)}var R=!1,S,f,L=n===void 0?null:n;return[function(){return h(i())},L===null?void 0:function(){return h(L())}]},[i,n,u,c]);var d=l(_,p[0],p[1]);return E(function(){s.hasValue=!0,s.value=d},[d]),O(d),d},W}var K={};/**
25
+ */var N;function J(){if(N)return D;N=1;var e=y,r=z();function n(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var c=typeof Object.is=="function"?Object.is:n,a=r.useSyncExternalStore,l=e.useRef,v=e.useEffect,p=e.useMemo,O=e.useDebugValue;return D.useSyncExternalStoreWithSelector=function(f,d,i,s,t){var o=l(null);if(o.current===null){var u={hasValue:!1,value:null};o.current=u}else u=o.current;o=p(function(){function _(m){if(!E){if(E=!0,h=m,m=s(m),t!==void 0&&u.hasValue){var b=u.value;if(t(b,m))return L=b}return L=m}if(b=L,c(h,m))return b;var w=s(m);return t!==void 0&&t(b,w)?(h=m,b):(h=m,L=w)}var E=!1,h,L,R=i===void 0?null:i;return[function(){return _(d())},R===null?void 0:function(){return _(R())}]},[d,i,s,t]);var S=a(f,o[0],o[1]);return v(function(){u.hasValue=!0,u.value=S},[S]),O(S),S},D}var C={};/**
26
26
  * @license React
27
27
  * use-sync-external-store-shim/with-selector.development.js
28
28
  *
29
- * Copyright (c) Facebook, Inc. and its affiliates.
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
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 Q;function ue(){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=g,r=X();function t(i,n){return i===n&&(i!==0||1/i===1/n)||i!==i&&n!==n}var o=typeof Object.is=="function"?Object.is:t,l=r.useSyncExternalStore,a=e.useRef,E=e.useEffect,m=e.useMemo,O=e.useDebugValue;function _(i,n,u,c,p){var s=a(null),d;s.current===null?(d={hasValue:!1,value:null},s.current=d):d=s.current;var h=m(function(){var L=!1,v,y,A=function(V){if(!L){L=!0,v=V;var x=c(V);if(p!==void 0&&d.hasValue){var M=d.value;if(p(M,x))return y=M,M}return y=x,x}var ee=v,I=y;if(o(ee,V))return I;var G=c(V);return p!==void 0&&p(I,G)?I:(v=V,y=G,G)},w=u===void 0?null:u,T=function(){return A(n())},C=w===null?void 0:function(){return A(w())};return[T,C]},[n,u,c,p]),R=h[0],S=h[1],f=l(i,R,S);return E(function(){d.hasValue=!0,d.value=f},[f]),O(f),f}K.useSyncExternalStoreWithSelector=_,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),K}process.env.NODE_ENV==="production"?N.exports=ne():N.exports=ue();var oe=N.exports;const b=e=>{const r=g.useRef(e??{});return g.useEffect(()=>void(r.current=e),[e]),r},q=e=>{const r=g.useRef();return g.useEffect(()=>{r.current=e},[e]),r.current},ce=e=>e&&typeof e=="object",se=Object.keys,D=e=>Object.entries(e),P=e=>e instanceof Promise,k=e=>{const r=typeof e;return r==="string"||r==="number"||r==="bigint"||r==="boolean"||r==="undefined"||r===null},Z=(e,r)=>{if(e===r||Object.is(e,r))return!0;if(Array.isArray(e)&&Array.isArray(r)&&e.length!==r.length)return!1;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();const t=Object.keys(e);if(length=t.length,length!==Object.keys(r).length)return!1;let o=length;for(;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,t[o]))return!1;o=length;for(let l=length;l--!==0;){const a=t[l];if(!(k(e[a])&&k(r[a])&&r[a]===e[a]))return!1}return!0}return e!==e&&r!==r},ae=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),e),ie=(e,r)=>typeof r=="function"?r(e):r,le=(e,r,t)=>{const[o,l]=g.useState(e),a=b(t??{}),E=g.useCallback(()=>a.current,[a]),m=g.useMemo(()=>D(r).reduce((O,[_,i])=>({...O,[_]:async(...n)=>{const u=await i(...n);return l(c=>u(c,E()))}}),r),[r,E]);return[o,m]},U=(e,r,t,o)=>r===e?t.reduce((l,a)=>a(l,r,o),e):e.constructor.name===Object.name?t.reduce((l,a)=>a(l,r,o),{...r,...e}):t.reduce((l,a)=>a(l,r,o),e),fe=(e,r,t,o,l,a)=>(...E)=>{const m=performance.now(),O=r(...E),_=(i,n)=>t(u=>U(i,u,a,n));return P(O)?O.then(i=>{l.current={method:e,props:o(),time:performance.now()-m},_(i,l.current)}):(l.current={method:e,props:o(),time:performance.now()-m},void _(O,l.current))},de=(e,r,t,o,l,a)=>(...E)=>{l.current={method:e,time:0,props:o()};const m=r(...E),O=_=>t(i=>U(_,i,a,l.current));return P(m)?m.then(_=>O(_)):O(m)},Se=(e,r,t)=>{const[o,l]=g.useState(()=>e),a=b(o),E=b((t==null?void 0:t.props)??{}),m=b(r),O=b((t==null?void 0:t.postMiddleware)??[]),_=b((t==null?void 0:t.interceptor)??[]),i=g.useRef(e),n=q(o),u=b(n),c=g.useRef(null);g.useEffect(()=>{if(c.current===null)return;const s=c.current;O.current.forEach(d=>{d(o,n,s)})},[o,O,n]);const[p]=g.useState(()=>{const s=()=>E.current,d=m.current({props:s,state:()=>a.current,initialState:i.current,previousState:()=>u.current});return D(d).reduce((h,[R,S])=>({...h,[R]:t!=null&&t.debug?fe(R,S,l,s,c,_.current):de(R,S,l,s,c,_.current)}),{})});return[o,p,E.current]},ve=(e,r,t)=>{let o=e;const l=(t==null?void 0:t.interceptor)??[],a=()=>o,E=new Set,m=u=>(E.add(u),()=>E.delete(u)),O=u=>{const c={...o},p=u(o);o=p,E.forEach(s=>s(p,c))},_={initialState:e,props:{},state:a,previousState:a},i=u=>u,n=D(r(_)).reduce((u,[c,p])=>({...u,[c]:(...s)=>{const d=p(...s),h=R=>O(S=>U(R,S,l,{method:c,props:{},selector:i,time:0}));return P(d)?d.then(h):h(d)}}),{});return Object.assign(function(c,p=Z,s){const d=b((s==null?void 0:s.postMiddleware)??[]),h=oe.useSyncExternalStoreWithSelector(m,a,a,c||i,p),R=q(h);return g.useEffect(()=>{Array.isArray(d.current)&&d.current.forEach(S=>{S(h,R,{method:"@globalState@",time:-1,props:{},selector:c})})},[h,R,d]),[h,n,{}]},{dispatchers:n})},$=e=>r=>(t,o)=>(e().set(r,JSON.stringify(t)),t),_e=$(()=>({set:(e,r)=>localStorage.setItem(e,r)})),pe=$(()=>({set:(e,r)=>sessionStorage.setItem(e,r)})),Oe=e=>(r,t,o)=>(console.group(e),console.info(`%cAction %c- "${o.method}" ${o.time}ms
34
- `,"color: gold","color: white",t),console.info(`%cPrevious state
35
- `,"color: silver",t),console.info(`%cCurrent state
33
+ */var U;function Y(){return U||(U=1,process.env.NODE_ENV!=="production"&&function(){function e(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=y,n=z(),c=typeof Object.is=="function"?Object.is:e,a=n.useSyncExternalStore,l=r.useRef,v=r.useEffect,p=r.useMemo,O=r.useDebugValue;C.useSyncExternalStoreWithSelector=function(f,d,i,s,t){var o=l(null);if(o.current===null){var u={hasValue:!1,value:null};o.current=u}else u=o.current;o=p(function(){function _(m){if(!E){if(E=!0,h=m,m=s(m),t!==void 0&&u.hasValue){var b=u.value;if(t(b,m))return L=b}return L=m}if(b=L,c(h,m))return b;var w=s(m);return t!==void 0&&t(b,w)?(h=m,b):(h=m,L=w)}var E=!1,h,L,R=i===void 0?null:i;return[function(){return _(d())},R===null?void 0:function(){return _(R())}]},[d,i,s,t]);var S=a(f,o[0],o[1]);return v(function(){u.hasValue=!0,u.value=S},[S]),O(S),S},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),C}var $;function Q(){return $||($=1,process.env.NODE_ENV==="production"?A.exports=J():A.exports=Y()),A.exports}var X=Q();const g=e=>{const r=y.useRef(e??{});return y.useEffect(()=>void(r.current=e),[e]),r},I=e=>{const r=y.useRef(void 0);return y.useEffect(()=>{r.current=e},[e]),r.current},Z=e=>e&&typeof e=="object",ee=Object.keys,T=e=>Object.entries(e),V=e=>e instanceof Promise,G=e=>{const r=typeof e;return r==="string"||r==="number"||r==="bigint"||r==="boolean"||r==="undefined"||r===null},q=(e,r)=>{if(e===r||Object.is(e,r))return!0;if(Array.isArray(e)&&Array.isArray(r)&&e.length!==r.length)return!1;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();const n=Object.keys(e);if(length=n.length,length!==Object.keys(r).length)return!1;let c=length;for(;c--!==0;)if(!Object.prototype.hasOwnProperty.call(r,n[c]))return!1;c=length;for(let a=length;a--!==0;){const l=n[a];if(!(G(e[l])&&G(r[l])&&r[l]===e[l]))return!1}return!0}return e!==e&&r!==r},re=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),e),te=(e,r)=>typeof r=="function"?r(e):r,ne=(e,r,n)=>{const[c,a]=y.useState(e),l=g(n??{}),v=y.useCallback(()=>l.current,[l]),p=y.useMemo(()=>T(r).reduce((O,[f,d])=>({...O,[f]:async(...i)=>{const s=await d(...i);return a(t=>s(t,v()))}}),r),[r,v]);return[c,p]},k=(e,r,n,c)=>r===e?n.reduce((a,l)=>l(a,r,c),e):e.constructor.name===Object.name?n.reduce((a,l)=>l(a,r,c),{...r,...e}):n.reduce((a,l)=>l(a,r,c),e),ue=(e,r,n,c,a,l)=>(...v)=>{const p=performance.now(),O=r(...v),f=(d,i)=>n(s=>k(d,s,l,i));return V(O)?O.then(d=>{a.current={method:e,props:c(),time:performance.now()-p},f(d,a.current)}):(a.current={method:e,props:c(),time:performance.now()-p},void f(O,a.current))},oe=(e,r,n,c,a,l)=>(...v)=>{a.current={method:e,time:0,props:c()};const p=r(...v),O=f=>n(d=>k(f,d,l,a.current));return V(p)?p.then(f=>O(f)):O(p)},ce=(e,r,n)=>{const[c,a]=y.useState(()=>e),l=g(c),v=g((n==null?void 0:n.props)??{}),p=g(r),O=g((n==null?void 0:n.postMiddleware)??[]),f=g((n==null?void 0:n.interceptor)??[]),d=y.useRef(e),i=I(c),s=g(i),t=y.useRef(null);y.useEffect(()=>{if(t.current===null)return;const u=t.current;O.current.forEach(S=>{S(c,i,u)})},[c,O,i]);const[o]=y.useState(()=>{const u=()=>v.current,S=p.current({props:u,state:()=>l.current,initialState:d.current,previousState:()=>s.current});return T(S).reduce((_,[E,h])=>({..._,[E]:n!=null&&n.debug?ue(E,h,a,u,t,f.current):oe(E,h,a,u,t,f.current)}),{})});return[c,o,v.current]},se=(e,r,n)=>{let c=e;const a=(n==null?void 0:n.interceptor)??[],l=()=>c,v=new Set,p=s=>(v.add(s),()=>v.delete(s)),O=s=>{const t={...c},o=s(c);c=o,v.forEach(u=>u(o,t))},f={initialState:e,props:{},state:l,previousState:l},d=s=>s,i=T(r(f)).reduce((s,[t,o])=>({...s,[t]:(...u)=>{const S=o(...u),_=E=>O(h=>k(E,h,a,{method:t,props:{},selector:d,time:0}));return V(S)?S.then(_):_(S)}}),{});return Object.assign(function(t,o=q,u){const S=g((u==null?void 0:u.postMiddleware)??[]),_=X.useSyncExternalStoreWithSelector(p,l,l,t||d,o),E=I(_);return y.useEffect(()=>{Array.isArray(S.current)&&S.current.forEach(h=>{h(_,E,{method:"@globalState@",time:-1,props:{},selector:t})})},[_,E,S]),[_,i,{}]},{dispatchers:i,getState:()=>c})},B=e=>r=>(n,c)=>(e().set(r,JSON.stringify(n)),n),ae=B(()=>({set:(e,r)=>localStorage.setItem(e,r)})),ie=B(()=>({set:(e,r)=>sessionStorage.setItem(e,r)})),le=e=>(r,n,c)=>(console.group(e),console.info(`%cAction %c- "${c.method}" ${c.time}ms
34
+ `,"color: gold","color: white",n),console.info(`%cPrevious state
35
+ `,"color: silver",n),console.info(`%cCurrent state
36
36
  `,"color: green",r),console.info(`Props
37
- `,o.props),console.groupEnd(),r);exports.clone=ae;exports.createGlobalReducer=ve;exports.createLocalStoragePlugin=_e;exports.createLoggerPlugin=Oe;exports.createSessionStoragePlugin=pe;exports.createStoragePlugin=$;exports.dispatchCallback=ie;exports.entries=D;exports.isObject=ce;exports.isPrimitive=k;exports.isPromise=P;exports.keys=se;exports.shallowCompare=Z;exports.useLegacyReducer=le;exports.useMutable=b;exports.usePrevious=q;exports.useReducer=Se;
37
+ `,c.props),console.groupEnd(),r);exports.clone=re;exports.createGlobalReducer=se;exports.createLocalStoragePlugin=ae;exports.createLoggerPlugin=le;exports.createSessionStoragePlugin=ie;exports.createStoragePlugin=B;exports.dispatchCallback=te;exports.entries=T;exports.isObject=Z;exports.isPrimitive=G;exports.isPromise=V;exports.keys=ee;exports.shallowCompare=q;exports.useLegacyReducer=ne;exports.useMutable=g;exports.usePrevious=I;exports.useReducer=ce;
38
38
  //# 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/hooks.ts","../src/lib.ts","../src/use-typed-reducer.ts","../src/plugins.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 { 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 { 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 React, { SetStateAction, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useSyncExternalStoreWithSelector } from \"use-sync-external-store/shim/with-selector\";\nimport { useMutable, usePrevious } from \"./hooks\";\nimport { entries, isPromise, shallowCompare } from \"./lib\";\nimport {\n Action,\n Debug,\n Dispatch,\n Listener,\n MapReducerReturn,\n MapReducers,\n ReducerActions,\n ReducerMiddleware,\n UseReducer\n} from \"./types\";\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\nconst reduce = <State extends {}, Props extends {}>(\n state: State,\n prev: State,\n mutations: Mutators<State, Props>,\n debug: Debug<Props>\n) => {\n if (prev === state) return mutations.reduce((acc, el) => el(acc, prev, debug), state);\n return state.constructor.name === Object.name\n ? mutations.reduce((acc, el) => el(acc, prev, debug), { ...prev, ...state })\n : mutations.reduce((acc, el) => el(acc, prev, debug), 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 mutations: Mutators<State, Props>\n ) =>\n (...params: any[]) => {\n const now = performance.now();\n const result = dispatch(...params);\n const set = (newState: State, debug: Debug<Props>) =>\n setState((prev) => reduce(newState, prev, mutations, debug));\n if (isPromise<State>(result)) {\n return result.then((resolved) => {\n debug.current = {\n method: name,\n props: getProps(),\n time: performance.now() - now\n };\n set(resolved, debug.current);\n });\n }\n debug.current = {\n method: name,\n props: getProps(),\n time: performance.now() - now\n };\n return void set(result, debug.current);\n };\n\ntype Mutators<State extends {}, Props extends {}> = Array<(state: State, prev: State, debug: Debug<Props>) => State>;\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 mutations: Mutators<State, Props>\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, mutations, debug.current!));\n if (isPromise<State>(result)) {\n return result.then((resolved) => set(resolved));\n }\n return set(result);\n };\n\ntype Options<PostMiddleware, Props, Debug, Selector, Interceptor> = Partial<{\n props: Props;\n debug: Debug;\n selector: Selector;\n interceptor: Interceptor;\n postMiddleware: PostMiddleware;\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 Mutations extends Mutators<State, Props>,\n UseDebug extends boolean\n>(\n initialState: State,\n reducer: Reducers,\n options?: Options<Middlewares, Props, UseDebug, undefined, Mutations>\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?.postMiddleware ?? ([] as unknown as Middlewares));\n const mutations = useMutable<Mutations>(options?.interceptor ?? ([] as unknown as Mutations));\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, mutations.current)\n : optimizedFunc(name, dispatch, setState, getProps, debug, mutations.current)\n }),\n {} as MapReducerReturn<State, ReturnType<Reducers>>\n );\n });\n return [state, dispatchers, mutableProps.current] as const;\n};\n\nexport const createGlobalReducer = <\n State extends {},\n Reducers extends ReducerActions<State, {}>,\n Mutations extends Mutators<State, {}>\n>(\n initialState: State,\n reducer: Reducers,\n rootOptions?: Pick<Options<[], {}, {}, () => State, Mutations>, \"interceptor\">\n): (<Selector extends (state: State) => any, Middlewares extends ReducerMiddleware<ReturnType<Selector>, {}>>(\n selector?: Selector,\n comparator?: (a: any, b: any) => boolean,\n options?: Options<Middlewares, {}, {}, Selector, []>\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 rootMutations = rootOptions?.interceptor ?? [];\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 debugOptions = { initialState, props: {} as any, state: getSnapshot, previousState: getSnapshot };\n\n const defaultSelector = (state: State) => state;\n\n const dispatchers: MapReducerReturn<State, ReturnType<Reducers>> = entries(reducer(debugOptions)).reduce<any>(\n (acc, [method, fn]: any) => ({\n ...acc,\n [method]: (...args: any[]) => {\n const result = fn(...args);\n const set = (newState: State) =>\n setState((prev) =>\n reduce(newState, prev, rootMutations, {\n method,\n props: {},\n selector: defaultSelector,\n time: 0\n })\n );\n return isPromise<State>(result) ? result.then(set) : set(result);\n }\n }),\n {}\n );\n\n return Object.assign(\n function useStore<\n Selector extends (state: State) => any,\n O extends Omit<Options<ReducerMiddleware<ReturnType<Selector>, {}>, {}, {}, Selector, []>, \"mutations\">\n >(selector?: Selector, comparator = shallowCompare, options?: O) {\n const middleware = useMutable(options?.postMiddleware ?? []);\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 (Array.isArray(middleware.current))\n middleware.current.forEach((middle) => {\n middle(state, previous, { method: \"@globalState@\", time: -1, props: {}, selector });\n });\n }, [state, previous, middleware]);\n return [state, dispatchers, {}] as const;\n },\n { dispatchers }\n );\n};\n","import { Debug } from \"./types\";\n\nexport type StoragePluginManager = {\n set: (key: string, value: any) => void;\n};\n\nexport const createStoragePlugin =\n (storage: () => StoragePluginManager) =>\n (key: string) =>\n <T>(state: T, _: T) => {\n storage().set(key, JSON.stringify(state));\n return state;\n };\n\nexport const createLocalStoragePlugin = createStoragePlugin(() => ({\n set: (k, v) => localStorage.setItem(k, v)\n}));\n\nexport const createSessionStoragePlugin = createStoragePlugin(() => ({\n set: (k, v) => sessionStorage.setItem(k, v)\n}));\n\nexport const createLoggerPlugin =\n (groupName: string) =>\n <State, Props extends object>(state: State, prev: State, debug: Debug<Props>) => {\n console.group(groupName);\n console.info(`%cAction %c- \"${debug.method}\" ${debug.time}ms\\n`, \"color: gold\", \"color: white\", prev);\n console.info(\"%cPrevious state\\n\", \"color: silver\", prev);\n console.info(\"%cCurrent state\\n\", \"color: green\", state);\n console.info(\"Props\\n\", debug.props);\n console.groupEnd();\n return state;\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","useMutable","state","mutable","usePrevious","ref","isObject","obj","keys","entries","isPromise","promise","isPrimitive","type","shallowCompare","left","right","i","key","clone","instance","dispatchCallback","prev","setter","useLegacyReducer","initialState","reducers","props","setState","refProps","getProps","useCallback","dispatches","acc","name","dispatch","params","dispatcher","previousState","reduce","mutations","debug","el","debugFunc","now","result","set","newState","resolved","optimizedFunc","useReducer","reducer","options","mutableState","mutableProps","mutableReducer","middleware","savedInitialState","previous","previousRef","middle","dispatchers","createGlobalReducer","rootOptions","rootMutations","listeners","addListener","listener","callback","exec","debugOptions","defaultSelector","method","fn","comparator","createStoragePlugin","storage","_","createLocalStoragePlugin","createSessionStoragePlugin","createLoggerPlugin","groupName"],"mappings":";;;;;;;;yCASa,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,gBAAgBC,EAAE,EAAE,cAAc,SAASC,EAAEP,EAAEC,EAAE,CAAC,IAAIO,EAAEP,EAAC,EAAGQ,EAAEN,EAAE,CAAC,KAAK,CAAC,MAAMK,EAAE,YAAYP,CAAC,CAAC,CAAC,EAAES,EAAED,EAAE,CAAC,EAAE,KAAKE,EAAEF,EAAE,CAAC,EAAE,OAAAJ,EAAE,UAAU,CAACK,EAAE,MAAMF,EAAEE,EAAE,YAAYT,EAAEW,EAAEF,CAAC,GAAGC,EAAE,CAAC,KAAKD,CAAC,CAAC,CAAC,EAAE,CAACV,EAAEQ,EAAEP,CAAC,CAAC,EAAEG,EAAE,UAAU,CAAC,OAAAQ,EAAEF,CAAC,GAAGC,EAAE,CAAC,KAAKD,CAAC,CAA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EAAqB,eAAgBpB,CAAK,EAC/C,QAAA,KAAK;AAAA,EAAWuC,EAAM,KAAK,EACnC,QAAQ,SAAS,EACVvC","x_google_ignoreList":[0,1,2,3,4,5]}
1
+ {"version":3,"file":"index.cjs","sources":["../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js","../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js","../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js","../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js","../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/with-selector.js","../src/hooks.ts","../src/lib.ts","../src/use-typed-reducer.ts","../src/plugins.ts"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and 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\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n var value = getSnapshot(),\n _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n}\nvar shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n","/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and 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\"production\" !== process.env.NODE_ENV &&\n (function () {\n function is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n }\n function useSyncExternalStore$2(subscribe, getSnapshot) {\n didWarnOld18Alpha ||\n void 0 === React.startTransition ||\n ((didWarnOld18Alpha = !0),\n console.error(\n \"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 var value = getSnapshot();\n if (!didWarnUncachedGetSnapshot) {\n var cachedValue = getSnapshot();\n objectIs(value, cachedValue) ||\n (console.error(\n \"The result of getSnapshot should be cached to avoid an infinite loop\"\n ),\n (didWarnUncachedGetSnapshot = !0));\n }\n cachedValue = useState({\n inst: { value: value, getSnapshot: getSnapshot }\n });\n var inst = cachedValue[0].inst,\n forceUpdate = cachedValue[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n }\n function checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n }\n function useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var React = require(\"react\"),\n objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue,\n didWarnOld18Alpha = !1,\n didWarnUncachedGetSnapshot = !1,\n shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\n exports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.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.js\n *\n * Copyright (c) Meta Platforms, Inc. and 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\";\nvar React = require(\"react\"),\n shim = require(\"use-sync-external-store/shim\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = shim.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\nexports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n};\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and 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\"production\" !== process.env.NODE_ENV &&\n (function () {\n function is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var React = require(\"react\"),\n shim = require(\"use-sync-external-store/shim\"),\n objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = shim.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\n exports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n ) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot))\n return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n };\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\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>(undefined);\n useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref.current!;\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 React, { SetStateAction, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useSyncExternalStoreWithSelector } from \"use-sync-external-store/shim/with-selector\";\nimport { useMutable, usePrevious } from \"./hooks\";\nimport { entries, isPromise, shallowCompare } from \"./lib\";\nimport {\n Action,\n Debug,\n Dispatch,\n Listener,\n MapReducerReturn,\n MapReducers,\n ReducerActions,\n ReducerMiddleware,\n UseReducer\n} from \"./types\";\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\nconst reduce = <State extends {}, Props extends {}>(\n state: State,\n prev: State,\n mutations: Mutators<State, Props>,\n debug: Debug<Props>\n) => {\n if (prev === state) return mutations.reduce((acc, el) => el(acc, prev, debug), state);\n return state.constructor.name === Object.name\n ? mutations.reduce((acc, el) => el(acc, prev, debug), { ...prev, ...state })\n : mutations.reduce((acc, el) => el(acc, prev, debug), 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 mutations: Mutators<State, Props>\n ) =>\n (...params: any[]) => {\n const now = performance.now();\n const result = dispatch(...params);\n const set = (newState: State, debug: Debug<Props>) =>\n setState((prev) => reduce(newState, prev, mutations, debug));\n if (isPromise<State>(result)) {\n return result.then((resolved) => {\n debug.current = {\n method: name,\n props: getProps(),\n time: performance.now() - now\n };\n set(resolved, debug.current);\n });\n }\n debug.current = {\n method: name,\n props: getProps(),\n time: performance.now() - now\n };\n return void set(result, debug.current);\n };\n\ntype Mutators<State extends {}, Props extends {}> = Array<(state: State, prev: State, debug: Debug<Props>) => State>;\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 mutations: Mutators<State, Props>\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, mutations, debug.current!));\n if (isPromise<State>(result)) {\n return result.then((resolved) => set(resolved));\n }\n return set(result);\n };\n\ntype Options<PostMiddleware, Props, Debug, Selector, Interceptor> = Partial<{\n props: Props;\n debug: Debug;\n selector: Selector;\n interceptor: Interceptor;\n postMiddleware: PostMiddleware;\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 Mutations extends Mutators<State, Props>,\n UseDebug extends boolean\n>(\n initialState: State,\n reducer: Reducers,\n options?: Options<Middlewares, Props, UseDebug, undefined, Mutations>\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?.postMiddleware ?? ([] as unknown as Middlewares));\n const mutations = useMutable<Mutations>(options?.interceptor ?? ([] as unknown as Mutations));\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, mutations.current)\n : optimizedFunc(name, dispatch, setState, getProps, debug, mutations.current)\n }),\n {} as MapReducerReturn<State, ReturnType<Reducers>>\n );\n });\n return [state, dispatchers, mutableProps.current] as const;\n};\n\nexport const createGlobalReducer = <\n State extends {},\n Reducers extends ReducerActions<State, {}>,\n Mutations extends Mutators<State, {}>\n>(\n initialState: State,\n reducer: Reducers,\n rootOptions?: Pick<Options<[], {}, {}, () => State, Mutations>, \"interceptor\">\n): (<Selector extends (state: State) => any, Middlewares extends ReducerMiddleware<ReturnType<Selector>, {}>>(\n selector?: Selector,\n comparator?: (a: any, b: any) => boolean,\n options?: Options<Middlewares, {}, {}, Selector, []>\n) => UseReducer<Selector extends (state: State) => State ? State : ReturnType<Selector>, State, {}, Reducers>) & {\n dispatchers: MapReducerReturn<State, ReturnType<Reducers>>;\n getState: () => State\n} => {\n let state = initialState;\n const rootMutations = rootOptions?.interceptor ?? [];\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 debugOptions = { initialState, props: {} as any, state: getSnapshot, previousState: getSnapshot };\n\n const defaultSelector = (state: State) => state;\n\n const dispatchers: MapReducerReturn<State, ReturnType<Reducers>> = entries(reducer(debugOptions)).reduce<any>(\n (acc, [method, fn]: any) => ({\n ...acc,\n [method]: (...args: any[]) => {\n const result = fn(...args);\n const set = (newState: State) =>\n setState((prev) =>\n reduce(newState, prev, rootMutations, {\n method,\n props: {},\n selector: defaultSelector,\n time: 0\n })\n );\n return isPromise<State>(result) ? result.then(set) : set(result);\n }\n }),\n {}\n );\n\n return Object.assign(\n function useStore<\n Selector extends (state: State) => any,\n O extends Omit<Options<ReducerMiddleware<ReturnType<Selector>, {}>, {}, {}, Selector, []>, \"mutations\">\n >(selector?: Selector, comparator = shallowCompare, options?: O) {\n const middleware = useMutable(options?.postMiddleware ?? []);\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 (Array.isArray(middleware.current))\n middleware.current.forEach((middle) => {\n middle(state, previous, { method: \"@globalState@\", time: -1, props: {}, selector });\n });\n }, [state, previous, middleware]);\n return [state, dispatchers, {}] as const;\n },\n { dispatchers, getState: () => state }\n );\n};\n","import { Debug } from \"./types\";\n\nexport type StoragePluginManager = {\n set: (key: string, value: any) => void;\n};\n\nexport const createStoragePlugin =\n (storage: () => StoragePluginManager) =>\n (key: string) =>\n <T>(state: T, _: T) => {\n storage().set(key, JSON.stringify(state));\n return state;\n };\n\nexport const createLocalStoragePlugin = createStoragePlugin(() => ({\n set: (k, v) => localStorage.setItem(k, v)\n}));\n\nexport const createSessionStoragePlugin = createStoragePlugin(() => ({\n set: (k, v) => sessionStorage.setItem(k, v)\n}));\n\nexport const createLoggerPlugin =\n (groupName: string) =>\n <State, Props extends object>(state: State, prev: State, debug: Debug<Props>) => {\n console.group(groupName);\n console.info(`%cAction %c- \"${debug.method}\" ${debug.time}ms\\n`, \"color: gold\", \"color: white\", prev);\n console.info(\"%cPrevious state\\n\", \"color: silver\", prev);\n console.info(\"%cCurrent state\\n\", \"color: green\", state);\n console.info(\"Props\\n\", debug.props);\n console.groupEnd();\n return state;\n };\n"],"names":["React","require$$0","is","x","y","objectIs","useState","useEffect","useLayoutEffect","useDebugValue","useSyncExternalStore$2","subscribe","getSnapshot","value","_useState","inst","forceUpdate","checkIfSnapshotChanged","latestGetSnapshot","nextValue","useSyncExternalStore$1","shim","useSyncExternalStoreShim_production","didWarnOld18Alpha","didWarnUncachedGetSnapshot","cachedValue","useSyncExternalStoreShim_development","shimModule","require$$1","useSyncExternalStore","useRef","useMemo","withSelector_production","getServerSnapshot","selector","isEqual","instRef","memoizedSelector","nextSnapshot","hasMemo","memoizedSnapshot","currentSelection","memoizedSelection","nextSelection","maybeGetServerSnapshot","withSelector_development","withSelectorModule","useMutable","state","mutable","usePrevious","ref","isObject","obj","keys","entries","t","isPromise","promise","isPrimitive","a","type","shallowCompare","left","right","i","key","clone","instance","dispatchCallback","prev","setter","useLegacyReducer","initialState","reducers","props","setState","refProps","getProps","useCallback","dispatches","acc","name","dispatch","params","dispatcher","previousState","reduce","mutations","debug","el","debugFunc","now","result","set","newState","resolved","optimizedFunc","useReducer","reducer","options","mutableState","mutableProps","mutableReducer","middleware","savedInitialState","previous","previousRef","d","middle","dispatchers","createGlobalReducer","rootOptions","rootMutations","listeners","addListener","listener","callback","exec","debugOptions","defaultSelector","method","fn","args","comparator","useSyncExternalStoreWithSelector","createStoragePlugin","storage","_","createLocalStoragePlugin","k","v","createSessionStoragePlugin","createLoggerPlugin","groupName"],"mappings":";;;;;;;;wCAWA,IAAIA,EAAQC,EACZ,SAASC,EAAGC,EAAGC,EAAG,CAChB,OAAQD,IAAMC,IAAYD,IAAN,GAAW,EAAIA,IAAM,EAAIC,IAAQD,IAAMA,GAAKC,IAAMA,CACxE,CACA,IAAIC,EAA0B,OAAO,OAAO,IAA7B,WAAkC,OAAO,GAAKH,EAC3DI,EAAWN,EAAM,SACjBO,EAAYP,EAAM,UAClBQ,EAAkBR,EAAM,gBACxBS,EAAgBT,EAAM,cACxB,SAASU,EAAuBC,EAAWC,EAAa,CACtD,IAAIC,EAAQD,EAAa,EACvBE,EAAYR,EAAS,CAAE,KAAM,CAAE,MAAOO,EAAO,YAAaD,CAAW,EAAI,EACzEG,EAAOD,EAAU,CAAC,EAAE,KACpBE,EAAcF,EAAU,CAAC,EAC3B,OAAAN,EACE,UAAY,CACVO,EAAK,MAAQF,EACbE,EAAK,YAAcH,EACnBK,EAAuBF,CAAI,GAAKC,EAAY,CAAE,KAAMD,CAAI,CAAE,CAC3D,EACD,CAACJ,EAAWE,EAAOD,CAAW,CAC/B,EACDL,EACE,UAAY,CACV,OAAAU,EAAuBF,CAAI,GAAKC,EAAY,CAAE,KAAMD,CAAI,CAAE,EACnDJ,EAAU,UAAY,CAC3BM,EAAuBF,CAAI,GAAKC,EAAY,CAAE,KAAMD,CAA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