react-native-global-state-hooks 7.0.1 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -68,36 +68,132 @@ The metadata and components will be updated and re-rendered even if there's no d
68
68
  What if you already have a global state that you want to subscribe to, but you don't want your component to listen to all the changes of the state, only a small portion of it? Let's create a more complex **state**
69
69
 
70
70
  ```ts
71
- import { createGlobalState } from "react-native-global-state-hooks";
71
+ import { createGlobalState } from 'react-hooks-global-states';
72
72
 
73
73
  export const useContacts = createGlobalState({
74
74
  isLoading: true,
75
- filter: "",
76
- items: [] as Contact[],
75
+ entities: Contact[],
76
+ selected: Set<number>,
77
77
  });
78
78
  ```
79
79
 
80
- Now, let's say we want to have a filter bar for the contacts that will only have access to the filter.
81
-
82
- **FilterBar.tsx**
80
+ Now, let's say we have a situation where we want to access only the list of contacts. We don't care about the rest of the state.
83
81
 
84
82
  ```tsx
85
- const [contacts] = useContacts((state) =>
86
- state.contacts.filter((contact) => contact.status === "active")
87
- );
83
+ // That's it. With that simple selector, we now get the list of contacts,
84
+ // and the component will only re-render if the property **entities** changes on the global state
85
+ const [contacts] = useContacts((state) => state.entities]);
88
86
 
89
87
  return (
90
- <View>
88
+ <ul>
91
89
  {contacts.map((contact) => (
92
- <Text key={contact.id}>{contact.name}</Text>
90
+ <li key={contact.id}>{contact.name}</li>
93
91
  ))}
94
- </View>
92
+ </ul>
93
+ );
94
+ ```
95
+
96
+ What about special cases, like when you have a map instead of an array and want to extract a list of contacts? It's common to use selectors that return a new array, but this can cause React to re-render because the new array has a different reference than the previous one.
97
+
98
+ ```tsx
99
+ export const useContacts = createGlobalState({
100
+ isLoading: true,
101
+ entities: Map<number, Contact>,
102
+ selected: Set<number>,
103
+ });
104
+
105
+ // The selector is simply a standard selector used to extract the values from the map.
106
+
107
+ const [contacts] = useContacts((state) => [...state.entities.values()], {
108
+ // The isEqualRoots function allows you to create your own validation logic for determining when to recompute the selector.
109
+ isEqualRoot: (a, b) => a.entities === b.entities,
110
+ });
111
+ ```
112
+
113
+ Okay, everything works when the changes come from the state, but what happens if I want to recompute the selector based on the internal state of the component?
114
+
115
+ **component.ts**
116
+
117
+ ```tsx
118
+ const [filter, setFilter] = useState("");
119
+
120
+ const [contacts] = useContacts(
121
+ (state) =>
122
+ [...state.entities.values()].filter((item) => item.name.includes(filter)),
123
+ {
124
+ isEqualRoot: (a, b) => a.entities === b.entities,
125
+ /**
126
+ * Easy to understand, right? With the dependencies prop, you can,
127
+ * just like with any other hook, provide a collection of values that will be compared during each render cycle
128
+ * to determine if the selector should be recomputed.*/
129
+ dependencies: [filter],
130
+ }
131
+ );
132
+ ```
133
+
134
+ And finally, what if you need to reuse this selector throughout your application and don't want to duplicate code?
135
+
136
+ ```tsx
137
+ export const useContacts = createGlobalState({
138
+ isLoading: true,
139
+ entities: Map<number, Contact>,
140
+ selected: Set<number>,
141
+ });
142
+
143
+ const useContactsArray = useContacts.createSelectorHook(
144
+ (state) => [...state.entities.values()],
145
+ {
146
+ isEqualRoot: (a, b) => a.entities === b.entities,
147
+ }
148
+ );
149
+ ```
150
+
151
+ Now inside your component just call the new hook
152
+
153
+ **component.ts**
154
+
155
+ ```tsx
156
+ const [filter, setFilter] = useState("");
157
+
158
+ const [contacts] = useContactsArray(
159
+ (entities) => entities.name.includes(filter),
160
+ {
161
+ dependencies: [filter],
162
+ }
163
+ );
164
+ ```
165
+
166
+ Or you can create another selectorHook from your **useContactsArray**
167
+
168
+ ```ts
169
+ const useContactsArray = useContacts.createSelectorHook(
170
+ (state) => [...state.entities.values()],
171
+ {
172
+ isEqualRoot: (a, b) => a.entities === b.entities,
173
+ }
174
+ );
175
+
176
+ const useContactsLength = useContactsArray.createSelectorHook(
177
+ (entities) => entities.length
95
178
  );
96
179
  ```
97
180
 
98
- There you have it again, super simple! By adding a **selector** function, you are able to create a derivative hook that will only trigger when the result of the **selector** changes.
181
+ Or you can create a custom hook
182
+
183
+ ```tsx
184
+ const useFilteredContacts = (filter: string) => {
185
+ const [contacts] = useContactsArray(
186
+ (entities) => entities.name.includes(filter),
187
+ {
188
+ dependencies: [filter],
189
+ }
190
+ );
191
+
192
+ return contacts;
193
+ };
194
+ ```
99
195
 
100
- If you want to have more control over when the hook should recompute the selector result, there are a couple of options:
196
+ To summarize
101
197
 
102
198
  ```tsx
103
199
  const [filter, setFilter] = useState("");
@@ -129,15 +225,15 @@ const [contacts] = useContacts(
129
225
  );
130
226
 
131
227
  return (
132
- <View>
228
+ <ul>
133
229
  {contacts.map((contact) => (
134
- <Text key={contact.id}>{contact.name}</Text>
230
+ <li key={contact.id}>{contact.name}</li>
135
231
  ))}
136
- </View>
232
+ </ul>
137
233
  );
138
234
  ```
139
235
 
140
- If you want to perform a shallow comparison between the previous and new values, you can use the **shallowCompare** function from the library.
236
+ Btw, If you want to perform a shallow comparison between the previous and new values, you can use the **shallowCompare** function from the library.
141
237
 
142
238
  ```TSX
143
239
  ({
@@ -148,29 +244,27 @@ If you want to perform a shallow comparison between the previous and new values,
148
244
  })
149
245
  ```
150
246
 
151
- ## What if you want to reuse the selector?
152
-
153
- It will be super common to have the necessity of reusing a specific **selector**, and it can be a little annoying to have to do the same thing again and again. Right?
247
+ Just remember, you can select or derive different values from the global state endlessly, but the state mutator will remain the same throughout the hooks.
154
248
 
155
- No problem, you can create a reusable **derivative-state** and use it across your components. Let's create one for our filter.
249
+ More examples:
156
250
 
157
251
  ```ts
158
- const useFilter = createDerivate(useContacts, ({ filter }) => ({ filter }));
159
- ```
252
+ const useFilter = useContacts.createSelectorHook(({ filter }) => filter);
160
253
 
161
- Well, that's it! Now you can simply call **useFilter** inside your component, and everything will continue to work the same.
254
+ const useContactsArray = useContacts.createSelectorHook(({ items }) => items);
162
255
 
163
- **FilterBar.tsx**
164
-
165
- ```ts
166
- const [{ filter }, setState] = useFilter();
256
+ const useContactsLength = useContactsArray.createSelectorHook(
257
+ (items) => items.length
258
+ );
167
259
 
168
- return (
169
- <TextInput onChangeText={() => setState((state) => ({ ...state, filter }))} />
260
+ const useIsContactsEmpty = useContactsLength.createSelectorHook(
261
+ (length) => !length
170
262
  );
171
263
  ```
172
264
 
173
- Notice that the **state** changes, but the **stateMutator** does not. This is because this is a **DERIVATE state**, and it cannot be directly changed. It will always be derived from the main hook.
265
+ It can't get any simpler, right? Everything is connected, everything is reactive. Plus, these hooks are strongly typed, so if you're working with **TypeScript**, you'll absolutely love it.
266
+
267
+ Each selector hook is reactive only to the fragment/derived of the state returned by the selector. And again you can optimize it by using the **isEqualRoot** and **isEqual** functions, which help avoid recomputing the selector if the root state or the fragment hasn't changed.
174
268
 
175
269
  # State actions
176
270
 
@@ -237,33 +331,22 @@ It can't get any simpler, right? Everything is connected, everything is reactive
237
331
 
238
332
  # State Controls
239
333
 
240
- Decoupled state access is particularly useful when you want to create components that have editing access to a specific store but don't necessarily need to reactively respond to state changes.
241
-
242
- Using the state controls allows you to retrieve the state when needed without establishing a reactive relationship with the state changes. This approach provides more flexibility and control over when and how components interact with the global state. Let's see and example:
334
+ If you need to access the global state outside of a component or a hook without subscribing to state changes, or even inside a **ClassComponent**, you can use:
243
335
 
244
- ```ts
245
- import { createGlobalState } from "react-native-global-state-hooks";
336
+ ```tsx
337
+ useContacts.stateControls: () => [stateRetriever: StateGetter<State>, stateMutator: Setter<State>|ActionCollectionResult<State>, metadataRetriever: Metadata];
246
338
 
247
- export const useContacts = createGlobalState({
248
- isLoading: true,
249
- filter: "",
250
- items: [] as Contact[],
251
- });
339
+ // example:
340
+ const [getContacts, setContacts] = useContacts.stateControls();
252
341
 
253
- export const [contactsRetriever, contactsRetriever] =
254
- useContacts.stateControls();
342
+ console.log(getContacts()); // prints the list of contacts
255
343
  ```
256
344
 
257
- That's great! With the addition of the **contactsRetriever** and **contactsRetriever** methods, you now have the ability to access and modify the state without the need for subscription to the hook.
258
-
259
- While **useContacts** will allow your components to subscribe to the custom hook, using the **contactsRetriever** method you will be able retrieve the current value of the state. This allows you to access the state whenever necessary, without being reactive to its changes. Let' see how:
345
+ **stateMutator** is particularly useful when you want to create components that have editing access to a specific store but don't necessarily need to reactively respond to state changes.
260
346
 
261
- ```ts
262
- // To synchronously get the value of the state
263
- const value = contactsRetriever();
347
+ Using the **stateRetriever** and the **stateMutator** allows you to retrieve the state when needed without establishing a reactive relationship with the state changes. This approach provides more flexibility and control over when and how components interact with the global state.
264
348
 
