react-global-state-hooks 4.0.1 → 4.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 +337 -263
- package/lib/bundle.js +1 -1
- package/lib/src/GlobalStore.functionHooks.d.ts +1 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -40,28 +40,46 @@ return <button onclick={() => setCount((count) => count + 1)}>{count}</button>;
|
|
|
40
40
|
|
|
41
41
|
Isn't it cool? It works just like a regular **useState**. Notice the only difference is that now you don't need to provide the initial value since this is a global hook, and the initial value has already been provided.
|
|
42
42
|
|
|
43
|
+
# Local Storage
|
|
44
|
+
|
|
45
|
+
By default, our global hooks are capable of persisting information in local storage. To achieve this, you need to provide the key that will be used to persist the data. Additionally, you have the option to encrypt the stored data.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
const useContacts = createGlobalState(
|
|
49
|
+
{
|
|
50
|
+
filter: '',
|
|
51
|
+
items: [] as Contact[],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
localStorage: {
|
|
55
|
+
key: 'data',
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
That means your data will automatically be synchronized with the local storage, and you don't need to worry about losing the type of your Maps/Sets/Dates - the store takes care of it for you.
|
|
62
|
+
|
|
43
63
|
# Selectors
|
|
44
64
|
|
|
45
65
|
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**
|
|
46
66
|
|
|
47
67
|
```ts
|
|
48
|
-
import { createGlobalState } from 'react-global-
|
|
68
|
+
import { createGlobalState } from 'react-hooks-global-states';
|
|
49
69
|
|
|
50
70
|
export const useContacts = createGlobalState({
|
|
51
71
|
isLoading: true,
|
|
52
|
-
|
|
53
|
-
|
|
72
|
+
entities: Contact[],
|
|
73
|
+
selected: Set<number>,
|
|
54
74
|
});
|
|
55
75
|
```
|
|
56
76
|
|
|
57
|
-
Now, let's say we want to
|
|
58
|
-
|
|
59
|
-
**FilterBar.tsx**
|
|
77
|
+
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.
|
|
60
78
|
|
|
61
79
|
```tsx
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
);
|
|
80
|
+
// That's it. With that simple selector, we now get the list of contacts,
|
|
81
|
+
// and the component will only re-render if the property **entities** changes on the global state
|
|
82
|
+
const [contacts] = useContacts((state) => state.entities]);
|
|
65
83
|
|
|
66
84
|
return (
|
|
67
85
|
<ul>
|
|
@@ -72,9 +90,107 @@ return (
|
|
|
72
90
|
);
|
|
73
91
|
```
|
|
74
92
|
|
|
75
|
-
|
|
93
|
+
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.
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
export const useContacts = createGlobalState({
|
|
97
|
+
isLoading: true,
|
|
98
|
+
entities: Map<number, Contact>,
|
|
99
|
+
selected: Set<number>,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// The selector is simply a standard selector used to extract the values from the map.
|
|
103
|
+
|
|
104
|
+
const [contacts] = useContacts((state) => [...state.entities.values()], {
|
|
105
|
+
// The isEqualRoots function allows you to create your own validation logic for determining when to recompute the selector.
|
|
106
|
+
isEqualRoot: (a, b) => a.entities === b.entities,
|
|
107
|
+
});
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
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?
|
|
111
|
+
|
|
112
|
+
**component.ts**
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
const [filter, setFilter] = useState('');
|
|
116
|
+
|
|
117
|
+
const [contacts] = useContacts(
|
|
118
|
+
(state) =>
|
|
119
|
+
[...state.entities.values()].filter((item) => item.name.includes(filter)),
|
|
120
|
+
{
|
|
121
|
+
isEqualRoot: (a, b) => a.entities === b.entities,
|
|
122
|
+
/**
|
|
123
|
+
* Easy to understand, right? With the dependencies prop, you can,
|
|
124
|
+
* just like with any other hook, provide a collection of values that will be compared during each render cycle
|
|
125
|
+
* to determine if the selector should be recomputed.*/
|
|
126
|
+
dependencies: [filter],
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
And finally, what if you need to reuse this selector throughout your application and don't want to duplicate code?
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
export const useContacts = createGlobalState({
|
|
135
|
+
isLoading: true,
|
|
136
|
+
entities: Map<number, Contact>,
|
|
137
|
+
selected: Set<number>,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const useContactsArray = useContacts.createSelectorHook(
|
|
141
|
+
(state) => [...state.entities.values()],
|
|
142
|
+
{
|
|
143
|
+
isEqualRoot: (a, b) => a.entities === b.entities,
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Now inside your component just call the new hook
|
|
149
|
+
|
|
150
|
+
**component.ts**
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
const [filter, setFilter] = useState('');
|
|
154
|
+
|
|
155
|
+
const [contacts] = useContactsArray(
|
|
156
|
+
(entities) => entities.name.includes(filter),
|
|
157
|
+
{
|
|
158
|
+
dependencies: [filter],
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Or you can create another selectorHook from your **useContactsArray**
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
const useContactsArray = useContacts.createSelectorHook(
|
|
167
|
+
(state) => [...state.entities.values()],
|
|
168
|
+
{
|
|
169
|
+
isEqualRoot: (a, b) => a.entities === b.entities,
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
const useContactsLength = useContactsArray.createSelectorHook(
|
|
174
|
+
(entities) => entities.length
|
|
175
|
+
);
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Or you can create a custom hook
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
const useFilteredContacts = (filter: string) => {
|
|
182
|
+
const [contacts] = useContactsArray(
|
|
183
|
+
(entities) => entities.name.includes(filter),
|
|
184
|
+
{
|
|
185
|
+
dependencies: [filter],
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
return contacts;
|
|
190
|
+
};
|
|
191
|
+
```
|
|
76
192
|
|
|
77
|
-
|
|
193
|
+
To summarize
|
|
78
194
|
|
|
79
195
|
```tsx
|
|
80
196
|
const [filter, setFilter] = useState('');
|
|
@@ -114,7 +230,7 @@ return (
|
|
|
114
230
|
);
|
|
115
231
|
```
|
|
116
232
|
|
|
117
|
-
If you want to perform a shallow comparison between the previous and new values, you can use the **shallowCompare** function from the library.
|
|
233
|
+
Btw, If you want to perform a shallow comparison between the previous and new values, you can use the **shallowCompare** function from the library.
|
|
118
234
|
|
|
119
235
|
```TSX
|
|
120
236
|
({
|
|
@@ -125,33 +241,27 @@ If you want to perform a shallow comparison between the previous and new values,
|
|
|
125
241
|
})
|
|
126
242
|
```
|
|
127
243
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
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?
|
|
244
|
+
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.
|
|
131
245
|
|
|
132
|
-
|
|
246
|
+
More examples:
|
|
133
247
|
|
|
134
248
|
```ts
|
|
135
|
-
const useFilter =
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
Well, that's it! Now you can simply call **useFilter** inside your component, and everything will continue to work the same.
|
|
249
|
+
const useFilter = useContacts.createSelectorHook(({ filter }) => filter);
|
|
139
250
|
|
|
140
|
-
|
|
251
|
+
const useContactsArray = useContacts.createSelectorHook(({ items }) => items);
|
|
141
252
|
|
|
142
|
-
|
|
143
|
-
|
|
253
|
+
const useContactsLength = useContactsArray.createSelectorHook(
|
|
254
|
+
(items) => items.length
|
|
255
|
+
);
|
|
144
256
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
onChange={(event) =>
|
|
148
|
-
setState((state) => ({ ...state, filter: event.target.value }))
|
|
149
|
-
}
|
|
150
|
-
/>
|
|
257
|
+
const useIsContactsEmpty = useContactsLength.createSelectorHook(
|
|
258
|
+
(length) => !length
|
|
151
259
|
);
|
|
152
260
|
```
|
|
153
261
|
|
|
154
|
-
|
|
262
|
+
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.
|
|
263
|
+
|
|
264
|
+
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.
|
|
155
265
|
|
|
156
266
|
# State actions
|
|
157
267
|
|
|
@@ -160,7 +270,7 @@ Is common and often necessary to restrict the manipulation of state to a specifi
|
|
|
160
270
|
By defining a custom API for the **useContacts**, we can encapsulate and expose only the necessary actions or operations that are allowed to modify the state. This provides a controlled interface for interacting with the state, ensuring that modifications stick to the desired restrictions.
|
|
161
271
|
|
|
162
272
|
```ts
|
|
163
|
-
import { createGlobalState } from 'react-global-state-hooks';
|
|
273
|
+
import { createGlobalState } from 'react-native-global-state-hooks';
|
|
164
274
|
|
|
165
275
|
const initialState = {
|
|
166
276
|
isLoading: true,
|
|
@@ -188,14 +298,14 @@ export const useContacts = createGlobalState(initialState, {
|
|
|
188
298
|
});
|
|
189
299
|
```
|
|
190
300
|
|
|
191
|
-
That's it! In this updated version, the **useContacts** hook will no longer return [**state**, **
|
|
301
|
+
That's it! In this updated version, the **useContacts** hook will no longer return [**state**, **stateMutator**] but instead will return [**state**, **actions**]. This change will provide a more intuitive and convenient way to access and interact with the state and its associated actions.
|
|
192
302
|
|
|
193
303
|
Let's see how that will look now into our **FilterBar.tsx**
|
|
194
304
|
|
|
195
305
|
```tsx
|
|
196
306
|
const [{ filter }, { setFilter }] = useFilter();
|
|
197
307
|
|
|
198
|
-
return <
|
|
308
|
+
return <TextInput onChangeText={setFilter} />;
|
|
199
309
|
```
|
|
200
310
|
|
|
201
311
|
Yeah, that's it! All the **derived states** and **emitters** (we will talk about this later) will inherit the new actions interface.
|
|
@@ -216,36 +326,24 @@ const useIsContactsEmpty = createDerivate(useContactsLength, (length) => !length
|
|
|
216
326
|
|
|
217
327
|
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.
|
|
218
328
|
|
|
219
|
-
#
|
|
220
|
-
|
|
221
|
-
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 the **createGlobalStateWithDecoupledFuncs**.
|
|
329
|
+
# State Controls
|
|
222
330
|
|
|
223
|
-
|
|
331
|
+
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:
|
|
224
332
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
```ts
|
|
228
|
-
import { createGlobalState } from 'react-global-state-hooks';
|
|
333
|
+
```tsx
|
|
334
|
+
useContacts.stateControls: () => [stateRetriever: StateGetter<State>, stateMutator: Setter<State>|ActionCollectionResult<State>, metadataRetriever: Metadata];
|
|
229
335
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
filter: '',
|
|
233
|
-
items: [] as Contact[],
|
|
234
|
-
});
|
|
336
|
+
// example:
|
|
337
|
+
const [getContacts, setContacts] = useContacts.stateControls();
|
|
235
338
|
|
|
236
|
-
|
|
339
|
+
console.log(getContacts()); // prints the list of contacts
|
|
237
340
|
```
|
|
238
341
|
|
|
239
|
-
|
|
342
|
+
**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.
|
|
240
343
|
|
|
241
|
-
|
|
344
|
+
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.
|
|
242
345
|
|
|
243
|
-
|
|
244
|
-
// To synchronously get the value of the state
|
|
245
|
-
const value = contactsRetriever();
|
|
246
|
-
|
|
247
|
-
// the type of value will be { isLoading: boolean; filter: string; items: Contact[] }
|
|
248
|
-
```
|
|
346
|
+
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.
|
|
249
347
|
|
|
250
348
|
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.
|
|
251
349
|
|
|
@@ -270,9 +368,163 @@ const removeSubscriptionGroup = contactsRetriever<Subscribe>((subscribe) => {
|
|
|
270
368
|
|
|
271
369
|
That's great, isn't it? everything stays synchronized with the original state!!
|
|
272
370
|
|
|
371
|
+
## stateMutator
|
|
372
|
+
|
|
373
|
+
Let's add more actions to the state and explore how to use one action from inside another.
|
|
374
|
+
|
|
375
|
+
Here's an example of adding multiple actions to the state and utilizing one action within another:
|
|
376
|
+
|
|
377
|
+
```ts
|
|
378
|
+
import { createGlobalState } from 'react-hooks-global-states';
|
|
379
|
+
|
|
380
|
+
export const useCount = createGlobalState(0, {
|
|
381
|
+
actions: {
|
|
382
|
+
log: (currentValue: string) => {
|
|
383
|
+
return ({ getState }: StoreTools<number>): void => {
|
|
384
|
+
console.log(`Current Value: ${getState()}`);
|
|
385
|
+
};
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
increase(value: number = 1) {
|
|
389
|
+
return ({ getState, setState, actions }: StoreTools<number>) => {
|
|
390
|
+
setState((count) => count + value);
|
|
391
|
+
|
|
392
|
+
actions.log(message);
|
|
393
|
+
};
|
|
394
|
+
},
|
|
395
|
+
|
|
396
|
+
decrease(value: number = 1) {
|
|
397
|
+
return ({ getState, setState, actions }: StoreTools<number>) => {
|
|
398
|
+
setState((count) => count - value);
|
|
399
|
+
|
|
400
|
+
actions.log(message);
|
|
401
|
+
};
|
|
402
|
+
},
|
|
403
|
+
} as const,
|
|
404
|
+
});
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
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.
|
|
408
|
+
|
|
409
|
+
# Stateful Context with Actions
|
|
410
|
+
|
|
411
|
+
**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...
|
|
412
|
+
|
|
413
|
+
**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.
|
|
414
|
+
|
|
415
|
+
## Creating a Stateful Context
|
|
416
|
+
|
|
417
|
+
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.
|
|
418
|
+
|
|
419
|
+
```tsx
|
|
420
|
+
export const [useCounterContext, CounterProvider] = createStatefulContext(2);
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Then just wrap the components you need with the provider:
|
|
424
|
+
|
|
425
|
+
```tsx
|
|
426
|
+
<CounterProvider>
|
|
427
|
+
<MyComponent />
|
|
428
|
+
</CounterProvider>
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
And finally, access the context value with the generated custom hook:
|
|
432
|
+
|
|
433
|
+
```tsx
|
|
434
|
+
const MyComponent = () => {
|
|
435
|
+
const [useCounter] = useCounterContext();
|
|
436
|
+
|
|
437
|
+
// If the component needs to react to state changes, simply use the hook
|
|
438
|
+
const [count, setCount] = useCounter();
|
|
439
|
+
|
|
440
|
+
return <>{count}</>;
|
|
441
|
+
};
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
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:
|
|
445
|
+
|
|
446
|
+
```tsx
|
|
447
|
+
const MyComponent = () => {
|
|
448
|
+
const [, , setCount] = useCounterContext();
|
|
449
|
+
|
|
450
|
+
// This component can access only the stateMutator of the state,
|
|
451
|
+
// and won't re-render if the counter changes
|
|
452
|
+
return (
|
|
453
|
+
<button onClick={() => setCount((count) => count + 1)}>Increase</button>
|
|
454
|
+
);
|
|
455
|
+
};
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
Now you have selectors—if the state changes, the component will only re-render if the selected portion of the state changes.
|
|
459
|
+
|
|
460
|
+
```tsx
|
|
461
|
+
const MyComponent = () => {
|
|
462
|
+
const [useCounter] = useCounterContext();
|
|
463
|
+
|
|
464
|
+
// Notice that we can select and derive values from the state
|
|
465
|
+
const [isEven, setCount] = useCounter((count) => count % 2 === 0);
|
|
466
|
+
|
|
467
|
+
useEffect(() => {
|
|
468
|
+
// Since the counter initially was 2 and now is 4, it’s still an even number.
|
|
469
|
+
// Because of this, the component will not re-render.
|
|
470
|
+
setCount(4);
|
|
471
|
+
}, []);
|
|
472
|
+
|
|
473
|
+
return <>{isEven ? 'is even' : 'is odd'}</>;
|
|
474
|
+
};
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
**createStatefulContext** also allows you to add custom actions to control the manipulation of the state.
|
|
478
|
+
|
|
479
|
+
```tsx
|
|
480
|
+
import { createStatefulContext, StoreTools } from 'react-global-state-hooks';
|
|
481
|
+
|
|
482
|
+
type CounterState = {
|
|
483
|
+
count: number;
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
const initialState: CounterState = {
|
|
487
|
+
count: 0,
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
export const [useCounterContext, CounterProvider] = createStatefulContext(
|
|
491
|
+
initialState,
|
|
492
|
+
{
|
|
493
|
+
actions: {
|
|
494
|
+
increase: (value: number = 1) => {
|
|
495
|
+
return ({ setState }: StoreTools<CounterState>) => {
|
|
496
|
+
setState((state) => ({
|
|
497
|
+
...state,
|
|
498
|
+
count: state.count + value,
|
|
499
|
+
}));
|
|
500
|
+
};
|
|
501
|
+
},
|
|
502
|
+
decrease: (value: number = 1) => {
|
|
503
|
+
return ({ setState }: StoreTools<CounterState>) => {
|
|
504
|
+
setState((state) => ({
|
|
505
|
+
...state,
|
|
506
|
+
count: state.count - value,
|
|
507
|
+
}));
|
|
508
|
+
};
|
|
509
|
+
},
|
|
510
|
+
} as const,
|
|
511
|
+
}
|
|
512
|
+
);
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
And just like with regular global hooks, now instead of a setState function, the hook will return the collection of actions:
|
|
516
|
+
|
|
517
|
+
```tsx
|
|
518
|
+
const MyComponent = () => {
|
|
519
|
+
const [, , actions] = useCounterContext();
|
|
520
|
+
|
|
521
|
+
return <button onClick={() => actions.increase(1)}>Increase</button>;
|
|
522
|
+
};
|
|
523
|
+
```
|
|
524
|
+
|
|
273
525
|
# Emitters
|
|
274
526
|
|
|
275
|
-
So, we have seen that we can subscribe a callback to state changes, create **
|
|
527
|
+
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:
|
|
276
528
|
|
|
277
529
|
```ts
|
|
278
530
|
const subscribeToFilter = createDerivateEmitter(
|
|
@@ -306,7 +558,7 @@ const removeFilterSubscription = subscribeToFilter<Subscribe>(
|
|
|
306
558
|
);
|
|
307
559
|
```
|
|
308
560
|
|
|
309
|
-
Also, of course, if you have an exceptional case where you want to
|
|
561
|
+
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
|
|
310
562
|
|
|
311
563
|
```ts
|
|
312
564
|
const removeFilterSubscription = subscribeToFilter<Subscribe>(
|
|
@@ -343,7 +595,7 @@ const subscribeToItemsLength = createDerivateEmitter(
|
|
|
343
595
|
);
|
|
344
596
|
```
|
|
345
597
|
|
|
346
|
-
The examples may seem a little silly, but they allow you to see the incredible things you can accomplish with these **
|
|
598
|
+
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!
|
|
347
599
|
|
|
348
600
|
# Combining stateRetriever
|
|
349
601
|
|
|
@@ -351,7 +603,7 @@ What if you have two states and you want to combine them? You may have already g
|
|
|
351
603
|
|
|
352
604
|
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:
|
|
353
605
|
|
|
354
|
-
|
|
606
|
+
First we are gonna create a couple of **global states**, and extract the **stateRetriever**.
|
|
355
607
|
|
|
356
608
|
```ts
|
|
357
609
|
const useHook1 = createGlobalState({
|
|
@@ -366,13 +618,13 @@ const useHook2 = createGlobalState({
|
|
|
366
618
|
propD: 4,
|
|
367
619
|
});
|
|
368
620
|
|
|
369
|
-
const [,
|
|
621
|
+
const [, stateRetriever2] = useHook2.stateControls();
|
|
370
622
|
```
|
|
371
623
|
|
|
372
624
|
Okay, cool, the first state as **propA, propB** while the second one has **propC, propD**, let's combine them:
|
|
373
625
|
|
|
374
626
|
```ts
|
|
375
|
-
const [useCombinedHook,
|
|
627
|
+
const [useCombinedHook, combinedStateRetriever] = combineAsyncGetters(
|
|
376
628
|
{
|
|
377
629
|
selector: ([state1, state2]) => ({
|
|
378
630
|
...state1,
|
|
@@ -380,17 +632,17 @@ const [useCombinedHook, stateMutator, dispose] = combineAsyncGetters(
|
|
|
380
632
|
}),
|
|
381
633
|
},
|
|
382
634
|
stateRetriever1,
|
|
383
|
-
|
|
635
|
+
stateRetriever2
|
|
384
636
|
);
|
|
385
637
|
```
|
|
386
638
|
|
|
387
|
-
Well, that's it! Now you have access to a **
|
|
639
|
+
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:
|
|
388
640
|
|
|
389
641
|
```ts
|
|
390
|
-
const value =
|
|
642
|
+
const value = stateRetriever(); // { propA, propB, propC, propD }
|
|
391
643
|
|
|
392
644
|
// subscribe to the new emitter
|
|
393
|
-
const unsubscribeGroup =
|
|
645
|
+
const unsubscribeGroup = stateRetriever<Subscribe>((subscribe) => {
|
|
394
646
|
subscribe((state) => {
|
|
395
647
|
console.log(subscribe); // full state
|
|
396
648
|
});
|
|
@@ -399,8 +651,8 @@ const unsubscribeGroup = stateMutator<Subscribe>((subscribe) => {
|
|
|
399
651
|
// the callback will only trigger if the result of the selector changes.
|
|
400
652
|
subscribe(
|
|
401
653
|
({ propA, propD }) => ({ propA, propD }),
|
|
402
|
-
(
|
|
403
|
-
console.log(
|
|
654
|
+
(derived) => {
|
|
655
|
+
console.log(derived); // { propA, propD }
|
|
404
656
|
}
|
|
405
657
|
);
|
|
406
658
|
});
|
|
@@ -422,39 +674,39 @@ Similar to your other **global state hooks**, **combined hooks** allow you to us
|
|
|
422
674
|
const [fragment] = useCombinedHook(({ propA, propD }) => ({ propA, propD }));
|
|
423
675
|
```
|
|
424
676
|
|
|
425
|
-
Lastly, you have the flexibility to continue combining
|
|
677
|
+
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.
|
|
426
678
|
|
|
427
679
|
Let's see an example:
|
|
428
680
|
|
|
429
681
|
```ts
|
|
430
|
-
const [useCombinedHook,
|
|
431
|
-
|
|
432
|
-
{
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
);
|
|
682
|
+
const [useCombinedHook, combinedStateRetriever1] = combineAsyncGetters(
|
|
683
|
+
{
|
|
684
|
+
selector: ([state1, state2]) => ({
|
|
685
|
+
...state1,
|
|
686
|
+
...state2,
|
|
687
|
+
}),
|
|
688
|
+
},
|
|
689
|
+
stateRetriever1,
|
|
690
|
+
stateRetriever2
|
|
691
|
+
);
|
|
441
692
|
|
|
442
693
|
const useHook3 = createGlobalState({
|
|
443
694
|
propE: 1,
|
|
444
695
|
propF: 2,
|
|
445
696
|
});
|
|
446
697
|
|
|
447
|
-
const [
|
|
698
|
+
const [stateRetriever3, stateMutator3] = useHook3.stateControls();
|
|
448
699
|
|
|
449
700
|
const useIsLoading = createGlobalState(false);
|
|
450
701
|
|
|
451
|
-
const [
|
|
702
|
+
const [isLoadingStateRetriever, isLoadingMutator] =
|
|
703
|
+
useIsLoading.stateControls();
|
|
452
704
|
```
|
|
453
705
|
|
|
454
706
|
Once we created another peace of state, we can combine it with our other **global hooks** and **emitters**
|
|
455
707
|
|
|
456
708
|
```ts
|
|
457
|
-
const [useCombinedHook2,
|
|
709
|
+
const [useCombinedHook2, combinedStateRetriever2] = combineAsyncGetters(
|
|
458
710
|
{
|
|
459
711
|
selector: ([state1, state2, isLoading]) => ({
|
|
460
712
|
...state1,
|
|
@@ -462,9 +714,9 @@ const [useCombinedHook2, combinedGetter2, dispose2] = combineAsyncGetters(
|
|
|
462
714
|
isLoading,
|
|
463
715
|
}),
|
|
464
716
|
},
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
717
|
+
combinedStateRetriever1,
|
|
718
|
+
stateRetriever3,
|
|
719
|
+
isLoadingStateRetriever
|
|
468
720
|
);
|
|
469
721
|
```
|
|
470
722
|
|
|
@@ -474,184 +726,6 @@ You have the freedom to combine as many global hooks as you wish. This means you
|
|
|
474
726
|
|
|
475
727
|
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.
|
|
476
728
|
|
|
477
|
-
## Setter
|
|
478
|
-
|
|
479
|
-
Similarly, the **contactsSetter** 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**.
|
|
480
|
-
|
|
481
|
-
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.
|
|
482
|
-
|
|
483
|
-
Let's add more actions to the state and explore how to use one action from inside another.
|
|
484
|
-
|
|
485
|
-
Here's an example of adding multiple actions to the state and utilizing one action within another:
|
|
486
|
-
|
|
487
|
-
```ts
|
|
488
|
-
import { createGlobalState } from 'react-global-state-hooks';
|
|
489
|
-
|
|
490
|
-
export const useCount = createGlobalState(0, {
|
|
491
|
-
actions: {
|
|
492
|
-
log: (currentValue: string) => {
|
|
493
|
-
return ({ getState }: StoreTools<number>): void => {
|
|
494
|
-
console.log(`Current Value: ${getState()}`);
|
|
495
|
-
};
|
|
496
|
-
},
|
|
497
|
-
|
|
498
|
-
increase(value: number = 1) {
|
|
499
|
-
return ({ getState, setState, actions }: StoreTools<number>) => {
|
|
500
|
-
setState((count) => count + value);
|
|
501
|
-
|
|
502
|
-
actions.log(message);
|
|
503
|
-
};
|
|
504
|
-
},
|
|
505
|
-
|
|
506
|
-
decrease(value: number = 1) {
|
|
507
|
-
return ({ getState, setState, actions }: StoreTools<number>) => {
|
|
508
|
-
setState((count) => count - value);
|
|
509
|
-
|
|
510
|
-
actions.log(message);
|
|
511
|
-
};
|
|
512
|
-
},
|
|
513
|
-
} as const,
|
|
514
|
-
});
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
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.
|
|
518
|
-
|
|
519
|
-
# Local Storage
|
|
520
|
-
|
|
521
|
-
By default, our global hooks are capable of persisting information in local storage. To achieve this, you need to provide the key that will be used to persist the data. Additionally, you have the option to encrypt the stored data.
|
|
522
|
-
|
|
523
|
-
```ts
|
|
524
|
-
const useContacts = createGlobalState(
|
|
525
|
-
{
|
|
526
|
-
filter: '',
|
|
527
|
-
items: [] as Contact[],
|
|
528
|
-
},
|
|
529
|
-
{
|
|
530
|
-
localStorage: {
|
|
531
|
-
key: 'data',
|
|
532
|
-
},
|
|
533
|
-
}
|
|
534
|
-
);
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
That means your data will automatically be synchronized with the local storage, and you don't need to worry about losing the type of your Maps/Sets/Dates - the store takes care of it for you.
|
|
538
|
-
|
|
539
|
-
# Stateful Context with Actions
|
|
540
|
-
|
|
541
|
-
**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...
|
|
542
|
-
|
|
543
|
-
**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.
|
|
544
|
-
|
|
545
|
-
## Creating a Stateful Context
|
|
546
|
-
|
|
547
|
-
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.
|
|
548
|
-
|
|
549
|
-
```tsx
|
|
550
|
-
export const [useCounterContext, CounterProvider] = createStatefulContext(2);
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
Then just wrap the components you need with the provider:
|
|
554
|
-
|
|
555
|
-
```tsx
|
|
556
|
-
<CounterProvider>
|
|
557
|
-
<MyComponent />
|
|
558
|
-
</CounterProvider>
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
And finally, access the context value with the generated custom hook:
|
|
562
|
-
|
|
563
|
-
```tsx
|
|
564
|
-
const MyComponent = () => {
|
|
565
|
-
const [useCounter] = useCounterContext();
|
|
566
|
-
|
|
567
|
-
// If the component needs to react to state changes, simply use the hook
|
|
568
|
-
const [count, setCount] = useCounter();
|
|
569
|
-
|
|
570
|
-
return <>{count}</>;
|
|
571
|
-
};
|
|
572
|
-
```
|
|
573
|
-
|
|
574
|
-
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:
|
|
575
|
-
|
|
576
|
-
```tsx
|
|
577
|
-
const MyComponent = () => {
|
|
578
|
-
const [, , setCount] = useCounterContext();
|
|
579
|
-
|
|
580
|
-
// This component can access only the stateMutator of the state,
|
|
581
|
-
// and won't re-render if the counter changes
|
|
582
|
-
return (
|
|
583
|
-
<button onClick={() => setCount((count) => count + 1)}>Increase</button>
|
|
584
|
-
);
|
|
585
|
-
};
|
|
586
|
-
```
|
|
587
|
-
|
|
588
|
-
Now you have selectors—if the state changes, the component will only re-render if the selected portion of the state changes.
|
|
589
|
-
|
|
590
|
-
```tsx
|
|
591
|
-
const MyComponent = () => {
|
|
592
|
-
const [useCounter] = useCounterContext();
|
|
593
|
-
|
|
594
|
-
// Notice that we can select and derive values from the state
|
|
595
|
-
const [isEven, setCount] = useCounter((count) => count % 2 === 0);
|
|
596
|
-
|
|
597
|
-
useEffect(() => {
|
|
598
|
-
// Since the counter initially was 2 and now is 4, it’s still an even number.
|
|
599
|
-
// Because of this, the component will not re-render.
|
|
600
|
-
setCount(4);
|
|
601
|
-
}, []);
|
|
602
|
-
|
|
603
|
-
return <>{isEven ? 'is even' : 'is odd'}</>;
|
|
604
|
-
};
|
|
605
|
-
```
|
|
606
|
-
|
|
607
|
-
**createStatefulContext** also allows you to add custom actions to control the manipulation of the state.
|
|
608
|
-
|
|
609
|
-
```tsx
|
|
610
|
-
import { createStatefulContext, StoreTools } from 'react-global-state-hooks';
|
|
611
|
-
|
|
612
|
-
type CounterState = {
|
|
613
|
-
count: number;
|
|
614
|
-
};
|
|
615
|
-
|
|
616
|
-
const initialState: CounterState = {
|
|
617
|
-
count: 0,
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
export const [useCounterContext, CounterProvider] = createStatefulContext(
|
|
621
|
-
initialState,
|
|
622
|
-
{
|
|
623
|
-
actions: {
|
|
624
|
-
increase: (value: number = 1) => {
|
|
625
|
-
return ({ setState }: StoreTools<CounterState>) => {
|
|
626
|
-
setState((state) => ({
|
|
627
|
-
...state,
|
|
628
|
-
count: state.count + value,
|
|
629
|
-
}));
|
|
630
|
-
};
|
|
631
|
-
},
|
|
632
|
-
decrease: (value: number = 1) => {
|
|
633
|
-
return ({ setState }: StoreTools<CounterState>) => {
|
|
634
|
-
setState((state) => ({
|
|
635
|
-
...state,
|
|
636
|
-
count: state.count - value,
|
|
637
|
-
}));
|
|
638
|
-
};
|
|
639
|
-
},
|
|
640
|
-
} as const,
|
|
641
|
-
}
|
|
642
|
-
);
|
|
643
|
-
```
|
|
644
|
-
|
|
645
|
-
And just like with regular global hooks, now instead of a stateMutator, the hook will return the collection of actions:
|
|
646
|
-
|
|
647
|
-
```tsx
|
|
648
|
-
const MyComponent = () => {
|
|
649
|
-
const [, , actions] = useCounterContext();
|
|
650
|
-
|
|
651
|
-
return <button onClick={() => actions.increase(1)}>Increase</button>;
|
|
652
|
-
};
|
|
653
|
-
```
|
|
654
|
-
|
|
655
729
|
# Extending Global Hooks
|
|
656
730
|
|
|
657
731
|
Creating a custom builder for your **global hook** is made incredibly easy with the **createCustomGlobalState** function.
|
package/lib/bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("react")):t["react-global-state-hooks"]=e(t.react)}(this,(t=>{return e={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(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(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)}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var u=r(608),c=r(734),l=function(){return!!(null===globalThis||void 0===globalThis?void 0:globalThis.localStorage)},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&&o(t,e)}(f,t);var e,r,n,c=(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=a(r);if(n){var o=a(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return i(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=c.call(this,t,r,n)).onInitialize=function(t){var r,n,o=t.setState,i=t.getState;if(l()&&(null===(n=null===(r=e.config)||void 0===r?void 0:r.localStorage)||void 0===n?void 0:n.key)){var a=(0,u.getLocalStorageItem)({config:e.config});if(null!==a)o(a);else{var c=i();(0,u.setLocalStorageItem)({item:c,config:e.config})}}},e.onChange=function(t){var r=t.getState;l()&&(0,u.setLocalStorageItem)({item:r(),config:e.config})},e.constructor!==f?i(e):(e.initialize(),e)}return e=f,Object.defineProperty(e,"prototype",{writable:!1}),e}(c.GlobalStoreAbstract);e.GlobalStore=f},608:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setLocalStorageItem=e.getLocalStorageItem=void 0;var n=r(734);e.getLocalStorageItem=function(t){var e,r=t.config,o=null===(e=null==r?void 0:r.localStorage)||void 0===e?void 0:e.key;if(!o)return null;var i=localStorage.getItem(o);if(null===i)return null;var a=function(){var t,e=null!==(t=null==r?void 0:r.localStorage)&&void 0!==t?t:{},n=e.decrypt,o=e.encrypt;return n||o?"function"==typeof n?n(i):atob(i):i}();return(0,n.formatFromStore)(a,{jsonParse:!0})},e.setLocalStorageItem=function(t){var e,r=t.item,o=t.config,i=null===(e=null==o?void 0:o.localStorage)||void 0===e?void 0:e.key;if(!i)return null;var a=(0,n.formatToStore)(r,{stringify:!0,excludeTypes:["function"]}),u=function(){var t,e=(null!==(t=null==o?void 0:o.localStorage)&&void 0!==t?t:{}).encrypt;return e?"function"==typeof e?e(a):btoa(a):a}();localStorage.setItem(i,u)}},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.setLocalStorageItem=e.getLocalStorageItem=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,"getLocalStorageItem",{enumerable:!0,get:function(){return c.getLocalStorageItem}}),Object.defineProperty(e,"setLocalStorageItem",{enumerable:!0,get:function(){return c.setLocalStorageItem}}),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,p=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},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,f=new Map(l.map((function(t,e){return[e,t()]}))),s=t.selector(Array.from(f.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(f.values()));(null==p?void 0:p(s,e))||(s=e,y.forEach((function(t){return t()})))}),null===(n=null==t?void 0:t.config)||void 0===n?void 0:n.delay),b=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:{}),p=null!==(n=null==u?void 0:u(s))&&void 0!==n?n:s;f.skipFirst||c(p);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,p,r))||(p=r,c(r))}),null!==(o=f.delay)&&void 0!==o?o:0);return y.add(v),function(){y.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(),y.delete(t)}))}},function(){b.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 E(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=s;var y={};function v(){}function b(){}function d(){}var m={};f(m,u,(function(){return this}));var h=Object.getPrototypeOf,g=h&&h(h(_([])));g&&g!==e&&r.call(g,u)&&(m=g);var S=d.prototype=v.prototype=Object.create(m);function O(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(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)&&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=P(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 P(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,P(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 A(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 x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,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:C}}function C(){return{value:void 0,done:!0}}return b.prototype=d,o(S,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:b,configurable:!0}),b.displayName=f(d,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"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}},O(w.prototype),f(w.prototype,c,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(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=_,E.prototype={constructor:E,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(x),!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),x(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;x(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 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,p=f.stateWrapper,y=(0,u.uniqueId)();n.addNewSubscriber(y,{selector:a,config:l,stateWrapper:p,callback:s}),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,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.")}(),p=s[0],y=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:p,selector:t,config:i,callback:y}),(0,c.useEffect)((function(){var e=a.current;null!==e&&!n.subscribers.has(e)&&(n.addNewSubscriber(e,{stateWrapper:p,selector:t,config:i,callback:y}),n.executeOnSubscribed())}),[p]),[function(){var e=a.current;if(!t||!n.subscribers.has(e))return p.state;var r=n.subscribers.get(e),o=r.currentDependencies,c=r.config,s=(void 0===c?{}:c).dependencies;if(o===l)return p.state;if(o===s)return p.state;if((null==o?void 0:o.length)===(null==s?void 0:s.length)&&(0,u.shallowCompare)(o,s))return p.state;var v=f();return n.updateSubscriptionIfExists(e,{stateWrapper:v,selector:t,config:i,callback:y}),p.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,p=n.config.computePreventStateChange;if((s||p)&&((null==s?void 0:s(f))||(null==p?void 0:p(f))))return;n.setState({forceUpdate:e,state:i});var y=n.onStateChanged,v=n.config.onStateChanged;(y||v)&&(null==y||y(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,p=e;if(s.size!==p.size)return!1;var y,v=o(s);try{for(v.s();!(y=v.n()).done;){var b=n(y.value,2),d=b[0];if(b[1]!==p.get(d))return!1}}catch(t){v.e(t)}finally{v.f()}}if(t instanceof Set){var m=t,h=e;if(m.size!==h.size)return!1;var g,S=o(m);try{for(S.s();!(g=S.n()).done;){var O=g.value;if(!h.has(O))return!1}}catch(t){S.e(t)}finally{S.f()}}var w=Object.keys(t),j=Object.keys(e);if(w.length!==j.length)return!1;for(var P=0,A=w;P<A.length;P++){var x=A[P];if(t[x]!==e[x])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,p=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},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))},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}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("react")):t["react-global-state-hooks"]=e(t.react)}(this,(t=>{return e={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],f=c[1];return[u.getHook(),l,f]},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(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(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)}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var u=r(608),c=r(734),l=function(){return!!(null===globalThis||void 0===globalThis?void 0:globalThis.localStorage)},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&&o(t,e)}(f,t);var e,r,n,c=(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=a(r);if(n){var o=a(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return i(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=c.call(this,t,r,n)).onInitialize=function(t){var r,n,o=t.setState,i=t.getState;if(l()&&(null===(n=null===(r=e.config)||void 0===r?void 0:r.localStorage)||void 0===n?void 0:n.key)){var a=(0,u.getLocalStorageItem)({config:e.config});if(null!==a)o(a);else{var c=i();(0,u.setLocalStorageItem)({item:c,config:e.config})}}},e.onChange=function(t){var r=t.getState;l()&&(0,u.setLocalStorageItem)({item:r(),config:e.config})},e.constructor!==f?i(e):(e.initialize(),e)}return e=f,Object.defineProperty(e,"prototype",{writable:!1}),e}(c.GlobalStoreAbstract);e.GlobalStore=f},608:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setLocalStorageItem=e.getLocalStorageItem=void 0;var n=r(734);e.getLocalStorageItem=function(t){var e,r=t.config,o=null===(e=null==r?void 0:r.localStorage)||void 0===e?void 0:e.key;if(!o)return null;var i=localStorage.getItem(o);if(null===i)return null;var a=function(){var t,e=null!==(t=null==r?void 0:r.localStorage)&&void 0!==t?t:{},n=e.decrypt,o=e.encrypt;return n||o?"function"==typeof n?n(i):atob(i):i}();return(0,n.formatFromStore)(a,{jsonParse:!0})},e.setLocalStorageItem=function(t){var e,r=t.item,o=t.config,i=null===(e=null==o?void 0:o.localStorage)||void 0===e?void 0:e.key;if(!i)return null;var a=(0,n.formatToStore)(r,{stringify:!0,excludeTypes:["function"]}),u=function(){var t,e=(null!==(t=null==o?void 0:o.localStorage)&&void 0!==t?t:{}).encrypt;return e?"function"==typeof e?e(a):btoa(a):a}();localStorage.setItem(i,u)}},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.setLocalStorageItem=e.getLocalStorageItem=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,"getLocalStorageItem",{enumerable:!0,get:function(){return c.getLocalStorageItem}}),Object.defineProperty(e,"setLocalStorageItem",{enumerable:!0,get:function(){return c.setLocalStorageItem}}),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,p=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},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,f=new Map(l.map((function(t,e){return[e,t()]}))),s=t.selector(Array.from(f.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,b=(0,i.debounce)((function(){var e=t.selector(Array.from(f.values()));(null==p?void 0:p(s,e))||(s=e,y.forEach((function(t){return t()})))}),null===(n=null==t?void 0:t.config)||void 0===n?void 0:n.delay),v=l.map((function(t,e){return t((function(t){t((function(t){f.set(e,t),b()}))}))})),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:{}),p=null!==(n=null==u?void 0:u(s))&&void 0!==n?n:s;f.skipFirst||c(p);var b=(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,p,r))||(p=r,c(r))}),null!==(o=f.delay)&&void 0!==o?o:0);return y.add(b),function(){y.delete(b)}};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(),y.delete(t)}))}},function(){v.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){(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 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 b?e:b,a=Object.create(i.prototype),u=new x(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=s;var y={};function b(){}function v(){}function d(){}var m={};f(m,u,(function(){return this}));var h=Object.getPrototypeOf,g=h&&h(h(_([])));g&&g!==e&&r.call(g,u)&&(m=g);var S=d.prototype=b.prototype=Object.create(m);function O(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(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)&&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=P(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 P(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,P(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 A(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 E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,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:C}}function C(){return{value:void 0,done:!0}}return v.prototype=d,o(S,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:v,configurable:!0}),v.displayName=f(d,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"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}},O(w.prototype),f(w.prototype,c,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(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=_,x.prototype={constructor:x,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(E),!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),E(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;E(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 f=function(){function t(r){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},f=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=f,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 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,u=i?e:t,l=i?o:e,f=n.createChangesSubscriber({selector:a,callback:u,config:l}),s=f.subscriptionCallback,p=f.stateWrapper,y=(0,c.uniqueId)();n.addNewSubscriber(y,{selector:a,config:l,stateWrapper:p,callback:s}),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}},f=o((0,l.useState)(u),2),s=f[0],p=f[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:s,selector:t,config:i,callback:p}),(0,l.useEffect)((function(){var e=a.current;null!==e&&!n.subscribers.has(e)&&(n.addNewSubscriber(e,{stateWrapper:s,selector:t,config:i,callback:p}),n.executeOnSubscribed())}),[s]),[function(){var r=a.current;if(!t||!n.subscribers.has(r))return s.state;var o=n.subscribers.get(r),l=o.currentDependencies,f=o.config,y=(void 0===f?{}:f).dependencies;if(l===e.uniqueSymbol)return s.state;if(l===y)return s.state;if((null==l?void 0:l.length)===(null==y?void 0:y.length)&&(0,c.shallowCompare)(l,y))return s.state;var b=u();return n.updateSubscriptionIfExists(r,{stateWrapper:b,selector:t,config:i,callback:p}),s.state=b.state,b.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,f=o(n.stateControls(),3),s=f[0],p=f[1],y=f[2],b=s(),v=(null!=t?t:function(t){return t})(s());s((function(e){e((function(e){if(!(null!=i?i:Object.is)(b,e)){b=e;var r=t(e);(null!=a?a:Object.is)(v,r)||(v=r,u.forEach((function(t){t.callback({state:v})})))}}),{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})},m=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}},h=function(t){if(!t)return v;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})(v),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,f=u.stateWrapper,s=(0,c.uniqueId)();d(s,{selector:i,config:a,stateWrapper:f,callback:l}),r.push(s)})),r.length||(0,e.throwNoSubscribersWereAdded)(),function(){r.forEach((function(t){u.delete(t)}))}},g=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"]),f=function(){return t?{state:t(v)}:{state:v}},s=(0,l.useRef)(null),b=o((0,l.useState)(f),2),g=b[0],S=b[1];return(0,l.useEffect)((function(){null===s.current&&(s.current=(0,c.uniqueId)());var e=h((function(e){var r=v;e((function(e){var o=u.get(s.current);if(!(null!=n?n:Object.is)(r,e)){r=e;var a=(null!=t?t:function(t){return t})(v);(null!=i?i:Object.is)(a,o.currentState)||(o.currentState=a,S({state:a}))}}),{skipFirst:!0})}));return function(){e(),u.delete(s.current)}}),[]),m(s.current,{stateWrapper:g,selector:t,config:a,callback:S}),(0,l.useEffect)((function(){var e=s.current;null!==e&&!u.has(e)&&d(e,{stateWrapper:g,selector:t,config:a,callback:S})}),[g]),[function(){var r=s.current;if(!t||!u.has(r))return g.state;var n=u.get(r),o=n.currentDependencies,i=n.config,l=(void 0===i?{}:i).dependencies;if(o===e.uniqueSymbol)return g.state;if(o===l)return g.state;if((null==o?void 0:o.length)===(null==l?void 0:l.length)&&(0,c.shallowCompare)(o,l))return g.state;var p=f();return m(r,{stateWrapper:p,selector:t,config:a,callback:S}),g.state=p.state,p.state}(),p,y]};return g.stateControls=function(){return[h,p,y]},g.createSelectorHook=n.createSelectorHook.bind(g),g},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,f={setMetadata:a,getMetadata:u,setState:n.setState,getState:c,actions:l,previousState:o,state:i},s=n.computePreventStateChange,p=n.config.computePreventStateChange;if((s||p)&&((null==s?void 0:s(f))||(null==p?void 0:p(f))))return;n.setState({forceUpdate:e,state:i});var y=n.onStateChanged,b=n.config.onStateChanged;(y||b)&&(null==y||y(f),null==b||b(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,a=Object.keys(t).reduce((function(n,c){var l,f,s;return Object.assign(n,(l={},s=function(){for(var n=t[c],u=arguments.length,l=new Array(u),f=0;f<u;f++)l[f]=arguments[f];var s=n.apply(a,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(a,{setState:r,getState:o,setMetadata:e,getMetadata:i,actions:a})},(f=u(f=c))in l?Object.defineProperty(l,f,{value:s,enumerable:!0,configurable:!0,writable:!0}):l[f]=s,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=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,p=e;if(s.size!==p.size)return!1;var y,b=o(s);try{for(b.s();!(y=b.n()).done;){var v=n(y.value,2),d=v[0];if(v[1]!==p.get(d))return!1}}catch(t){b.e(t)}finally{b.f()}}if(t instanceof Set){var m=t,h=e;if(m.size!==h.size)return!1;var g,S=o(m);try{for(S.s();!(g=S.n()).done;){var O=g.value;if(!h.has(O))return!1}}catch(t){S.e(t)}finally{S.f()}}var w=Object.keys(t),j=Object.keys(e);if(w.length!==j.length)return!1;for(var P=0,A=w;P<A.length;P++){var E=A[P];if(t[E]!==e[E])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,p=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},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))},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}));
|
|
@@ -9,9 +9,7 @@ export declare const createGlobalStateWithDecoupledFuncs: <TState, TMetadata = n
|
|
|
9
9
|
* Creates a global hook that can be used to access the state and actions across the application
|
|
10
10
|
* @returns {} - () => [TState, stateMutator, TMetadata] the hook that can be used to access the state and the stateMutator of the state
|
|
11
11
|
*/
|
|
12
|
-
export declare const createGlobalState: <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, TMetadata> = null>(state: TState, config?: createStateConfig<TState, TMetadata, TActions>) => StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>, TMetadata
|
|
13
|
-
stateControls: () => [stateRetriever: StateGetter<TState>, stateMutator: keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>];
|
|
14
|
-
};
|
|
12
|
+
export declare const createGlobalState: <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, TMetadata> = null>(state: TState, config?: createStateConfig<TState, TMetadata, TActions>) => StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>, TMetadata>;
|
|
15
13
|
/**
|
|
16
14
|
* @description
|
|
17
15
|
* Use this function to create a custom global store.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-global-state-hooks",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "This is a package to easily handling global-state across your react components No-redux, No-context.",
|
|
5
5
|
"main": "lib/bundle.js",
|
|
6
6
|
"types": "lib/src/index.d.ts",
|
|
@@ -76,6 +76,6 @@
|
|
|
76
76
|
"react": ">=17.0.0"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"react-hooks-global-states": "
|
|
79
|
+
"react-hooks-global-states": "2.1.0"
|
|
80
80
|
}
|
|
81
81
|
}
|