react-hooks-global-states 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -422,7 +422,7 @@ const initialState: CounterState = {
422
422
  count: 0,
423
423
  };
424
424
 
425
- export const [useCounterContext, CounterProvider] = createStatefulContext(initialState, () => ({
425
+ export const [useCounterContext, CounterProvider] = createContext(initialState, () => ({
426
426
  increase: (value: number = 1) => {
427
427
  return ({ setState }: StoreTools<CounterState>) => {
428
428
  setState((state) => ({
@@ -651,29 +651,18 @@ Creating a global hook that connects to an asyncStorage is made incredibly easy
651
651
  This function returns a new global state builder wrapped with the desired custom implementation, allowing you to get creative! Le'ts see and example:
652
652
 
653
653
  ```ts
654
- import { formatFromStore, formatToStore, createCustomGlobalState } = 'react-hooks-global-states'
655
-
656
- // Optional configuration available for the consumers of the builder
657
- type HookConfig = {
658
- asyncStorageKey?: string;
659
- };
660
-
661
- // This is the base metadata that all the stores created from the builder will have.
662
- type BaseMetadata = {
663
- isAsyncStorageReady?: boolean;
664
- };
665
-
666
654
  export const createGlobalState = createCustomGlobalState<
667
- BaseMetadata,
668
- HookConfig
655
+ {
656
+ asyncStorageKey?: string;
657
+ },
658
+ {
659
+ isAsyncStorageReady?: boolean;
660
+ }
669
661
  >({
670
- /**
671
- * This function executes immediately after the global state is created, before the invocations of the hook
672
- */
673
662
  onInitialize: async ({ setState, setMetadata }, config) => {
674
663
  setMetadata((metadata) => ({
675
664
  ...(metadata ?? {}),
676
- isAsyncStorageReady: null,
665
+ isAsyncStorageReady: undefined,
677
666
  }));
678
667
 
679
668
  const asyncStorageKey = config?.asyncStorageKey;
@@ -681,14 +670,13 @@ export const createGlobalState = createCustomGlobalState<
681
670
 
682
671
  const storedItem = (await asyncStorage.getItem(asyncStorageKey)) as string;
683
672
 
684
- // update the metadata, remember, metadata is not reactive
685
673
  setMetadata((metadata) => ({
686
674
  ...metadata,
687
675
  isAsyncStorageReady: true,
688
676
  }));
689
677
 
690
678
  if (storedItem === null) {
691
- return setState((state) => state, { forceUpdate: true });
679
+ return setState((state: unknown) => state, { forceUpdate: true });
692
680
  }
693
681
 
694
682
  const parsed = formatFromStore(storedItem, {
@@ -733,10 +721,10 @@ That's correct! If you add an **asyncStorageKey** to the state configuration, th
733
721
  Let's see how to use this async storage hook into our components:
734
722
 
735
723
  ```ts
736
- const [todos, setTodos, metadata] = useTodos();
724
+ const [todos, setTodos, {isAsyncStorageReady}] = useTodos();
737
725
 
738
726
  return (<>
739
- {metadata.isAsyncStorageReady ? <TodoList todos={todos} /> : <Text>Loading...</Text>}
727
+ {isAsyncStorageReady ? <TodoList todos={todos} /> : <Text>Loading...</Text>}
740
728
  <>);
741
729
  ```
742
730
 
@@ -808,58 +796,58 @@ const useData = createGlobalState(
808
796
  metadata: {
809
797
  someExtraInformation: 'someExtraInformation',
810
798
  },
811
- // onSubscribed: (StateConfigCallbackParam) => {},
812
- // onInit // etc
813
- computePreventStateChange: ({ state, previousState }) => {
814
- const prevent = isEqual(state, previousState);
815
-
816
- return prevent;
799
+ callbacks: {
800
+ // onSubscribed: (StateConfigCallbackParam) => {},
801
+ // onInit // etc
802
+ computePreventStateChange: ({ state, previousState }) => {
803
+ const prevent = isEqual(state, previousState);
804
+
805
+ return prevent;
806
+ },
817
807
  },
818
808
  }
819
809
  );
820
810
  ```
821
811
 
822
- Finally, if you have a very specific necessity but still want to use the global hooks, you can extend the **GlobalStoreAbstract** class. This will give you even more control over the state and the lifecycle of the global state.
812
+ Finally, if you have a very specific necessity but still want to use the global hooks, you can extend the **GlobalStoreAbstract** class.
823
813
 
824
814
  Let's see an example again with the **asyncStorage** custom global hook but with the abstract class.
825
815
 
826
816
  ```ts
827
817
  export class GlobalStore<
828
- TState,
829
- TMetadata extends {
830
- asyncStorageKey?: string;
818
+ State,
819
+ Metadata extends {
831
820
  isAsyncStorageReady?: boolean;
832
- } | null = null,
833
- TStateMutator extends ActionCollectionConfig<TState, TMetadata> | StateSetter<TState> = StateSetter<TState>
834
- > extends GlobalStoreAbstract<TState, TMetadata, TStateMutator> {
821
+ },
822
+ ActionsConfig extends ActionCollectionConfig<State, Metadata> | unknown
823
+ > extends GlobalStoreAbstract<State, Metadata, ActionsConfig> {
824
+ public asyncStorageKey?: string;
825
+
835
826
  constructor(
836
- state: TState,
837
- config: GlobalStoreConfig<TState, TMetadata, TStateMutator> = {},
838
- actionsConfig: TStateMutator | null = null
827
+ state: State,
828
+ args: {
829
+ metadata?: Metadata;
830
+ callbacks?: GlobalStoreCallbacks<State, Metadata>;
831
+ actions?: ActionsConfig;
832
+ name?: string;
833
+ asyncStorageKey?: string;
834
+ } = {}
839
835
  ) {
840
- super(state, config, actionsConfig);
841
-
836
+ super(state, args);
837
+ this.asyncStorageKey = args.asyncStorageKey;
842
838
  this.initialize();
843
839
  }
844
840
 
845
841
  protected onInitialize = async ({
846
842
  setState,
847
843
  setMetadata,
848
- getMetadata,
849
844
  getState,
850
- }: StateConfigCallbackParam<TState, TMetadata, TStateMutator>) => {
851
- setMetadata({
852
- ...(metadata ?? {}),
853
- isAsyncStorageReady: null,
854
- });
855
-
856
- const metadata = getMetadata();
857
- const asyncStorageKey = metadata?.asyncStorageKey;
845
+ }: StoreTools<State, Metadata>) => {
846
+ if (!this.asyncStorageKey) return;
858
847
 
859
- if (!asyncStorageKey) return;
848
+ const storedItem = (await asyncStorage.getItem(this.asyncStorageKey)) as string | null;
860
849
 
861
- const storedItem = (await asyncStorage.getItem(asyncStorageKey)) as string;
862
- setMetadata({
850
+ setMetadata((metadata) => {
863
851
  ...metadata,
864
852
  isAsyncStorageReady: true,
865
853
  });
@@ -871,19 +859,15 @@ export class GlobalStore<
871
859
  return setState(state, { forceUpdate: true });
872
860
  }
873
861
 
874
- const items = formatFromStore<TState>(storedItem, {
862
+ const items = formatFromStore<State>(storedItem, {
875
863
  jsonParse: true,
876
864
  });
877
865
 
878
866
  setState(items, { forceUpdate: true });
879
867
  };
880
868
 
881
- protected onChange = ({
882
- getMetadata,
883
- getState,
884
- }: StateChangesParam<TState, TMetadata, NonNullable<TStateMutator>>) => {
885
- const asyncStorageKey = getMetadata()?.asyncStorageKey;
886
-
869
+ protected onChange = ({ getState }: StoreTools<State, Metadata> & StateChanges<State>) => {
870
+ const asyncStorageKey = this.asyncStorageKey;
887
871
  if (!asyncStorageKey) return;
888
872
 
889
873
  const state = getState();
@@ -900,17 +884,16 @@ export class GlobalStore<
900
884
  Then, from an instance of the global store, you will be able to access the hooks.
901
885
 
902
886
  ```ts
903
- const storage = new GlobalStore(0, {
904
- metadata: {
887
+ const useCount = new GlobalStore(1, {
888
+ config: {
905
889
  asyncStorageKey: 'counter',
906
- isAsyncStorageReady: false,
907
890
  },
908
- });
891
+ }).getHook();
909
892
 
910
- const [getState, _, getMetadata] = storage.stateControls();
911
- const useState = storage.getHook();
912
- ```
893
+ const [stateRetriever, stateMutator, getMetadata] = useCount.stateControls();
913
894
 
914
- ### **Note**: The GlobalStore class is still available in the package in case you were already extending from it.
895
+ // into a component
896
+ const [state, setState, { isAsyncStorageReady }] = useCount();
897
+ ```
915
898
 
916
899
  # That's it for now!! hope you enjoy coding!!
package/lib/bundle.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see bundle.js.LICENSE.txt */
2
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("react")):t["react-hooks-global-states"]=e(t.react)}(this,(t=>{return e={852:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.combineRetrieverAsynchronously=e.combineRetrieverEmitterAsynchronously=void 0;var i=r(608),a=r(156);e.combineRetrieverEmitterAsynchronously=function(t){for(var e,r,n,o=arguments.length,a=new Array(o>1?o-1:0),u=1;u<o;u++)a[u-1]=arguments[u];var c=a,l=new Map(c.map((function(t,e){return[e,t()]}))),s=t.selector(Array.from(l.values())),f=void 0!==(null===(e=null==t?void 0:t.config)||void 0===e?void 0:e.isEqual)?null===(r=null==t?void 0:t.config)||void 0===r?void 0:r.isEqual:i.shallowCompare,v=new Set,d=(0,i.debounce)((function(){var e=t.selector(Array.from(l.values()));(null==f?void 0:f(s,e))||(s=e,v.forEach((function(t){return t()})))}),null===(n=null==t?void 0:t.config)||void 0===n?void 0:n.delay),p=c.map((function(t,e){return t((function(t){l.set(e,t),d()}))})),y=function(t,e,r){var n,o,a="function"==typeof e,u=a?t:null,c=a?e:t,l=a?r:e,f=Object.assign({delay:0,isEqual:i.shallowCompare},null!=l?l:{}),d=null!==(n=null==u?void 0:u(s))&&void 0!==n?n:s;f.skipFirst||c(d);var p=(0,i.debounce)((function(){var t,e,r=null!==(t=null==u?void 0:u(s))&&void 0!==t?t:s;(null===(e=f.isEqual)||void 0===e?void 0:e.call(f,d,r))||(d=r,c(r))}),null!==(o=f.delay)&&void 0!==o?o:0);return v.add(p),function(){v.delete(p)}};return[y,function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e[0]?y.apply(void 0,e):s},function(){p.forEach((function(t){return t()}))}]},e.combineRetrieverAsynchronously=function(t){for(var r=arguments.length,o=new Array(r>1?r-1:0),u=1;u<r;u++)o[u-1]=arguments[u];var c=n(e.combineRetrieverEmitterAsynchronously.apply(void 0,[t].concat(o)),3),l=c[0],s=c[1],f=c[2];return[function(t,e){var r=n((0,a.useState)((function(){var e=s();return t?t(e):e})),2),o=r[0],u=r[1];return(0,a.useEffect)((function(){var r,n=Object.assign({delay:0,isEqual:i.shallowCompare},null!=e?e:{}),o=void 0!==n.isEqual?n.isEqual:i.shallowCompare,a=l((function(e){return t?t(e):e}),(0,i.debounce)((function(e){var r=t?t(e):e;(null==o?void 0:o(e,r))||u(r)}),null!==(r=n.delay)&&void 0!==r?r:0));return function(){a()}}),[]),[o,null,null]},s,f]}},113:(t,e,r)=>{"use strict";var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},o=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};Object.defineProperty(e,"__esModule",{value:!0}),e.createContext=void 0;var i=r(608),a=r(774),u=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e}(r(156)),c=r(684);e.createContext=function(t,e){var r=new Map,n=u.default.createContext(i.uniqueSymbol),o=function(){var t=u.default.useContext(n);if(t===i.uniqueSymbol)throw new Error("context hooks need to be used inside a provider");return t};return o.createSelectorHook=function(t,e){var n=(0,i.uniqueId)("cs:");return function(){var i,a,u=o(),l=(i=u,null!==(a=r.get(i))&&void 0!==a?a:r.set(i,new Map).get(i));l.has(n)||l.set(n,u.createSelectorHook(t,e));var s=l.get(n);if((0,c.isNil)(s))throw new Error("useSelectedHook is nil");return s.apply(void 0,arguments)}},[o,function(o){var i=o.children,l=o.value,s=o.ref,f=(0,u.useMemo)((function(){var r=void 0===l?t():(0,c.isFunction)(l)?l(t()):l,n=new a.GlobalStore(r,e);return{store:n,hook:n.getHook()}}),[]),v=f.store,d=f.hook;return r.has(d)||r.set(d,new Map),(0,u.useEffect)((function(){return function(){var t,e,n,o;r.delete(d),null===(e=null===(t=v.callbacks)||void 0===t?void 0:t.onUnMount)||void 0===e||e.call(t),null===(o=(n=v).__onUnMountContext)||void 0===o||o.call(n,v,d)}}),[]),(0,u.useImperativeHandle)(s,(function(){return s?v.getConfigCallbackParam():{}}),[v,s]),u.default.createElement(n.Provider,{value:d},i)}]}},853:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createCustomGlobalState=e.createGlobalState=void 0;var n=r(774);e.createGlobalState=function(t,e){return new n.GlobalStore(t,e).getHook()},e.createCustomGlobalState=function(t){var r=t.onInitialize,n=t.onChange;return function(t,o){return(0,e.createGlobalState)(t,{callbacks:Object.assign(Object.assign({},null==o?void 0:o.callbacks),{onInit:function(t){var e,n;null==r||r(t,null==o?void 0:o.config),null===(n=null===(e=null==o?void 0:o.callbacks)||void 0===e?void 0:e.onInit)||void 0===n||n.call(e,t)},onStateChanged:function(t){var e,r;null==n||n(t,null==o?void 0:o.config),null===(r=null===(e=null==o?void 0:o.callbacks)||void 0===e?void 0:e.onStateChanged)||void 0===r||r.call(e,t)}})})}}},774:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(){u=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),u=new C(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function v(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var d={};function p(){}function y(){}function b(){}var h={};s(h,a,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(k([])));g&&g!==e&&r.call(g,a)&&(h=g);var S=b.prototype=p.prototype=Object.create(h);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function i(o,a,u,c){var l=v(t[o],t,a);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==n(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,u,c)}),(function(t){i("throw",t,u,c)})):e.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return i("throw",t,u,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function j(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=E(a,r);if(u){if(u===d)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=v(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=v(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:_}}function _(){return{value:void 0,done:!0}}return y.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:y,configurable:!0}),y.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},w(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(S),s(S,l,"Generator"),s(S,a,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l(n.key),n)}}function l(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===n(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var s=r(608),f=r(156),v=r(684),d=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return t=r,e=void 0,n=void 0,o=u().mark((function t(){var e,r,n,o,i,a;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},i=o.onInit,n||i){t.next=6;break}return t.abrupt("return");case 6:a=this.getConfigCallbackParam(),null==n||n(a),(0,v.isNil)(i)||null==i||i(a);case 9:case"end":return t.stop()}}),t,this)})),new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function u(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((o=o.apply(t,e||[])).next())}));var t,e,n,o},this.executeSetStateForSubscriber=function(t,e){var n,o,i=t.selector,a=t.callback,u=t.currentState,c=t.config;if(!e.forceUpdate&&(null!==(n=null==c?void 0:c.isEqualRoot)&&void 0!==n?n:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var l=i?i(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(o=null==c?void 0:c.isEqual)&&void 0!==o?o:function(t,e){return t===e})(u,l)?{didUpdate:!1}:(r.partialUpdateSubscription(t.subscriptionId,{currentState:l}),a({state:l},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var n=t.state,o=e.forceUpdate,a=e.identifier,u=r.stateWrapper.state;if(o||u!==n){r.stateWrapper={state:n};var c,l={forceUpdate:o,newRootState:n,currentRootState:u,identifier:a},s=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}(r.subscribers.values());try{for(s.s();!(c=s.n()).done;){var f=c.value;r.executeSetStateForSubscriber(f,l)}}catch(t){s.e(t)}finally{s.f()}}},this.setMetadata=function(t){var e=(0,v.isFunction)(t)?t(r.metadata):t;r.metadata=e},this.getMetadata=function(){return r.metadata},this.getState=function(t,e,n){var o;if(!t)return r.stateWrapper.state;var i=(0,v.isFunction)(e),a=i?t:void 0,u=i?e:t,c=null!==(o=i?n:e)&&void 0!==o?o:void 0,l=a?a(r.stateWrapper.state):r.stateWrapper.state;(null==c?void 0:c.skipFirst)||u(l);var f=(0,s.uniqueId)("gs:");return r.setOrUpdateSubscription({subscriptionId:f,selector:a,config:c,currentState:l,callback:function(t){var e=t.state;return u(e)},isSetStateCallback:!1}),function(){r.subscribers.delete(f)}},this.getConfigCallbackParam=function(){var t=r.setMetadata,e=r.getMetadata,n=r.getState,o=r.actions;return{setMetadata:t,getMetadata:e,getState:n,setState:r.setStateWrapper,actions:o}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var n=r.subscribers.get(e);return(0,s.isRecord)(n)?(Object.assign(n,t),{isNewSubscription:!1}):(r.executeOnSubscribed(),r.subscribers.set(e,t),r.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var n=r.subscribers.get(t);(0,s.isRecord)(n)&&Object.assign(n,e)},this.executeOnSubscribed=function(){var t,e=r.onSubscribed,n=null===(t=r.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||n){var o=r.getConfigCallbackParam();null==e||e(o),null==n||n(o)}},this.getHook=function(){var t=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,s.useConstantValueRef)((function(){return{subscriptionId:null,tempInitialRootState:r.stateWrapper.state}})),a=function(){return t?{state:t(r.stateWrapper.state)}:r.stateWrapper},u=o((0,f.useState)(a),2),c=u[0],l=u[1];(0,f.useEffect)((function(){if(!(0,v.isNil)(i.current)){(0,v.isNil)(i.current.subscriptionId)&&(i.current.subscriptionId=(0,s.uniqueId)("ss:"));var e=i.current.subscriptionId,o={subscriptionId:e,currentState:c.state,selector:t,config:n,callback:l,isSetStateCallback:!0};return r.setOrUpdateSubscription(o).isNewSubscription&&(r.executeSetStateForSubscriber(o,{forceUpdate:!1,newRootState:r.stateWrapper.state,currentRootState:i.current.tempInitialRootState,identifier:"on mount state update"}),i.current.tempInitialRootState=s.uniqueSymbol),function(){r.subscribers.delete(e)}}}),[]);var d=(0,v.isString)(i.current)?i.current:"",p=r.subscribers.get(d),y=(null!==(e=null==p?void 0:p.config)&&void 0!==e?e:{dependencies:n.dependencies}).dependencies;return r.partialUpdateSubscription(d,{currentState:c.state,selector:t,config:n,callback:l}),[r.computeSelectedState({selector:t,subscriptionId:d,config:n,currentDependencies:y,computeChildState:a,stateWrapperRef:c}),r.getStateOrchestrator(),r.metadata]};return t.stateControls=r.stateControls,t.createSelectorHook=r.createSelectorHook,t.createObservable=r.createObservable,t},this.computeSelectedState=function(t){var e=t.selector,n=t.subscriptionId,o=t.config,i=t.currentDependencies,a=t.computeChildState,u=t.stateWrapperRef;if(!e||!n)return u.state;var c=o.dependencies;if(i===c)return u.state;if((null==i?void 0:i.length)===(null==c?void 0:c.length)&&(0,s.shallowCompare)(i,c))return u.state;var l=a().state;return r.partialUpdateSubscription(n,{currentState:l}),u.state=l,l},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isEqualRoot,a=n.isEqual,u=n.name,c=o(r.stateControls(),3),l=c[0],f=c[1],d=c[2],p=l(),y=(null!=e?e:function(t){return t})(p),b=new t(y,{name:null!=u?u:(0,s.uniqueId)("sh:")}),h=o(b.stateControls(),2),m=h[0],g=h[1];l((function(t){if(!(null!=i?i:Object.is)(p,t)){p=t;var r=e(t);(null!=a?a:Object.is)(y,r)||(y=r,g(r))}}),{skipFirst:!0});var S=b.getHook(),w=function(t,e){return[o((0,v.isFunction)(t)?S(t,e):S(),1)[0],f,d]};return w.stateControls=function(){return[m,f,d]},w.createSelectorHook=r.createSelectorHook.bind(w),w.createObservable=r.createObservable.bind(w),w},this.stateControls=function(){var t=r.getStateOrchestrator(),e=r.getMetadata;return[r.getState,t,e]},this.getStateOrchestrator=function(){return r.actions?r.actions:r.setStateWrapper},this.setStateWrapper=function(t){var e,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.forceUpdate,a=o.identifier,u=r.stateWrapper.state,c=(0,v.isFunction)(t)?t(u):t;if(i||r.stateWrapper.state!==c){var l=r.setMetadata,s=r.getMetadata,f=r.getState,d=r.actions,p={setMetadata:l,getMetadata:s,setState:r.setState,getState:f,actions:d,previousState:u,state:c,identifier:a},y=r.computePreventStateChange,b=null===(e=r.callbacks)||void 0===e?void 0:e.computePreventStateChange;if((y||b)&&((null==y?void 0:y(p))||(null==b?void 0:b(p))))return;r.setState({state:c},{forceUpdate:i,identifier:a});var h=r.onStateChanged,m=null===(n=r.callbacks)||void 0===n?void 0:n.onStateChanged;(h||m)&&(null==h||h(p),null==m||m(p))}},this.getStoreActionsMap=function(){if(!(0,s.isRecord)(r.actionsConfig))return null;var t=r.actionsConfig,e=r.setMetadata,n=r.setStateWrapper,o=r.getState,i=r.getMetadata,a=Object.keys(t).reduce((function(r,u){var c,f,v;return Object.assign(r,(c={},v=function(){for(var r=t[u],c=arguments.length,l=new Array(c),f=0;f<c;f++)l[f]=arguments[f];var v=r.apply(a,l);return"function"!=typeof v&&(0,s.throwWrongKeyOnActionCollectionConfig)(u),v.call(a,{setState:n,getState:o,setMetadata:e,getMetadata:i,actions:a})},(f=l(f=u))in c?Object.defineProperty(c,f,{value:v,enumerable:!0,configurable:!0,writable:!0}):c[f]=v,c)),r}),{});return a};var a=n.metadata,c=n.callbacks,d=n.actions,p=n.name;this.stateWrapper={state:e},this._name=null!=p?p:(0,s.uniqueId)("gs:"),this.metadata=null!=a?a:{},this.callbacks=null!=c?c:null,this.actionsConfig=null!=d?d:null,(null===globalThis||void 0===globalThis?void 0:globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG)&&globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG(this),this.constructor!==t||this.initialize()}var e,r;return e=t,r=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.isEqualRoot,n=e.isEqual,i=e.name,a=o(this.stateControls(),1)[0],u=[],c=a(),l=(null!=t?t:function(t){return t})(a());a((function(e){if(!(null!=r?r:Object.is)(c,e)){c=e;var o=t(e);(null!=n?n:Object.is)(l,o)||(l=o,u.forEach((function(t){return t()})))}}),{skipFirst:!0});var f=function(t,e,r){var n;if(!t)return l;var o=(0,v.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,s=function(){return a(i?i(l):l)};(null==c?void 0:c.skipFirst)||s();var f=function(){s()};return u.push(f),function(){u.splice(u.indexOf(f),1)}};return f._name=null!=i?i:(0,s.uniqueId)("ob:"),f.createObservable=this.createObservable.bind(f),f.stateControls=function(){return[f]},f}}],r&&c(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.GlobalStore=d},530:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},608:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}function i(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.useConstantValueRef=e.uniqueSymbol=e.isRecord=e.throwWrongKeyOnActionCollectionConfig=e.uniqueId=e.debounce=e.shallowCompare=void 0;var c,l=r(684),s=r(156);e.shallowCompare=function(t,r){if(t===r)return!0;var i=u(t),a=u(r);if(i!==a)return!1;if((0,l.isNil)(t)||(0,l.isNil)(r)||(0,l.isPrimitive)(t)&&(0,l.isPrimitive)(r)||(0,l.isDate)(t)&&(0,l.isDate)(r)||"function"===i&&"function"===a)return t===r;if(Array.isArray(t)){var c=t,s=r;if(c.length!==s.length)return!1;for(var f=0;f<c.length;f++)if(c[f]!==s[f])return!1}if(t instanceof Map){var v=t,d=r;if(v.size!==d.size)return!1;var p,y=o(v);try{for(y.s();!(p=y.n()).done;){var b=n(p.value,2),h=b[0];if(b[1]!==d.get(h))return!1}}catch(t){y.e(t)}finally{y.f()}}if(t instanceof Set){var m=t,g=r;if(m.size!==g.size)return!1;var S,w=o(m);try{for(w.s();!(S=w.n()).done;){var O=S.value;if(!g.has(O))return!1}}catch(t){w.e(t)}finally{w.f()}}if(!(0,e.isRecord)(t)||!(0,e.isRecord)(r))return t===r;var j=Object.keys(t),E=Object.keys(r);if(j.length!==E.length)return!1;for(var x=0,A=j;x<A.length;x++){var C=A[x];if(t[C]!==r[C])return!1}return!0},e.debounce=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];e&&clearTimeout(e),e=setTimeout((function(){t.apply(void 0,o)}),r)}},e.uniqueId=(c=0,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return c===Number.MAX_SAFE_INTEGER&&(c=0),t+Date.now().toString(36)+(c++).toString(36)}),e.throwWrongKeyOnActionCollectionConfig=function(t){throw new Error("[WRONG CONFIGURATION!]: Every key inside the storeActionsConfig must be a higher order function that returns a function \n[".concat(t,"]: key is not a valid function, try something like this: \n{\n\n ").concat(t,": (param) => ({ setState, getState, setMetadata, getMetadata, actions }) => {\n\n setState((state) => ({ ...state, ...param }))\n\n }\n\n}\n"))},e.isRecord=function(t){return!(0,l.isNil)(t)&&"object"===u(t)},e.uniqueSymbol=Symbol("unique"),e.useConstantValueRef=function(t){var r=(0,s.useRef)(e.uniqueSymbol);return r.current===e.uniqueSymbol&&(r.current=t()),r}},195:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStoreAbstract=void 0;var a=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(c,t);var e,r,a,u=(r=c,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=i(r);if(a){var o=i(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function c(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(t=u.apply(this,arguments)).onInit=function(e){t.onInitialize(e)},t.onStateChanged=function(e){t.onChange(e)},t}return e=c,Object.defineProperty(e,"prototype",{writable:!1}),e}(r(774).GlobalStore);e.GlobalStoreAbstract=a},991:(t,e,r)=>{"use strict";var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},o=function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(684),e),o(r(530),e),o(r(774),e),o(r(195),e),o(r(853),e),o(r(608),e),o(r(852),e),o(r(113),e)},684:function(t){t.exports=(()=>{"use strict";var t={124:(t,e,r)=>{var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]};Object.defineProperty(e,"__esModule",{value:!0}),function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)}(r(331),e)},331:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e,n){return(e=function(t){var e=function(t){if("object"!=r(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.formatToStore=e.formatFromStore=e.isPrimitive=e.isFunction=e.isRegex=e.isDate=e.isString=e.isBoolean=e.isNumber=e.isNil=e.clone=void 0,e.clone=function(t){var r,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).shallow;if((0,e.isPrimitive)(t)||(0,e.isDate)(t))return t;if(Array.isArray(t))return a?function(t){if(Array.isArray(t))return i(t)}(r=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||o(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}():t.map((function(t){return(0,e.clone)(t)}));if(t instanceof Map){var u=Array.from(t.entries());return a?new Map(u):new Map(u.map((function(t){return(0,e.clone)(t)})))}if(t instanceof Set){var c=Array.from(t.values());return a?new Set(c):new Set(c.map((function(t){return(0,e.clone)(t)})))}return t instanceof RegExp?new RegExp(t.toString()):(0,e.isFunction)(t)?a?t:Object.create(t):a?Object.assign({},t):t instanceof Error?new Error(t.message):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.clone)(i)))}),{})},e.isNil=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isBoolean=function(t){return"boolean"==typeof t},e.isString=function(t){return"string"==typeof t},e.isDate=function(t){return t instanceof Date},e.isRegex=function(t){return t instanceof RegExp},e.isFunction=function(t){return"function"==typeof t||t instanceof Function},e.isPrimitive=function(t){return(0,e.isNil)(t)||(0,e.isNumber)(t)||(0,e.isBoolean)(t)||(0,e.isString)(t)||"symbol"===r(t)},e.formatFromStore=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.jsonParse,a=r.sortKeys;return function(t){var r,i,u;if((0,e.isPrimitive)(t))return t;if("date"===(null==t?void 0:t.$t))return new Date(t.$v);if("map"===(null==t?void 0:t.$t)){var c=(null!==(r=t.$v)&&void 0!==r?r:[]).map((function(t){var r,n=(2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next,0;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(r)||o(r,2)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=n[0],a=n[1];return[i,(0,e.formatFromStore)(a)]}));return new Map(c)}if("set"===(null==t?void 0:t.$t)){var l=null!==(i=t.$v)&&void 0!==i?i:[].map((function(t){return(0,e.formatFromStore)(t)}));return new Set(l)}return"regex"===(null==t?void 0:t.$t)?new RegExp(t.$v):"error"===(null==t?void 0:t.$t)?new Error(t.$v):Array.isArray(t)?t.map((function(t){return(0,e.formatFromStore)(t)})):"function"===(null==t?void 0:t.$t)?Function("(".concat(t.$v,")(...arguments)")):(u=Object.keys(t),a?(0,e.isFunction)(a)?u.sort(a):u.sort((function(t,e){return(null!=t?t:"").localeCompare(e)})):u).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.formatFromStore)(i)))}),{})}(i?JSON.parse(t):(0,e.clone)(t))},e.formatToStore=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{stringify:!1},i=o.stringify,a=o.validator,u=o.excludeTypes,c=o.excludeKeys,l=o.sortKeys,s=new Set(null!=u?u:[]),f=new Set(null!=c?c:[]),v=s.size||f.size,d=null!=a?a:function(t){var e=t.key,n=t.value;if(!v)return!0;var o=f.has(e),i=s.has(r(n));return!o&&!i},p=function(t){if((0,e.isPrimitive)(t))return t;var r;if(Array.isArray(t))return t.map((function(t){return p(t)}));if(t instanceof Map)return{$t:"map",$v:Array.from(t.entries()).map((function(t){return p(t)}))};if(t instanceof Set)return{$t:"set",$v:Array.from(t.values()).map((function(t){return p(t)}))};if((0,e.isDate)(t))return{$t:"date",$v:t.toISOString()};if((0,e.isRegex)(t))return{$t:"regex",$v:t.toString()};if((0,e.isFunction)(t)){var o;try{o={$t:"function",$v:t.toString()}}catch(t){o={$t:"error",$v:"Error: Could not serialize function"}}return o}return t instanceof Error?{$t:"error",$v:t.message}:(r=Object.keys(t),l?(0,e.isFunction)(l)?r.sort(l):r.sort((function(t,e){return(null!=t?t:"").localeCompare(e)})):r).reduce((function(e,r){var o=t[r],i=p(o);return d({obj:t,key:r,value:i})?Object.assign(Object.assign({},e),n({},r,p(o))):e}),{})},y=p((0,e.clone)(t));return i?JSON.stringify(y):y}}},e={};return function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}(124)})()},156:e=>{"use strict";e.exports=t}},r={},function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(991);var e,r}));
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("react")):t["react-hooks-global-states"]=e(t.react)}(this,(t=>{return e={852:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.combineRetrieverAsynchronously=e.combineRetrieverEmitterAsynchronously=void 0;var i=r(608),a=r(156);e.combineRetrieverEmitterAsynchronously=function(t){for(var e,r,n,o=arguments.length,a=new Array(o>1?o-1:0),u=1;u<o;u++)a[u-1]=arguments[u];var c=a,l=new Map(c.map((function(t,e){return[e,t()]}))),s=t.selector(Array.from(l.values())),f=void 0!==(null===(e=null==t?void 0:t.config)||void 0===e?void 0:e.isEqual)?null===(r=null==t?void 0:t.config)||void 0===r?void 0:r.isEqual:i.shallowCompare,v=new Set,d=(0,i.debounce)((function(){var e=t.selector(Array.from(l.values()));(null==f?void 0:f(s,e))||(s=e,v.forEach((function(t){return t()})))}),null===(n=null==t?void 0:t.config)||void 0===n?void 0:n.delay),p=c.map((function(t,e){return t((function(t){l.set(e,t),d()}))})),y=function(t,e,r){var n,o,a="function"==typeof e,u=a?t:null,c=a?e:t,l=a?r:e,f=Object.assign({delay:0,isEqual:i.shallowCompare},null!=l?l:{}),d=null!==(n=null==u?void 0:u(s))&&void 0!==n?n:s;f.skipFirst||c(d);var p=(0,i.debounce)((function(){var t,e,r=null!==(t=null==u?void 0:u(s))&&void 0!==t?t:s;(null===(e=f.isEqual)||void 0===e?void 0:e.call(f,d,r))||(d=r,c(r))}),null!==(o=f.delay)&&void 0!==o?o:0);return v.add(p),function(){v.delete(p)}};return[y,function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e[0]?y.apply(void 0,e):s},function(){p.forEach((function(t){return t()}))}]},e.combineRetrieverAsynchronously=function(t){for(var r=arguments.length,o=new Array(r>1?r-1:0),u=1;u<r;u++)o[u-1]=arguments[u];var c=n(e.combineRetrieverEmitterAsynchronously.apply(void 0,[t].concat(o)),3),l=c[0],s=c[1],f=c[2];return[function(t,e){var r=n((0,a.useState)((function(){var e=s();return t?t(e):e})),2),o=r[0],u=r[1];return(0,a.useEffect)((function(){var r,n=Object.assign({delay:0,isEqual:i.shallowCompare},null!=e?e:{}),o=void 0!==n.isEqual?n.isEqual:i.shallowCompare,a=l((function(e){return t?t(e):e}),(0,i.debounce)((function(e){var r=t?t(e):e;(null==o?void 0:o(e,r))||u(r)}),null!==(r=n.delay)&&void 0!==r?r:0));return function(){a()}}),[]),[o,null,null]},s,f]}},113:(t,e,r)=>{"use strict";var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},o=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};Object.defineProperty(e,"__esModule",{value:!0}),e.createContext=void 0;var i=r(608),a=r(774),u=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e}(r(156)),c=r(684);e.createContext=function(t,e){var r=new Map,n=u.default.createContext(i.uniqueSymbol),o=function(){var t=u.default.useContext(n);if(t===i.uniqueSymbol)throw new Error("context hooks need to be used inside a provider");return t};return o.createSelectorHook=function(t,e){var n=(0,i.uniqueId)("cs:");return function(){var i,a,u=o(),l=(i=u,null!==(a=r.get(i))&&void 0!==a?a:r.set(i,new Map).get(i));l.has(n)||l.set(n,u.createSelectorHook(t,e));var s=l.get(n);if((0,c.isNil)(s))throw new Error("useSelectedHook is nil");return s.apply(void 0,arguments)}},[o,function(o){var i=o.children,l=o.value,s=o.ref,f=(0,u.useMemo)((function(){var r=void 0===l?t():(0,c.isFunction)(l)?l(t()):l,n=new a.GlobalStore(r,e);return{store:n,hook:n.getHook()}}),[]),v=f.store,d=f.hook;return r.has(d)||r.set(d,new Map),(0,u.useEffect)((function(){return function(){var t,e,n,o;r.delete(d),null===(e=null===(t=v.callbacks)||void 0===t?void 0:t.onUnMount)||void 0===e||e.call(t),null===(o=(n=v).__onUnMountContext)||void 0===o||o.call(n,v,d)}}),[]),(0,u.useImperativeHandle)(s,(function(){return s?v.getConfigCallbackParam():{}}),[v,s]),u.default.createElement(n.Provider,{value:d},i)}]}},853:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createCustomGlobalState=e.createGlobalState=void 0;var n=r(774);e.createGlobalState=function(t,e){return new n.GlobalStore(t,e).getHook()},e.createCustomGlobalState=function(t){var r=t.onInitialize,n=t.onChange;return function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.callbacks,a=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(o,["callbacks"]);return(0,e.createGlobalState)(t,Object.assign(Object.assign({},a),{callbacks:Object.assign(Object.assign({},null!=i?i:{}),{onInit:function(t){var e;null==r||r(t,null==a?void 0:a.config),null===(e=null==i?void 0:i.onInit)||void 0===e||e.call(i,t)},onStateChanged:function(t){var e;null==n||n(t,null==a?void 0:a.config),null===(e=null==i?void 0:i.onStateChanged)||void 0===e||e.call(i,t)}})}))}}},774:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(){u=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),u=new C(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function v(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var d={};function p(){}function y(){}function b(){}var h={};s(h,a,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(k([])));g&&g!==e&&r.call(g,a)&&(h=g);var S=b.prototype=p.prototype=Object.create(h);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function i(o,a,u,c){var l=v(t[o],t,a);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==n(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,u,c)}),(function(t){i("throw",t,u,c)})):e.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return i("throw",t,u,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function j(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=E(a,r);if(u){if(u===d)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=v(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=v(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:_}}function _(){return{value:void 0,done:!0}}return y.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:y,configurable:!0}),y.displayName=s(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},w(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(S),s(S,l,"Generator"),s(S,a,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l(n.key),n)}}function l(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===n(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var s=r(608),f=r(156),v=r(684),d=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return t=r,e=void 0,n=void 0,o=u().mark((function t(){var e,r,n,o,i,a;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},i=o.onInit,n||i){t.next=6;break}return t.abrupt("return");case 6:a=this.getConfigCallbackParam(),null==n||n(a),(0,v.isNil)(i)||null==i||i(a);case 9:case"end":return t.stop()}}),t,this)})),new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function u(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((o=o.apply(t,e||[])).next())}));var t,e,n,o},this.executeSetStateForSubscriber=function(t,e){var n,o,i=t.selector,a=t.callback,u=t.currentState,c=t.config;if(!e.forceUpdate&&(null!==(n=null==c?void 0:c.isEqualRoot)&&void 0!==n?n:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var l=i?i(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(o=null==c?void 0:c.isEqual)&&void 0!==o?o:function(t,e){return t===e})(u,l)?{didUpdate:!1}:(r.partialUpdateSubscription(t.subscriptionId,{currentState:l}),a({state:l},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var n=t.state,o=e.forceUpdate,a=e.identifier,u=r.stateWrapper.state;if(o||u!==n){r.stateWrapper={state:n};var c,l={forceUpdate:o,newRootState:n,currentRootState:u,identifier:a},s=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}(r.subscribers.values());try{for(s.s();!(c=s.n()).done;){var f=c.value;r.executeSetStateForSubscriber(f,l)}}catch(t){s.e(t)}finally{s.f()}}},this.setMetadata=function(t){var e=(0,v.isFunction)(t)?t(r.metadata):t;r.metadata=e},this.getMetadata=function(){return r.metadata},this.getState=function(t,e,n){var o;if(!t)return r.stateWrapper.state;var i=(0,v.isFunction)(e),a=i?t:void 0,u=i?e:t,c=null!==(o=i?n:e)&&void 0!==o?o:void 0,l=a?a(r.stateWrapper.state):r.stateWrapper.state;(null==c?void 0:c.skipFirst)||u(l);var f=(0,s.uniqueId)("gs:");return r.setOrUpdateSubscription({subscriptionId:f,selector:a,config:c,currentState:l,callback:function(t){var e=t.state;return u(e)},isSetStateCallback:!1}),function(){r.subscribers.delete(f)}},this.getConfigCallbackParam=function(){var t=r.setMetadata,e=r.getMetadata,n=r.getState,o=r.actions;return{setMetadata:t,getMetadata:e,getState:n,setState:r.setStateWrapper,actions:o}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var n=r.subscribers.get(e);return(0,s.isRecord)(n)?(Object.assign(n,t),{isNewSubscription:!1}):(r.executeOnSubscribed(),r.subscribers.set(e,t),r.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var n=r.subscribers.get(t);(0,s.isRecord)(n)&&Object.assign(n,e)},this.executeOnSubscribed=function(){var t,e=r.onSubscribed,n=null===(t=r.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||n){var o=r.getConfigCallbackParam();null==e||e(o),null==n||n(o)}},this.getHook=function(){var t=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,s.useConstantValueRef)((function(){return{subscriptionId:null,tempInitialRootState:r.stateWrapper.state}})),a=function(){return t?{state:t(r.stateWrapper.state)}:r.stateWrapper},u=o((0,f.useState)(a),2),c=u[0],l=u[1];(0,f.useEffect)((function(){if(!(0,v.isNil)(i.current)){(0,v.isNil)(i.current.subscriptionId)&&(i.current.subscriptionId=(0,s.uniqueId)("ss:"));var e=i.current.subscriptionId,o={subscriptionId:e,currentState:c.state,selector:t,config:n,callback:l,isSetStateCallback:!0};return r.setOrUpdateSubscription(o).isNewSubscription&&(r.executeSetStateForSubscriber(o,{forceUpdate:!1,newRootState:r.stateWrapper.state,currentRootState:i.current.tempInitialRootState,identifier:"on mount state update"}),i.current.tempInitialRootState=s.uniqueSymbol),function(){r.subscribers.delete(e)}}}),[]);var d=(0,v.isString)(i.current)?i.current:"",p=r.subscribers.get(d),y=(null!==(e=null==p?void 0:p.config)&&void 0!==e?e:{dependencies:n.dependencies}).dependencies;return r.partialUpdateSubscription(d,{currentState:c.state,selector:t,config:n,callback:l}),[r.computeSelectedState({selector:t,subscriptionId:d,config:n,currentDependencies:y,computeChildState:a,stateWrapperRef:c}),r.getStateOrchestrator(),r.metadata]};return t.stateControls=r.stateControls,t.createSelectorHook=r.createSelectorHook,t.createObservable=r.createObservable,t},this.computeSelectedState=function(t){var e=t.selector,n=t.subscriptionId,o=t.config,i=t.currentDependencies,a=t.computeChildState,u=t.stateWrapperRef;if(!e||!n)return u.state;var c=o.dependencies;if(i===c)return u.state;if((null==i?void 0:i.length)===(null==c?void 0:c.length)&&(0,s.shallowCompare)(i,c))return u.state;var l=a().state;return r.partialUpdateSubscription(n,{currentState:l}),u.state=l,l},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isEqualRoot,a=n.isEqual,u=n.name,c=o(r.stateControls(),3),l=c[0],f=c[1],d=c[2],p=l(),y=(null!=e?e:function(t){return t})(p),b=new t(y,{name:null!=u?u:(0,s.uniqueId)("sh:")}),h=o(b.stateControls(),2),m=h[0],g=h[1];l((function(t){if(!(null!=i?i:Object.is)(p,t)){p=t;var r=e(t);(null!=a?a:Object.is)(y,r)||(y=r,g(r))}}),{skipFirst:!0});var S=b.getHook(),w=function(t,e){return[o((0,v.isFunction)(t)?S(t,e):S(),1)[0],f,d]};return w.stateControls=function(){return[m,f,d]},w.createSelectorHook=r.createSelectorHook.bind(w),w.createObservable=r.createObservable.bind(w),w},this.stateControls=function(){var t=r.getStateOrchestrator(),e=r.getMetadata;return[r.getState,t,e]},this.getStateOrchestrator=function(){return r.actions?r.actions:r.setStateWrapper},this.setStateWrapper=function(t){var e,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.forceUpdate,a=o.identifier,u=r.stateWrapper.state,c=(0,v.isFunction)(t)?t(u):t;if(i||r.stateWrapper.state!==c){var l=r.setMetadata,s=r.getMetadata,f=r.getState,d=r.actions,p={setMetadata:l,getMetadata:s,setState:r.setState,getState:f,actions:d,previousState:u,state:c,identifier:a},y=r.computePreventStateChange,b=null===(e=r.callbacks)||void 0===e?void 0:e.computePreventStateChange;if((y||b)&&((null==y?void 0:y(p))||(null==b?void 0:b(p))))return;r.setState({state:c},{forceUpdate:i,identifier:a});var h=r.onStateChanged,m=null===(n=r.callbacks)||void 0===n?void 0:n.onStateChanged;(h||m)&&(null==h||h(p),null==m||m(p))}},this.getStoreActionsMap=function(){if(!(0,s.isRecord)(r.actionsConfig))return null;var t=r.actionsConfig,e=r.setMetadata,n=r.setStateWrapper,o=r.getState,i=r.getMetadata,a=Object.keys(t).reduce((function(r,u){var c,f,v;return Object.assign(r,(c={},v=function(){for(var r=t[u],c=arguments.length,l=new Array(c),f=0;f<c;f++)l[f]=arguments[f];var v=r.apply(a,l);return"function"!=typeof v&&(0,s.throwWrongKeyOnActionCollectionConfig)(u),v.call(a,{setState:n,getState:o,setMetadata:e,getMetadata:i,actions:a})},(f=l(f=u))in c?Object.defineProperty(c,f,{value:v,enumerable:!0,configurable:!0,writable:!0}):c[f]=v,c)),r}),{});return a};var a=n.metadata,c=n.callbacks,d=n.actions,p=n.name;this.stateWrapper={state:e},this._name=null!=p?p:(0,s.uniqueId)("gs:"),this.metadata=null!=a?a:{},this.callbacks=null!=c?c:null,this.actionsConfig=null!=d?d:null,(null===globalThis||void 0===globalThis?void 0:globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG)&&globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG(this),this.constructor!==t||this.initialize()}var e,r;return e=t,r=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.isEqualRoot,n=e.isEqual,i=e.name,a=o(this.stateControls(),1)[0],u=[],c=a(),l=(null!=t?t:function(t){return t})(a());a((function(e){if(!(null!=r?r:Object.is)(c,e)){c=e;var o=t(e);(null!=n?n:Object.is)(l,o)||(l=o,u.forEach((function(t){return t()})))}}),{skipFirst:!0});var f=function(t,e,r){var n;if(!t)return l;var o=(0,v.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,s=function(){return a(i?i(l):l)};(null==c?void 0:c.skipFirst)||s();var f=function(){s()};return u.push(f),function(){u.splice(u.indexOf(f),1)}};return f._name=null!=i?i:(0,s.uniqueId)("ob:"),f.createObservable=this.createObservable.bind(f),f.stateControls=function(){return[f]},f}}],r&&c(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.GlobalStore=d},530:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},608:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}function i(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.useConstantValueRef=e.uniqueSymbol=e.isRecord=e.throwWrongKeyOnActionCollectionConfig=e.uniqueId=e.debounce=e.shallowCompare=void 0;var c,l=r(684),s=r(156);e.shallowCompare=function(t,r){if(t===r)return!0;var i=u(t),a=u(r);if(i!==a)return!1;if((0,l.isNil)(t)||(0,l.isNil)(r)||(0,l.isPrimitive)(t)&&(0,l.isPrimitive)(r)||(0,l.isDate)(t)&&(0,l.isDate)(r)||"function"===i&&"function"===a)return t===r;if(Array.isArray(t)){var c=t,s=r;if(c.length!==s.length)return!1;for(var f=0;f<c.length;f++)if(c[f]!==s[f])return!1}if(t instanceof Map){var v=t,d=r;if(v.size!==d.size)return!1;var p,y=o(v);try{for(y.s();!(p=y.n()).done;){var b=n(p.value,2),h=b[0];if(b[1]!==d.get(h))return!1}}catch(t){y.e(t)}finally{y.f()}}if(t instanceof Set){var m=t,g=r;if(m.size!==g.size)return!1;var S,w=o(m);try{for(w.s();!(S=w.n()).done;){var O=S.value;if(!g.has(O))return!1}}catch(t){w.e(t)}finally{w.f()}}if(!(0,e.isRecord)(t)||!(0,e.isRecord)(r))return t===r;var j=Object.keys(t),E=Object.keys(r);if(j.length!==E.length)return!1;for(var x=0,A=j;x<A.length;x++){var C=A[x];if(t[C]!==r[C])return!1}return!0},e.debounce=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];e&&clearTimeout(e),e=setTimeout((function(){t.apply(void 0,o)}),r)}},e.uniqueId=(c=0,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return c===Number.MAX_SAFE_INTEGER&&(c=0),t+Date.now().toString(36)+(c++).toString(36)}),e.throwWrongKeyOnActionCollectionConfig=function(t){throw new Error("[WRONG CONFIGURATION!]: Every key inside the storeActionsConfig must be a higher order function that returns a function \n[".concat(t,"]: key is not a valid function, try something like this: \n{\n\n ").concat(t,": (param) => ({ setState, getState, setMetadata, getMetadata, actions }) => {\n\n setState((state) => ({ ...state, ...param }))\n\n }\n\n}\n"))},e.isRecord=function(t){return!(0,l.isNil)(t)&&"object"===u(t)},e.uniqueSymbol=Symbol("unique"),e.useConstantValueRef=function(t){var r=(0,s.useRef)(e.uniqueSymbol);return r.current===e.uniqueSymbol&&(r.current=t()),r}},195:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStoreAbstract=void 0;var a=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(c,t);var e,r,a,u=(r=c,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=i(r);if(a){var o=i(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function c(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(t=u.apply(this,arguments)).onInit=function(e){t.onInitialize(e)},t.onStateChanged=function(e){t.onChange(e)},t}return e=c,Object.defineProperty(e,"prototype",{writable:!1}),e}(r(774).GlobalStore);e.GlobalStoreAbstract=a},991:(t,e,r)=>{"use strict";var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},o=function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(684),e),o(r(530),e),o(r(774),e),o(r(195),e),o(r(853),e),o(r(608),e),o(r(852),e),o(r(113),e)},684:function(t){t.exports=(()=>{"use strict";var t={124:(t,e,r)=>{var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]};Object.defineProperty(e,"__esModule",{value:!0}),function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)}(r(331),e)},331:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e,n){return(e=function(t){var e=function(t){if("object"!=r(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.formatToStore=e.formatFromStore=e.isPrimitive=e.isFunction=e.isRegex=e.isDate=e.isString=e.isBoolean=e.isNumber=e.isNil=e.clone=void 0,e.clone=function(t){var r,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).shallow;if((0,e.isPrimitive)(t)||(0,e.isDate)(t))return t;if(Array.isArray(t))return a?function(t){if(Array.isArray(t))return i(t)}(r=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||o(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}():t.map((function(t){return(0,e.clone)(t)}));if(t instanceof Map){var u=Array.from(t.entries());return a?new Map(u):new Map(u.map((function(t){return(0,e.clone)(t)})))}if(t instanceof Set){var c=Array.from(t.values());return a?new Set(c):new Set(c.map((function(t){return(0,e.clone)(t)})))}return t instanceof RegExp?new RegExp(t.toString()):(0,e.isFunction)(t)?a?t:Object.create(t):a?Object.assign({},t):t instanceof Error?new Error(t.message):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.clone)(i)))}),{})},e.isNil=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isBoolean=function(t){return"boolean"==typeof t},e.isString=function(t){return"string"==typeof t},e.isDate=function(t){return t instanceof Date},e.isRegex=function(t){return t instanceof RegExp},e.isFunction=function(t){return"function"==typeof t||t instanceof Function},e.isPrimitive=function(t){return(0,e.isNil)(t)||(0,e.isNumber)(t)||(0,e.isBoolean)(t)||(0,e.isString)(t)||"symbol"===r(t)},e.formatFromStore=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.jsonParse,a=r.sortKeys;return function(t){var r,i,u;if((0,e.isPrimitive)(t))return t;if("date"===(null==t?void 0:t.$t))return new Date(t.$v);if("map"===(null==t?void 0:t.$t)){var c=(null!==(r=t.$v)&&void 0!==r?r:[]).map((function(t){var r,n=(2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next,0;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(r)||o(r,2)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=n[0],a=n[1];return[i,(0,e.formatFromStore)(a)]}));return new Map(c)}if("set"===(null==t?void 0:t.$t)){var l=null!==(i=t.$v)&&void 0!==i?i:[].map((function(t){return(0,e.formatFromStore)(t)}));return new Set(l)}return"regex"===(null==t?void 0:t.$t)?new RegExp(t.$v):"error"===(null==t?void 0:t.$t)?new Error(t.$v):Array.isArray(t)?t.map((function(t){return(0,e.formatFromStore)(t)})):"function"===(null==t?void 0:t.$t)?Function("(".concat(t.$v,")(...arguments)")):(u=Object.keys(t),a?(0,e.isFunction)(a)?u.sort(a):u.sort((function(t,e){return(null!=t?t:"").localeCompare(e)})):u).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.formatFromStore)(i)))}),{})}(i?JSON.parse(t):(0,e.clone)(t))},e.formatToStore=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{stringify:!1},i=o.stringify,a=o.validator,u=o.excludeTypes,c=o.excludeKeys,l=o.sortKeys,s=new Set(null!=u?u:[]),f=new Set(null!=c?c:[]),v=s.size||f.size,d=null!=a?a:function(t){var e=t.key,n=t.value;if(!v)return!0;var o=f.has(e),i=s.has(r(n));return!o&&!i},p=function(t){if((0,e.isPrimitive)(t))return t;var r;if(Array.isArray(t))return t.map((function(t){return p(t)}));if(t instanceof Map)return{$t:"map",$v:Array.from(t.entries()).map((function(t){return p(t)}))};if(t instanceof Set)return{$t:"set",$v:Array.from(t.values()).map((function(t){return p(t)}))};if((0,e.isDate)(t))return{$t:"date",$v:t.toISOString()};if((0,e.isRegex)(t))return{$t:"regex",$v:t.toString()};if((0,e.isFunction)(t)){var o;try{o={$t:"function",$v:t.toString()}}catch(t){o={$t:"error",$v:"Error: Could not serialize function"}}return o}return t instanceof Error?{$t:"error",$v:t.message}:(r=Object.keys(t),l?(0,e.isFunction)(l)?r.sort(l):r.sort((function(t,e){return(null!=t?t:"").localeCompare(e)})):r).reduce((function(e,r){var o=t[r],i=p(o);return d({obj:t,key:r,value:i})?Object.assign(Object.assign({},e),n({},r,p(o))):e}),{})},y=p((0,e.clone)(t));return i?JSON.stringify(y):y}}},e={};return function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}(124)})()},156:e=>{"use strict";e.exports=t}},r={},function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(991);var e,r}));
@@ -17,19 +17,20 @@ export interface CreateGlobalState {
17
17
  export declare const createGlobalState: CreateGlobalState;
18
18
  export interface CustomCreateGlobalState<TCustomConfig extends BaseMetadata | unknown, InheritMetadata extends BaseMetadata | unknown = BaseMetadata> {
19
19
  <State>(state: State): StateHook<State, StateSetter<State>, BaseMetadata>;
20
- <State, Metadata extends BaseMetadata | unknown>(state: State, args: {
20
+ <State, Metadata extends BaseMetadata | unknown, ActionsConfig extends ActionCollectionConfig<State, InheritMetadata & Metadata> | null | {}, PublicStateMutator = keyof ActionsConfig extends never | undefined ? StateSetter<State> : ActionCollectionResult<State, InheritMetadata & Metadata, NonNullable<ActionsConfig>>>(state: State, args: {
21
21
  name?: string;
22
22
  metadata?: Metadata;
23
- callbacks?: GlobalStoreCallbacks<State, Metadata>;
23
+ callbacks?: GlobalStoreCallbacks<State, InheritMetadata & Metadata>;
24
+ actions?: ActionsConfig;
24
25
  config?: TCustomConfig;
25
- }): StateHook<State, StateSetter<State>, BaseMetadata>;
26
+ }): StateHook<State, PublicStateMutator, InheritMetadata & Metadata>;
26
27
  <State, Metadata extends BaseMetadata | unknown, ActionsConfig extends Readonly<ActionCollectionConfig<State, InheritMetadata & Metadata>>>(state: State, args: {
27
28
  name?: string;
28
29
  metadata?: Metadata;
29
- callbacks?: GlobalStoreCallbacks<State, Metadata>;
30
- actions?: ActionsConfig;
30
+ callbacks?: GlobalStoreCallbacks<State, InheritMetadata & Metadata>;
31
+ actions: ActionsConfig;
31
32
  config?: TCustomConfig;
32
- }): StateHook<State, ActionCollectionResult<State, InheritMetadata & Metadata, ActionsConfig>, Metadata>;
33
+ }): StateHook<State, ActionCollectionResult<State, InheritMetadata & Metadata, ActionsConfig>, InheritMetadata & Metadata>;
33
34
  }
34
35
  /**
35
36
  * @description Simple custom global state hook builder
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hooks-global-states",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "This is a package to easily handling global-state across your react-components No-redux",
5
5
  "main": "lib/bundle.js",
6
6
  "types": "lib/src/index.d.ts",