265
- // the type of value will be { isLoading: boolean; filter: string; items: Contact[] }
266
- ```
349
+ So, While **useContacts** will allow your components to subscribe to the custom hook, using the **contactsRetriever** method you will be able retrieve the current value of the state. This allows you to access the state whenever necessary, without being reactive to its changes and with the **contactsMutator** you now have the ability to modify the state without the need for subscription to the hook.
267
350
 
268
351
  Additionally, to subscribe to state changes, you can pass a callback function as a parameter to the **stateRetriever**. This approach enables you to create a subscription group, allowing you to subscribe to either the entire state or a specific portion of it. When a callback function is provided to the **stateRetriever**, it will return a cleanup function instead of the state. This cleanup function can be used to unsubscribe or clean up the subscription when it is no longer needed.
269
352
 
@@ -288,9 +371,163 @@ const removeSubscriptionGroup = contactsRetriever<Subscribe>((subscribe) => {
288
371
 
289
372
  That's great, isn't it? everything stays synchronized with the original state!!
290
373
 
374
+ ## stateMutator
375
+
376
+ Let's add more actions to the state and explore how to use one action from inside another.
377
+
378
+ Here's an example of adding multiple actions to the state and utilizing one action within another:
379
+
380
+ ```ts
381
+ import { createGlobalState } from "react-hooks-global-states";
382
+
383
+ export const useCount = createGlobalState(0, {
384
+ actions: {
385
+ log: (currentValue: string) => {
386
+ return ({ getState }: StoreTools<number>): void => {
387
+ console.log(`Current Value: ${getState()}`);
388
+ };
389
+ },
390
+
391
+ increase(value: number = 1) {
392
+ return ({ getState, setState, actions }: StoreTools<number>) => {
393
+ setState((count) => count + value);
394
+
395
+ actions.log(message);
396
+ };
397
+ },
398
+
399
+ decrease(value: number = 1) {
400
+ return ({ getState, setState, actions }: StoreTools<number>) => {
401
+ setState((count) => count - value);
402
+
403
+ actions.log(message);
404
+ };
405
+ },
406
+ } as const,
407
+ });
408
+ ```
409
+
410
+ Notice that the **StoreTools** will contain a reference to the generated actions API. From there, you'll be able to access all actions from inside another one... the **StoreTools** is generic and allow your to set an interface for getting the typing on the actions.
411
+
412
+ # Stateful Context with Actions
413
+
414
+ **The ultimate blend of flexibility and control in React state management!** You can now create an isolated global state within a React context, giving each consumer of the context provider a unique state instance. But that’s not all...
415
+
416
+ **Stateful Context with Actions** extends the powerful features of global hooks into the realm of React Context. By integrating global hooks within a context, you bring all the benefits of global state management—such as modularity, selectors, derived states, and actions—into a context-specific environment. This means each consumer of the context not only gets a unique state instance but also inherits all the advanced capabilities of global hooks.
417
+
418
+ ## Creating a Stateful Context
419
+
420
+ Forget about the boilerplate of creating a context... with **createStatefulContext** it's straightforward and powerful. You can create a context and provider with one line of code.
421
+
422
+ ```tsx
423
+ export const [useCounterContext, CounterProvider] = createStatefulContext(2);
424
+ ```
425
+
426
+ Then just wrap the components you need with the provider:
427
+
428
+ ```tsx
429
+ <CounterProvider>
430
+ <MyComponent />
431
+ </CounterProvider>
432
+ ```
433
+
434
+ And finally, access the context value with the generated custom hook:
435
+
436
+ ```tsx
437
+ const MyComponent = () => {
438
+ const [useCounter] = useCounterContext();
439
+
440
+ // If the component needs to react to state changes, simply use the hook
441
+ const [count, setCount] = useCounter();
442
+
443
+ return <>{count}</>;
444
+ };
445
+ ```
446
+
447
+ What’s the advantage of this, you might ask? Well, now you have all the capabilities of the global hooks within the isolated scope of the context. For example, you can choose whether or not to listen to changes in the state:
448
+
449
+ ```tsx
450
+ const MyComponent = () => {
451
+ const [, , setCount] = useCounterContext();
452
+
453
+ // This component can access only the stateMutator of the state,
454
+ // and won't re-render if the counter changes
455
+ return (
456
+ <button onClick={() => setCount((count) => count + 1)}>Increase</button>
457
+ );
458
+ };
459
+ ```
460
+
461
+ Now you have selectors—if the state changes, the component will only re-render if the selected portion of the state changes.
462
+
463
+ ```tsx
464
+ const MyComponent = () => {
465
+ const [useCounter] = useCounterContext();
466
+
467
+ // Notice that we can select and derive values from the state
468
+ const [isEven, setCount] = useCounter((count) => count % 2 === 0);
469
+
470
+ useEffect(() => {
471
+ // Since the counter initially was 2 and now is 4, it’s still an even number.
472
+ // Because of this, the component will not re-render.
473
+ setCount(4);
474
+ }, []);
475
+
476
+ return <>{isEven ? "is even" : "is odd"}</>;
477
+ };
478
+ ```
479
+
480
+ **createStatefulContext** also allows you to add custom actions to control the manipulation of the state.
481
+
482
+ ```tsx
483
+ import { createStatefulContext, StoreTools } from "react-global-state-hooks";
484
+
485
+ type CounterState = {
486
+ count: number;
487
+ };
488
+
489
+ const initialState: CounterState = {
490
+ count: 0,
491
+ };
492
+
493
+ export const [useCounterContext, CounterProvider] = createStatefulContext(
494
+ initialState,
495
+ {
496
+ actions: {
497
+ increase: (value: number = 1) => {
498
+ return ({ setState }: StoreTools<CounterState>) => {
499
+ setState((state) => ({
500
+ ...state,
501
+ count: state.count + value,
502
+ }));
503
+ };
504
+ },
505
+ decrease: (value: number = 1) => {
506
+ return ({ setState }: StoreTools<CounterState>) => {
507
+ setState((state) => ({
508
+ ...state,
509
+ count: state.count - value,
510
+ }));
511
+ };
512
+ },
513
+ } as const,
514
+ }
515
+ );
516
+ ```
517
+
518
+ And just like with regular global hooks, now instead of a setState function, the hook will return the collection of actions:
519
+
520
+ ```tsx
521
+ const MyComponent = () => {
522
+ const [, , actions] = useCounterContext();
523
+
524
+ return <button onClick={() => actions.increase(1)}>Increase</button>;
525
+ };
526
+ ```
527
+
291
528
  # Emitters
292
529
 
293
- So, we have seen that we can subscribe a callback to state changes, create **derivative states** from our global hooks, **and derive hooks from those derivative states**. Guess what? We can also create derivative **emitters** and subscribe callbacks to specific portions of the state. Let's review it:
530
+ So, we have seen that we can subscribe a callback to state changes, create **selector hooks** from our global states. Guess what? We can also create derived **emitters** and subscribe callbacks to specific portions of the state. Let's review it:
294
531
 
295
532
  ```ts
296
533
  const subscribeToFilter = createDerivateEmitter(
@@ -324,7 +561,7 @@ const removeFilterSubscription = subscribeToFilter<Subscribe>(
324
561
  );
325
562
  ```
326
563
 
327
- Also, of course, if you have an exceptional case where you want to derivate directly from the current **emitter**, you can add a **selector**. This allows you to fine-tune the emitted values based on your requirements
564
+ Also, of course, if you have an exceptional case where you want to derived/selected directly from the current **emitter**, you can add a **selector**. This allows you to fine-tune the emitted values based on your requirements
328
565
 
329
566
  ```ts
330
567
  const removeFilterSubscription = subscribeToFilter<Subscribe>(
@@ -361,15 +598,15 @@ const subscribeToItemsLength = createDerivateEmitter(
361
598
  );
362
599
  ```
363
600
 
364
- The examples may seem a little silly, but they allow you to see the incredible things you can accomplish with these **derivative states** and **emitters**. They open up a world of possibilities!
601
+ The examples may seem a little silly, but they allow you to see the incredible things you can accomplish with these **derived states** and **emitters**. They open up a world of possibilities!
365
602
 
366
- # Combining stateRetrievers
603
+ # Combining stateRetriever
367
604
 
368
- What if you have two states and you want to combine them? You may have already guessed it right? ... you can create combined **emitters** and **hooks** from the **stateRetrievers**.
605
+ What if you have two states and you want to combine them? You may have already guessed it right? ... you can create combined **emitters** and **hooks** from the hook **stateRetriever**.
369
606
 
370
607
  By utilizing the approach of combining **emitters** and **hooks**, you can effectively merge multiple states and make them shareable. This allows for better organization and simplifies the management of the combined states. You don't need to refactor everything; you just need to combine the **global state hooks** you already have. Let's see a simple example:
371
608
 
372
- Fist we are gonna create a couple of **global states**:
609
+ First we are gonna create a couple of **global states**, and extract the **stateRetriever**.
373
610
 
374
611
  ```ts
375
612
  const useHook1 = createGlobalState({
@@ -384,13 +621,13 @@ const useHook2 = createGlobalState({
384
621
  propD: 4,
385
622
  });
386
623
 
387
- const [stateRetriever2] = useHook2.stateControls();
624
+ const [, stateRetriever2] = useHook2.stateControls();
388
625
  ```
389
626
 
390
627
  Okay, cool, the first state as **propA, propB** while the second one has **propC, propD**, let's combine them:
391
628
 
392
629
  ```ts
393
- const [useCombinedHook, stateRetriever, dispose] = combineAsyncGetters(
630
+ const [useCombinedHook, combinedStateRetriever] = combineAsyncGetters(
394
631
  {
395
632
  selector: ([state1, state2]) => ({
396
633
  ...state1,
@@ -402,7 +639,7 @@ const [useCombinedHook, stateRetriever, dispose] = combineAsyncGetters(
402
639
  );
403
640
  ```
404
641
 
405
- Well, that's it! Now you have access to a **stateRetriever** that will return the combined value of the two states. From this new **stateRetriever**, you can retrieve the value or subscribe to its changes. Let'see:
642
+ Well, that's it! Now you have access to a **combinedStateRetriever** that will return the combined value of the two states. From this new **combinedStateRetriever**, you can retrieve the value or subscribe to its changes. Let'see:
406
643
 
407
644
  ```ts
408
645
  const value = stateRetriever(); // { propA, propB, propC, propD }
@@ -417,8 +654,8 @@ const unsubscribeGroup = stateRetriever<Subscribe>((subscribe) => {
417
654
  // the callback will only trigger if the result of the selector changes.
418
655
  subscribe(
419
656
  ({ propA, propD }) => ({ propA, propD }),
420
- (derivate) => {
421
- console.log(derivate); // { propA, propD }
657
+ (derived) => {
658
+ console.log(derived); // { propA, propD }
422
659
  }
423
660
  );
424
661
  });
@@ -440,22 +677,21 @@ Similar to your other **global state hooks**, **combined hooks** allow you to us
440
677
  const [fragment] = useCombinedHook(({ propA, propD }) => ({ propA, propD }));
441
678
  ```
442
679
 
443
- Lastly, you have the flexibility to continue combining stateRetriever if desired. This means you can extend the functionality of combined hooks by adding more stateRetriever to merge additional states. By combining stateRetriever in this way, you can create a comprehensive and unified representation of the combined states within your application. This approach allows for modular and scalable state management, enabling you to efficiently handle complex state compositions.
680
+ Lastly, you have the flexibility to continue combining stateRetrievers if desired. This means you can extend the functionality of combined hooks by adding more stateRetrievers to merge additional states. By combining stateRetrievers in this way, you can create a comprehensive and unified representation of the combined states within your application. This approach allows for modular and scalable state management, enabling you to efficiently handle complex state compositions.
444
681
 
445
682
  Let's see an example:
446
683
 
447
684
  ```ts
448
- const [useCombinedHook, combinedStateRetriever1, dispose1] =
449
- combineAsyncGetters(
450
- {
451
- selector: ([state1, state2]) => ({
452
- ...state1,
453
- ...state2,
454
- }),
455
- },
456
- stateRetriever1,
457
- stateRetriever2
458
- );
685
+ const [useCombinedHook, combinedStateRetriever1] = combineAsyncGetters(
686
+ {
687
+ selector: ([state1, state2]) => ({
688
+ ...state1,
689
+ ...state2,
690
+ }),
691
+ },
692
+ stateRetriever1,
693
+ stateRetriever2
694
+ );
459
695
 
460
696
  const useHook3 = createGlobalState({
461
697
  propE: 1,
@@ -466,13 +702,14 @@ const [stateRetriever3, stateMutator3] = useHook3.stateControls();
466
702
 
467
703
  const useIsLoading = createGlobalState(false);
468
704
 
469
- const [isLoadingGetter, isLoadingSetter] = useIsLoading.stateControls();
705
+ const [isLoadingStateRetriever, isLoadingMutator] =
706
+ useIsLoading.stateControls();
470
707
  ```
471
708
 
472
709
  Once we created another peace of state, we can combine it with our other **global hooks** and **emitters**
473
710
 
474
711
  ```ts
475
- const [useCombinedHook2, combinedGetter2, dispose2] = combineAsyncGetters(
712
+ const [useCombinedHook2, combinedStateRetriever2] = combineAsyncGetters(
476
713
  {
477
714
  selector: ([state1, state2, isLoading]) => ({
478
715
  ...state1,
@@ -482,7 +719,7 @@ const [useCombinedHook2, combinedGetter2, dispose2] = combineAsyncGetters(
482
719
  },
483
720
  combinedStateRetriever1,
484
721
  stateRetriever3,
485
- isLoadingGetter
722
+ isLoadingStateRetriever
486
723
  );
487
724
  ```
488
725
 
@@ -492,190 +729,6 @@ You have the freedom to combine as many global hooks as you wish. This means you
492
729
 
493
730
  Please be aware that the third parameter is a **dispose callback**, which can be particularly useful in **high-order** functions when you want to release any resources associated with the hook. By invoking the dispose callback, the hook will no longer report any changes, ensuring that resources are properly cleaned up. This allows for efficient resource management and can be beneficial in scenarios where you need to handle resource cleanup or termination in a controlled manner.
494
731
 
495
- ## Setter
496
-
497
- Similarly, the **contactsRetriever** method allows you to modify the state stored in **useContacts**. You can use this method to update the state with a new value or perform any necessary state mutations without the restrictions imposed by **hooks**.
498
-
499
- These additional methods provide a more flexible and granular way to interact with the state managed by **useContacts**. You can retrieve and modify the state as needed, without establishing a subscription relationship or reactivity with the state changes.
500
-
501
- Let's add more actions to the state and explore how to use one action from inside another.
502
-
503
- Here's an example of adding multiple actions to the state and utilizing one action within another:
504
-
505
- ```ts
506
- import { createGlobalState } from "react-native-global-state-hooks";
507
-
508
- export const useCount = createGlobalState(0, {
509
- actions: {
510
- log: (currentValue: string) => {
511
- return ({ getState }: StoreTools<number>): void => {
512
- console.log(`Current Value: ${getState()}`);
513
- };
514
- },
515
-
516
- increase(value: number = 1) {
517
- return ({ getState, setState, actions }: StoreTools<number>) => {
518
- setState((count) => count + value);
519
-
520
- actions.log(message);
521
- };
522
- },
523
-
524
- decrease(value: number = 1) {
525
- return ({ getState, setState, actions }: StoreTools<number>) => {
526
- setState((count) => count - value);
527
-
528
- actions.log(message);
529
- };
530
- },
531
- } as const,
532
- });
533
- ```
534
-
535
- Notice that the **StoreTools** will contain a reference to the generated actions API. From there, you'll be able to access all actions from inside another one... the **StoreTools** is generic and allow your to set an interface for getting the typing on the actions.
536
-
537
- ```ts
538
- import { createGlobalState } from "react-native-global-state-hooks";
539
-
540
- export const useCount = createGlobalState(0, {
541
- actions: {
542
- log: (currentValue: string) => {
543
- return ({ getState }: StoreTools<number>): void => {
544
- console.log(`Current Value: ${getState()}`);
545
- };
546
- },
547
-
548
- increase(value: number = 1) {
549
- return ({ getState, setState }: StoreTools<number>) => {
550
- setState((count) => count + value);
551
-
552
- $actions.log(message);
553
- };
554
- },
555
- } as const,
556
- });
557
-
558
- export const [getCount, $actions] = useCount.stateControls();
559
- ```
560
-
561
- In the example the hook will work the same and you'll have access to the correct typing.
562
-
563
- # Stateful Context with Actions
564
-
565
- **The ultimate blend of flexibility and control in React state management!** You can now create an isolated global state within a React context, giving each consumer of the context provider a unique state instance. But that’s not all...
566
-
567
- **Stateful Context with Actions** extends the powerful features of global hooks into the realm of React Context. By integrating global hooks within a context, you bring all the benefits of global state management—such as modularity, selectors, derived states, and actions—into a context-specific environment. This means each consumer of the context not only gets a unique state instance but also inherits all the advanced capabilities of global hooks.
568
-
569
- ## Creating a Stateful Context
570
-
571
- Forget about the boilerplate of creating a context... with **createStatefulContext** it's straightforward and powerful. You can create a context and provider with one line of code.
572
-
573
- ```tsx
574
- export const [useCounterContext, CounterProvider] = createStatefulContext(2);
575
- ```
576
-
577
- Then just wrap the components you need with the provider:
578
-
579
- ```tsx
580
- <CounterProvider>
581
- <MyComponent />
582
- </CounterProvider>
583
- ```
584
-
585
- And finally, access the context value with the generated custom hook:
586
-
587
- ```tsx
588
- const MyComponent = () => {
589
- const [useCounter] = useCounterContext();
590
-
591
- // If the component needs to react to state changes, simply use the hook
592
- const [count, setCount] = useCounter();
593
-
594
- return <>{count}</>;
595
- };
596
- ```
597
-
598
- What’s the advantage of this, you might ask? Well, now you have all the capabilities of the global hooks within the isolated scope of the context. For example, you can choose whether or not to listen to changes in the state:
599
-
600
- ```tsx
601
- const MyComponent = () => {
602
- const [, , setCount] = useCounterContext();
603
-
604
- // This component can access only the stateMutator of the state,
605
- // and won't re-render if the counter changes
606
- return (
607
- <button onClick={() => setCount((count) => count + 1)}>Increase</button>
608
- );
609
- };
610
- ```
611
-
612
- Now you have selectors—if the state changes, the component will only re-render if the selected portion of the state changes.
613
-
614
- ```tsx
615
- const MyComponent = () => {
616
- const [useCounter] = useCounterContext();
617
-
618
- // Notice that we can select and derive values from the state
619
- const [isEven, setCount] = useCounter((count) => count % 2 === 0);
620
-
621
- useEffect(() => {
622
- // Since the counter initially was 2 and now is 4, it’s still an even number.
623
- // Because of this, the component will not re-render.
624
- setCount(4);
625
- }, []);
626
-
627
- return <>{isEven ? "is even" : "is odd"}</>;
628
- };
629
- ```
630
-
631
- **createStatefulContext** also allows you to add custom actions to control the manipulation of the state.
632
-
633
- ```tsx
634
- import { createStatefulContext, StoreTools } from "react-global-state-hooks";
635
-
636
- type CounterState = {
637
- count: number;
638
- };
639
-
640
- const initialState: CounterState = {
641
- count: 0,
642
- };
643
-
644
- export const [useCounterContext, CounterProvider] = createStatefulContext(
645
- initialState,
646
- {
647
- actions: {
648
- increase: (value: number = 1) => {
649
- return ({ setState }: StoreTools<CounterState>) => {
650
- setState((state) => ({
651
- ...state,
652
- count: state.count + value,
653
- }));
654
- };
655
- },
656
- decrease: (value: number = 1) => {
657
- return ({ setState }: StoreTools<CounterState>) => {
658
- setState((state) => ({
659
- ...state,
660
- count: state.count - value,
661
- }));
662
- };
663
- },
664
- } as const,
665
- }
666
- );
667
- ```
668
-
669
- And just like with regular global hooks, now instead of a setState function, the hook will return the collection of actions:
670
-
671
- ```tsx
672
- const MyComponent = () => {
673
- const [, , actions] = useCounterContext();
674
-
675
- return <button onClick={() => actions.increase(1)}>Increase</button>;
676
- };
677
- ```
678
-
679
732
  # Extending Global Hooks
680
733
 
681
734
  ## `[IMPORTANT!]`: From version 6.0.0, you can continue creating your custom implementations or using your previous ones. However, now AsyncStorage is already integrated into the global hooks with @react-native-async-storage/async-storage. You simply need to add a key for the persistent storage, and that will do the trick.
@@ -700,7 +753,7 @@ const useCountPersisted = createGlobalState(1, {
700
753
  const [count, setCount, { isAsyncStorageReady }] = useCountPersisted();
701
754
  ```
702
755
 
703
- ##### Now lets continue analizing how to create a custom GlobalStore!
756
+ ##### Now lets continue analyzing how to create a custom GlobalStore!
704
757
 
705
758
  Creating a global hook that connects to an asyncStorage is made incredibly easy with the **createCustomGlobalState** function.
706
759
 
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-native-async-storage/async-storage"),require("react")):"function"==typeof define&&define.amd?define(["@react-native-async-storage/async-storage","react"],e):"object"==typeof exports?exports["react-native-global-state-hooks"]=e(require("@react-native-async-storage/async-storage"),require("react")):t["react-native-global-state-hooks"]=e(t["@react-native-async-storage/async-storage"],t.react)}(this,((t,e)=>{return r={113:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createStatefulContext=void 0;var n,o=r(853),i=r(684),a=(n=r(156))&&n.__esModule?n:{default:n};e.createStatefulContext=function(t,e){var r=a.default.createContext(null);return[function(){return a.default.useContext(r)},function(n){var u=n.children,c=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}(n,["children"]),l=(0,o.createGlobalStateWithDecoupledFuncs)(function(){if(c.initialValue){if("function"==typeof c.initialValue)return c.initialValue((0,i.clone)(t));var e=Array.isArray(c.initialValue),r=c.initialValue instanceof Map,n=c.initialValue instanceof Set;return(0,i.isPrimitive)(c.initialValue)||(0,i.isDate)(c.initialValue)||e||r||n?c.initialValue:Object.assign(Object.assign({},t),c.initialValue)}return(0,i.clone)(t)}(),e);return a.default.createElement(r.Provider,{value:l},u)}]}},853:(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}var i=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};Object.defineProperty(e,"__esModule",{value:!0}),e.createCustomGlobalStateWithDecoupledFuncs=e.createGlobalState=e.createGlobalStateWithDecoupledFuncs=void 0;var a=r(774);e.createGlobalStateWithDecoupledFuncs=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.actions,o=i(e,["actions"]),u=new a.GlobalStore(t,o,r),c=n(u.getHookDecoupled(),2),l=c[0],f=c[1];return[u.getHook(),l,f]},e.createGlobalState=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n((0,e.createGlobalStateWithDecoupledFuncs)(t,r),3),i=o[0],a=o[1],u=o[2];return i.stateControls=function(){return[a,u]},i},e.createCustomGlobalStateWithDecoupledFuncs=function(t){var r=t.onInitialize,n=t.onChange;return function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{config:null},a=o.config,u=o.onInit,c=o.onStateChanged,l=i(o,["config","onInit","onStateChanged"]);return(0,e.createGlobalStateWithDecoupledFuncs)(t,Object.assign({onInit:function(t){r(t,a),null==u||u(t)},onStateChanged:function(t){n(t,a),null==c||c(t)}},l))}}},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(){o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.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 y(t,e,r,n){var o=e&&e.prototype instanceof m?e:m,i=Object.create(o.prototype),u=new I(n||[]);return a(i,"_invoke",{value:_(t,r,u)}),i}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=y;var v="suspendedStart",h="suspendedYield",d="executing",b="completed",g={};function m(){}function S(){}function w(){}var O={};s(O,c,(function(){return this}));var j=Object.getPrototypeOf,x=j&&j(j(C([])));x&&x!==r&&i.call(x,c)&&(O=x);var E=w.prototype=m.prototype=Object.create(O);function P(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(o,a,u,c){var l=p(t[o],t,a);if("throw"!==l.type){var f=l.arg,s=f.value;return s&&"object"==n(s)&&i.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,u,c)}),(function(t){r("throw",t,u,c)})):e.resolve(s).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function _(e,r,n){var o=v;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=k(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=b,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=p(e,r,n);if("normal"===l.type){if(o=n.done?b:h,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=b,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=p(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function G(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 L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(G,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return S.prototype=w,a(E,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:S,configurable:!0}),S.displayName=s(w,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===S||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,s(t,f,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},P(A.prototype),s(A.prototype,l,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new A(y(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(E),s(E,f,"Generator"),s(E,c,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),e.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}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):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),g},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),L(r),g}},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;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function a(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 u(t)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var l=r(608),f=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&&i(t,e)}(s,t);var e,r,n,f=(r=s,n=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=c(r);if(n){var o=c(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return a(this,t)});function s(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=f.call(this,t,r,n)).getMetadata=function(){var t=e.config,r=t.metadata,n=t.asyncStorage;return(null==n?void 0:n.key)?Object.assign({isAsyncStorageReady:!1,asyncStorageKey:null==n?void 0:n.key},null!=r?r:{}):null!=r?r:null},e.onInitialize=function(t){var r,n,i,a,c=t.setState,f=t.getState,s=t.setMetadata;r=u(e),n=void 0,i=void 0,a=o().mark((function t(){var e,r,n;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(r=null===(e=this.config)||void 0===e?void 0:e.asyncStorage)||void 0===r?void 0:r.key){t.next=3;break}return t.abrupt("return");case 3:return s((function(t){return Object.assign(Object.assign({},null!=t?t:{}),{isAsyncStorageReady:!1})})),t.next=6,(0,l.getAsyncStorageItem)({config:this.config});case 6:n=t.sent,s((function(t){return Object.assign(Object.assign({},t),{isAsyncStorageReady:!0})})),null===n&&(n=f(),(0,l.setAsyncStorageItem)({item:n,config:this.config})),c(n,{forceUpdate:!0});case 10:case"end":return t.stop()}}),t,this)})),new(i||(i=Promise))((function(t,e){function o(t){try{c(a.next(t))}catch(t){e(t)}}function u(t){try{c(a.throw(t))}catch(t){e(t)}}function c(e){var r;e.done?t(e.value):(r=e.value,r instanceof i?r:new i((function(t){t(r)}))).then(o,u)}c((a=a.apply(r,n||[])).next())}))},e.onChange=function(t){var r=t.getState;(0,l.setAsyncStorageItem)({item:r(),config:e.config})};var i=u(e),c=i.getHookDecoupled,y=i.getHook;return e.getHookDecoupled=function(){return c()},e.getHook=function(){return y()},e.constructor!==s?a(e):(e.initialize(),e)}return e=s,Object.defineProperty(e,"prototype",{writable:!1}),e}(r(734).GlobalStoreAbstract);e.GlobalStore=f},608:(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(){o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.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 y(t,e,r,n){var o=e&&e.prototype instanceof m?e:m,i=Object.create(o.prototype),u=new I(n||[]);return a(i,"_invoke",{value:_(t,r,u)}),i}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=y;var v="suspendedStart",h="suspendedYield",d="executing",b="completed",g={};function m(){}function S(){}function w(){}var O={};s(O,c,(function(){return this}));var j=Object.getPrototypeOf,x=j&&j(j(C([])));x&&x!==r&&i.call(x,c)&&(O=x);var E=w.prototype=m.prototype=Object.create(O);function P(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(o,a,u,c){var l=p(t[o],t,a);if("throw"!==l.type){var f=l.arg,s=f.value;return s&&"object"==n(s)&&i.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,u,c)}),(function(t){r("throw",t,u,c)})):e.resolve(s).then((function(t){f.value=t,u(f)}),(function(t){return r("throw",t,u,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function _(e,r,n){var o=v;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=k(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=b,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=p(e,r,n);if("normal"===l.type){if(o=n.done?b:h,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=b,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=p(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function G(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 L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(G,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return S.prototype=w,a(E,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:S,configurable:!0}),S.displayName=s(w,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===S||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,s(t,f,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},P(A.prototype),s(A.prototype,l,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new A(y(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(E),s(E,f,"Generator"),s(E,c,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),e.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}},e.values=C,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):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),g},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),L(r),g}},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;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}var i=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.setAsyncStorageItem=e.getAsyncStorageItem=void 0;var a,u=(a=r(878))&&a.__esModule?a:{default:a},c=r(734);e.getAsyncStorageItem=function(t){var e=t.config;return i(void 0,void 0,void 0,o().mark((function t(){var r,n,i,a,l;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=null===(r=null==e?void 0:e.asyncStorage)||void 0===r?void 0:r.key){t.next=3;break}return t.abrupt("return",null);case 3:return t.next=5,u.default.getItem(n);case 5:if(null!==(i=t.sent)){t.next=8;break}return t.abrupt("return",null);case 8:return a=function(){var t,r=null!==(t=null==e?void 0:e.asyncStorage)&&void 0!==t?t:{},n=r.decrypt,o=r.encrypt;return n||o?"function"==typeof n?n(i):atob(i):i}(),l=(0,c.formatFromStore)(a,{jsonParse:!0}),t.abrupt("return",l);case 11:case"end":return t.stop()}}),t)})))},e.setAsyncStorageItem=function(t){var e=t.item,r=t.config;return i(void 0,void 0,void 0,o().mark((function t(){var n,i,a,l;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=null===(n=null==r?void 0:r.asyncStorage)||void 0===n?void 0:n.key){t.next=3;break}return t.abrupt("return",null);case 3:return a=(0,c.formatToStore)(e,{stringify:!0,excludeTypes:["function"]}),void 0,f=void 0,f=(null!==(o=null==r?void 0:r.asyncStorage)&&void 0!==o?o:{}).encrypt,l=f?"function"==typeof f?f(a):btoa(a):a,t.next=7,u.default.setItem(i,l);case 7:case"end":return t.stop()}var o,f}),t)})))}},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(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(e=u.call(this,t,r,n)).onInit=function(t){e.onInitialize(t)},e.onStateChanged=function(t){e.onChange(t)},e}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]};Object.defineProperty(e,"__esModule",{value:!0}),e.setAsyncStorageItem=e.getAsyncStorageItem=e.createCustomGlobalStateWithDecoupledFuncs=e.createGlobalState=e.createGlobalStateWithDecoupledFuncs=e.GlobalStoreAbstract=e.GlobalStore=e.combineRetrieverAsynchronously=e.combineAsyncGetters=e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter=e.debounce=e.shallowCompare=e.createDerivateEmitter=e.createDerivate=e.throwNoSubscribersWereAdded=e.formatToStore=e.formatFromStore=e.isPrimitive=e.isFunction=e.isRegex=e.isDate=e.isString=e.isBoolean=e.isNumber=e.isNil=e.clone=void 0;var o=r(734);Object.defineProperty(e,"clone",{enumerable:!0,get:function(){return o.clone}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return o.isNil}}),Object.defineProperty(e,"isNumber",{enumerable:!0,get:function(){return o.isNumber}}),Object.defineProperty(e,"isBoolean",{enumerable:!0,get:function(){return o.isBoolean}}),Object.defineProperty(e,"isString",{enumerable:!0,get:function(){return o.isString}}),Object.defineProperty(e,"isDate",{enumerable:!0,get:function(){return o.isDate}}),Object.defineProperty(e,"isRegex",{enumerable:!0,get:function(){return o.isRegex}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return o.isFunction}}),Object.defineProperty(e,"isPrimitive",{enumerable:!0,get:function(){return o.isPrimitive}}),Object.defineProperty(e,"formatFromStore",{enumerable:!0,get:function(){return o.formatFromStore}}),Object.defineProperty(e,"formatToStore",{enumerable:!0,get:function(){return o.formatToStore}}),Object.defineProperty(e,"throwNoSubscribersWereAdded",{enumerable:!0,get:function(){return o.throwNoSubscribersWereAdded}}),Object.defineProperty(e,"createDerivate",{enumerable:!0,get:function(){return o.createDerivate}}),Object.defineProperty(e,"createDerivateEmitter",{enumerable:!0,get:function(){return o.createDerivateEmitter}}),Object.defineProperty(e,"shallowCompare",{enumerable:!0,get:function(){return o.shallowCompare}}),Object.defineProperty(e,"debounce",{enumerable:!0,get:function(){return o.debounce}}),Object.defineProperty(e,"combineAsyncGettersEmitter",{enumerable:!0,get:function(){return o.combineAsyncGettersEmitter}}),Object.defineProperty(e,"combineRetrieverEmitterAsynchronously",{enumerable:!0,get:function(){return o.combineRetrieverEmitterAsynchronously}}),Object.defineProperty(e,"combineAsyncGetters",{enumerable:!0,get:function(){return o.combineAsyncGetters}}),Object.defineProperty(e,"combineRetrieverAsynchronously",{enumerable:!0,get:function(){return o.combineRetrieverAsynchronously}});var i=r(774);Object.defineProperty(e,"GlobalStore",{enumerable:!0,get:function(){return i.GlobalStore}});var a=r(195);Object.defineProperty(e,"GlobalStoreAbstract",{enumerable:!0,get:function(){return a.GlobalStoreAbstract}});var u=r(853);Object.defineProperty(e,"createGlobalStateWithDecoupledFuncs",{enumerable:!0,get:function(){return u.createGlobalStateWithDecoupledFuncs}}),Object.defineProperty(e,"createGlobalState",{enumerable:!0,get:function(){return u.createGlobalState}}),Object.defineProperty(e,"createCustomGlobalStateWithDecoupledFuncs",{enumerable:!0,get:function(){return u.createCustomGlobalStateWithDecoupledFuncs}});var c=r(608);Object.defineProperty(e,"getAsyncStorageItem",{enumerable:!0,get:function(){return c.getAsyncStorageItem}}),Object.defineProperty(e,"setAsyncStorageItem",{enumerable:!0,get:function(){return c.setAsyncStorageItem}}),function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)}(r(113),e)},684:function(t){t.exports=(()=>{"use strict";var t={991:(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(729),e)},729:(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,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===r(e)?e:String(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=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)?i(t,e):void 0}}function i(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.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){return function(t){var r,i;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 a=(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(a)}if("set"===(null==t?void 0:t.$t)){var u=null!==(i=t.$v)&&void 0!==i?i:[].map((function(t){return(0,e.formatFromStore)(t)}));return new Set(u)}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)")):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.formatFromStore)(i)))}),{})}((arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).jsonParse?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=new Set(null!=u?u:[]),f=new Set(null!=c?c:[]),s=l.size||f.size,y=null!=a?a:function(t){var e=t.key,n=t.value;if(!s)return!0;var o=f.has(e),i=l.has(r(n));return!o&&!i},p=function t(r){if((0,e.isPrimitive)(r))return r;if(Array.isArray(r))return r.map((function(e){return t(e)}));if(r instanceof Map)return{$t:"map",$v:Array.from(r.entries()).map((function(e){return t(e)}))};if(r instanceof Set)return{$t:"set",$v:Array.from(r.values()).map((function(e){return t(e)}))};if((0,e.isDate)(r))return{$t:"date",$v:r.toISOString()};if((0,e.isRegex)(r))return{$t:"regex",$v:r.toString()};if((0,e.isFunction)(r)){var o;try{o={$t:"function",$v:r.toString()}}catch(t){o={$t:"error",$v:"Error: Could not serialize function"}}return o}return r instanceof Error?{$t:"error",$v:r.message}:Object.keys(r).reduce((function(e,o){var i=r[o],a=t(i);return y({obj:r,key:o,value:a})?Object.assign(Object.assign({},e),n({},o,t(i))):e}),{})}((0,e.clone)(t));return i?JSON.stringify(p):p}}},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}(991)})()},734:function(t,e,r){var n;n=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.combineAsyncGetters=e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter=void 0;var i=r(608),a=r(156),u=r(774);e.combineAsyncGettersEmitter=function(t){for(var e,r,n,o=arguments.length,a=new Array(o>1?o-1:0),c=1;c<o;c++)a[c-1]=arguments[c];var l=a,f=new Map(l.map((function(t,e){return[e,t()]}))),s=t.selector(Array.from(f.values())),y=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,p=new Set,v=(0,i.debounce)((function(){var e=t.selector(Array.from(f.values()));(null==y?void 0:y(s,e))||(s=e,p.forEach((function(t){return t()})))}),null===(n=null==t?void 0:t.config)||void 0===n?void 0:n.delay),h=l.map((function(t,e){return t((function(t){t((function(t){f.set(e,t),v()}))}))})),d=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:{}),y=null!==(n=null==u?void 0:u(s))&&void 0!==n?n:s;f.skipFirst||c(y);var v=(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,y,r))||(y=r,c(r))}),null!==(o=f.delay)&&void 0!==o?o:0);return p.add(v),function(){p.delete(v)}};return[d,function(t){if(!t)return s;var e=[];return t((function(){e.push(d.apply(void 0,arguments))})),e.length||(0,u.throwNoSubscribersWereAdded)(),function(){e.forEach((function(t){t(),p.delete(t)}))}},function(){h.forEach((function(t){return t()}))}]},e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter,e.combineAsyncGetters=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.combineAsyncGettersEmitter.apply(void 0,[t].concat(o)),3),l=c[0],f=c[1],s=c[2];return[function(t,e){var r=n((0,a.useState)((function(){var e=f();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]},f,s]},e.combineRetrieverAsynchronously=e.combineAsyncGetters},113:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createStatefulContext=void 0;var n,o=r(853),i=r(684),a=(n=r(156))&&n.__esModule?n:{default:n};e.createStatefulContext=function(t,e){var r=a.default.createContext(null);return[function(){return a.default.useContext(r)},function(n){var u=n.children,c=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}(n,["children"]),l=(0,o.createGlobalStateWithDecoupledFuncs)(function(){if(c.initialValue){if("function"==typeof c.initialValue)return c.initialValue((0,i.clone)(t));var e=Array.isArray(c.initialValue),r=c.initialValue instanceof Map,n=c.initialValue instanceof Set;return(0,i.isPrimitive)(c.initialValue)||(0,i.isDate)(c.initialValue)||e||r||n?c.initialValue:Object.assign(Object.assign({},t),c.initialValue)}return(0,i.clone)(t)}(),e);return a.default.createElement(r.Provider,{value:l},u)}]}},853:(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}var i=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};Object.defineProperty(e,"__esModule",{value:!0}),e.createDerivateEmitter=e.createDerivate=e.createCustomGlobalStateWithDecoupledFuncs=e.createGlobalState=e.createGlobalStateWithDecoupledFuncs=void 0;var a=r(774);e.createGlobalStateWithDecoupledFuncs=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.actions,o=i(e,["actions"]),u=new a.GlobalStore(t,o,r),c=n(u.getHookDecoupled(),2),l=c[0],f=c[1];return[u.getHook(),l,f]},e.createGlobalState=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n((0,e.createGlobalStateWithDecoupledFuncs)(t,r),3),i=o[0],a=o[1],u=o[2];return i.stateControls=function(){return[a,u]},i},e.createCustomGlobalStateWithDecoupledFuncs=function(t){var r=t.onInitialize,n=t.onChange;return function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{config:null},a=o.config,u=o.onInit,c=o.onStateChanged,l=i(o,["config","onInit","onStateChanged"]);return(0,e.createGlobalStateWithDecoupledFuncs)(t,Object.assign({onInit:function(t){r(t,a),null==u||u(t)},onStateChanged:function(t){n(t,a),null==c||c(t)}},l))}},e.createDerivate=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t((function(t){var r=e(t);return n?n(r):r}),n&&o?o:r)}},e.createDerivateEmitter=function(t,r){var n=t._father_emitter;if(n){var o=function(t){var e=n.selector(t);return r(e)},i=(0,e.createDerivateEmitter)(n.getter,o);return i._father_emitter={getter:n.getter,selector:o},i}var a=function(e,n){var o="function"==typeof n,i=o?e:null,a=o?n:e,u=o?arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}:n;return t((function(t){t((function(t){var e,n=r(t);return null!==(e=null==i?void 0:i(n))&&void 0!==e?e:n}),a,u)}))};return a._father_emitter={getter:t,selector:r},a}},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){(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 i(){i=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),u=new A(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function y(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p={};function v(){}function h(){}function d(){}var b={};f(b,u,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(_([])));m&&m!==e&&r.call(m,u)&&(b=m);var S=d.prototype=v.prototype=Object.create(b);function w(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function i(o,a,u,c){var l=y(t[o],t,a);if("throw"!==l.type){var f=l.arg,s=f.value;return s&&"object"==n(s)&&r.call(s,"__await")?e.resolve(s.__await).then((function(t){i("next",t,u,c)}),(function(t){i("throw",t,u,c)})):e.resolve(s).then((function(t){f.value=t,u(f)}),(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=x(a,r);if(u){if(u===p)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=y(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function x(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,x(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=y(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,p;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,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function E(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 P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function _(t){if(t){var e=t[u];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:k}}function k(){return{value:void 0,done:!0}}return h.prototype=d,o(S,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:h,configurable:!0}),h.displayName=f(d,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,f(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},w(O.prototype),f(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(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(S),f(S,l,"Generator"),f(S,u,(function(){return this})),f(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=_,A.prototype={constructor:A,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(P),!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,p):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),p},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),P(r),p}},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;P(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function a(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=e.throwNoSubscribersWereAdded=void 0;var u=r(608),c=r(156);e.throwNoSubscribersWereAdded=function(){throw new Error("No new subscribers were added, please make sure to add at least one subscriber with the subscribe method")};var l=Symbol("unique"),f=function(){function t(r){var n=this,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=s,this.subscribers=new Map,this.actions=null,this.config={metadata:null},this.onInit=null,this.onStateChanged=null,this.onSubscribed=null,this.computePreventStateChange=null,this.initialize=function(){return t=n,e=void 0,r=i().mark((function t(){var e,r,n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.actionsConfig&&(this.actions=this.getStoreActionsMap()),e=this.onInit,r=this.config.onInit,e||r){t.next=5;break}return t.abrupt("return");case 5:n=this.getConfigCallbackParam(),null==e||e(n),null==r||r(n);case 8:case"end":return t.stop()}}),t,this)})),new(e||(e=Promise))((function(n,o){function i(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var r;t.done?n(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(i,a)}u((r=r.apply(t,[])).next())}));var t,e,r},this.setState=function(t){var e=t.state,r=t.forceUpdate,o=n.stateWrapper.state;n.stateWrapper={state:e};for(var i=function(t){var n,i,a=t.selector,u=t.callback,c=t.currentState,l=t.config;if(r||!(null!==(n=null==l?void 0:l.isEqualRoot)&&void 0!==n?n:function(t,e){return Object.is(t,e)})(o,e)){var f=a?a(e):e;!r&&(null!==(i=null==l?void 0:l.isEqual)&&void 0!==i?i:function(t,e){return Object.is(t,e)})(c,f)||u({state:f})}},a=Array.from(n.subscribers.values()),u=0;u<a.length;u++)i(a[u])},this.setMetadata=function(t){var e,r,o="function"==typeof t?t(null!==(e=n.config.metadata)&&void 0!==e?e:null):t;n.config=Object.assign(Object.assign({},null!==(r=n.config)&&void 0!==r?r:{}),{metadata:o})},this.getMetadata=function(){var t;return null!==(t=n.config.metadata)&&void 0!==t?t:null},this.createChangesSubscriber=function(t){var e=t.callback,r=t.selector,o=t.config,i=r?r(n.stateWrapper.state):n.stateWrapper.state,a={state:i};return(null==o?void 0:o.skipFirst)||e(i),{stateWrapper:a,subscriptionCallback:function(t){var r=t.state;a.state=r,e(r)}}},this.getState=function(t){if(!t)return n.stateWrapper.state;var r=[];return t((function(t,e,o){var i="function"==typeof e,a=i?t:null,c=i?e:t,l=i?o:e,f=n.createChangesSubscriber({selector:a,callback:c,config:l}),s=f.subscriptionCallback,y=f.stateWrapper,p=(0,u.uniqueId)();n.addNewSubscriber(p,{selector:a,config:l,stateWrapper:y,callback:s}),r.push(p)})),r.length||(0,e.throwNoSubscribersWereAdded)(),function(){r.forEach((function(t){n.subscribers.delete(t)}))}},this.getConfigCallbackParam=function(){var t=n.setMetadata,e=n.getMetadata,r=n.getState,o=n.actions;return{setMetadata:t,getMetadata:e,getState:r,setState:n.setStateWrapper,actions:o}},this.addNewSubscriber=function(t,e){n.subscribers.set(t,{subscriptionId:t,currentState:e.stateWrapper.state,selector:e.selector,config:e.config,callback:e.callback,currentDependencies:l})},this.updateSubscriptionIfExists=function(t,e){var r;if(n.subscribers.has(t)){var o=n.subscribers.get(t);o.currentState=e.stateWrapper.state,o.currentDependencies=null===(r=o.config)||void 0===r?void 0:r.dependencies,o.selector=e.selector,o.config=e.config,o.callback=e.callback}},this.executeOnSubscribed=function(){var t=n.onSubscribed,e=n.config.onSubscribed;if(t||e){var r=n.getConfigCallbackParam();null==t||t(r),null==e||e(r)}},this.getHook=function(){return function(t){var e,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=(0,c.useRef)(null),f=function(){return t?{state:t(n.stateWrapper.state)}:n.stateWrapper},s=function(t){if(Array.isArray(t))return t}(r=(0,c.useState)(f))||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;!(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)||function(t,e){if(t){if("string"==typeof t)return o(t,2);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,2):void 0}}(r)||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.")}(),y=s[0],p=s[1];return(0,c.useEffect)((function(){return null===a.current&&(a.current=(0,u.uniqueId)()),function(){n.subscribers.delete(a.current)}}),[]),n.updateSubscriptionIfExists(a.current,{stateWrapper:y,selector:t,config:i,callback:p}),(0,c.useEffect)((function(){var e=a.current;null!==e&&!n.subscribers.has(e)&&(n.addNewSubscriber(e,{stateWrapper:y,selector:t,config:i,callback:p}),n.executeOnSubscribed())}),[y]),[function(){var e=a.current;if(!t||!n.subscribers.has(e))return y.state;var r=n.subscribers.get(e),o=r.currentDependencies,c=r.config,s=(void 0===c?{}:c).dependencies;if(o===l)return y.state;if(o===s)return y.state;if((null==o?void 0:o.length)===(null==s?void 0:s.length)&&(0,u.shallowCompare)(o,s))return y.state;var v=f();return n.updateSubscriptionIfExists(e,{stateWrapper:v,selector:t,config:i,callback:p}),y.state=v.state,v.state}(),n.getStateOrchestrator(),null!==(e=n.config.metadata)&&void 0!==e?e:null]}},this.getHookDecoupled=function(){var t=n.getStateOrchestrator(),e=n.getMetadata;return[n.getState,t,e]},this.getStateOrchestrator=function(){return n.actions?n.actions:n.setStateWrapper},this.hasStateCallbacks=function(){var t=n.computePreventStateChange,e=n.onStateChanged,r=n.config,o=r.computePreventStateChange,i=r.onStateChanged;return!!(t||o||e||i)},this.setStateWrapper=function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).forceUpdate,r="function"==typeof t,o=n.stateWrapper.state,i=r?t(o):t;if(e||!Object.is(n.stateWrapper.state,i)){var a=n.setMetadata,u=n.getMetadata,c=n.getState,l=n.actions,f={setMetadata:a,getMetadata:u,setState:n.setState,getState:c,actions:l,previousState:o,state:i},s=n.computePreventStateChange,y=n.config.computePreventStateChange;if((s||y)&&((null==s?void 0:s(f))||(null==y?void 0:y(f))))return;n.setState({forceUpdate:e,state:i});var p=n.onStateChanged,v=n.config.onStateChanged;(p||v)&&(null==p||p(f),null==v||v(f))}},this.getStoreActionsMap=function(){if(!n.actionsConfig)return null;var t=n.actionsConfig,e=n.setMetadata,r=n.setStateWrapper,o=n.getState,i=n.getMetadata,u=Object.keys(t).reduce((function(n,c){var l,f,s;return Object.assign(n,(l={},s=function(){for(var n=t[c],a=arguments.length,l=new Array(a),f=0;f<a;f++)l[f]=arguments[f];var s=n.apply(u,l);return"function"!=typeof s&&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"))}(c),s.call(u,{setState:r,getState:o,setMetadata:e,getMetadata:i,actions:u})},(f=a(f=c))in l?Object.defineProperty(l,f,{value:s,enumerable:!0,configurable:!0,writable:!0}):l[f]=s,l)),n}),{});return u},this.stateWrapper={state:r},this.config=Object.assign({metadata:null},null!=f?f:{}),this.constructor!==t||this.initialize()}var r,n;return r=t,(n=[{key:"state",get:function(){return this.stateWrapper.state}}])&&function(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,a(n.key),n)}}(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),t}();e.GlobalStore=f},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.uniqueId=e.debounce=e.shallowCompare=void 0;var c=r(684);e.shallowCompare=function(t,e){if(t===e)return!0;var r=u(t),i=u(e);if(r!==i)return!1;if((0,c.isNil)(t)||(0,c.isNil)(e)||(0,c.isPrimitive)(t)&&(0,c.isPrimitive)(e)||(0,c.isDate)(t)&&(0,c.isDate)(e)||"function"===r&&"function"===i)return t===e;if(Array.isArray(t)){var a=t,l=e;if(a.length!==l.length)return!1;for(var f=0;f<a.length;f++)if(a[f]!==l[f])return!1}if(t instanceof Map){var s=t,y=e;if(s.size!==y.size)return!1;var p,v=o(s);try{for(v.s();!(p=v.n()).done;){var h=n(p.value,2),d=h[0];if(h[1]!==y.get(d))return!1}}catch(t){v.e(t)}finally{v.f()}}if(t instanceof Set){var b=t,g=e;if(b.size!==g.size)return!1;var m,S=o(b);try{for(S.s();!(m=S.n()).done;){var w=m.value;if(!g.has(w))return!1}}catch(t){S.e(t)}finally{S.f()}}var O=Object.keys(t),j=Object.keys(e);if(O.length!==j.length)return!1;for(var x=0,E=O;x<E.length;x++){var P=E[x];if(t[P]!==e[P])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=function(){return Date.now().toString(36)+Math.random().toString(36).substr(2,5)}},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(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(e=u.call(this,t,r,n)).onInit=function(t){e.onInitialize(t)},e.onStateChanged=function(t){e.onChange(t)},e}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={991:(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(729),e)},729:(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,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===r(e)?e:String(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=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)?i(t,e):void 0}}function i(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.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){return function(t){var r,i;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 a=(null!==(r=t.$v)&&void 0!==r?r:[]).map((function(t){var r,n=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;!(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(a)}if("set"===(null==t?void 0:t.$t)){var u=null!==(i=t.$v)&&void 0!==i?i:[].map((function(t){return(0,e.formatFromStore)(t)}));return new Set(u)}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)")):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.formatFromStore)(i)))}),{})}((arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).jsonParse?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=new Set(null!=u?u:[]),f=new Set(null!=c?c:[]),s=l.size||f.size,y=null!=a?a:function(t){var e=t.key,n=t.value;if(!s)return!0;var o=f.has(e),i=l.has(r(n));return!o&&!i},p=function t(r){if((0,e.isPrimitive)(r))return r;if(Array.isArray(r))return r.map((function(e){return t(e)}));if(r instanceof Map)return{$t:"map",$v:Array.from(r.entries()).map((function(e){return t(e)}))};if(r instanceof Set)return{$t:"set",$v:Array.from(r.values()).map((function(e){return t(e)}))};if((0,e.isDate)(r))return{$t:"date",$v:r.toISOString()};if((0,e.isRegex)(r))return{$t:"regex",$v:r.toString()};if((0,e.isFunction)(r)){var o;try{o={$t:"function",$v:r.toString()}}catch(t){o={$t:"error",$v:"Error: Could not serialize function"}}return o}return r instanceof Error?{$t:"error",$v:r.message}:Object.keys(r).reduce((function(e,o){var i=r[o],a=t(i);return y({obj:r,key:o,value:a})?Object.assign(Object.assign({},e),n({},o,t(i))):e}),{})}((0,e.clone)(t));return i?JSON.stringify(p):p}}},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}(991)})()},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},t.exports=n(r(156))},878:e=>{"use strict";e.exports=t},156:t=>{"use strict";t.exports=e}},n={},function t(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return r[e].call(i.exports,i,i.exports,t),i.exports}(991);var r,n}));
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@react-native-async-storage/async-storage"),require("react")):"function"==typeof define&&define.amd?define(["@react-native-async-storage/async-storage","react"],e):"object"==typeof exports?exports["react-native-global-state-hooks"]=e(require("@react-native-async-storage/async-storage"),require("react")):t["react-native-global-state-hooks"]=e(t["@react-native-async-storage/async-storage"],t.react)}(this,((t,e)=>{return r={113:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createStatefulContext=void 0;var n,o=r(853),i=r(684),a=(n=r(156))&&n.__esModule?n:{default:n};e.createStatefulContext=function(t,e){var r=a.default.createContext(null);return[function(){return a.default.useContext(r)},function(n){var u=n.children,c=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}(n,["children"]),l=(0,o.createGlobalStateWithDecoupledFuncs)(function(){if(c.initialValue){if("function"==typeof c.initialValue)return c.initialValue((0,i.clone)(t));var e=Array.isArray(c.initialValue),r=c.initialValue instanceof Map,n=c.initialValue instanceof Set;return(0,i.isPrimitive)(c.initialValue)||(0,i.isDate)(c.initialValue)||e||r||n?c.initialValue:Object.assign(Object.assign({},t),c.initialValue)}return(0,i.clone)(t)}(),e);return a.default.createElement(r.Provider,{value:l},u)}]}},853:(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}var i=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};Object.defineProperty(e,"__esModule",{value:!0}),e.createCustomGlobalStateWithDecoupledFuncs=e.createGlobalState=e.createGlobalStateWithDecoupledFuncs=void 0;var a=r(774);e.createGlobalStateWithDecoupledFuncs=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.actions,o=i(e,["actions"]),u=new a.GlobalStore(t,o,r),c=n(u.getHook().stateControls(),2),l=c[0],s=c[1];return[u.getHook(),l,s]},e.createGlobalState=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n((0,e.createGlobalStateWithDecoupledFuncs)(t,r),1)[0]},e.createCustomGlobalStateWithDecoupledFuncs=function(t){var r=t.onInitialize,n=t.onChange;return function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{config:null},a=o.config,u=o.onInit,c=o.onStateChanged,l=i(o,["config","onInit","onStateChanged"]);return(0,e.createGlobalStateWithDecoupledFuncs)(t,Object.assign({onInit:function(t){r(t,a),null==u||u(t)},onStateChanged:function(t){n(t,a),null==c||c(t)}},l))}}},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(){o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var o=e&&e.prototype instanceof m?e:m,i=Object.create(o.prototype),u=new G(n||[]);return a(i,"_invoke",{value:_(t,r,u)}),i}function y(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var v="suspendedStart",h="suspendedYield",d="executing",b="completed",g={};function m(){}function S(){}function w(){}var O={};f(O,c,(function(){return this}));var j=Object.getPrototypeOf,x=j&&j(j(L([])));x&&x!==r&&i.call(x,c)&&(O=x);var E=w.prototype=m.prototype=Object.create(O);function P(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(o,a,u,c){var l=y(t[o],t,a);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==n(f)&&i.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,u,c)}),(function(t){r("throw",t,u,c)})):e.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function _(e,r,n){var o=v;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=k(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=b,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=y(e,r,n);if("normal"===l.type){if(o=n.done?b:h,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=b,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=y(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(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 I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function L(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return S.prototype=w,a(E,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:S,configurable:!0}),S.displayName=f(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===S||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,f(t,s,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},P(A.prototype),f(A.prototype,l,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new A(p(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(E),f(E,s,"Generator"),f(E,c,(function(){return this})),f(E,"toString",(function(){return"[object Generator]"})),e.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}},e.values=L,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):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),g},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),I(r),g}},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;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:L(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function a(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 u(t)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var l=r(608),s=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&&i(t,e)}(f,t);var e,r,n,s=(r=f,n=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=c(r);if(n){var o=c(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return a(this,t)});function f(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),(e=s.call(this,t,r,n)).getMetadata=function(){var t=e.config,r=t.metadata,n=t.asyncStorage;return(null==n?void 0:n.key)?Object.assign({isAsyncStorageReady:!1,asyncStorageKey:null==n?void 0:n.key},null!=r?r:{}):null!=r?r:null},e.onInitialize=function(t){var r,n,i,a,c=t.setState,s=t.getState,f=t.setMetadata;r=u(e),n=void 0,i=void 0,a=o().mark((function t(){var e,r,n;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(r=null===(e=this.config)||void 0===e?void 0:e.asyncStorage)||void 0===r?void 0:r.key){t.next=3;break}return t.abrupt("return");case 3:return f((function(t){return Object.assign(Object.assign({},null!=t?t:{}),{isAsyncStorageReady:!1})})),t.next=6,(0,l.getAsyncStorageItem)({config:this.config});case 6:n=t.sent,f((function(t){return Object.assign(Object.assign({},t),{isAsyncStorageReady:!0})})),null===n&&(n=s(),(0,l.setAsyncStorageItem)({item:n,config:this.config})),c(n,{forceUpdate:!0});case 10:case"end":return t.stop()}}),t,this)})),new(i||(i=Promise))((function(t,e){function o(t){try{c(a.next(t))}catch(t){e(t)}}function u(t){try{c(a.throw(t))}catch(t){e(t)}}function c(e){var r;e.done?t(e.value):(r=e.value,r instanceof i?r:new i((function(t){t(r)}))).then(o,u)}c((a=a.apply(r,n||[])).next())}))},e.onChange=function(t){var r=t.getState;(0,l.setAsyncStorageItem)({item:r(),config:e.config})},e.constructor!==f?a(e):(e.initialize(),e)}return e=f,Object.defineProperty(e,"prototype",{writable:!1}),e}(r(734).GlobalStoreAbstract);e.GlobalStore=s},608:(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(){o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var o=e&&e.prototype instanceof m?e:m,i=Object.create(o.prototype),u=new G(n||[]);return a(i,"_invoke",{value:_(t,r,u)}),i}function y(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var v="suspendedStart",h="suspendedYield",d="executing",b="completed",g={};function m(){}function S(){}function w(){}var O={};f(O,c,(function(){return this}));var j=Object.getPrototypeOf,x=j&&j(j(L([])));x&&x!==r&&i.call(x,c)&&(O=x);var E=w.prototype=m.prototype=Object.create(O);function P(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(o,a,u,c){var l=y(t[o],t,a);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==n(f)&&i.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,u,c)}),(function(t){r("throw",t,u,c)})):e.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function _(e,r,n){var o=v;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=k(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=b,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=y(e,r,n);if("normal"===l.type){if(o=n.done?b:h,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=b,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=y(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(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 I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function L(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return S.prototype=w,a(E,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:S,configurable:!0}),S.displayName=f(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===S||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,f(t,s,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},P(A.prototype),f(A.prototype,l,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new A(p(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(E),f(E,s,"Generator"),f(E,c,(function(){return this})),f(E,"toString",(function(){return"[object Generator]"})),e.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}},e.values=L,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):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),g},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),I(r),g}},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;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:L(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}var i=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.setAsyncStorageItem=e.getAsyncStorageItem=void 0;var a,u=(a=r(878))&&a.__esModule?a:{default:a},c=r(734);e.getAsyncStorageItem=function(t){var e=t.config;return i(void 0,void 0,void 0,o().mark((function t(){var r,n,i,a,l;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=null===(r=null==e?void 0:e.asyncStorage)||void 0===r?void 0:r.key){t.next=3;break}return t.abrupt("return",null);case 3:return t.next=5,u.default.getItem(n);case 5:if(null!==(i=t.sent)){t.next=8;break}return t.abrupt("return",null);case 8:return a=function(){var t,r=null!==(t=null==e?void 0:e.asyncStorage)&&void 0!==t?t:{},n=r.decrypt,o=r.encrypt;return n||o?"function"==typeof n?n(i):atob(i):i}(),l=(0,c.formatFromStore)(a,{jsonParse:!0}),t.abrupt("return",l);case 11:case"end":return t.stop()}}),t)})))},e.setAsyncStorageItem=function(t){var e=t.item,r=t.config;return i(void 0,void 0,void 0,o().mark((function t(){var n,i,a,l;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=null===(n=null==r?void 0:r.asyncStorage)||void 0===n?void 0:n.key){t.next=3;break}return t.abrupt("return",null);case 3:return a=(0,c.formatToStore)(e,{stringify:!0,excludeTypes:["function"]}),void 0,s=void 0,s=(null!==(o=null==r?void 0:r.asyncStorage)&&void 0!==o?o:{}).encrypt,l=s?"function"==typeof s?s(a):btoa(a):a,t.next=7,u.default.setItem(i,l);case 7:case"end":return t.stop()}var o,s}),t)})))}},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(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(e=u.call(this,t,r,n)).onInit=function(t){e.onInitialize(t)},e.onStateChanged=function(t){e.onChange(t)},e}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]};Object.defineProperty(e,"__esModule",{value:!0}),e.setAsyncStorageItem=e.getAsyncStorageItem=e.createCustomGlobalStateWithDecoupledFuncs=e.createGlobalState=e.createGlobalStateWithDecoupledFuncs=e.GlobalStoreAbstract=e.GlobalStore=e.combineRetrieverAsynchronously=e.combineAsyncGetters=e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter=e.debounce=e.shallowCompare=e.createDerivateEmitter=e.createDerivate=e.throwNoSubscribersWereAdded=e.formatToStore=e.formatFromStore=e.isPrimitive=e.isFunction=e.isRegex=e.isDate=e.isString=e.isBoolean=e.isNumber=e.isNil=e.clone=void 0;var o=r(734);Object.defineProperty(e,"clone",{enumerable:!0,get:function(){return o.clone}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return o.isNil}}),Object.defineProperty(e,"isNumber",{enumerable:!0,get:function(){return o.isNumber}}),Object.defineProperty(e,"isBoolean",{enumerable:!0,get:function(){return o.isBoolean}}),Object.defineProperty(e,"isString",{enumerable:!0,get:function(){return o.isString}}),Object.defineProperty(e,"isDate",{enumerable:!0,get:function(){return o.isDate}}),Object.defineProperty(e,"isRegex",{enumerable:!0,get:function(){return o.isRegex}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return o.isFunction}}),Object.defineProperty(e,"isPrimitive",{enumerable:!0,get:function(){return o.isPrimitive}}),Object.defineProperty(e,"formatFromStore",{enumerable:!0,get:function(){return o.formatFromStore}}),Object.defineProperty(e,"formatToStore",{enumerable:!0,get:function(){return o.formatToStore}}),Object.defineProperty(e,"throwNoSubscribersWereAdded",{enumerable:!0,get:function(){return o.throwNoSubscribersWereAdded}}),Object.defineProperty(e,"createDerivate",{enumerable:!0,get:function(){return o.createDerivate}}),Object.defineProperty(e,"createDerivateEmitter",{enumerable:!0,get:function(){return o.createDerivateEmitter}}),Object.defineProperty(e,"shallowCompare",{enumerable:!0,get:function(){return o.shallowCompare}}),Object.defineProperty(e,"debounce",{enumerable:!0,get:function(){return o.debounce}}),Object.defineProperty(e,"combineAsyncGettersEmitter",{enumerable:!0,get:function(){return o.combineAsyncGettersEmitter}}),Object.defineProperty(e,"combineRetrieverEmitterAsynchronously",{enumerable:!0,get:function(){return o.combineRetrieverEmitterAsynchronously}}),Object.defineProperty(e,"combineAsyncGetters",{enumerable:!0,get:function(){return o.combineAsyncGetters}}),Object.defineProperty(e,"combineRetrieverAsynchronously",{enumerable:!0,get:function(){return o.combineRetrieverAsynchronously}});var i=r(774);Object.defineProperty(e,"GlobalStore",{enumerable:!0,get:function(){return i.GlobalStore}});var a=r(195);Object.defineProperty(e,"GlobalStoreAbstract",{enumerable:!0,get:function(){return a.GlobalStoreAbstract}});var u=r(853);Object.defineProperty(e,"createGlobalStateWithDecoupledFuncs",{enumerable:!0,get:function(){return u.createGlobalStateWithDecoupledFuncs}}),Object.defineProperty(e,"createGlobalState",{enumerable:!0,get:function(){return u.createGlobalState}}),Object.defineProperty(e,"createCustomGlobalStateWithDecoupledFuncs",{enumerable:!0,get:function(){return u.createCustomGlobalStateWithDecoupledFuncs}});var c=r(608);Object.defineProperty(e,"getAsyncStorageItem",{enumerable:!0,get:function(){return c.getAsyncStorageItem}}),Object.defineProperty(e,"setAsyncStorageItem",{enumerable:!0,get:function(){return c.setAsyncStorageItem}}),function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)}(r(113),e)},684:function(t){t.exports=(()=>{"use strict";var t={991:(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(729),e)},729:(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,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===r(e)?e:String(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=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)?i(t,e):void 0}}function i(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.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){return function(t){var r,i;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 a=(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(a)}if("set"===(null==t?void 0:t.$t)){var u=null!==(i=t.$v)&&void 0!==i?i:[].map((function(t){return(0,e.formatFromStore)(t)}));return new Set(u)}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)")):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.formatFromStore)(i)))}),{})}((arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).jsonParse?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=new Set(null!=u?u:[]),s=new Set(null!=c?c:[]),f=l.size||s.size,p=null!=a?a:function(t){var e=t.key,n=t.value;if(!f)return!0;var o=s.has(e),i=l.has(r(n));return!o&&!i},y=function t(r){if((0,e.isPrimitive)(r))return r;if(Array.isArray(r))return r.map((function(e){return t(e)}));if(r instanceof Map)return{$t:"map",$v:Array.from(r.entries()).map((function(e){return t(e)}))};if(r instanceof Set)return{$t:"set",$v:Array.from(r.values()).map((function(e){return t(e)}))};if((0,e.isDate)(r))return{$t:"date",$v:r.toISOString()};if((0,e.isRegex)(r))return{$t:"regex",$v:r.toString()};if((0,e.isFunction)(r)){var o;try{o={$t:"function",$v:r.toString()}}catch(t){o={$t:"error",$v:"Error: Could not serialize function"}}return o}return r instanceof Error?{$t:"error",$v:r.message}:Object.keys(r).reduce((function(e,o){var i=r[o],a=t(i);return p({obj:r,key:o,value:a})?Object.assign(Object.assign({},e),n({},o,t(i))):e}),{})}((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}(991)})()},734:function(t,e,r){var n;n=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.combineAsyncGetters=e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter=void 0;var i=r(608),a=r(156),u=r(774);e.combineAsyncGettersEmitter=function(t){for(var e,r,n,o=arguments.length,a=new Array(o>1?o-1:0),c=1;c<o;c++)a[c-1]=arguments[c];var l=a,s=new Map(l.map((function(t,e){return[e,t()]}))),f=t.selector(Array.from(s.values())),p=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,y=new Set,v=(0,i.debounce)((function(){var e=t.selector(Array.from(s.values()));(null==p?void 0:p(f,e))||(f=e,y.forEach((function(t){return t()})))}),null===(n=null==t?void 0:t.config)||void 0===n?void 0:n.delay),h=l.map((function(t,e){return t((function(t){t((function(t){s.set(e,t),v()}))}))})),d=function(t,e,r){var n,o,a="function"==typeof e,u=a?t:null,c=a?e:t,l=a?r:e,s=Object.assign({delay:0,isEqual:i.shallowCompare},null!=l?l:{}),p=null!==(n=null==u?void 0:u(f))&&void 0!==n?n:f;s.skipFirst||c(p);var v=(0,i.debounce)((function(){var t,e,r=null!==(t=null==u?void 0:u(f))&&void 0!==t?t:f;(null===(e=s.isEqual)||void 0===e?void 0:e.call(s,p,r))||(p=r,c(r))}),null!==(o=s.delay)&&void 0!==o?o:0);return y.add(v),function(){y.delete(v)}};return[d,function(t){if(!t)return f;var e=[];return t((function(){e.push(d.apply(void 0,arguments))})),e.length||(0,u.throwNoSubscribersWereAdded)(),function(){e.forEach((function(t){t(),y.delete(t)}))}},function(){h.forEach((function(t){return t()}))}]},e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter,e.combineAsyncGetters=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.combineAsyncGettersEmitter.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]},e.combineRetrieverAsynchronously=e.combineAsyncGetters},113:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createStatefulContext=void 0;var n,o=r(853),i=r(684),a=(n=r(156))&&n.__esModule?n:{default:n};e.createStatefulContext=function(t,e){var r=a.default.createContext(null);return[function(){return a.default.useContext(r)},function(n){var u=n.children,c=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}(n,["children"]),l=(0,o.createGlobalStateWithDecoupledFuncs)(function(){if(c.initialValue){if("function"==typeof c.initialValue)return c.initialValue((0,i.clone)(t));var e=Array.isArray(c.initialValue),r=c.initialValue instanceof Map,n=c.initialValue instanceof Set;return(0,i.isPrimitive)(c.initialValue)||(0,i.isDate)(c.initialValue)||e||r||n?c.initialValue:Object.assign(Object.assign({},t),c.initialValue)}return(0,i.clone)(t)}(),e);return a.default.createElement(r.Provider,{value:l},u)}]}},853:(t,e,r)=>{"use strict";function n(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}var o=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};Object.defineProperty(e,"__esModule",{value:!0}),e.createDerivateEmitter=e.createDerivate=e.createCustomGlobalStateWithDecoupledFuncs=e.createGlobalState=e.createGlobalStateWithDecoupledFuncs=void 0;var i=r(774);e.createGlobalStateWithDecoupledFuncs=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.actions,u=o(r,["actions"]),c=new i.GlobalStore(t,u,a).getHook(),l=function(t){if(Array.isArray(t))return t}(e=c.stateControls())||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;!(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}}(e)||function(t,e){if(t){if("string"==typeof t)return n(t,2);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)?n(t,2):void 0}}(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.")}();return[c,l[0],l[1]]},e.createGlobalState=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.actions,n=o(e,["actions"]);return new i.GlobalStore(t,n,r).getHook()},e.createCustomGlobalStateWithDecoupledFuncs=function(t){var r=t.onInitialize,n=t.onChange;return function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{config:null},a=i.config,u=i.onInit,c=i.onStateChanged,l=o(i,["config","onInit","onStateChanged"]);return(0,e.createGlobalStateWithDecoupledFuncs)(t,Object.assign({onInit:function(t){r(t,a),null==u||u(t)},onStateChanged:function(t){n(t,a),null==c||c(t)}},l))}},e.createDerivate=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.createSelectorHook(e,r)},e.createDerivateEmitter=function(t,r){var n=t._father_emitter;if(n){var o=function(t){var e=n.selector(t);return r(e)},i=(0,e.createDerivateEmitter)(n.getter,o);return i._father_emitter={getter:n.getter,selector:o},i}var a=function(e,n){var o="function"==typeof n,i=o?e:null,a=o?n:e,u=o?arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}:n;return t((function(t){t((function(t){var e,n=r(t);return null!==(e=null==i?void 0:i(n))&&void 0!==e?e:n}),a,u)}))};return a._father_emitter={getter:t,selector:r},a}},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)||function(t,e){if(t){if("string"==typeof t)return i(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)?i(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 i(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 a(){a=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:{},u=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 v?e:v,a=Object.create(i.prototype),u=new A(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var y={};function v(){}function h(){}function d(){}var b={};s(b,u,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(_([])));m&&m!==e&&r.call(m,u)&&(b=m);var S=d.prototype=v.prototype=Object.create(b);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=p(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=x(a,r);if(u){if(u===y)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=p(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function x(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,x(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=p(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,y;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,y):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function E(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 P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function _(t){if(t){var e=t[u];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:k}}function k(){return{value:void 0,done:!0}}return h.prototype=d,o(S,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:h,configurable:!0}),h.displayName=s(d,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,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,u,(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=_,A.prototype={constructor:A,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(P),!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,y):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),y},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),P(r),y}},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;P(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),y}},t}function u(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=e.uniqueSymbol=e.throwNoSubscribersWereAdded=void 0;var c=r(608),l=r(156);e.throwNoSubscribersWereAdded=function(){throw new Error("No new subscribers were added, please make sure to add at least one subscriber with the subscribe method")},e.uniqueSymbol=Symbol("unique");var s=function(){function t(r){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=s,this.subscribers=new Map,this.actions=null,this.config={metadata:null},this.onInit=null,this.onStateChanged=null,this.onSubscribed=null,this.computePreventStateChange=null,this.initialize=function(){return t=n,e=void 0,r=a().mark((function t(){var e,r,n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.actionsConfig&&(this.actions=this.getStoreActionsMap()),e=this.onInit,r=this.config.onInit,e||r){t.next=5;break}return t.abrupt("return");case 5:n=this.getConfigCallbackParam(),null==e||e(n),null==r||r(n);case 8:case"end":return t.stop()}}),t,this)})),new(e||(e=Promise))((function(n,o){function i(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var r;t.done?n(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(i,a)}u((r=r.apply(t,[])).next())}));var t,e,r},this.setState=function(t){var e=t.state,r=t.forceUpdate,o=n.stateWrapper.state;n.stateWrapper={state:e};for(var i=function(t){var n,i,a=t.selector,u=t.callback,c=t.currentState,l=t.config;if(r||!(null!==(n=null==l?void 0:l.isEqualRoot)&&void 0!==n?n:function(t,e){return Object.is(t,e)})(o,e)){var s=a?a(e):e;!r&&(null!==(i=null==l?void 0:l.isEqual)&&void 0!==i?i:function(t,e){return Object.is(t,e)})(c,s)||u({state:s})}},a=Array.from(n.subscribers.values()),u=0;u<a.length;u++)i(a[u])},this.setMetadata=function(t){var e,r,o="function"==typeof t?t(null!==(e=n.config.metadata)&&void 0!==e?e:null):t;n.config=Object.assign(Object.assign({},null!==(r=n.config)&&void 0!==r?r:{}),{metadata:o})},this.getMetadata=function(){var t;return null!==(t=n.config.metadata)&&void 0!==t?t:null},this.createChangesSubscriber=function(t){var e=t.callback,r=t.selector,o=t.config,i=r?r(n.stateWrapper.state):n.stateWrapper.state,a={state:i};return(null==o?void 0:o.skipFirst)||e(i),{stateWrapper:a,subscriptionCallback:function(t){var r=t.state;a.state=r,e(r)}}},this.getState=function(t){if(!t)return n.stateWrapper.state;var r=[];return t((function(t,e,o){var i="function"==typeof e,a=i?t:null,u=i?e:t,l=i?o:e,s=n.createChangesSubscriber({selector:a,callback:u,config:l}),f=s.subscriptionCallback,p=s.stateWrapper,y=(0,c.uniqueId)();n.addNewSubscriber(y,{selector:a,config:l,stateWrapper:p,callback:f}),r.push(y)})),r.length||(0,e.throwNoSubscribersWereAdded)(),function(){r.forEach((function(t){n.subscribers.delete(t)}))}},this.getConfigCallbackParam=function(){var t=n.setMetadata,e=n.getMetadata,r=n.getState,o=n.actions;return{setMetadata:t,getMetadata:e,getState:r,setState:n.setStateWrapper,actions:o}},this.addNewSubscriber=function(t,r){n.subscribers.set(t,{subscriptionId:t,currentState:r.stateWrapper.state,selector:r.selector,config:r.config,callback:r.callback,currentDependencies:e.uniqueSymbol})},this.updateSubscriptionIfExists=function(t,e){var r;if(n.subscribers.has(t)){var o=n.subscribers.get(t);o.currentState=e.stateWrapper.state,o.currentDependencies=null===(r=o.config)||void 0===r?void 0:r.dependencies,o.selector=e.selector,o.config=e.config,o.callback=e.callback}},this.executeOnSubscribed=function(){var t=n.onSubscribed,e=n.config.onSubscribed;if(t||e){var r=n.getConfigCallbackParam();null==t||t(r),null==e||e(r)}},this.getHook=function(){var t=function(t){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=(0,l.useRef)(null),u=function(){return t?{state:t(n.stateWrapper.state)}:{state:n.stateWrapper.state}},s=o((0,l.useState)(u),2),f=s[0],p=s[1];return(0,l.useEffect)((function(){return null===a.current&&(a.current=(0,c.uniqueId)()),function(){n.subscribers.delete(a.current)}}),[]),n.updateSubscriptionIfExists(a.current,{stateWrapper:f,selector:t,config:i,callback:p}),(0,l.useEffect)((function(){var e=a.current;null!==e&&!n.subscribers.has(e)&&(n.addNewSubscriber(e,{stateWrapper:f,selector:t,config:i,callback:p}),n.executeOnSubscribed())}),[f]),[function(){var r=a.current;if(!t||!n.subscribers.has(r))return f.state;var o=n.subscribers.get(r),l=o.currentDependencies,s=o.config,y=(void 0===s?{}:s).dependencies;if(l===e.uniqueSymbol)return f.state;if(l===y)return f.state;if((null==l?void 0:l.length)===(null==y?void 0:y.length)&&(0,c.shallowCompare)(l,y))return f.state;var v=u();return n.updateSubscriptionIfExists(r,{stateWrapper:v,selector:t,config:i,callback:p}),f.state=v.state,v.state}(),n.getStateOrchestrator(),null!==(r=n.config.metadata)&&void 0!==r?r:null]};return t.stateControls=n.stateControls,t.createSelectorHook=n.createSelectorHook,t},this.createSelectorHook=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.isEqualRoot,a=r.isEqual,u=new Map,s=o(n.stateControls(),3),f=s[0],p=s[1],y=s[2],v=f(),h=(null!=t?t:function(t){return t})(f());f((function(e){e((function(e){if(!(null!=i?i:Object.is)(v,e)){v=e;var r=t(e);(null!=a?a:Object.is)(h,r)||(h=r,u.forEach((function(t){t.callback({state:h})})))}}),{skipFirst:!0})}));var d=function(t,r){u.set(t,{subscriptionId:t,currentState:r.stateWrapper.state,selector:r.selector,config:r.config,callback:r.callback,currentDependencies:e.uniqueSymbol})},b=function(t,e){var r;if(u.has(t)){var n=u.get(t);n.currentState=e.stateWrapper.state,n.currentDependencies=null===(r=n.config)||void 0===r?void 0:r.dependencies,n.selector=e.selector,n.config=e.config,n.callback=e.callback}},g=function(t){if(!t)return h;var r=[];return t((function(t,e,n){var o="function"==typeof e,i=o?t:null,a=o?n:e,u=function(t){var e=t.callback,r=t.selector,n=t.config,o=(null!=r?r:function(t){return t})(h),i={state:o};return(null==n?void 0:n.skipFirst)||e(o),{stateWrapper:i,subscriptionCallback:function(t){var r=t.state;i.state=r,e(r)}}}({selector:i,callback:o?e:t,config:a}),l=u.subscriptionCallback,s=u.stateWrapper,f=(0,c.uniqueId)();d(f,{selector:i,config:a,stateWrapper:s,callback:l}),r.push(f)})),r.length||(0,e.throwNoSubscribersWereAdded)(),function(){r.forEach((function(t){u.delete(t)}))}},m=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.isEqualRoot,i=r.isEqual,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}(r,["isEqualRoot","isEqual"]),s=function(){return t?{state:t(h)}:{state:h}},f=(0,l.useRef)(null),v=o((0,l.useState)(s),2),m=v[0],S=v[1];return(0,l.useEffect)((function(){null===f.current&&(f.current=(0,c.uniqueId)());var e=g((function(e){var r=h;e((function(e){var o=u.get(f.current);if(!(null!=n?n:Object.is)(r,e)){r=e;var a=(null!=t?t:function(t){return t})(h);(null!=i?i:Object.is)(a,o.currentState)||(o.currentState=a,S({state:a}))}}),{skipFirst:!0})}));return function(){e(),u.delete(f.current)}}),[]),b(f.current,{stateWrapper:m,selector:t,config:a,callback:S}),(0,l.useEffect)((function(){var e=f.current;null!==e&&!u.has(e)&&d(e,{stateWrapper:m,selector:t,config:a,callback:S})}),[m]),[function(){var r=f.current;if(!t||!u.has(r))return m.state;var n=u.get(r),o=n.currentDependencies,i=n.config,l=(void 0===i?{}:i).dependencies;if(o===e.uniqueSymbol)return m.state;if(o===l)return m.state;if((null==o?void 0:o.length)===(null==l?void 0:l.length)&&(0,c.shallowCompare)(o,l))return m.state;var p=s();return b(r,{stateWrapper:p,selector:t,config:a,callback:S}),m.state=p.state,p.state}(),p,y]};return m.stateControls=function(){return[g,p,y]},m.createSelectorHook=n.createSelectorHook.bind(m),m},this.stateControls=function(){var t=n.getStateOrchestrator(),e=n.getMetadata;return[n.getState,t,e]},this.getHookDecoupled=function(){return n.stateControls()},this.getStateOrchestrator=function(){return n.actions?n.actions:n.setStateWrapper},this.hasStateCallbacks=function(){var t=n.computePreventStateChange,e=n.onStateChanged,r=n.config,o=r.computePreventStateChange,i=r.onStateChanged;return!!(t||o||e||i)},this.setStateWrapper=function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).forceUpdate,r="function"==typeof t,o=n.stateWrapper.state,i=r?t(o):t;if(e||!Object.is(n.stateWrapper.state,i)){var a=n.setMetadata,u=n.getMetadata,c=n.getState,l=n.actions,s={setMetadata:a,getMetadata:u,setState:n.setState,getState:c,actions:l,previousState:o,state:i},f=n.computePreventStateChange,p=n.config.computePreventStateChange;if((f||p)&&((null==f?void 0:f(s))||(null==p?void 0:p(s))))return;n.setState({forceUpdate:e,state:i});var y=n.onStateChanged,v=n.config.onStateChanged;(y||v)&&(null==y||y(s),null==v||v(s))}},this.getStoreActionsMap=function(){if(!n.actionsConfig)return null;var t=n.actionsConfig,e=n.setMetadata,r=n.setStateWrapper,o=n.getState,i=n.getMetadata,a=Object.keys(t).reduce((function(n,c){var l,s,f;return Object.assign(n,(l={},f=function(){for(var n=t[c],u=arguments.length,l=new Array(u),s=0;s<u;s++)l[s]=arguments[s];var f=n.apply(a,l);return"function"!=typeof f&&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"))}(c),f.call(a,{setState:r,getState:o,setMetadata:e,getMetadata:i,actions:a})},(s=u(s=c))in l?Object.defineProperty(l,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):l[s]=f,l)),n}),{});return a},this.stateWrapper={state:r},this.config=Object.assign({metadata:null},null!=i?i:{}),this.constructor!==t||this.initialize()}var r,n;return r=t,(n=[{key:"state",get:function(){return this.stateWrapper.state}}])&&function(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,u(n.key),n)}}(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),t}();e.GlobalStore=s},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.uniqueId=e.debounce=e.shallowCompare=void 0;var c=r(684);e.shallowCompare=function(t,e){if(t===e)return!0;var r=u(t),i=u(e);if(r!==i)return!1;if((0,c.isNil)(t)||(0,c.isNil)(e)||(0,c.isPrimitive)(t)&&(0,c.isPrimitive)(e)||(0,c.isDate)(t)&&(0,c.isDate)(e)||"function"===r&&"function"===i)return t===e;if(Array.isArray(t)){var a=t,l=e;if(a.length!==l.length)return!1;for(var s=0;s<a.length;s++)if(a[s]!==l[s])return!1}if(t instanceof Map){var f=t,p=e;if(f.size!==p.size)return!1;var y,v=o(f);try{for(v.s();!(y=v.n()).done;){var h=n(y.value,2),d=h[0];if(h[1]!==p.get(d))return!1}}catch(t){v.e(t)}finally{v.f()}}if(t instanceof Set){var b=t,g=e;if(b.size!==g.size)return!1;var m,S=o(b);try{for(S.s();!(m=S.n()).done;){var w=m.value;if(!g.has(w))return!1}}catch(t){S.e(t)}finally{S.f()}}var O=Object.keys(t),j=Object.keys(e);if(O.length!==j.length)return!1;for(var x=0,E=O;x<E.length;x++){var P=E[x];if(t[P]!==e[P])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=function(){return Date.now().toString(36)+Math.random().toString(36).substr(2,5)}},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(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(e=u.call(this,t,r,n)).onInit=function(t){e.onInitialize(t)},e.onStateChanged=function(t){e.onChange(t)},e}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={991:(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(729),e)},729:(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,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===r(e)?e:String(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=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)?i(t,e):void 0}}function i(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.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){return function(t){var r,i;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 a=(null!==(r=t.$v)&&void 0!==r?r:[]).map((function(t){var r,n=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;!(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(a)}if("set"===(null==t?void 0:t.$t)){var u=null!==(i=t.$v)&&void 0!==i?i:[].map((function(t){return(0,e.formatFromStore)(t)}));return new Set(u)}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)")):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.formatFromStore)(i)))}),{})}((arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).jsonParse?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=new Set(null!=u?u:[]),s=new Set(null!=c?c:[]),f=l.size||s.size,p=null!=a?a:function(t){var e=t.key,n=t.value;if(!f)return!0;var o=s.has(e),i=l.has(r(n));return!o&&!i},y=function t(r){if((0,e.isPrimitive)(r))return r;if(Array.isArray(r))return r.map((function(e){return t(e)}));if(r instanceof Map)return{$t:"map",$v:Array.from(r.entries()).map((function(e){return t(e)}))};if(r instanceof Set)return{$t:"set",$v:Array.from(r.values()).map((function(e){return t(e)}))};if((0,e.isDate)(r))return{$t:"date",$v:r.toISOString()};if((0,e.isRegex)(r))return{$t:"regex",$v:r.toString()};if((0,e.isFunction)(r)){var o;try{o={$t:"function",$v:r.toString()}}catch(t){o={$t:"error",$v:"Error: Could not serialize function"}}return o}return r instanceof Error?{$t:"error",$v:r.message}:Object.keys(r).reduce((function(e,o){var i=r[o],a=t(i);return p({obj:r,key:o,value:a})?Object.assign(Object.assign({},e),n({},o,t(i))):e}),{})}((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}(991)})()},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},t.exports=n(r(156))},878:e=>{"use strict";e.exports=t},156:t=>{"use strict";t.exports=e}},n={},function t(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return r[e].call(i.exports,i,i.exports,t),i.exports}(991);var r,n}));
@@ -1,11 +1,12 @@
1
1
  import * as GlobalStoreBase from "react-hooks-global-states";
2
2
  import { GlobalStoreConfig, StateChangesParam, TMetadataResult, ActionCollectionConfig, ActionCollectionResult } from "./GlobalStore.types";
3
- import { GlobalStoreAbstract, MetadataGetter, StateGetter, StateSetter } from "react-hooks-global-states";
3
+ import { GlobalStoreAbstract, MetadataGetter, StateGetter, StateSetter, UseHookConfig } from "react-hooks-global-states";
4
4
  export declare class GlobalStore<TState, TMetadata = null, TStateSetter extends ActionCollectionConfig<TState, TMetadata> | StateSetter<TState> = StateSetter<TState>> extends GlobalStoreAbstract<TState, TMetadata, NonNullable<TStateSetter>> {
5
5
  protected config: GlobalStoreConfig<TState, TMetadata, TStateSetter>;
6
6
  constructor(state: TState, config?: GlobalStoreConfig<TState, TMetadata, TStateSetter>, actionsConfig?: TStateSetter | null);
7
7
  protected getMetadata: () => TMetadata | TMetadataResult<TMetadata>;
8
8
  /**
9
+ * @deprecated
9
10
  * Returns an array with the a function to get the state, the state setter or the actions map, and a function to get the metadata
10
11
  * @returns {[() => TState, TStateSetter, () => TMetadata]} - The state getter, the state setter or the actions map, the metadata getter
11
12
  * */
@@ -14,15 +15,17 @@ export declare class GlobalStore<TState, TMetadata = null, TStateSetter extends
14
15
  keyof TStateSetter extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TStateSetter>,
15
16
  MetadataGetter<TMetadataResult<TMetadata>>
16
17
  ];
18
+ stateControls: () => [
19
+ StateGetter<TState>,
20
+ keyof TStateSetter extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TStateSetter>,
21
+ MetadataGetter<TMetadataResult<TMetadata>>
22
+ ];
23
+ createSelectorHook: <RootState, StateMutator, RootSelectorResult, RootDerivate = RootSelectorResult extends never ? RootState : RootSelectorResult>(this: GlobalStoreBase.StateHook<RootState, StateMutator, MetadataGetter<TMetadataResult<TMetadata>>>, mainSelector?: (state: RootState) => RootSelectorResult, { isEqualRoot, isEqual, }?: Omit<UseHookConfig<RootDerivate, RootState>, "dependencies">) => GlobalStoreBase.StateHook<RootDerivate, StateMutator, MetadataGetter<TMetadataResult<TMetadata>>>;
17
24
  /**
18
25
  * Returns a custom hook that allows to handle a global state
19
26
  * @returns {[TState, TStateSetter, TMetadata]} - The state, the state setter or the actions map, the metadata
20
27
  * */
21
- getHook: () => () => [
22
- state: TState,
23
- stateMutator: keyof TStateSetter extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TStateSetter>,
24
- metadata: MetadataGetter<TMetadataResult<TMetadata>>
25
- ];
28
+ getHook: () => GlobalStoreBase.StateHook<TState, keyof TStateSetter extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TStateSetter>, MetadataGetter<TMetadataResult<TMetadata>>>;
26
29
  protected onInitialize: ({ setState, getState, setMetadata, }: GlobalStoreBase.StateConfigCallbackParam<TState, TMetadata>) => void;
27
30
  protected onChange: ({ getState, }: StateChangesParam<TState, TMetadata, TStateSetter>) => void;
28
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-global-state-hooks",
3
- "version": "7.0.1",
3
+ "version": "7.1.0",
4
4
  "description": "This is a package to easily handling global-state across your react-native-components No-redux... The library now includes @react-native-async-storage/async-storage to persist your state across sessions... if you want to keep using the old version without async-storage or react-native dependencies just use version 5.0.15 or user react-hooks-global-states instead",
5
5
  "main": "lib/bundle.js",
6
6
  "types": "lib/src/index.d.ts",
@@ -93,6 +93,6 @@
93
93
  }
94
94
  },
95
95
  "dependencies": {
96
- "react-hooks-global-states": "^2.0.2"
96
+ "react-hooks-global-states": "2.1.0"
97
97
  }
98
98
  }