react-achievements 1.3.7 → 2.0.5
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 +282 -146
- package/coverage/clover.xml +1 -1
- package/coverage/lcov-report/src/context/AchievementContext.tsx.html +6 -6
- package/coverage/lcov-report/src/context/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +1 -1
- package/coverage/lcov.info +1 -1
- package/dist/assets/defaultIcons.d.ts +81 -0
- package/dist/components/AchievementModal.d.ts +3 -2
- package/dist/components/BadgesButton.d.ts +6 -1
- package/dist/components/BadgesModal.d.ts +3 -2
- package/dist/hooks/useAchievement.d.ts +8 -0
- package/dist/index.cjs.js +2100 -103
- package/dist/index.d.ts +5 -3
- package/dist/index.esm.js +2097 -120
- package/dist/providers/AchievementProvider.d.ts +11 -0
- package/dist/redux/achievementSlice.d.ts +25 -0
- package/dist/redux/notificationSlice.d.ts +7 -0
- package/dist/redux/store.d.ts +15 -0
- package/dist/types.d.ts +22 -13
- package/package.json +26 -18
- package/src/assets/defaultIcons.ts +100 -0
- package/src/components/AchievementModal.tsx +37 -8
- package/src/components/BadgesButton.tsx +33 -7
- package/src/components/BadgesModal.tsx +23 -9
- package/src/hooks/useAchievement.ts +20 -0
- package/src/index.ts +11 -7
- package/src/providers/AchievementProvider.tsx +185 -0
- package/src/redux/achievementSlice.ts +71 -0
- package/src/redux/notificationSlice.ts +26 -0
- package/src/redux/store.ts +20 -0
- package/src/types.ts +24 -13
- package/demo/src/stories/Button.jsx +0 -50
- package/demo/src/stories/Button.stories.js +0 -48
- package/demo/src/stories/Configure.mdx +0 -364
- package/demo/src/stories/Header.jsx +0 -59
- package/demo/src/stories/Header.stories.js +0 -28
- package/demo/src/stories/Page.jsx +0 -69
- package/demo/src/stories/Page.stories.js +0 -28
- package/demo/src/stories/assets/accessibility.png +0 -0
- package/demo/src/stories/assets/accessibility.svg +0 -1
- package/demo/src/stories/assets/addon-library.png +0 -0
- package/demo/src/stories/assets/assets.png +0 -0
- package/demo/src/stories/assets/avif-test-image.avif +0 -0
- package/demo/src/stories/assets/context.png +0 -0
- package/demo/src/stories/assets/discord.svg +0 -1
- package/demo/src/stories/assets/docs.png +0 -0
- package/demo/src/stories/assets/figma-plugin.png +0 -0
- package/demo/src/stories/assets/github.svg +0 -1
- package/demo/src/stories/assets/share.png +0 -0
- package/demo/src/stories/assets/styling.png +0 -0
- package/demo/src/stories/assets/testing.png +0 -0
- package/demo/src/stories/assets/theming.png +0 -0
- package/demo/src/stories/assets/tutorials.svg +0 -1
- package/demo/src/stories/assets/youtube.svg +0 -1
- package/demo/src/stories/button.css +0 -30
- package/demo/src/stories/header.css +0 -32
- package/demo/src/stories/page.css +0 -69
- package/dist/stories/Button.d.ts +0 -28
- package/dist/stories/Button.stories.d.ts +0 -23
- package/dist/stories/Header.d.ts +0 -13
- package/dist/stories/Header.stories.d.ts +0 -18
- package/dist/stories/Page.d.ts +0 -3
- package/dist/stories/Page.stories.d.ts +0 -12
- package/src/context/AchievementContext.tsx +0 -185
- package/src/stories/Button.stories.ts +0 -52
- package/src/stories/Button.tsx +0 -48
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/Header.stories.ts +0 -33
- package/src/stories/Header.tsx +0 -56
- package/src/stories/Page.stories.ts +0 -32
- package/src/stories/Page.tsx +0 -73
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -1
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/page.css +0 -69
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,1892 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { useContext, useRef, useCallback, useDebugValue, useEffect, useState } from 'react';
|
|
3
|
+
import 'react-dom';
|
|
4
|
+
|
|
5
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
6
|
+
|
|
7
|
+
function getDefaultExportFromCjs (x) {
|
|
8
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var shim = {exports: {}};
|
|
12
|
+
|
|
13
|
+
var useSyncExternalStoreShim_production = {};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @license React
|
|
17
|
+
* use-sync-external-store-shim.production.js
|
|
18
|
+
*
|
|
19
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
20
|
+
*
|
|
21
|
+
* This source code is licensed under the MIT license found in the
|
|
22
|
+
* LICENSE file in the root directory of this source tree.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var hasRequiredUseSyncExternalStoreShim_production;
|
|
26
|
+
|
|
27
|
+
function requireUseSyncExternalStoreShim_production () {
|
|
28
|
+
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
29
|
+
hasRequiredUseSyncExternalStoreShim_production = 1;
|
|
30
|
+
var React = React__default;
|
|
31
|
+
function is(x, y) {
|
|
32
|
+
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
|
|
33
|
+
}
|
|
34
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
35
|
+
useState = React.useState,
|
|
36
|
+
useEffect = React.useEffect,
|
|
37
|
+
useLayoutEffect = React.useLayoutEffect,
|
|
38
|
+
useDebugValue = React.useDebugValue;
|
|
39
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
40
|
+
var value = getSnapshot(),
|
|
41
|
+
_useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),
|
|
42
|
+
inst = _useState[0].inst,
|
|
43
|
+
forceUpdate = _useState[1];
|
|
44
|
+
useLayoutEffect(
|
|
45
|
+
function () {
|
|
46
|
+
inst.value = value;
|
|
47
|
+
inst.getSnapshot = getSnapshot;
|
|
48
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
49
|
+
},
|
|
50
|
+
[subscribe, value, getSnapshot]
|
|
51
|
+
);
|
|
52
|
+
useEffect(
|
|
53
|
+
function () {
|
|
54
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
55
|
+
return subscribe(function () {
|
|
56
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
[subscribe]
|
|
60
|
+
);
|
|
61
|
+
useDebugValue(value);
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
function checkIfSnapshotChanged(inst) {
|
|
65
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
66
|
+
inst = inst.value;
|
|
67
|
+
try {
|
|
68
|
+
var nextValue = latestGetSnapshot();
|
|
69
|
+
return !objectIs(inst, nextValue);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
75
|
+
return getSnapshot();
|
|
76
|
+
}
|
|
77
|
+
var shim =
|
|
78
|
+
"undefined" === typeof window ||
|
|
79
|
+
"undefined" === typeof window.document ||
|
|
80
|
+
"undefined" === typeof window.document.createElement
|
|
81
|
+
? useSyncExternalStore$1
|
|
82
|
+
: useSyncExternalStore$2;
|
|
83
|
+
useSyncExternalStoreShim_production.useSyncExternalStore =
|
|
84
|
+
void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
|
85
|
+
return useSyncExternalStoreShim_production;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var useSyncExternalStoreShim_development = {};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @license React
|
|
92
|
+
* use-sync-external-store-shim.development.js
|
|
93
|
+
*
|
|
94
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the MIT license found in the
|
|
97
|
+
* LICENSE file in the root directory of this source tree.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
var hasRequiredUseSyncExternalStoreShim_development;
|
|
101
|
+
|
|
102
|
+
function requireUseSyncExternalStoreShim_development () {
|
|
103
|
+
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
104
|
+
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
105
|
+
"production" !== process.env.NODE_ENV &&
|
|
106
|
+
(function () {
|
|
107
|
+
function is(x, y) {
|
|
108
|
+
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
|
|
109
|
+
}
|
|
110
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
111
|
+
didWarnOld18Alpha ||
|
|
112
|
+
void 0 === React.startTransition ||
|
|
113
|
+
((didWarnOld18Alpha = true),
|
|
114
|
+
console.error(
|
|
115
|
+
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
116
|
+
));
|
|
117
|
+
var value = getSnapshot();
|
|
118
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
119
|
+
var cachedValue = getSnapshot();
|
|
120
|
+
objectIs(value, cachedValue) ||
|
|
121
|
+
(console.error(
|
|
122
|
+
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
123
|
+
),
|
|
124
|
+
(didWarnUncachedGetSnapshot = true));
|
|
125
|
+
}
|
|
126
|
+
cachedValue = useState({
|
|
127
|
+
inst: { value: value, getSnapshot: getSnapshot }
|
|
128
|
+
});
|
|
129
|
+
var inst = cachedValue[0].inst,
|
|
130
|
+
forceUpdate = cachedValue[1];
|
|
131
|
+
useLayoutEffect(
|
|
132
|
+
function () {
|
|
133
|
+
inst.value = value;
|
|
134
|
+
inst.getSnapshot = getSnapshot;
|
|
135
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
136
|
+
},
|
|
137
|
+
[subscribe, value, getSnapshot]
|
|
138
|
+
);
|
|
139
|
+
useEffect(
|
|
140
|
+
function () {
|
|
141
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
142
|
+
return subscribe(function () {
|
|
143
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
[subscribe]
|
|
147
|
+
);
|
|
148
|
+
useDebugValue(value);
|
|
149
|
+
return value;
|
|
150
|
+
}
|
|
151
|
+
function checkIfSnapshotChanged(inst) {
|
|
152
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
153
|
+
inst = inst.value;
|
|
154
|
+
try {
|
|
155
|
+
var nextValue = latestGetSnapshot();
|
|
156
|
+
return !objectIs(inst, nextValue);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
162
|
+
return getSnapshot();
|
|
163
|
+
}
|
|
164
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
|
165
|
+
"function" ===
|
|
166
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
|
|
167
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
168
|
+
var React = React__default,
|
|
169
|
+
objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
170
|
+
useState = React.useState,
|
|
171
|
+
useEffect = React.useEffect,
|
|
172
|
+
useLayoutEffect = React.useLayoutEffect,
|
|
173
|
+
useDebugValue = React.useDebugValue,
|
|
174
|
+
didWarnOld18Alpha = false,
|
|
175
|
+
didWarnUncachedGetSnapshot = false,
|
|
176
|
+
shim =
|
|
177
|
+
"undefined" === typeof window ||
|
|
178
|
+
"undefined" === typeof window.document ||
|
|
179
|
+
"undefined" === typeof window.document.createElement
|
|
180
|
+
? useSyncExternalStore$1
|
|
181
|
+
: useSyncExternalStore$2;
|
|
182
|
+
useSyncExternalStoreShim_development.useSyncExternalStore =
|
|
183
|
+
void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
|
184
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
|
185
|
+
"function" ===
|
|
186
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
|
|
187
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
188
|
+
})();
|
|
189
|
+
return useSyncExternalStoreShim_development;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (process.env.NODE_ENV === 'production') {
|
|
193
|
+
shim.exports = requireUseSyncExternalStoreShim_production();
|
|
194
|
+
} else {
|
|
195
|
+
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
var shimExports = shim.exports;
|
|
199
|
+
|
|
200
|
+
var withSelector = {exports: {}};
|
|
201
|
+
|
|
202
|
+
var withSelector_production = {};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @license React
|
|
206
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
207
|
+
*
|
|
208
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the MIT license found in the
|
|
211
|
+
* LICENSE file in the root directory of this source tree.
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
var hasRequiredWithSelector_production;
|
|
215
|
+
|
|
216
|
+
function requireWithSelector_production () {
|
|
217
|
+
if (hasRequiredWithSelector_production) return withSelector_production;
|
|
218
|
+
hasRequiredWithSelector_production = 1;
|
|
219
|
+
var React = React__default,
|
|
220
|
+
shim = shimExports;
|
|
221
|
+
function is(x, y) {
|
|
222
|
+
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
|
|
223
|
+
}
|
|
224
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
225
|
+
useSyncExternalStore = shim.useSyncExternalStore,
|
|
226
|
+
useRef = React.useRef,
|
|
227
|
+
useEffect = React.useEffect,
|
|
228
|
+
useMemo = React.useMemo,
|
|
229
|
+
useDebugValue = React.useDebugValue;
|
|
230
|
+
withSelector_production.useSyncExternalStoreWithSelector = function (
|
|
231
|
+
subscribe,
|
|
232
|
+
getSnapshot,
|
|
233
|
+
getServerSnapshot,
|
|
234
|
+
selector,
|
|
235
|
+
isEqual
|
|
236
|
+
) {
|
|
237
|
+
var instRef = useRef(null);
|
|
238
|
+
if (null === instRef.current) {
|
|
239
|
+
var inst = { hasValue: false, value: null };
|
|
240
|
+
instRef.current = inst;
|
|
241
|
+
} else inst = instRef.current;
|
|
242
|
+
instRef = useMemo(
|
|
243
|
+
function () {
|
|
244
|
+
function memoizedSelector(nextSnapshot) {
|
|
245
|
+
if (!hasMemo) {
|
|
246
|
+
hasMemo = true;
|
|
247
|
+
memoizedSnapshot = nextSnapshot;
|
|
248
|
+
nextSnapshot = selector(nextSnapshot);
|
|
249
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
250
|
+
var currentSelection = inst.value;
|
|
251
|
+
if (isEqual(currentSelection, nextSnapshot))
|
|
252
|
+
return (memoizedSelection = currentSelection);
|
|
253
|
+
}
|
|
254
|
+
return (memoizedSelection = nextSnapshot);
|
|
255
|
+
}
|
|
256
|
+
currentSelection = memoizedSelection;
|
|
257
|
+
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
|
|
258
|
+
var nextSelection = selector(nextSnapshot);
|
|
259
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
|
|
260
|
+
return (memoizedSnapshot = nextSnapshot), currentSelection;
|
|
261
|
+
memoizedSnapshot = nextSnapshot;
|
|
262
|
+
return (memoizedSelection = nextSelection);
|
|
263
|
+
}
|
|
264
|
+
var hasMemo = false,
|
|
265
|
+
memoizedSnapshot,
|
|
266
|
+
memoizedSelection,
|
|
267
|
+
maybeGetServerSnapshot =
|
|
268
|
+
void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
269
|
+
return [
|
|
270
|
+
function () {
|
|
271
|
+
return memoizedSelector(getSnapshot());
|
|
272
|
+
},
|
|
273
|
+
null === maybeGetServerSnapshot
|
|
274
|
+
? void 0
|
|
275
|
+
: function () {
|
|
276
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
277
|
+
}
|
|
278
|
+
];
|
|
279
|
+
},
|
|
280
|
+
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
281
|
+
);
|
|
282
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
283
|
+
useEffect(
|
|
284
|
+
function () {
|
|
285
|
+
inst.hasValue = true;
|
|
286
|
+
inst.value = value;
|
|
287
|
+
},
|
|
288
|
+
[value]
|
|
289
|
+
);
|
|
290
|
+
useDebugValue(value);
|
|
291
|
+
return value;
|
|
292
|
+
};
|
|
293
|
+
return withSelector_production;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
var withSelector_development = {};
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* @license React
|
|
300
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
301
|
+
*
|
|
302
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
303
|
+
*
|
|
304
|
+
* This source code is licensed under the MIT license found in the
|
|
305
|
+
* LICENSE file in the root directory of this source tree.
|
|
306
|
+
*/
|
|
307
|
+
|
|
308
|
+
var hasRequiredWithSelector_development;
|
|
309
|
+
|
|
310
|
+
function requireWithSelector_development () {
|
|
311
|
+
if (hasRequiredWithSelector_development) return withSelector_development;
|
|
312
|
+
hasRequiredWithSelector_development = 1;
|
|
313
|
+
"production" !== process.env.NODE_ENV &&
|
|
314
|
+
(function () {
|
|
315
|
+
function is(x, y) {
|
|
316
|
+
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
|
|
317
|
+
}
|
|
318
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
|
319
|
+
"function" ===
|
|
320
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
|
|
321
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
322
|
+
var React = React__default,
|
|
323
|
+
shim = shimExports,
|
|
324
|
+
objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
325
|
+
useSyncExternalStore = shim.useSyncExternalStore,
|
|
326
|
+
useRef = React.useRef,
|
|
327
|
+
useEffect = React.useEffect,
|
|
328
|
+
useMemo = React.useMemo,
|
|
329
|
+
useDebugValue = React.useDebugValue;
|
|
330
|
+
withSelector_development.useSyncExternalStoreWithSelector = function (
|
|
331
|
+
subscribe,
|
|
332
|
+
getSnapshot,
|
|
333
|
+
getServerSnapshot,
|
|
334
|
+
selector,
|
|
335
|
+
isEqual
|
|
336
|
+
) {
|
|
337
|
+
var instRef = useRef(null);
|
|
338
|
+
if (null === instRef.current) {
|
|
339
|
+
var inst = { hasValue: false, value: null };
|
|
340
|
+
instRef.current = inst;
|
|
341
|
+
} else inst = instRef.current;
|
|
342
|
+
instRef = useMemo(
|
|
343
|
+
function () {
|
|
344
|
+
function memoizedSelector(nextSnapshot) {
|
|
345
|
+
if (!hasMemo) {
|
|
346
|
+
hasMemo = true;
|
|
347
|
+
memoizedSnapshot = nextSnapshot;
|
|
348
|
+
nextSnapshot = selector(nextSnapshot);
|
|
349
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
350
|
+
var currentSelection = inst.value;
|
|
351
|
+
if (isEqual(currentSelection, nextSnapshot))
|
|
352
|
+
return (memoizedSelection = currentSelection);
|
|
353
|
+
}
|
|
354
|
+
return (memoizedSelection = nextSnapshot);
|
|
355
|
+
}
|
|
356
|
+
currentSelection = memoizedSelection;
|
|
357
|
+
if (objectIs(memoizedSnapshot, nextSnapshot))
|
|
358
|
+
return currentSelection;
|
|
359
|
+
var nextSelection = selector(nextSnapshot);
|
|
360
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
|
|
361
|
+
return (memoizedSnapshot = nextSnapshot), currentSelection;
|
|
362
|
+
memoizedSnapshot = nextSnapshot;
|
|
363
|
+
return (memoizedSelection = nextSelection);
|
|
364
|
+
}
|
|
365
|
+
var hasMemo = false,
|
|
366
|
+
memoizedSnapshot,
|
|
367
|
+
memoizedSelection,
|
|
368
|
+
maybeGetServerSnapshot =
|
|
369
|
+
void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
370
|
+
return [
|
|
371
|
+
function () {
|
|
372
|
+
return memoizedSelector(getSnapshot());
|
|
373
|
+
},
|
|
374
|
+
null === maybeGetServerSnapshot
|
|
375
|
+
? void 0
|
|
376
|
+
: function () {
|
|
377
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
378
|
+
}
|
|
379
|
+
];
|
|
380
|
+
},
|
|
381
|
+
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
382
|
+
);
|
|
383
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
384
|
+
useEffect(
|
|
385
|
+
function () {
|
|
386
|
+
inst.hasValue = true;
|
|
387
|
+
inst.value = value;
|
|
388
|
+
},
|
|
389
|
+
[value]
|
|
390
|
+
);
|
|
391
|
+
useDebugValue(value);
|
|
392
|
+
return value;
|
|
393
|
+
};
|
|
394
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
|
395
|
+
"function" ===
|
|
396
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
|
|
397
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
398
|
+
})();
|
|
399
|
+
return withSelector_development;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (process.env.NODE_ENV === 'production') {
|
|
403
|
+
withSelector.exports = requireWithSelector_production();
|
|
404
|
+
} else {
|
|
405
|
+
withSelector.exports = requireWithSelector_development();
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
var withSelectorExports = withSelector.exports;
|
|
409
|
+
|
|
410
|
+
const ContextKey = Symbol.for(`react-redux-context`);
|
|
411
|
+
const gT = typeof globalThis !== "undefined" ? globalThis :
|
|
412
|
+
/* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
|
|
413
|
+
{};
|
|
414
|
+
|
|
415
|
+
function getContext() {
|
|
416
|
+
var _gT$ContextKey;
|
|
417
|
+
|
|
418
|
+
if (!React.createContext) return {};
|
|
419
|
+
const contextMap = (_gT$ContextKey = gT[ContextKey]) != null ? _gT$ContextKey : gT[ContextKey] = new Map();
|
|
420
|
+
let realContext = contextMap.get(React.createContext);
|
|
421
|
+
|
|
422
|
+
if (!realContext) {
|
|
423
|
+
realContext = React.createContext(null);
|
|
424
|
+
|
|
425
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
426
|
+
realContext.displayName = 'ReactRedux';
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
contextMap.set(React.createContext, realContext);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return realContext;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const ReactReduxContext = /*#__PURE__*/getContext();
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level
|
|
439
|
+
* hook that you should usually not need to call directly.
|
|
440
|
+
*
|
|
441
|
+
* @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
|
|
442
|
+
* @returns {Function} A `useReduxContext` hook bound to the specified context.
|
|
443
|
+
*/
|
|
444
|
+
function createReduxContextHook(context = ReactReduxContext) {
|
|
445
|
+
return function useReduxContext() {
|
|
446
|
+
const contextValue = useContext(context);
|
|
447
|
+
|
|
448
|
+
if (process.env.NODE_ENV !== 'production' && !contextValue) {
|
|
449
|
+
throw new Error('could not find react-redux context value; please ensure the component is wrapped in a <Provider>');
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return contextValue;
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* A hook to access the value of the `ReactReduxContext`. This is a low-level
|
|
457
|
+
* hook that you should usually not need to call directly.
|
|
458
|
+
*
|
|
459
|
+
* @returns {any} the value of the `ReactReduxContext`
|
|
460
|
+
*
|
|
461
|
+
* @example
|
|
462
|
+
*
|
|
463
|
+
* import React from 'react'
|
|
464
|
+
* import { useReduxContext } from 'react-redux'
|
|
465
|
+
*
|
|
466
|
+
* export const CounterComponent = () => {
|
|
467
|
+
* const { store } = useReduxContext()
|
|
468
|
+
* return <div>{store.getState()}</div>
|
|
469
|
+
* }
|
|
470
|
+
*/
|
|
471
|
+
|
|
472
|
+
const useReduxContext = /*#__PURE__*/createReduxContextHook();
|
|
473
|
+
|
|
474
|
+
const notInitialized = () => {
|
|
475
|
+
throw new Error('uSES not initialized!');
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
let useSyncExternalStoreWithSelector = notInitialized;
|
|
479
|
+
const initializeUseSelector = fn => {
|
|
480
|
+
useSyncExternalStoreWithSelector = fn;
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
const refEquality = (a, b) => a === b;
|
|
484
|
+
/**
|
|
485
|
+
* Hook factory, which creates a `useSelector` hook bound to a given context.
|
|
486
|
+
*
|
|
487
|
+
* @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
|
|
488
|
+
* @returns {Function} A `useSelector` hook bound to the specified context.
|
|
489
|
+
*/
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
function createSelectorHook(context = ReactReduxContext) {
|
|
493
|
+
const useReduxContext$1 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
|
|
494
|
+
return function useSelector(selector, equalityFnOrOptions = {}) {
|
|
495
|
+
const {
|
|
496
|
+
equalityFn = refEquality,
|
|
497
|
+
stabilityCheck = undefined,
|
|
498
|
+
noopCheck = undefined
|
|
499
|
+
} = typeof equalityFnOrOptions === 'function' ? {
|
|
500
|
+
equalityFn: equalityFnOrOptions
|
|
501
|
+
} : equalityFnOrOptions;
|
|
502
|
+
|
|
503
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
504
|
+
if (!selector) {
|
|
505
|
+
throw new Error(`You must pass a selector to useSelector`);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (typeof selector !== 'function') {
|
|
509
|
+
throw new Error(`You must pass a function as a selector to useSelector`);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
if (typeof equalityFn !== 'function') {
|
|
513
|
+
throw new Error(`You must pass a function as an equality function to useSelector`);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
const {
|
|
518
|
+
store,
|
|
519
|
+
subscription,
|
|
520
|
+
getServerState,
|
|
521
|
+
stabilityCheck: globalStabilityCheck,
|
|
522
|
+
noopCheck: globalNoopCheck
|
|
523
|
+
} = useReduxContext$1();
|
|
524
|
+
const firstRun = useRef(true);
|
|
525
|
+
const wrappedSelector = useCallback({
|
|
526
|
+
[selector.name](state) {
|
|
527
|
+
const selected = selector(state);
|
|
528
|
+
|
|
529
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
530
|
+
const finalStabilityCheck = typeof stabilityCheck === 'undefined' ? globalStabilityCheck : stabilityCheck;
|
|
531
|
+
|
|
532
|
+
if (finalStabilityCheck === 'always' || finalStabilityCheck === 'once' && firstRun.current) {
|
|
533
|
+
const toCompare = selector(state);
|
|
534
|
+
|
|
535
|
+
if (!equalityFn(selected, toCompare)) {
|
|
536
|
+
let stack = undefined;
|
|
537
|
+
|
|
538
|
+
try {
|
|
539
|
+
throw new Error();
|
|
540
|
+
} catch (e) {
|
|
541
|
+
({
|
|
542
|
+
stack
|
|
543
|
+
} = e);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
console.warn('Selector ' + (selector.name || 'unknown') + ' returned a different result when called with the same parameters. This can lead to unnecessary rerenders.' + '\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization', {
|
|
547
|
+
state,
|
|
548
|
+
selected,
|
|
549
|
+
selected2: toCompare,
|
|
550
|
+
stack
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
const finalNoopCheck = typeof noopCheck === 'undefined' ? globalNoopCheck : noopCheck;
|
|
556
|
+
|
|
557
|
+
if (finalNoopCheck === 'always' || finalNoopCheck === 'once' && firstRun.current) {
|
|
558
|
+
// @ts-ignore
|
|
559
|
+
if (selected === state) {
|
|
560
|
+
let stack = undefined;
|
|
561
|
+
|
|
562
|
+
try {
|
|
563
|
+
throw new Error();
|
|
564
|
+
} catch (e) {
|
|
565
|
+
({
|
|
566
|
+
stack
|
|
567
|
+
} = e);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
console.warn('Selector ' + (selector.name || 'unknown') + ' returned the root state when called. This can lead to unnecessary rerenders.' + '\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.', {
|
|
571
|
+
stack
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
if (firstRun.current) firstRun.current = false;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
return selected;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
}[selector.name], [selector, globalStabilityCheck, stabilityCheck]);
|
|
583
|
+
const selectedState = useSyncExternalStoreWithSelector(subscription.addNestedSub, store.getState, getServerState || store.getState, wrappedSelector, equalityFn);
|
|
584
|
+
useDebugValue(selectedState);
|
|
585
|
+
return selectedState;
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* A hook to access the redux store's state. This hook takes a selector function
|
|
590
|
+
* as an argument. The selector is called with the store state.
|
|
591
|
+
*
|
|
592
|
+
* This hook takes an optional equality comparison function as the second parameter
|
|
593
|
+
* that allows you to customize the way the selected state is compared to determine
|
|
594
|
+
* whether the component needs to be re-rendered.
|
|
595
|
+
*
|
|
596
|
+
* @param {Function} selector the selector function
|
|
597
|
+
* @param {Function=} equalityFn the function that will be used to determine equality
|
|
598
|
+
*
|
|
599
|
+
* @returns {any} the selected state
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
*
|
|
603
|
+
* import React from 'react'
|
|
604
|
+
* import { useSelector } from 'react-redux'
|
|
605
|
+
*
|
|
606
|
+
* export const CounterComponent = () => {
|
|
607
|
+
* const counter = useSelector(state => state.counter)
|
|
608
|
+
* return <div>{counter}</div>
|
|
609
|
+
* }
|
|
610
|
+
*/
|
|
611
|
+
|
|
612
|
+
const useSelector = /*#__PURE__*/createSelectorHook();
|
|
613
|
+
|
|
614
|
+
var reactIs$1 = {exports: {}};
|
|
615
|
+
|
|
616
|
+
var reactIs_production_min$1 = {};
|
|
617
|
+
|
|
618
|
+
/** @license React v16.13.1
|
|
619
|
+
* react-is.production.min.js
|
|
620
|
+
*
|
|
621
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
622
|
+
*
|
|
623
|
+
* This source code is licensed under the MIT license found in the
|
|
624
|
+
* LICENSE file in the root directory of this source tree.
|
|
625
|
+
*/
|
|
626
|
+
|
|
627
|
+
var hasRequiredReactIs_production_min$1;
|
|
628
|
+
|
|
629
|
+
function requireReactIs_production_min$1 () {
|
|
630
|
+
if (hasRequiredReactIs_production_min$1) return reactIs_production_min$1;
|
|
631
|
+
hasRequiredReactIs_production_min$1 = 1;
|
|
632
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
633
|
+
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
634
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min$1.AsyncMode=l;reactIs_production_min$1.ConcurrentMode=m;reactIs_production_min$1.ContextConsumer=k;reactIs_production_min$1.ContextProvider=h;reactIs_production_min$1.Element=c;reactIs_production_min$1.ForwardRef=n;reactIs_production_min$1.Fragment=e;reactIs_production_min$1.Lazy=t;reactIs_production_min$1.Memo=r;reactIs_production_min$1.Portal=d;
|
|
635
|
+
reactIs_production_min$1.Profiler=g;reactIs_production_min$1.StrictMode=f;reactIs_production_min$1.Suspense=p;reactIs_production_min$1.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min$1.isConcurrentMode=A;reactIs_production_min$1.isContextConsumer=function(a){return z(a)===k};reactIs_production_min$1.isContextProvider=function(a){return z(a)===h};reactIs_production_min$1.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min$1.isForwardRef=function(a){return z(a)===n};reactIs_production_min$1.isFragment=function(a){return z(a)===e};reactIs_production_min$1.isLazy=function(a){return z(a)===t};
|
|
636
|
+
reactIs_production_min$1.isMemo=function(a){return z(a)===r};reactIs_production_min$1.isPortal=function(a){return z(a)===d};reactIs_production_min$1.isProfiler=function(a){return z(a)===g};reactIs_production_min$1.isStrictMode=function(a){return z(a)===f};reactIs_production_min$1.isSuspense=function(a){return z(a)===p};
|
|
637
|
+
reactIs_production_min$1.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min$1.typeOf=z;
|
|
638
|
+
return reactIs_production_min$1;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
var reactIs_development$1 = {};
|
|
642
|
+
|
|
643
|
+
/** @license React v16.13.1
|
|
644
|
+
* react-is.development.js
|
|
645
|
+
*
|
|
646
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
647
|
+
*
|
|
648
|
+
* This source code is licensed under the MIT license found in the
|
|
649
|
+
* LICENSE file in the root directory of this source tree.
|
|
650
|
+
*/
|
|
651
|
+
|
|
652
|
+
var hasRequiredReactIs_development$1;
|
|
653
|
+
|
|
654
|
+
function requireReactIs_development$1 () {
|
|
655
|
+
if (hasRequiredReactIs_development$1) return reactIs_development$1;
|
|
656
|
+
hasRequiredReactIs_development$1 = 1;
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
if (process.env.NODE_ENV !== "production") {
|
|
661
|
+
(function() {
|
|
662
|
+
|
|
663
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
664
|
+
// nor polyfill, then a plain number is used for performance.
|
|
665
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
666
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
667
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
668
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
669
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
670
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
671
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
672
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
673
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
674
|
+
|
|
675
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
676
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
677
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
678
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
679
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
680
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
681
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
682
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
683
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
684
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
685
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
686
|
+
|
|
687
|
+
function isValidElementType(type) {
|
|
688
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
689
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function typeOf(object) {
|
|
693
|
+
if (typeof object === 'object' && object !== null) {
|
|
694
|
+
var $$typeof = object.$$typeof;
|
|
695
|
+
|
|
696
|
+
switch ($$typeof) {
|
|
697
|
+
case REACT_ELEMENT_TYPE:
|
|
698
|
+
var type = object.type;
|
|
699
|
+
|
|
700
|
+
switch (type) {
|
|
701
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
702
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
703
|
+
case REACT_FRAGMENT_TYPE:
|
|
704
|
+
case REACT_PROFILER_TYPE:
|
|
705
|
+
case REACT_STRICT_MODE_TYPE:
|
|
706
|
+
case REACT_SUSPENSE_TYPE:
|
|
707
|
+
return type;
|
|
708
|
+
|
|
709
|
+
default:
|
|
710
|
+
var $$typeofType = type && type.$$typeof;
|
|
711
|
+
|
|
712
|
+
switch ($$typeofType) {
|
|
713
|
+
case REACT_CONTEXT_TYPE:
|
|
714
|
+
case REACT_FORWARD_REF_TYPE:
|
|
715
|
+
case REACT_LAZY_TYPE:
|
|
716
|
+
case REACT_MEMO_TYPE:
|
|
717
|
+
case REACT_PROVIDER_TYPE:
|
|
718
|
+
return $$typeofType;
|
|
719
|
+
|
|
720
|
+
default:
|
|
721
|
+
return $$typeof;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
case REACT_PORTAL_TYPE:
|
|
727
|
+
return $$typeof;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
return undefined;
|
|
732
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
733
|
+
|
|
734
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
735
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
736
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
737
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
738
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
739
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
740
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
741
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
742
|
+
var Memo = REACT_MEMO_TYPE;
|
|
743
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
744
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
745
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
746
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
747
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
748
|
+
|
|
749
|
+
function isAsyncMode(object) {
|
|
750
|
+
{
|
|
751
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
752
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
753
|
+
|
|
754
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
759
|
+
}
|
|
760
|
+
function isConcurrentMode(object) {
|
|
761
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
762
|
+
}
|
|
763
|
+
function isContextConsumer(object) {
|
|
764
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
765
|
+
}
|
|
766
|
+
function isContextProvider(object) {
|
|
767
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
768
|
+
}
|
|
769
|
+
function isElement(object) {
|
|
770
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
771
|
+
}
|
|
772
|
+
function isForwardRef(object) {
|
|
773
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
774
|
+
}
|
|
775
|
+
function isFragment(object) {
|
|
776
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
777
|
+
}
|
|
778
|
+
function isLazy(object) {
|
|
779
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
780
|
+
}
|
|
781
|
+
function isMemo(object) {
|
|
782
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
783
|
+
}
|
|
784
|
+
function isPortal(object) {
|
|
785
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
786
|
+
}
|
|
787
|
+
function isProfiler(object) {
|
|
788
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
789
|
+
}
|
|
790
|
+
function isStrictMode(object) {
|
|
791
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
792
|
+
}
|
|
793
|
+
function isSuspense(object) {
|
|
794
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
reactIs_development$1.AsyncMode = AsyncMode;
|
|
798
|
+
reactIs_development$1.ConcurrentMode = ConcurrentMode;
|
|
799
|
+
reactIs_development$1.ContextConsumer = ContextConsumer;
|
|
800
|
+
reactIs_development$1.ContextProvider = ContextProvider;
|
|
801
|
+
reactIs_development$1.Element = Element;
|
|
802
|
+
reactIs_development$1.ForwardRef = ForwardRef;
|
|
803
|
+
reactIs_development$1.Fragment = Fragment;
|
|
804
|
+
reactIs_development$1.Lazy = Lazy;
|
|
805
|
+
reactIs_development$1.Memo = Memo;
|
|
806
|
+
reactIs_development$1.Portal = Portal;
|
|
807
|
+
reactIs_development$1.Profiler = Profiler;
|
|
808
|
+
reactIs_development$1.StrictMode = StrictMode;
|
|
809
|
+
reactIs_development$1.Suspense = Suspense;
|
|
810
|
+
reactIs_development$1.isAsyncMode = isAsyncMode;
|
|
811
|
+
reactIs_development$1.isConcurrentMode = isConcurrentMode;
|
|
812
|
+
reactIs_development$1.isContextConsumer = isContextConsumer;
|
|
813
|
+
reactIs_development$1.isContextProvider = isContextProvider;
|
|
814
|
+
reactIs_development$1.isElement = isElement;
|
|
815
|
+
reactIs_development$1.isForwardRef = isForwardRef;
|
|
816
|
+
reactIs_development$1.isFragment = isFragment;
|
|
817
|
+
reactIs_development$1.isLazy = isLazy;
|
|
818
|
+
reactIs_development$1.isMemo = isMemo;
|
|
819
|
+
reactIs_development$1.isPortal = isPortal;
|
|
820
|
+
reactIs_development$1.isProfiler = isProfiler;
|
|
821
|
+
reactIs_development$1.isStrictMode = isStrictMode;
|
|
822
|
+
reactIs_development$1.isSuspense = isSuspense;
|
|
823
|
+
reactIs_development$1.isValidElementType = isValidElementType;
|
|
824
|
+
reactIs_development$1.typeOf = typeOf;
|
|
825
|
+
})();
|
|
826
|
+
}
|
|
827
|
+
return reactIs_development$1;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
if (process.env.NODE_ENV === 'production') {
|
|
831
|
+
reactIs$1.exports = requireReactIs_production_min$1();
|
|
832
|
+
} else {
|
|
833
|
+
reactIs$1.exports = requireReactIs_development$1();
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
var reactIsExports = reactIs$1.exports;
|
|
837
|
+
|
|
838
|
+
var reactIs = reactIsExports;
|
|
839
|
+
var FORWARD_REF_STATICS = {
|
|
840
|
+
'$$typeof': true,
|
|
841
|
+
render: true,
|
|
842
|
+
defaultProps: true,
|
|
843
|
+
displayName: true,
|
|
844
|
+
propTypes: true
|
|
845
|
+
};
|
|
846
|
+
var MEMO_STATICS = {
|
|
847
|
+
'$$typeof': true,
|
|
848
|
+
compare: true,
|
|
849
|
+
defaultProps: true,
|
|
850
|
+
displayName: true,
|
|
851
|
+
propTypes: true,
|
|
852
|
+
type: true
|
|
853
|
+
};
|
|
854
|
+
var TYPE_STATICS = {};
|
|
855
|
+
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
856
|
+
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
|
|
857
|
+
|
|
858
|
+
var reactIs_production_min = {};
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* @license React
|
|
862
|
+
* react-is.production.min.js
|
|
863
|
+
*
|
|
864
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
865
|
+
*
|
|
866
|
+
* This source code is licensed under the MIT license found in the
|
|
867
|
+
* LICENSE file in the root directory of this source tree.
|
|
868
|
+
*/
|
|
869
|
+
|
|
870
|
+
var hasRequiredReactIs_production_min;
|
|
871
|
+
|
|
872
|
+
function requireReactIs_production_min () {
|
|
873
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
874
|
+
hasRequiredReactIs_production_min = 1;
|
|
875
|
+
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
|
|
876
|
+
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;
|
|
877
|
+
reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return false};reactIs_production_min.isConcurrentMode=function(){return false};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};
|
|
878
|
+
reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};
|
|
879
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?true:false};reactIs_production_min.typeOf=v;
|
|
880
|
+
return reactIs_production_min;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
var reactIs_development = {};
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* @license React
|
|
887
|
+
* react-is.development.js
|
|
888
|
+
*
|
|
889
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
890
|
+
*
|
|
891
|
+
* This source code is licensed under the MIT license found in the
|
|
892
|
+
* LICENSE file in the root directory of this source tree.
|
|
893
|
+
*/
|
|
894
|
+
|
|
895
|
+
var hasRequiredReactIs_development;
|
|
896
|
+
|
|
897
|
+
function requireReactIs_development () {
|
|
898
|
+
if (hasRequiredReactIs_development) return reactIs_development;
|
|
899
|
+
hasRequiredReactIs_development = 1;
|
|
900
|
+
|
|
901
|
+
if (process.env.NODE_ENV !== "production") {
|
|
902
|
+
(function() {
|
|
903
|
+
|
|
904
|
+
// ATTENTION
|
|
905
|
+
// When adding new symbols to this file,
|
|
906
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
907
|
+
// The Symbol used to tag the ReactElement-like types.
|
|
908
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
909
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
910
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
911
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
912
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
913
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
914
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
915
|
+
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
|
|
916
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
917
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
918
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
919
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
920
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
921
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
922
|
+
|
|
923
|
+
// -----------------------------------------------------------------------------
|
|
924
|
+
|
|
925
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
926
|
+
var enableCacheElement = false;
|
|
927
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
928
|
+
|
|
929
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
930
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
931
|
+
// issues in DEV builds.
|
|
932
|
+
|
|
933
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
934
|
+
|
|
935
|
+
var REACT_MODULE_REFERENCE;
|
|
936
|
+
|
|
937
|
+
{
|
|
938
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
function isValidElementType(type) {
|
|
942
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
943
|
+
return true;
|
|
944
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
948
|
+
return true;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
if (typeof type === 'object' && type !== null) {
|
|
952
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
953
|
+
// types supported by any Flight configuration anywhere since
|
|
954
|
+
// we don't know which Flight build this will end up being used
|
|
955
|
+
// with.
|
|
956
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
957
|
+
return true;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
return false;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
function typeOf(object) {
|
|
965
|
+
if (typeof object === 'object' && object !== null) {
|
|
966
|
+
var $$typeof = object.$$typeof;
|
|
967
|
+
|
|
968
|
+
switch ($$typeof) {
|
|
969
|
+
case REACT_ELEMENT_TYPE:
|
|
970
|
+
var type = object.type;
|
|
971
|
+
|
|
972
|
+
switch (type) {
|
|
973
|
+
case REACT_FRAGMENT_TYPE:
|
|
974
|
+
case REACT_PROFILER_TYPE:
|
|
975
|
+
case REACT_STRICT_MODE_TYPE:
|
|
976
|
+
case REACT_SUSPENSE_TYPE:
|
|
977
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
978
|
+
return type;
|
|
979
|
+
|
|
980
|
+
default:
|
|
981
|
+
var $$typeofType = type && type.$$typeof;
|
|
982
|
+
|
|
983
|
+
switch ($$typeofType) {
|
|
984
|
+
case REACT_SERVER_CONTEXT_TYPE:
|
|
985
|
+
case REACT_CONTEXT_TYPE:
|
|
986
|
+
case REACT_FORWARD_REF_TYPE:
|
|
987
|
+
case REACT_LAZY_TYPE:
|
|
988
|
+
case REACT_MEMO_TYPE:
|
|
989
|
+
case REACT_PROVIDER_TYPE:
|
|
990
|
+
return $$typeofType;
|
|
991
|
+
|
|
992
|
+
default:
|
|
993
|
+
return $$typeof;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
case REACT_PORTAL_TYPE:
|
|
999
|
+
return $$typeof;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
return undefined;
|
|
1004
|
+
}
|
|
1005
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
1006
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
1007
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
1008
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
1009
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
1010
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
1011
|
+
var Memo = REACT_MEMO_TYPE;
|
|
1012
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
1013
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
1014
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
1015
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
1016
|
+
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
1017
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
1018
|
+
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
|
|
1019
|
+
|
|
1020
|
+
function isAsyncMode(object) {
|
|
1021
|
+
{
|
|
1022
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
1023
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
1024
|
+
|
|
1025
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
return false;
|
|
1030
|
+
}
|
|
1031
|
+
function isConcurrentMode(object) {
|
|
1032
|
+
{
|
|
1033
|
+
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
|
1034
|
+
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
1035
|
+
|
|
1036
|
+
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
return false;
|
|
1041
|
+
}
|
|
1042
|
+
function isContextConsumer(object) {
|
|
1043
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
1044
|
+
}
|
|
1045
|
+
function isContextProvider(object) {
|
|
1046
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
1047
|
+
}
|
|
1048
|
+
function isElement(object) {
|
|
1049
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1050
|
+
}
|
|
1051
|
+
function isForwardRef(object) {
|
|
1052
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
1053
|
+
}
|
|
1054
|
+
function isFragment(object) {
|
|
1055
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
1056
|
+
}
|
|
1057
|
+
function isLazy(object) {
|
|
1058
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
1059
|
+
}
|
|
1060
|
+
function isMemo(object) {
|
|
1061
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
1062
|
+
}
|
|
1063
|
+
function isPortal(object) {
|
|
1064
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
1065
|
+
}
|
|
1066
|
+
function isProfiler(object) {
|
|
1067
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
1068
|
+
}
|
|
1069
|
+
function isStrictMode(object) {
|
|
1070
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
1071
|
+
}
|
|
1072
|
+
function isSuspense(object) {
|
|
1073
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
1074
|
+
}
|
|
1075
|
+
function isSuspenseList(object) {
|
|
1076
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
reactIs_development.ContextConsumer = ContextConsumer;
|
|
1080
|
+
reactIs_development.ContextProvider = ContextProvider;
|
|
1081
|
+
reactIs_development.Element = Element;
|
|
1082
|
+
reactIs_development.ForwardRef = ForwardRef;
|
|
1083
|
+
reactIs_development.Fragment = Fragment;
|
|
1084
|
+
reactIs_development.Lazy = Lazy;
|
|
1085
|
+
reactIs_development.Memo = Memo;
|
|
1086
|
+
reactIs_development.Portal = Portal;
|
|
1087
|
+
reactIs_development.Profiler = Profiler;
|
|
1088
|
+
reactIs_development.StrictMode = StrictMode;
|
|
1089
|
+
reactIs_development.Suspense = Suspense;
|
|
1090
|
+
reactIs_development.SuspenseList = SuspenseList;
|
|
1091
|
+
reactIs_development.isAsyncMode = isAsyncMode;
|
|
1092
|
+
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
1093
|
+
reactIs_development.isContextConsumer = isContextConsumer;
|
|
1094
|
+
reactIs_development.isContextProvider = isContextProvider;
|
|
1095
|
+
reactIs_development.isElement = isElement;
|
|
1096
|
+
reactIs_development.isForwardRef = isForwardRef;
|
|
1097
|
+
reactIs_development.isFragment = isFragment;
|
|
1098
|
+
reactIs_development.isLazy = isLazy;
|
|
1099
|
+
reactIs_development.isMemo = isMemo;
|
|
1100
|
+
reactIs_development.isPortal = isPortal;
|
|
1101
|
+
reactIs_development.isProfiler = isProfiler;
|
|
1102
|
+
reactIs_development.isStrictMode = isStrictMode;
|
|
1103
|
+
reactIs_development.isSuspense = isSuspense;
|
|
1104
|
+
reactIs_development.isSuspenseList = isSuspenseList;
|
|
1105
|
+
reactIs_development.isValidElementType = isValidElementType;
|
|
1106
|
+
reactIs_development.typeOf = typeOf;
|
|
1107
|
+
})();
|
|
1108
|
+
}
|
|
1109
|
+
return reactIs_development;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1113
|
+
requireReactIs_production_min();
|
|
1114
|
+
} else {
|
|
1115
|
+
requireReactIs_development();
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* Hook factory, which creates a `useStore` hook bound to a given context.
|
|
1120
|
+
*
|
|
1121
|
+
* @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
|
|
1122
|
+
* @returns {Function} A `useStore` hook bound to the specified context.
|
|
1123
|
+
*/
|
|
1124
|
+
|
|
1125
|
+
function createStoreHook(context = ReactReduxContext) {
|
|
1126
|
+
const useReduxContext$1 = // @ts-ignore
|
|
1127
|
+
context === ReactReduxContext ? useReduxContext : // @ts-ignore
|
|
1128
|
+
createReduxContextHook(context);
|
|
1129
|
+
return function useStore() {
|
|
1130
|
+
const {
|
|
1131
|
+
store
|
|
1132
|
+
} = useReduxContext$1(); // @ts-ignore
|
|
1133
|
+
|
|
1134
|
+
return store;
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* A hook to access the redux store.
|
|
1139
|
+
*
|
|
1140
|
+
* @returns {any} the redux store
|
|
1141
|
+
*
|
|
1142
|
+
* @example
|
|
1143
|
+
*
|
|
1144
|
+
* import React from 'react'
|
|
1145
|
+
* import { useStore } from 'react-redux'
|
|
1146
|
+
*
|
|
1147
|
+
* export const ExampleComponent = () => {
|
|
1148
|
+
* const store = useStore()
|
|
1149
|
+
* return <div>{store.getState()}</div>
|
|
1150
|
+
* }
|
|
1151
|
+
*/
|
|
1152
|
+
|
|
1153
|
+
const useStore = /*#__PURE__*/createStoreHook();
|
|
1154
|
+
|
|
1155
|
+
/**
|
|
1156
|
+
* Hook factory, which creates a `useDispatch` hook bound to a given context.
|
|
1157
|
+
*
|
|
1158
|
+
* @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
|
|
1159
|
+
* @returns {Function} A `useDispatch` hook bound to the specified context.
|
|
1160
|
+
*/
|
|
1161
|
+
|
|
1162
|
+
function createDispatchHook(context = ReactReduxContext) {
|
|
1163
|
+
const useStore$1 = // @ts-ignore
|
|
1164
|
+
context === ReactReduxContext ? useStore : createStoreHook(context);
|
|
1165
|
+
return function useDispatch() {
|
|
1166
|
+
const store = useStore$1(); // @ts-ignore
|
|
1167
|
+
|
|
1168
|
+
return store.dispatch;
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* A hook to access the redux `dispatch` function.
|
|
1173
|
+
*
|
|
1174
|
+
* @returns {any|function} redux store's `dispatch` function
|
|
1175
|
+
*
|
|
1176
|
+
* @example
|
|
1177
|
+
*
|
|
1178
|
+
* import React, { useCallback } from 'react'
|
|
1179
|
+
* import { useDispatch } from 'react-redux'
|
|
1180
|
+
*
|
|
1181
|
+
* export const CounterComponent = ({ value }) => {
|
|
1182
|
+
* const dispatch = useDispatch()
|
|
1183
|
+
* const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
|
|
1184
|
+
* return (
|
|
1185
|
+
* <div>
|
|
1186
|
+
* <span>{value}</span>
|
|
1187
|
+
* <button onClick={increaseCounter}>Increase counter</button>
|
|
1188
|
+
* </div>
|
|
1189
|
+
* )
|
|
1190
|
+
* }
|
|
1191
|
+
*/
|
|
1192
|
+
|
|
1193
|
+
const useDispatch = /*#__PURE__*/createDispatchHook();
|
|
1194
|
+
|
|
1195
|
+
// The primary entry point assumes we're working with standard ReactDOM/RN, but
|
|
1196
|
+
// older versions that do not include `useSyncExternalStore` (React 16.9 - 17.x).
|
|
1197
|
+
// Because of that, the useSyncExternalStore compat shim is needed.
|
|
1198
|
+
initializeUseSelector(withSelectorExports.useSyncExternalStoreWithSelector);
|
|
1199
|
+
|
|
1200
|
+
function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return !!n&&!!n[Q]}function t(n){var r;return !!n&&(function(n){if(!n||"object"!=typeof n)return false;var r=Object.getPrototypeOf(n);if(null===r)return true;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!(null===(r=n.constructor)||void 0===r?void 0:r[L])||s(n)||v(n))}function i(n,r,t){ void 0===t&&(t=false),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a(n,r){return 2===o(n)?n.get(r):n[r]}function f(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?n.add(t):n[r]=t;}function c(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];false===o.writable&&(o.writable=true,o.configurable=true),(o.get||o.set)&&(r[i]={configurable:true,writable:true,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=false),y(n)||r(n)||!t(n)||(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,true)}),true)),n}function h(){n(2);}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b(r){var t=tn[r];return t||n(18,r),t}function m(n,r){tn[n]||(tn[n]=r);}function _(){return "production"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b("Patches"),n.u=[],n.s=[],n.v=r);}function g(n){O(n),n.p.forEach(S),n.p=null;}function O(n){n===U&&(U=n.l);}function w(n){return U={p:[],l:U,h:n,m:true,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.g=true;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.O||b("ES5").S(e,r,o),o?(i[Q].P&&(g(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),g(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),true),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,true),e.t;if(!e.I){e.I=true,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o,u=o,a=false;3===e.i&&(u=new Set(o),o.clear(),a=true),i(u,(function(r,i){return A(n,e,o,r,i,t,a)})),x(n,o,false),t&&n.u&&b("Patches").N(e,t,n.u,n.s);}return e.o}function A(e,i,o,a,c,s,v){if("production"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var p=M(e,c,s&&i&&3!==i.i&&!u(i.R,a)?s.concat(a):void 0);if(f(o,a,p),!r(p))return;e.m=false;}else v&&o.add(c);if(t(c)&&!y(c)){if(!e.h.D&&e._<1)return;M(e,c),i&&i.A.l||x(e,c);}}function x(n,r,t){ void 0===t&&(t=false),!n.l&&n.h.D&&n.m&&d(r,t);}function z(n,r){var t=n[Q];return (t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k(n){n.P||(n.P=true,n.l&&k(n.l));}function E(n){n.o||(n.o=l(n.t));}function N(n,r,t){var e=s(r)?b("MapSet").F(r,t):v(r)?b("MapSet").T(r,t):n.O?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:false,I:false,R:{},l:r,t:n,k:null,o:null,j:null,C:false},i=e,o=en;t&&(i=[e],o=on$1);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function R(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b("ES5").K(u)))return u.t;u.I=true,e=D(r,c),u.I=false;}else e=D(r,c);return i(e,(function(r,t){u&&a(u.t,r)===t||f(e,r,n(t));})),3===c?new Set(e):e}(e)}function D(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}function F(){function t(n,r){var t=s[n];return t?t.enumerable=r:s[n]=t={configurable:true,enumerable:r,get:function(){var r=this[Q];return "production"!==process.env.NODE_ENV&&f(r),en.get(r,n)},set:function(r){var t=this[Q];"production"!==process.env.NODE_ENV&&f(t),en.set(t,n,r);}},t}function e(n){for(var r=n.length-1;r>=0;r--){var t=n[r][Q];if(!t.P)switch(t.i){case 5:a(t)&&k(t);break;case 4:o(t)&&k(t);}}}function o(n){for(var r=n.t,t=n.k,e=nn(t),i=e.length-1;i>=0;i--){var o=e[i];if(o!==Q){var a=r[o];if(void 0===a&&!u(r,o))return true;var f=t[o],s=f&&f[Q];if(s?s.t!==a:!c(f,a))return true}}var v=!!r[Q];return e.length!==nn(r).length+(v?0:1)}function a(n){var r=n.k;if(r.length!==n.t.length)return true;var t=Object.getOwnPropertyDescriptor(r,r.length-1);if(t&&!t.get)return true;for(var e=0;e<r.length;e++)if(!r.hasOwnProperty(e))return true;return false}function f(r){r.g&&n(3,JSON.stringify(p(r)));}var s={};m("ES5",{J:function(n,r){var e=Array.isArray(n),i=function(n,r){if(n){for(var e=Array(r.length),i=0;i<r.length;i++)Object.defineProperty(e,""+i,t(i,true));return e}var o=rn(r);delete o[Q];for(var u=nn(o),a=0;a<u.length;a++){var f=u[a];o[f]=t(f,n||!!o[f].enumerable);}return Object.create(Object.getPrototypeOf(r),o)}(e,n),o={i:e?5:4,A:r?r.A:_(),P:false,I:false,R:{},l:r,t:n,k:i,o:null,g:false,C:false};return Object.defineProperty(i,Q,{value:o,writable:true}),i},S:function(n,t,o){o?r(t)&&t[Q].A===n&&e(n.p):(n.u&&function n(r){if(r&&"object"==typeof r){var t=r[Q];if(t){var e=t.t,o=t.k,f=t.R,c=t.i;if(4===c)i(o,(function(r){r!==Q&&(void 0!==e[r]||u(e,r)?f[r]||n(o[r]):(f[r]=true,k(t)));})),i(e,(function(n){ void 0!==o[n]||u(o,n)||(f[n]=false,k(t));}));else if(5===c){if(a(t)&&(k(t),f.length=true),o.length<e.length)for(var s=o.length;s<e.length;s++)f[s]=false;else for(var v=e.length;v<o.length;v++)f[v]=true;for(var p=Math.min(o.length,e.length),l=0;l<p;l++)o.hasOwnProperty(l)||(f[l]=true),void 0===f[l]&&n(o[l]);}}}}(n.p[0]),e(n.p));},K:function(n){return 4===n.i?o(n):a(n)}});}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=true,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=N(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),true;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.R[r]=false,true;if(c(t,i)&&(void 0!==t||u(n.t,r)))return true;E(n),k(n);}return n.o[r]===t&&(void 0!==t||r in n.o)||Number.isNaN(t)&&Number.isNaN(n.o[r])||(n.o[r]=t,n.R[r]=true),true},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.R[r]=false,E(n),k(n)):delete n.R[r],n.o&&delete n.o[r],true},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:true,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12);}},on$1={};i(en,(function(n,r){on$1[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on$1.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on$1.set.call(this,r,t,void 0)},on$1.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.O=B,this.D=true,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=N(e,r,void 0),v=true;try{f=i(s),v=!1;}finally{v?g(c):O(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw g(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.D&&d(f,true),o){var p=[],l=[];b("Patches").M(r,f,p,l),o(p,l);}return f}n(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=R(e));var i=w(this),o=N(this,e,void 0);return o[Q].C=true,O(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.D=n;},i.setUseProxies=function(r){r&&!B&&n(20),this.O=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);
|
|
1201
|
+
|
|
1202
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
1203
|
+
var extendStatics = function (d, b) {
|
|
1204
|
+
extendStatics = Object.setPrototypeOf ||
|
|
1205
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1206
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
1207
|
+
return extendStatics(d, b);
|
|
1208
|
+
};
|
|
1209
|
+
return function (d, b) {
|
|
1210
|
+
if (typeof b !== "function" && b !== null)
|
|
1211
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1212
|
+
extendStatics(d, b);
|
|
1213
|
+
function __() { this.constructor = d; }
|
|
1214
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1215
|
+
};
|
|
1216
|
+
})();
|
|
1217
|
+
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
1218
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1219
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1220
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
1221
|
+
function step(op) {
|
|
1222
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
1223
|
+
while (_) try {
|
|
1224
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1225
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
1226
|
+
switch (op[0]) {
|
|
1227
|
+
case 0: case 1: t = op; break;
|
|
1228
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
1229
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
1230
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
1231
|
+
default:
|
|
1232
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
1233
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
1234
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
1235
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
1236
|
+
if (t[2]) _.ops.pop();
|
|
1237
|
+
_.trys.pop(); continue;
|
|
1238
|
+
}
|
|
1239
|
+
op = body.call(thisArg, _);
|
|
1240
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
1241
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) {
|
|
1245
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
1246
|
+
to[j] = from[i];
|
|
1247
|
+
return to;
|
|
1248
|
+
};
|
|
1249
|
+
var __defProp = Object.defineProperty;
|
|
1250
|
+
var __defProps = Object.defineProperties;
|
|
1251
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
1252
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1253
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1254
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1255
|
+
var __defNormalProp = function (obj, key, value) { return key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value }) : obj[key] = value; };
|
|
1256
|
+
var __spreadValues = function (a, b) {
|
|
1257
|
+
for (var prop in b || (b = {}))
|
|
1258
|
+
if (__hasOwnProp.call(b, prop))
|
|
1259
|
+
__defNormalProp(a, prop, b[prop]);
|
|
1260
|
+
if (__getOwnPropSymbols)
|
|
1261
|
+
for (var _i = 0, _c = __getOwnPropSymbols(b); _i < _c.length; _i++) {
|
|
1262
|
+
var prop = _c[_i];
|
|
1263
|
+
if (__propIsEnum.call(b, prop))
|
|
1264
|
+
__defNormalProp(a, prop, b[prop]);
|
|
1265
|
+
}
|
|
1266
|
+
return a;
|
|
1267
|
+
};
|
|
1268
|
+
var __spreadProps = function (a, b) { return __defProps(a, __getOwnPropDescs(b)); };
|
|
1269
|
+
var __async = function (__this, __arguments, generator) {
|
|
1270
|
+
return new Promise(function (resolve, reject) {
|
|
1271
|
+
var fulfilled = function (value) {
|
|
1272
|
+
try {
|
|
1273
|
+
step(generator.next(value));
|
|
1274
|
+
}
|
|
1275
|
+
catch (e) {
|
|
1276
|
+
reject(e);
|
|
1277
|
+
}
|
|
1278
|
+
};
|
|
1279
|
+
var rejected = function (value) {
|
|
1280
|
+
try {
|
|
1281
|
+
step(generator.throw(value));
|
|
1282
|
+
}
|
|
1283
|
+
catch (e) {
|
|
1284
|
+
reject(e);
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
var step = function (x) { return x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); };
|
|
1288
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1289
|
+
});
|
|
1290
|
+
};
|
|
1291
|
+
// src/createAction.ts
|
|
1292
|
+
function createAction(type, prepareAction) {
|
|
1293
|
+
function actionCreator() {
|
|
1294
|
+
var args = [];
|
|
1295
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1296
|
+
args[_i] = arguments[_i];
|
|
1297
|
+
}
|
|
1298
|
+
if (prepareAction) {
|
|
1299
|
+
var prepared = prepareAction.apply(void 0, args);
|
|
1300
|
+
if (!prepared) {
|
|
1301
|
+
throw new Error("prepareAction did not return an object");
|
|
1302
|
+
}
|
|
1303
|
+
return __spreadValues(__spreadValues({
|
|
1304
|
+
type: type,
|
|
1305
|
+
payload: prepared.payload
|
|
1306
|
+
}, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
|
|
1307
|
+
}
|
|
1308
|
+
return { type: type, payload: args[0] };
|
|
1309
|
+
}
|
|
1310
|
+
actionCreator.toString = function () { return "" + type; };
|
|
1311
|
+
actionCreator.type = type;
|
|
1312
|
+
actionCreator.match = function (action) { return action.type === type; };
|
|
1313
|
+
return actionCreator;
|
|
1314
|
+
}
|
|
1315
|
+
/** @class */ ((function (_super) {
|
|
1316
|
+
__extends(MiddlewareArray, _super);
|
|
1317
|
+
function MiddlewareArray() {
|
|
1318
|
+
var args = [];
|
|
1319
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1320
|
+
args[_i] = arguments[_i];
|
|
1321
|
+
}
|
|
1322
|
+
var _this = _super.apply(this, args) || this;
|
|
1323
|
+
Object.setPrototypeOf(_this, MiddlewareArray.prototype);
|
|
1324
|
+
return _this;
|
|
1325
|
+
}
|
|
1326
|
+
Object.defineProperty(MiddlewareArray, Symbol.species, {
|
|
1327
|
+
get: function () {
|
|
1328
|
+
return MiddlewareArray;
|
|
1329
|
+
},
|
|
1330
|
+
enumerable: false,
|
|
1331
|
+
configurable: true
|
|
1332
|
+
});
|
|
1333
|
+
MiddlewareArray.prototype.concat = function () {
|
|
1334
|
+
var arr = [];
|
|
1335
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1336
|
+
arr[_i] = arguments[_i];
|
|
1337
|
+
}
|
|
1338
|
+
return _super.prototype.concat.apply(this, arr);
|
|
1339
|
+
};
|
|
1340
|
+
MiddlewareArray.prototype.prepend = function () {
|
|
1341
|
+
var arr = [];
|
|
1342
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1343
|
+
arr[_i] = arguments[_i];
|
|
1344
|
+
}
|
|
1345
|
+
if (arr.length === 1 && Array.isArray(arr[0])) {
|
|
1346
|
+
return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr[0].concat(this))))();
|
|
1347
|
+
}
|
|
1348
|
+
return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr.concat(this))))();
|
|
1349
|
+
};
|
|
1350
|
+
return MiddlewareArray;
|
|
1351
|
+
})(Array));
|
|
1352
|
+
/** @class */ ((function (_super) {
|
|
1353
|
+
__extends(EnhancerArray, _super);
|
|
1354
|
+
function EnhancerArray() {
|
|
1355
|
+
var args = [];
|
|
1356
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1357
|
+
args[_i] = arguments[_i];
|
|
1358
|
+
}
|
|
1359
|
+
var _this = _super.apply(this, args) || this;
|
|
1360
|
+
Object.setPrototypeOf(_this, EnhancerArray.prototype);
|
|
1361
|
+
return _this;
|
|
1362
|
+
}
|
|
1363
|
+
Object.defineProperty(EnhancerArray, Symbol.species, {
|
|
1364
|
+
get: function () {
|
|
1365
|
+
return EnhancerArray;
|
|
1366
|
+
},
|
|
1367
|
+
enumerable: false,
|
|
1368
|
+
configurable: true
|
|
1369
|
+
});
|
|
1370
|
+
EnhancerArray.prototype.concat = function () {
|
|
1371
|
+
var arr = [];
|
|
1372
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1373
|
+
arr[_i] = arguments[_i];
|
|
1374
|
+
}
|
|
1375
|
+
return _super.prototype.concat.apply(this, arr);
|
|
1376
|
+
};
|
|
1377
|
+
EnhancerArray.prototype.prepend = function () {
|
|
1378
|
+
var arr = [];
|
|
1379
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1380
|
+
arr[_i] = arguments[_i];
|
|
1381
|
+
}
|
|
1382
|
+
if (arr.length === 1 && Array.isArray(arr[0])) {
|
|
1383
|
+
return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr[0].concat(this))))();
|
|
1384
|
+
}
|
|
1385
|
+
return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr.concat(this))))();
|
|
1386
|
+
};
|
|
1387
|
+
return EnhancerArray;
|
|
1388
|
+
})(Array));
|
|
1389
|
+
function freezeDraftable(val) {
|
|
1390
|
+
return t(val) ? fn(val, function () {
|
|
1391
|
+
}) : val;
|
|
1392
|
+
}
|
|
1393
|
+
// src/immutableStateInvariantMiddleware.ts
|
|
1394
|
+
process.env.NODE_ENV === "production";
|
|
1395
|
+
// src/configureStore.ts
|
|
1396
|
+
process.env.NODE_ENV === "production";
|
|
1397
|
+
// src/mapBuilders.ts
|
|
1398
|
+
function executeReducerBuilderCallback(builderCallback) {
|
|
1399
|
+
var actionsMap = {};
|
|
1400
|
+
var actionMatchers = [];
|
|
1401
|
+
var defaultCaseReducer;
|
|
1402
|
+
var builder = {
|
|
1403
|
+
addCase: function (typeOrActionCreator, reducer) {
|
|
1404
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1405
|
+
if (actionMatchers.length > 0) {
|
|
1406
|
+
throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");
|
|
1407
|
+
}
|
|
1408
|
+
if (defaultCaseReducer) {
|
|
1409
|
+
throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
var type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
1413
|
+
if (!type) {
|
|
1414
|
+
throw new Error("`builder.addCase` cannot be called with an empty action type");
|
|
1415
|
+
}
|
|
1416
|
+
if (type in actionsMap) {
|
|
1417
|
+
throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");
|
|
1418
|
+
}
|
|
1419
|
+
actionsMap[type] = reducer;
|
|
1420
|
+
return builder;
|
|
1421
|
+
},
|
|
1422
|
+
addMatcher: function (matcher, reducer) {
|
|
1423
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1424
|
+
if (defaultCaseReducer) {
|
|
1425
|
+
throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
actionMatchers.push({ matcher: matcher, reducer: reducer });
|
|
1429
|
+
return builder;
|
|
1430
|
+
},
|
|
1431
|
+
addDefaultCase: function (reducer) {
|
|
1432
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1433
|
+
if (defaultCaseReducer) {
|
|
1434
|
+
throw new Error("`builder.addDefaultCase` can only be called once");
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
defaultCaseReducer = reducer;
|
|
1438
|
+
return builder;
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
builderCallback(builder);
|
|
1442
|
+
return [actionsMap, actionMatchers, defaultCaseReducer];
|
|
1443
|
+
}
|
|
1444
|
+
// src/createReducer.ts
|
|
1445
|
+
function isStateFunction(x) {
|
|
1446
|
+
return typeof x === "function";
|
|
1447
|
+
}
|
|
1448
|
+
var hasWarnedAboutObjectNotation = false;
|
|
1449
|
+
function createReducer(initialState, mapOrBuilderCallback, actionMatchers, defaultCaseReducer) {
|
|
1450
|
+
if (actionMatchers === void 0) { actionMatchers = []; }
|
|
1451
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1452
|
+
if (typeof mapOrBuilderCallback === "object") {
|
|
1453
|
+
if (!hasWarnedAboutObjectNotation) {
|
|
1454
|
+
hasWarnedAboutObjectNotation = true;
|
|
1455
|
+
console.warn("The object notation for `createReducer` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
var _c = typeof mapOrBuilderCallback === "function" ? executeReducerBuilderCallback(mapOrBuilderCallback) : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer], actionsMap = _c[0], finalActionMatchers = _c[1], finalDefaultCaseReducer = _c[2];
|
|
1460
|
+
var getInitialState;
|
|
1461
|
+
if (isStateFunction(initialState)) {
|
|
1462
|
+
getInitialState = function () { return freezeDraftable(initialState()); };
|
|
1463
|
+
}
|
|
1464
|
+
else {
|
|
1465
|
+
var frozenInitialState_1 = freezeDraftable(initialState);
|
|
1466
|
+
getInitialState = function () { return frozenInitialState_1; };
|
|
1467
|
+
}
|
|
1468
|
+
function reducer(state, action) {
|
|
1469
|
+
if (state === void 0) { state = getInitialState(); }
|
|
1470
|
+
var caseReducers = __spreadArray([
|
|
1471
|
+
actionsMap[action.type]
|
|
1472
|
+
], finalActionMatchers.filter(function (_c) {
|
|
1473
|
+
var matcher = _c.matcher;
|
|
1474
|
+
return matcher(action);
|
|
1475
|
+
}).map(function (_c) {
|
|
1476
|
+
var reducer2 = _c.reducer;
|
|
1477
|
+
return reducer2;
|
|
1478
|
+
}));
|
|
1479
|
+
if (caseReducers.filter(function (cr) { return !!cr; }).length === 0) {
|
|
1480
|
+
caseReducers = [finalDefaultCaseReducer];
|
|
1481
|
+
}
|
|
1482
|
+
return caseReducers.reduce(function (previousState, caseReducer) {
|
|
1483
|
+
if (caseReducer) {
|
|
1484
|
+
if (r(previousState)) {
|
|
1485
|
+
var draft = previousState;
|
|
1486
|
+
var result = caseReducer(draft, action);
|
|
1487
|
+
if (result === void 0) {
|
|
1488
|
+
return previousState;
|
|
1489
|
+
}
|
|
1490
|
+
return result;
|
|
1491
|
+
}
|
|
1492
|
+
else if (!t(previousState)) {
|
|
1493
|
+
var result = caseReducer(previousState, action);
|
|
1494
|
+
if (result === void 0) {
|
|
1495
|
+
if (previousState === null) {
|
|
1496
|
+
return previousState;
|
|
1497
|
+
}
|
|
1498
|
+
throw Error("A case reducer on a non-draftable value must not return undefined");
|
|
1499
|
+
}
|
|
1500
|
+
return result;
|
|
1501
|
+
}
|
|
1502
|
+
else {
|
|
1503
|
+
return fn(previousState, function (draft) {
|
|
1504
|
+
return caseReducer(draft, action);
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
return previousState;
|
|
1509
|
+
}, state);
|
|
1510
|
+
}
|
|
1511
|
+
reducer.getInitialState = getInitialState;
|
|
1512
|
+
return reducer;
|
|
1513
|
+
}
|
|
1514
|
+
// src/createSlice.ts
|
|
1515
|
+
var hasWarnedAboutObjectNotation2 = false;
|
|
1516
|
+
function getType2(slice, actionKey) {
|
|
1517
|
+
return slice + "/" + actionKey;
|
|
1518
|
+
}
|
|
1519
|
+
function createSlice(options) {
|
|
1520
|
+
var name = options.name;
|
|
1521
|
+
if (!name) {
|
|
1522
|
+
throw new Error("`name` is a required option for createSlice");
|
|
1523
|
+
}
|
|
1524
|
+
if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1525
|
+
if (options.initialState === void 0) {
|
|
1526
|
+
console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
var initialState = typeof options.initialState == "function" ? options.initialState : freezeDraftable(options.initialState);
|
|
1530
|
+
var reducers = options.reducers || {};
|
|
1531
|
+
var reducerNames = Object.keys(reducers);
|
|
1532
|
+
var sliceCaseReducersByName = {};
|
|
1533
|
+
var sliceCaseReducersByType = {};
|
|
1534
|
+
var actionCreators = {};
|
|
1535
|
+
reducerNames.forEach(function (reducerName) {
|
|
1536
|
+
var maybeReducerWithPrepare = reducers[reducerName];
|
|
1537
|
+
var type = getType2(name, reducerName);
|
|
1538
|
+
var caseReducer;
|
|
1539
|
+
var prepareCallback;
|
|
1540
|
+
if ("reducer" in maybeReducerWithPrepare) {
|
|
1541
|
+
caseReducer = maybeReducerWithPrepare.reducer;
|
|
1542
|
+
prepareCallback = maybeReducerWithPrepare.prepare;
|
|
1543
|
+
}
|
|
1544
|
+
else {
|
|
1545
|
+
caseReducer = maybeReducerWithPrepare;
|
|
1546
|
+
}
|
|
1547
|
+
sliceCaseReducersByName[reducerName] = caseReducer;
|
|
1548
|
+
sliceCaseReducersByType[type] = caseReducer;
|
|
1549
|
+
actionCreators[reducerName] = prepareCallback ? createAction(type, prepareCallback) : createAction(type);
|
|
1550
|
+
});
|
|
1551
|
+
function buildReducer() {
|
|
1552
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1553
|
+
if (typeof options.extraReducers === "object") {
|
|
1554
|
+
if (!hasWarnedAboutObjectNotation2) {
|
|
1555
|
+
hasWarnedAboutObjectNotation2 = true;
|
|
1556
|
+
console.warn("The object notation for `createSlice.extraReducers` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
var _c = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers], _d = _c[0], extraReducers = _d === void 0 ? {} : _d, _e = _c[1], actionMatchers = _e === void 0 ? [] : _e, _f = _c[2], defaultCaseReducer = _f === void 0 ? void 0 : _f;
|
|
1561
|
+
var finalCaseReducers = __spreadValues(__spreadValues({}, extraReducers), sliceCaseReducersByType);
|
|
1562
|
+
return createReducer(initialState, function (builder) {
|
|
1563
|
+
for (var key in finalCaseReducers) {
|
|
1564
|
+
builder.addCase(key, finalCaseReducers[key]);
|
|
1565
|
+
}
|
|
1566
|
+
for (var _i = 0, actionMatchers_1 = actionMatchers; _i < actionMatchers_1.length; _i++) {
|
|
1567
|
+
var m = actionMatchers_1[_i];
|
|
1568
|
+
builder.addMatcher(m.matcher, m.reducer);
|
|
1569
|
+
}
|
|
1570
|
+
if (defaultCaseReducer) {
|
|
1571
|
+
builder.addDefaultCase(defaultCaseReducer);
|
|
1572
|
+
}
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
var _reducer;
|
|
1576
|
+
return {
|
|
1577
|
+
name: name,
|
|
1578
|
+
reducer: function (state, action) {
|
|
1579
|
+
if (!_reducer)
|
|
1580
|
+
_reducer = buildReducer();
|
|
1581
|
+
return _reducer(state, action);
|
|
1582
|
+
},
|
|
1583
|
+
actions: actionCreators,
|
|
1584
|
+
caseReducers: sliceCaseReducersByName,
|
|
1585
|
+
getInitialState: function () {
|
|
1586
|
+
if (!_reducer)
|
|
1587
|
+
_reducer = buildReducer();
|
|
1588
|
+
return _reducer.getInitialState();
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1592
|
+
// src/nanoid.ts
|
|
1593
|
+
var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
|
|
1594
|
+
var nanoid = function (size) {
|
|
1595
|
+
if (size === void 0) { size = 21; }
|
|
1596
|
+
var id = "";
|
|
1597
|
+
var i = size;
|
|
1598
|
+
while (i--) {
|
|
1599
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
1600
|
+
}
|
|
1601
|
+
return id;
|
|
1602
|
+
};
|
|
1603
|
+
// src/createAsyncThunk.ts
|
|
1604
|
+
var commonProperties = [
|
|
1605
|
+
"name",
|
|
1606
|
+
"message",
|
|
1607
|
+
"stack",
|
|
1608
|
+
"code"
|
|
1609
|
+
];
|
|
1610
|
+
var RejectWithValue = /** @class */ (function () {
|
|
1611
|
+
function RejectWithValue(payload, meta) {
|
|
1612
|
+
this.payload = payload;
|
|
1613
|
+
this.meta = meta;
|
|
1614
|
+
}
|
|
1615
|
+
return RejectWithValue;
|
|
1616
|
+
}());
|
|
1617
|
+
var FulfillWithMeta = /** @class */ (function () {
|
|
1618
|
+
function FulfillWithMeta(payload, meta) {
|
|
1619
|
+
this.payload = payload;
|
|
1620
|
+
this.meta = meta;
|
|
1621
|
+
}
|
|
1622
|
+
return FulfillWithMeta;
|
|
1623
|
+
}());
|
|
1624
|
+
var miniSerializeError = function (value) {
|
|
1625
|
+
if (typeof value === "object" && value !== null) {
|
|
1626
|
+
var simpleError = {};
|
|
1627
|
+
for (var _i = 0, commonProperties_1 = commonProperties; _i < commonProperties_1.length; _i++) {
|
|
1628
|
+
var property = commonProperties_1[_i];
|
|
1629
|
+
if (typeof value[property] === "string") {
|
|
1630
|
+
simpleError[property] = value[property];
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
return simpleError;
|
|
1634
|
+
}
|
|
1635
|
+
return { message: String(value) };
|
|
1636
|
+
};
|
|
1637
|
+
((function () {
|
|
1638
|
+
function createAsyncThunk2(typePrefix, payloadCreator, options) {
|
|
1639
|
+
var fulfilled = createAction(typePrefix + "/fulfilled", function (payload, requestId, arg, meta) { return ({
|
|
1640
|
+
payload: payload,
|
|
1641
|
+
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
1642
|
+
arg: arg,
|
|
1643
|
+
requestId: requestId,
|
|
1644
|
+
requestStatus: "fulfilled"
|
|
1645
|
+
})
|
|
1646
|
+
}); });
|
|
1647
|
+
var pending = createAction(typePrefix + "/pending", function (requestId, arg, meta) { return ({
|
|
1648
|
+
payload: void 0,
|
|
1649
|
+
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
1650
|
+
arg: arg,
|
|
1651
|
+
requestId: requestId,
|
|
1652
|
+
requestStatus: "pending"
|
|
1653
|
+
})
|
|
1654
|
+
}); });
|
|
1655
|
+
var rejected = createAction(typePrefix + "/rejected", function (error, requestId, arg, payload, meta) { return ({
|
|
1656
|
+
payload: payload,
|
|
1657
|
+
error: (options && options.serializeError || miniSerializeError)(error || "Rejected"),
|
|
1658
|
+
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
1659
|
+
arg: arg,
|
|
1660
|
+
requestId: requestId,
|
|
1661
|
+
rejectedWithValue: !!payload,
|
|
1662
|
+
requestStatus: "rejected",
|
|
1663
|
+
aborted: (error == null ? void 0 : error.name) === "AbortError",
|
|
1664
|
+
condition: (error == null ? void 0 : error.name) === "ConditionError"
|
|
1665
|
+
})
|
|
1666
|
+
}); });
|
|
1667
|
+
var displayedWarning = false;
|
|
1668
|
+
var AC = typeof AbortController !== "undefined" ? AbortController : /** @class */ (function () {
|
|
1669
|
+
function class_1() {
|
|
1670
|
+
this.signal = {
|
|
1671
|
+
aborted: false,
|
|
1672
|
+
addEventListener: function () {
|
|
1673
|
+
},
|
|
1674
|
+
dispatchEvent: function () {
|
|
1675
|
+
return false;
|
|
1676
|
+
},
|
|
1677
|
+
onabort: function () {
|
|
1678
|
+
},
|
|
1679
|
+
removeEventListener: function () {
|
|
1680
|
+
},
|
|
1681
|
+
reason: void 0,
|
|
1682
|
+
throwIfAborted: function () {
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
class_1.prototype.abort = function () {
|
|
1687
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1688
|
+
if (!displayedWarning) {
|
|
1689
|
+
displayedWarning = true;
|
|
1690
|
+
console.info("This platform does not implement AbortController. \nIf you want to use the AbortController to react to `abort` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'.");
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
return class_1;
|
|
1695
|
+
}());
|
|
1696
|
+
function actionCreator(arg) {
|
|
1697
|
+
return function (dispatch, getState, extra) {
|
|
1698
|
+
var requestId = (options == null ? void 0 : options.idGenerator) ? options.idGenerator(arg) : nanoid();
|
|
1699
|
+
var abortController = new AC();
|
|
1700
|
+
var abortReason;
|
|
1701
|
+
function abort(reason) {
|
|
1702
|
+
abortReason = reason;
|
|
1703
|
+
abortController.abort();
|
|
1704
|
+
}
|
|
1705
|
+
var promise2 = function () {
|
|
1706
|
+
return __async(this, null, function () {
|
|
1707
|
+
var _a, _b, finalAction, conditionResult, abortedPromise, err_1, skipDispatch;
|
|
1708
|
+
return __generator(this, function (_c) {
|
|
1709
|
+
switch (_c.label) {
|
|
1710
|
+
case 0:
|
|
1711
|
+
_c.trys.push([0, 4, , 5]);
|
|
1712
|
+
conditionResult = (_a = options == null ? void 0 : options.condition) == null ? void 0 : _a.call(options, arg, { getState: getState, extra: extra });
|
|
1713
|
+
if (!isThenable(conditionResult)) return [3 /*break*/, 2];
|
|
1714
|
+
return [4 /*yield*/, conditionResult];
|
|
1715
|
+
case 1:
|
|
1716
|
+
conditionResult = _c.sent();
|
|
1717
|
+
_c.label = 2;
|
|
1718
|
+
case 2:
|
|
1719
|
+
if (conditionResult === false || abortController.signal.aborted) {
|
|
1720
|
+
throw {
|
|
1721
|
+
name: "ConditionError",
|
|
1722
|
+
message: "Aborted due to condition callback returning false."
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1725
|
+
abortedPromise = new Promise(function (_, reject) { return abortController.signal.addEventListener("abort", function () { return reject({
|
|
1726
|
+
name: "AbortError",
|
|
1727
|
+
message: abortReason || "Aborted"
|
|
1728
|
+
}); }); });
|
|
1729
|
+
dispatch(pending(requestId, arg, (_b = options == null ? void 0 : options.getPendingMeta) == null ? void 0 : _b.call(options, { requestId: requestId, arg: arg }, { getState: getState, extra: extra })));
|
|
1730
|
+
return [4 /*yield*/, Promise.race([
|
|
1731
|
+
abortedPromise,
|
|
1732
|
+
Promise.resolve(payloadCreator(arg, {
|
|
1733
|
+
dispatch: dispatch,
|
|
1734
|
+
getState: getState,
|
|
1735
|
+
extra: extra,
|
|
1736
|
+
requestId: requestId,
|
|
1737
|
+
signal: abortController.signal,
|
|
1738
|
+
abort: abort,
|
|
1739
|
+
rejectWithValue: function (value, meta) {
|
|
1740
|
+
return new RejectWithValue(value, meta);
|
|
1741
|
+
},
|
|
1742
|
+
fulfillWithValue: function (value, meta) {
|
|
1743
|
+
return new FulfillWithMeta(value, meta);
|
|
1744
|
+
}
|
|
1745
|
+
})).then(function (result) {
|
|
1746
|
+
if (result instanceof RejectWithValue) {
|
|
1747
|
+
throw result;
|
|
1748
|
+
}
|
|
1749
|
+
if (result instanceof FulfillWithMeta) {
|
|
1750
|
+
return fulfilled(result.payload, requestId, arg, result.meta);
|
|
1751
|
+
}
|
|
1752
|
+
return fulfilled(result, requestId, arg);
|
|
1753
|
+
})
|
|
1754
|
+
])];
|
|
1755
|
+
case 3:
|
|
1756
|
+
finalAction = _c.sent();
|
|
1757
|
+
return [3 /*break*/, 5];
|
|
1758
|
+
case 4:
|
|
1759
|
+
err_1 = _c.sent();
|
|
1760
|
+
finalAction = err_1 instanceof RejectWithValue ? rejected(null, requestId, arg, err_1.payload, err_1.meta) : rejected(err_1, requestId, arg);
|
|
1761
|
+
return [3 /*break*/, 5];
|
|
1762
|
+
case 5:
|
|
1763
|
+
skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition;
|
|
1764
|
+
if (!skipDispatch) {
|
|
1765
|
+
dispatch(finalAction);
|
|
1766
|
+
}
|
|
1767
|
+
return [2 /*return*/, finalAction];
|
|
1768
|
+
}
|
|
1769
|
+
});
|
|
1770
|
+
});
|
|
1771
|
+
}();
|
|
1772
|
+
return Object.assign(promise2, {
|
|
1773
|
+
abort: abort,
|
|
1774
|
+
requestId: requestId,
|
|
1775
|
+
arg: arg,
|
|
1776
|
+
unwrap: function () {
|
|
1777
|
+
return promise2.then(unwrapResult);
|
|
1778
|
+
}
|
|
1779
|
+
});
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1782
|
+
return Object.assign(actionCreator, {
|
|
1783
|
+
pending: pending,
|
|
1784
|
+
rejected: rejected,
|
|
1785
|
+
fulfilled: fulfilled,
|
|
1786
|
+
typePrefix: typePrefix
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
createAsyncThunk2.withTypes = function () { return createAsyncThunk2; };
|
|
1790
|
+
return createAsyncThunk2;
|
|
1791
|
+
}))();
|
|
1792
|
+
function unwrapResult(action) {
|
|
1793
|
+
if (action.meta && action.meta.rejectedWithValue) {
|
|
1794
|
+
throw action.payload;
|
|
1795
|
+
}
|
|
1796
|
+
if (action.error) {
|
|
1797
|
+
throw action.error;
|
|
1798
|
+
}
|
|
1799
|
+
return action.payload;
|
|
1800
|
+
}
|
|
1801
|
+
function isThenable(value) {
|
|
1802
|
+
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
1803
|
+
}
|
|
1804
|
+
var alm = "listenerMiddleware";
|
|
1805
|
+
createAction(alm + "/add");
|
|
1806
|
+
createAction(alm + "/removeAll");
|
|
1807
|
+
createAction(alm + "/remove");
|
|
1808
|
+
var promise;
|
|
1809
|
+
typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : globalThis) : function (cb) { return (promise || (promise = Promise.resolve())).then(cb).catch(function (err) { return setTimeout(function () {
|
|
1810
|
+
throw err;
|
|
1811
|
+
}, 0); }); };
|
|
1812
|
+
// src/index.ts
|
|
1813
|
+
F();
|
|
1814
|
+
|
|
1815
|
+
const initialState$1 = {
|
|
1816
|
+
config: {},
|
|
1817
|
+
metrics: {},
|
|
1818
|
+
unlockedAchievements: [],
|
|
1819
|
+
storageKey: null,
|
|
1820
|
+
};
|
|
1821
|
+
const achievementSlice = createSlice({
|
|
1822
|
+
name: 'achievements',
|
|
1823
|
+
initialState: initialState$1,
|
|
1824
|
+
reducers: {
|
|
1825
|
+
initialize: (state, action) => {
|
|
1826
|
+
var _a, _b;
|
|
1827
|
+
state.config = action.payload.config;
|
|
1828
|
+
state.storageKey = action.payload.storageKey;
|
|
1829
|
+
const storedState = action.payload.storageKey ? localStorage.getItem(action.payload.storageKey) : null;
|
|
1830
|
+
if (storedState) {
|
|
1831
|
+
try {
|
|
1832
|
+
const parsedState = JSON.parse(storedState);
|
|
1833
|
+
state.metrics = ((_a = parsedState.achievements) === null || _a === void 0 ? void 0 : _a.metrics) || {};
|
|
1834
|
+
state.unlockedAchievements = ((_b = parsedState.achievements) === null || _b === void 0 ? void 0 : _b.unlockedAchievements) || [];
|
|
1835
|
+
}
|
|
1836
|
+
catch (error) {
|
|
1837
|
+
console.error('Error parsing stored achievement state:', error);
|
|
1838
|
+
state.metrics = action.payload.initialState ? Object.keys(action.payload.initialState).reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: Array.isArray(action.payload.initialState[key]) ? action.payload.initialState[key] : [action.payload.initialState[key]] })), {}) : {};
|
|
1839
|
+
state.unlockedAchievements = [];
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
else {
|
|
1843
|
+
state.metrics = action.payload.initialState ? Object.keys(action.payload.initialState).reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: Array.isArray(action.payload.initialState[key]) ? action.payload.initialState[key] : [action.payload.initialState[key]] })), {}) : {};
|
|
1844
|
+
state.unlockedAchievements = [];
|
|
1845
|
+
}
|
|
1846
|
+
},
|
|
1847
|
+
setMetrics: (state, action) => {
|
|
1848
|
+
state.metrics = action.payload;
|
|
1849
|
+
if (state.storageKey) {
|
|
1850
|
+
localStorage.setItem(state.storageKey, JSON.stringify({ achievements: { metrics: state.metrics, unlockedAchievements: state.unlockedAchievements } }));
|
|
1851
|
+
}
|
|
1852
|
+
},
|
|
1853
|
+
unlockAchievement: (state, action) => {
|
|
1854
|
+
if (!state.unlockedAchievements.includes(action.payload)) {
|
|
1855
|
+
state.unlockedAchievements.push(action.payload);
|
|
1856
|
+
if (state.storageKey) {
|
|
1857
|
+
localStorage.setItem(state.storageKey, JSON.stringify({ achievements: { metrics: state.metrics, unlockedAchievements: state.unlockedAchievements } }));
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
},
|
|
1861
|
+
resetAchievements: (state) => {
|
|
1862
|
+
state.metrics = {};
|
|
1863
|
+
state.unlockedAchievements = [];
|
|
1864
|
+
if (state.storageKey) {
|
|
1865
|
+
localStorage.removeItem(state.storageKey);
|
|
1866
|
+
}
|
|
1867
|
+
},
|
|
1868
|
+
},
|
|
1869
|
+
});
|
|
1870
|
+
const { initialize, setMetrics, unlockAchievement, resetAchievements } = achievementSlice.actions;
|
|
1871
|
+
var achievementSlice$1 = achievementSlice.reducer;
|
|
1872
|
+
|
|
1873
|
+
const initialState = {
|
|
1874
|
+
notifications: [],
|
|
1875
|
+
};
|
|
1876
|
+
const notificationSlice = createSlice({
|
|
1877
|
+
name: 'notifications',
|
|
1878
|
+
initialState,
|
|
1879
|
+
reducers: {
|
|
1880
|
+
addNotification: (state, action) => {
|
|
1881
|
+
state.notifications.push(action.payload);
|
|
1882
|
+
},
|
|
1883
|
+
clearNotifications: (state) => {
|
|
1884
|
+
state.notifications = [];
|
|
1885
|
+
},
|
|
1886
|
+
},
|
|
1887
|
+
});
|
|
1888
|
+
const { addNotification, clearNotifications } = notificationSlice.actions;
|
|
1889
|
+
var notificationSlice$1 = notificationSlice.reducer;
|
|
2
1890
|
|
|
3
1891
|
const defaultStyles = {
|
|
4
1892
|
achievementModal: {
|
|
@@ -111,51 +1999,154 @@ const defaultStyles = {
|
|
|
111
1999
|
},
|
|
112
2000
|
};
|
|
113
2001
|
|
|
114
|
-
|
|
2002
|
+
// src/defaultIcons.ts
|
|
2003
|
+
const defaultAchievementIcons = {
|
|
2004
|
+
// General Progress & Milestones
|
|
2005
|
+
levelUp: '🏆',
|
|
2006
|
+
questComplete: '📜',
|
|
2007
|
+
monsterDefeated: '⚔️',
|
|
2008
|
+
itemCollected: '📦',
|
|
2009
|
+
challengeCompleted: '🏁',
|
|
2010
|
+
milestoneReached: '🏅',
|
|
2011
|
+
firstStep: '👣',
|
|
2012
|
+
newBeginnings: '🌱',
|
|
2013
|
+
breakthrough: '💡',
|
|
2014
|
+
growth: '📈',
|
|
2015
|
+
// Social & Engagement
|
|
2016
|
+
shared: '🔗',
|
|
2017
|
+
liked: '❤️',
|
|
2018
|
+
commented: '💬',
|
|
2019
|
+
followed: '👥',
|
|
2020
|
+
invited: '🤝',
|
|
2021
|
+
communityMember: '🏘️',
|
|
2022
|
+
supporter: '🌟',
|
|
2023
|
+
connected: '🌐',
|
|
2024
|
+
participant: '🙋',
|
|
2025
|
+
influencer: '📣',
|
|
2026
|
+
// Time & Activity
|
|
2027
|
+
activeDay: '☀️',
|
|
2028
|
+
activeWeek: '📅',
|
|
2029
|
+
activeMonth: '🗓️',
|
|
2030
|
+
earlyBird: '⏰',
|
|
2031
|
+
nightOwl: '🌙',
|
|
2032
|
+
streak: '🔥',
|
|
2033
|
+
dedicated: '⏳',
|
|
2034
|
+
punctual: '⏱️',
|
|
2035
|
+
consistent: '🔄',
|
|
2036
|
+
marathon: '🏃',
|
|
2037
|
+
// Creativity & Skill
|
|
2038
|
+
artist: '🎨',
|
|
2039
|
+
writer: '✍️',
|
|
2040
|
+
innovator: '🔬',
|
|
2041
|
+
creator: '🛠️',
|
|
2042
|
+
expert: '🎓',
|
|
2043
|
+
master: '👑',
|
|
2044
|
+
pioneer: '🚀',
|
|
2045
|
+
performer: '🎭',
|
|
2046
|
+
thinker: '🧠',
|
|
2047
|
+
explorer: '🗺️',
|
|
2048
|
+
// Achievement Types
|
|
2049
|
+
bronze: '🥉',
|
|
2050
|
+
silver: '🥈',
|
|
2051
|
+
gold: '🥇',
|
|
2052
|
+
diamond: '💎',
|
|
2053
|
+
legendary: '✨',
|
|
2054
|
+
epic: '💥',
|
|
2055
|
+
rare: '🔮',
|
|
2056
|
+
common: '🔘',
|
|
2057
|
+
special: '🎁',
|
|
2058
|
+
hidden: '❓',
|
|
2059
|
+
// Numbers & Counters
|
|
2060
|
+
one: '1️⃣',
|
|
2061
|
+
ten: '🔟',
|
|
2062
|
+
hundred: '💯',
|
|
2063
|
+
thousand: '🔢',
|
|
2064
|
+
// Actions & Interactions
|
|
2065
|
+
clicked: '🖱️',
|
|
2066
|
+
used: '🔑',
|
|
2067
|
+
found: '🔍',
|
|
2068
|
+
built: '🧱',
|
|
2069
|
+
solved: '🧩',
|
|
2070
|
+
discovered: '🔭',
|
|
2071
|
+
unlocked: '🔓',
|
|
2072
|
+
upgraded: '⬆️',
|
|
2073
|
+
repaired: '🔧',
|
|
2074
|
+
defended: '🛡️',
|
|
2075
|
+
// Placeholders
|
|
2076
|
+
default: '⭐', // A fallback icon
|
|
2077
|
+
loading: '⏳',
|
|
2078
|
+
error: '⚠️',
|
|
2079
|
+
success: '✅',
|
|
2080
|
+
failure: '❌',
|
|
2081
|
+
// Miscellaneous
|
|
2082
|
+
trophy: '🏆',
|
|
2083
|
+
star: '⭐',
|
|
2084
|
+
flag: '🚩',
|
|
2085
|
+
puzzle: '🧩',
|
|
2086
|
+
gem: '💎',
|
|
2087
|
+
crown: '👑',
|
|
2088
|
+
medal: '🏅',
|
|
2089
|
+
ribbon: '🎗️',
|
|
2090
|
+
badge: '🎖️',
|
|
2091
|
+
shield: '🛡️',
|
|
2092
|
+
};
|
|
2093
|
+
|
|
2094
|
+
const AchievementModal = ({ isOpen, achievement, onClose, styles, icons = {} }) => {
|
|
115
2095
|
if (!isOpen || !achievement)
|
|
116
2096
|
return null;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
2097
|
+
const mergedIcons = Object.assign(Object.assign({}, defaultAchievementIcons), icons);
|
|
2098
|
+
const iconToDisplay = (achievement === null || achievement === void 0 ? void 0 : achievement.achievementIconKey) ? (mergedIcons[achievement.achievementIconKey] || mergedIcons.default) : mergedIcons.default;
|
|
2099
|
+
return (React__default.createElement("div", { style: Object.assign(Object.assign({}, styles.overlay), { display: 'flex', justifyContent: 'center', alignItems: 'center', position: 'fixed', top: 0, left: 0, width: '100%', height: '100%', backgroundColor: 'rgba(0, 0, 0, 0.5)' }) },
|
|
2100
|
+
React__default.createElement("div", { style: Object.assign(Object.assign({}, styles.content), { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', padding: '20px', borderRadius: '8px', backgroundColor: 'white' }) },
|
|
2101
|
+
React__default.createElement("h2", { style: styles.title }, "Achievement Unlocked!"),
|
|
2102
|
+
iconToDisplay.startsWith('http') || iconToDisplay.startsWith('data:image') ? (React__default.createElement("img", { src: iconToDisplay, alt: achievement.achievementTitle, style: styles.icon })) : (React__default.createElement("p", { style: { fontSize: '3em' } }, iconToDisplay)),
|
|
2103
|
+
React__default.createElement("h3", { style: styles.title }, achievement.achievementTitle),
|
|
2104
|
+
React__default.createElement("p", { style: styles.description }, achievement.achievementDescription),
|
|
2105
|
+
React__default.createElement("button", { onClick: onClose, style: styles.button }, "Okay"))));
|
|
124
2106
|
};
|
|
125
|
-
var AchievementModal$1 =
|
|
2107
|
+
var AchievementModal$1 = React__default.memo(AchievementModal);
|
|
126
2108
|
|
|
127
|
-
const BadgesModal = ({ isOpen, achievements, onClose, styles }) => {
|
|
2109
|
+
const BadgesModal = ({ isOpen, achievements, onClose, styles, icons = {} }) => {
|
|
128
2110
|
if (!isOpen)
|
|
129
2111
|
return null;
|
|
130
|
-
return (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
2112
|
+
return (React__default.createElement("div", { style: styles.overlay },
|
|
2113
|
+
React__default.createElement("div", { style: styles.content },
|
|
2114
|
+
React__default.createElement("h2", { style: styles.title }, "Your Achievements"),
|
|
2115
|
+
React__default.createElement("div", { style: styles.badgeContainer }, achievements.map((achievement) => {
|
|
2116
|
+
const mergedIcons = Object.assign(Object.assign({}, defaultAchievementIcons), icons);
|
|
2117
|
+
let iconToDisplay = mergedIcons.default;
|
|
2118
|
+
if (achievement.achievementIconKey && mergedIcons[achievement.achievementIconKey]) {
|
|
2119
|
+
iconToDisplay = mergedIcons[achievement.achievementIconKey];
|
|
2120
|
+
}
|
|
2121
|
+
return (React__default.createElement("div", { key: achievement.achievementId, style: styles.badge },
|
|
2122
|
+
iconToDisplay.startsWith('http') || iconToDisplay.startsWith('data:image') ? (React__default.createElement("img", { src: iconToDisplay, alt: achievement.achievementTitle, style: styles.badgeIcon })) : (React__default.createElement("p", { style: { fontSize: '2em' } }, iconToDisplay) // Render Unicode as large text
|
|
2123
|
+
),
|
|
2124
|
+
React__default.createElement("span", { style: styles.badgeTitle }, achievement.achievementTitle)));
|
|
2125
|
+
})),
|
|
2126
|
+
React__default.createElement("button", { onClick: onClose, style: styles.button }, "Close"))));
|
|
137
2127
|
};
|
|
138
|
-
var BadgesModal$1 =
|
|
2128
|
+
var BadgesModal$1 = React__default.memo(BadgesModal);
|
|
139
2129
|
|
|
140
|
-
const BadgesButton = ({ onClick, position, styles }) => {
|
|
141
|
-
const positionStyle =
|
|
142
|
-
|
|
143
|
-
|
|
2130
|
+
const BadgesButton = ({ onClick, position, styles, unlockedAchievements, icon, drawer = false, customStyles, }) => {
|
|
2131
|
+
const positionStyle = position
|
|
2132
|
+
? {
|
|
2133
|
+
[position.split('-')[0]]: '20px',
|
|
2134
|
+
[position.split('-')[1]]: '20px',
|
|
2135
|
+
}
|
|
2136
|
+
: {};
|
|
2137
|
+
const handleButtonClick = () => {
|
|
2138
|
+
onClick();
|
|
144
2139
|
};
|
|
145
|
-
|
|
2140
|
+
const achievementsText = 'View Achievements';
|
|
2141
|
+
const buttonContent = icon ? icon : achievementsText;
|
|
2142
|
+
return (React__default.createElement("button", { onClick: handleButtonClick, style: Object.assign(Object.assign(Object.assign({}, styles), positionStyle), customStyles) }, buttonContent));
|
|
146
2143
|
};
|
|
147
|
-
var BadgesButton$1 =
|
|
148
|
-
|
|
149
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
150
|
-
|
|
151
|
-
function getDefaultExportFromCjs (x) {
|
|
152
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
153
|
-
}
|
|
2144
|
+
var BadgesButton$1 = React__default.memo(BadgesButton);
|
|
154
2145
|
|
|
155
2146
|
var reactConfetti_min = {exports: {}};
|
|
156
2147
|
|
|
157
2148
|
(function (module, exports) {
|
|
158
|
-
!function(t,e){module.exports=e(React);}("undefined"!=typeof self?self:commonjsGlobal,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r});},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0});},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(e,n){e.exports=t;},function(t,e,n){var r={linear:function(t,e,n,r){return (n-e)*t/r+e},easeInQuad:function(t,e,n,r){return (n-e)*(t/=r)*t+e},easeOutQuad:function(t,e,n,r){return -(n-e)*(t/=r)*(t-2)+e},easeInOutQuad:function(t,e,n,r){var i=n-e;return (t/=r/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,n,r){return (n-e)*(t/=r)*t*t+e},easeOutCubic:function(t,e,n,r){return (n-e)*((t=t/r-1)*t*t+1)+e},easeInOutCubic:function(t,e,n,r){var i=n-e;return (t/=r/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,n,r){return (n-e)*(t/=r)*t*t*t+e},easeOutQuart:function(t,e,n,r){return -(n-e)*((t=t/r-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,n,r){var i=n-e;return (t/=r/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,n,r){return (n-e)*(t/=r)*t*t*t*t+e},easeOutQuint:function(t,e,n,r){return (n-e)*((t=t/r-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,n,r){var i=n-e;return (t/=r/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,n,r){var i=n-e;return -i*Math.cos(t/r*(Math.PI/2))+i+e},easeOutSine:function(t,e,n,r){return (n-e)*Math.sin(t/r*(Math.PI/2))+e},easeInOutSine:function(t,e,n,r){return -(n-e)/2*(Math.cos(Math.PI*t/r)-1)+e},easeInExpo:function(t,e,n,r){return 0==t?e:(n-e)*Math.pow(2,10*(t/r-1))+e},easeOutExpo:function(t,e,n,r){var i=n-e;return t==r?e+i:i*(1-Math.pow(2,-10*t/r))+e},easeInOutExpo:function(t,e,n,r){var i=n-e;return 0===t?e:t===r?e+i:(t/=r/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,n,r){return -(n-e)*(Math.sqrt(1-(t/=r)*t)-1)+e},easeOutCirc:function(t,e,n,r){return (n-e)*Math.sqrt(1-(t=t/r-1)*t)+e},easeInOutCirc:function(t,e,n,r){var i=n-e;return (t/=r/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(t,e,n,r){var i,o,a,c=n-e;return a=1.70158,0===t?e:1==(t/=r)?e+c:((o=0)||(o=.3*r),(i=c)<Math.abs(c)?(i=c,a=o/4):a=o/(2*Math.PI)*Math.asin(c/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t*r-a)*(2*Math.PI)/o)+e)},easeOutElastic:function(t,e,n,r){var i,o,a,c=n-e;return a=1.70158,0===t?e:1==(t/=r)?e+c:((o=0)||(o=.3*r),(i=c)<Math.abs(c)?(i=c,a=o/4):a=o/(2*Math.PI)*Math.asin(c/i),i*Math.pow(2,-10*t)*Math.sin((t*r-a)*(2*Math.PI)/o)+c+e)},easeInOutElastic:function(t,e,n,r){var i,o,a,c=n-e;return a=1.70158,0===t?e:2==(t/=r/2)?e+c:((o=0)||(o=r*(.3*1.5)),(i=c)<Math.abs(c)?(i=c,a=o/4):a=o/(2*Math.PI)*Math.asin(c/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t*r-a)*(2*Math.PI)/o)*-.5+e:i*Math.pow(2,-10*(t-=1))*Math.sin((t*r-a)*(2*Math.PI)/o)*.5+c+e)},easeInBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),(n-e)*(t/=r)*t*((i+1)*t-i)+e},easeOutBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),(n-e)*((t=t/r-1)*t*((i+1)*t+i)+1)+e},easeInOutBack:function(t,e,n,r,i){var o=n-e;return void 0===i&&(i=1.70158),(t/=r/2)<1?o/2*(t*t*((1+(i*=1.525))*t-i))+e:o/2*((t-=2)*t*((1+(i*=1.525))*t+i)+2)+e},easeInBounce:function(t,e,n,i){var o=n-e;return o-r.easeOutBounce(i-t,0,o,i)+e},easeOutBounce:function(t,e,n,r){var i=n-e;return (t/=r)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},easeInOutBounce:function(t,e,n,i){var o=n-e;return t<i/2?.5*r.easeInBounce(2*t,0,o,i)+e:.5*r.easeOutBounce(2*t-i,0,o,i)+.5*o+e}};t.exports=r;},function(t,e,n){t.exports=n(3);},function(t,e,n){n.r(e),n.d(e,"ReactConfetti",(function(){return Q}));var r,i,o=n(0),a=n.n(o),c=n(1),s=n.n(c);function u(t,e){return t+Math.random()*(e-t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r);}}function h(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}!function(t){t[t.Circle=0]="Circle",t[t.Square=1]="Square",t[t.Strip=2]="Strip";}(r||(r={})),function(t){t[t.Positive=1]="Positive",t[t.Negative=-1]="Negative";}(i||(i={}));var l=function(){function t(e,n,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),h(this,"context",void 0),h(this,"radius",void 0),h(this,"x",void 0),h(this,"y",void 0),h(this,"w",void 0),h(this,"h",void 0),h(this,"vx",void 0),h(this,"vy",void 0),h(this,"shape",void 0),h(this,"angle",void 0),h(this,"angularSpin",void 0),h(this,"color",void 0),h(this,"rotateY",void 0),h(this,"rotationDirection",void 0),h(this,"getOptions",void 0),this.getOptions=n;var a,c,s=this.getOptions(),f=s.colors,l=s.initialVelocityX,p=s.initialVelocityY;this.context=e,this.x=r,this.y=o,this.w=u(5,20),this.h=u(5,20),this.radius=u(5,10),this.vx="number"==typeof l?u(-l,l):u(l.min,l.max),this.vy="number"==typeof p?u(-p,0):u(p.min,p.max),this.shape=(a=0,c=2,Math.floor(a+Math.random()*(c-a+1))),this.angle=u(0,360)*Math.PI/180,this.angularSpin=u(-.2,.2),this.color=f[Math.floor(Math.random()*f.length)],this.rotateY=u(0,1),this.rotationDirection=u(0,1)?i.Positive:i.Negative;}var e,n;return e=t,(n=[{key:"update",value:function(){var t=this.getOptions(),e=t.gravity,n=t.wind,o=t.friction,a=t.opacity,c=t.drawShape;this.x+=this.vx,this.y+=this.vy,this.vy+=e,this.vx+=n,this.vx*=o,this.vy*=o,this.rotateY>=1&&this.rotationDirection===i.Positive?this.rotationDirection=i.Negative:this.rotateY<=-1&&this.rotationDirection===i.Negative&&(this.rotationDirection=i.Positive);var s=.1*this.rotationDirection;if(this.rotateY+=s,this.angle+=this.angularSpin,this.context.save(),this.context.translate(this.x,this.y),this.context.rotate(this.angle),this.context.scale(1,this.rotateY),this.context.rotate(this.angle),this.context.beginPath(),this.context.fillStyle=this.color,this.context.strokeStyle=this.color,this.context.globalAlpha=a,this.context.lineCap="round",this.context.lineWidth=2,c&&"function"==typeof c)c.call(this,this.context);else switch(this.shape){case r.Circle:this.context.beginPath(),this.context.arc(0,0,this.radius,0,2*Math.PI),this.context.fill();break;case r.Square:this.context.fillRect(-this.w/2,-this.h/2,this.w,this.h);break;case r.Strip:this.context.fillRect(-this.w/6,-this.h/2,this.w/3,this.h);}this.context.closePath(),this.context.restore();}}])&&f(e.prototype,n),t}();function p(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var v=function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,"canvas",void 0),p(this,"context",void 0),p(this,"getOptions",void 0),p(this,"x",0),p(this,"y",0),p(this,"w",0),p(this,"h",0),p(this,"lastNumberOfPieces",0),p(this,"tweenInitTime",Date.now()),p(this,"particles",[]),p(this,"particlesGenerated",0),p(this,"removeParticleAt",(function(t){r.particles.splice(t,1);})),p(this,"getParticle",(function(){var t=u(r.x,r.w+r.x),e=u(r.y,r.h+r.y);return new l(r.context,r.getOptions,t,e)})),p(this,"animate",(function(){var t=r.canvas,e=r.context,n=r.particlesGenerated,i=r.lastNumberOfPieces,o=r.getOptions(),a=o.run,c=o.recycle,s=o.numberOfPieces,u=o.debug,f=o.tweenFunction,h=o.tweenDuration;if(!a)return !1;var l=r.particles.length,p=c?l:n,v=Date.now();if(p<s){i!==s&&(r.tweenInitTime=v,r.lastNumberOfPieces=s);for(var y=r.tweenInitTime,d=f(v-y>h?h:Math.max(0,v-y),p,s,h),b=Math.round(d-p),g=0;g<b;g++)r.particles.push(r.getParticle());r.particlesGenerated+=b;}return u&&(e.font="12px sans-serif",e.fillStyle="#333",e.textAlign="right",e.fillText("Particles: ".concat(l),t.width-10,t.height-20)),r.particles.forEach((function(e,n){e.update(),(e.y>t.height||e.y<-100||e.x>t.width+100||e.x<-100)&&(c&&p<=s?r.particles[n]=r.getParticle():r.removeParticleAt(n));})),l>0||p<s})),this.canvas=e;var i=this.canvas.getContext("2d");if(!i)throw new Error("Could not get canvas context");this.context=i,this.getOptions=n;};function y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r);}return n}function d(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?y(Object(n),!0).forEach((function(e){g(t,e,n[e]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e));}));}return t}function b(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r);}}function g(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var O={width:"undefined"!=typeof window?window.innerWidth:300,height:"undefined"!=typeof window?window.innerHeight:200,numberOfPieces:200,friction:.99,wind:0,gravity:.1,initialVelocityX:4,initialVelocityY:10,colors:["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#795548"],opacity:1,debug:!1,tweenFunction:s.a.easeInOutQuad,tweenDuration:5e3,recycle:!0,run:!0},w=function(){function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),g(this,"canvas",void 0),g(this,"context",void 0),g(this,"_options",void 0),g(this,"generator",void 0),g(this,"rafId",void 0),g(this,"setOptionsWithDefaults",(function(t){var e={confettiSource:{x:0,y:0,w:r.canvas.width,h:0}};r._options=d(d(d({},e),O),t),Object.assign(r,t.confettiSource);})),g(this,"update",(function(){var t=r.options,e=t.run,n=t.onConfettiComplete,i=r.canvas,o=r.context;e&&(o.fillStyle="white",o.clearRect(0,0,i.width,i.height)),r.generator.animate()?r.rafId=requestAnimationFrame(r.update):(n&&"function"==typeof n&&r.generator.particlesGenerated>0&&n.call(r,r),r._options.run=!1);})),g(this,"reset",(function(){r.generator&&r.generator.particlesGenerated>0&&(r.generator.particlesGenerated=0,r.generator.particles=[],r.generator.lastNumberOfPieces=0);})),g(this,"stop",(function(){r.options={run:!1},r.rafId&&(cancelAnimationFrame(r.rafId),r.rafId=void 0);})),this.canvas=e;var i=this.canvas.getContext("2d");if(!i)throw new Error("Could not get canvas context");this.context=i,this.generator=new v(this.canvas,(function(){return r.options})),this.options=n,this.update();}var e,n;return e=t,(n=[{key:"options",get:function(){return this._options},set:function(t){var e=this._options&&this._options.run,n=this._options&&this._options.recycle;this.setOptionsWithDefaults(t),this.generator&&(Object.assign(this.generator,this.options.confettiSource),"boolean"==typeof t.recycle&&t.recycle&&!1===n&&(this.generator.lastNumberOfPieces=this.generator.particles.length)),"boolean"==typeof t.run&&t.run&&!1===e&&this.update();}}])&&b(e.prototype,n),t}();function m(t){return function(t){if(Array.isArray(t))return C(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||S(t)||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.")}()}function x(t){return (x="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})(t)}function P(){return (P=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);}return t}).apply(this,arguments)}function j(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r);}return n}function M(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?j(Object(n),!0).forEach((function(e){T(t,e,n[e]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e));}));}return t}function I(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t;}finally{try{r||null==c.return||c.return();}finally{if(i)throw o}}return n}(t,e)||S(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 S(t,e){if(t){if("string"==typeof t)return C(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return "Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(t,e):void 0}}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function D(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r);}}function _(t,e){return (_=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function R(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return !1}}();return function(){var n,r=F(t);if(e){var i=F(this).constructor;n=Reflect.construct(r,arguments,i);}else n=r.apply(this,arguments);return k(this,n)}}function k(t,e){return !e||"object"!==x(e)&&"function"!=typeof e?A(t):e}function A(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function F(t){return (F=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function T(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var B=a.a.createRef(),N=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}}),e&&_(t,e);}(o,t);var e,n,i=R(o);function o(t){var e;D(this,o);for(var n=arguments.length,r=new Array(n>1?n-1:0),c=1;c<n;c++)r[c-1]=arguments[c];return T(A(e=i.call.apply(i,[this,t].concat(r))),"canvas",a.a.createRef()),T(A(e),"confetti",void 0),e.canvas=t.canvasRef||B,e}return e=o,(n=[{key:"componentDidMount",value:function(){if(this.canvas.current){var t=q(this.props)[0];this.confetti=new w(this.canvas.current,t);}}},{key:"componentDidUpdate",value:function(){var t=q(this.props)[0];this.confetti&&(this.confetti.options=t);}},{key:"componentWillUnmount",value:function(){this.confetti&&this.confetti.stop(),this.confetti=void 0;}},{key:"render",value:function(){var t=I(q(this.props),2),e=t[0],n=t[1],r=M({zIndex:2,position:"absolute",pointerEvents:"none",top:0,left:0,bottom:0,right:0},n.style);return a.a.createElement("canvas",P({width:e.width,height:e.height,ref:this.canvas},n,{style:r}))}}])&&E(e.prototype,n),o}(o.Component);function q(t){var e={},n={},r=[].concat(m(Object.keys(O)),["confettiSource","drawShape","onConfettiComplete"]),i=["canvasRef"];for(var o in t){var a=t[o];r.includes(o)?e[o]=a:i.includes(o)?i[o]=a:n[o]=a;}return [e,n,{}]}T(N,"defaultProps",M({},O)),T(N,"displayName","ReactConfetti");var Q=a.a.forwardRef((function(t,e){return a.a.createElement(N,P({canvasRef:e},t))}));e.default=Q;}]).default}));
|
|
2149
|
+
!function(t,e){module.exports=e(React__default);}("undefined"!=typeof self?self:commonjsGlobal,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:false,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=true,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:true,get:r});},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:true});},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:true,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(e,n){e.exports=t;},function(t,e,n){var r={linear:function(t,e,n,r){return (n-e)*t/r+e},easeInQuad:function(t,e,n,r){return (n-e)*(t/=r)*t+e},easeOutQuad:function(t,e,n,r){return -(n-e)*(t/=r)*(t-2)+e},easeInOutQuad:function(t,e,n,r){var i=n-e;return (t/=r/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,n,r){return (n-e)*(t/=r)*t*t+e},easeOutCubic:function(t,e,n,r){return (n-e)*((t=t/r-1)*t*t+1)+e},easeInOutCubic:function(t,e,n,r){var i=n-e;return (t/=r/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,n,r){return (n-e)*(t/=r)*t*t*t+e},easeOutQuart:function(t,e,n,r){return -(n-e)*((t=t/r-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,n,r){var i=n-e;return (t/=r/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,n,r){return (n-e)*(t/=r)*t*t*t*t+e},easeOutQuint:function(t,e,n,r){return (n-e)*((t=t/r-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,n,r){var i=n-e;return (t/=r/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,n,r){var i=n-e;return -i*Math.cos(t/r*(Math.PI/2))+i+e},easeOutSine:function(t,e,n,r){return (n-e)*Math.sin(t/r*(Math.PI/2))+e},easeInOutSine:function(t,e,n,r){return -(n-e)/2*(Math.cos(Math.PI*t/r)-1)+e},easeInExpo:function(t,e,n,r){return 0==t?e:(n-e)*Math.pow(2,10*(t/r-1))+e},easeOutExpo:function(t,e,n,r){var i=n-e;return t==r?e+i:i*(1-Math.pow(2,-10*t/r))+e},easeInOutExpo:function(t,e,n,r){var i=n-e;return 0===t?e:t===r?e+i:(t/=r/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,n,r){return -(n-e)*(Math.sqrt(1-(t/=r)*t)-1)+e},easeOutCirc:function(t,e,n,r){return (n-e)*Math.sqrt(1-(t=t/r-1)*t)+e},easeInOutCirc:function(t,e,n,r){var i=n-e;return (t/=r/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(t,e,n,r){var i,o,a,c=n-e;return a=1.70158,0===t?e:1==(t/=r)?e+c:((o=0)||(o=.3*r),(i=c)<Math.abs(c)?(i=c,a=o/4):a=o/(2*Math.PI)*Math.asin(c/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t*r-a)*(2*Math.PI)/o)+e)},easeOutElastic:function(t,e,n,r){var i,o,a,c=n-e;return a=1.70158,0===t?e:1==(t/=r)?e+c:((o=0)||(o=.3*r),(i=c)<Math.abs(c)?(i=c,a=o/4):a=o/(2*Math.PI)*Math.asin(c/i),i*Math.pow(2,-10*t)*Math.sin((t*r-a)*(2*Math.PI)/o)+c+e)},easeInOutElastic:function(t,e,n,r){var i,o,a,c=n-e;return a=1.70158,0===t?e:2==(t/=r/2)?e+c:((o=0)||(o=r*(.3*1.5)),(i=c)<Math.abs(c)?(i=c,a=o/4):a=o/(2*Math.PI)*Math.asin(c/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t*r-a)*(2*Math.PI)/o)*-0.5+e:i*Math.pow(2,-10*(t-=1))*Math.sin((t*r-a)*(2*Math.PI)/o)*.5+c+e)},easeInBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),(n-e)*(t/=r)*t*((i+1)*t-i)+e},easeOutBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),(n-e)*((t=t/r-1)*t*((i+1)*t+i)+1)+e},easeInOutBack:function(t,e,n,r,i){var o=n-e;return void 0===i&&(i=1.70158),(t/=r/2)<1?o/2*(t*t*((1+(i*=1.525))*t-i))+e:o/2*((t-=2)*t*((1+(i*=1.525))*t+i)+2)+e},easeInBounce:function(t,e,n,i){var o=n-e;return o-r.easeOutBounce(i-t,0,o,i)+e},easeOutBounce:function(t,e,n,r){var i=n-e;return (t/=r)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},easeInOutBounce:function(t,e,n,i){var o=n-e;return t<i/2?.5*r.easeInBounce(2*t,0,o,i)+e:.5*r.easeOutBounce(2*t-i,0,o,i)+.5*o+e}};t.exports=r;},function(t,e,n){t.exports=n(3);},function(t,e,n){n.r(e),n.d(e,"ReactConfetti",(function(){return Q}));var r,i,o=n(0),a=n.n(o),c=n(1),s=n.n(c);function u(t,e){return t+Math.random()*(e-t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||false,r.configurable=true,"value"in r&&(r.writable=true),Object.defineProperty(t,r.key,r);}}function h(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:true,configurable:true,writable:true}):t[e]=n,t}!function(t){t[t.Circle=0]="Circle",t[t.Square=1]="Square",t[t.Strip=2]="Strip";}(r||(r={})),function(t){t[t.Positive=1]="Positive",t[t.Negative=-1]="Negative";}(i||(i={}));var l=function(){function t(e,n,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),h(this,"context",void 0),h(this,"radius",void 0),h(this,"x",void 0),h(this,"y",void 0),h(this,"w",void 0),h(this,"h",void 0),h(this,"vx",void 0),h(this,"vy",void 0),h(this,"shape",void 0),h(this,"angle",void 0),h(this,"angularSpin",void 0),h(this,"color",void 0),h(this,"rotateY",void 0),h(this,"rotationDirection",void 0),h(this,"getOptions",void 0),this.getOptions=n;var a,c,s=this.getOptions(),f=s.colors,l=s.initialVelocityX,p=s.initialVelocityY;this.context=e,this.x=r,this.y=o,this.w=u(5,20),this.h=u(5,20),this.radius=u(5,10),this.vx="number"==typeof l?u(-l,l):u(l.min,l.max),this.vy="number"==typeof p?u(-p,0):u(p.min,p.max),this.shape=(a=0,c=2,Math.floor(a+Math.random()*(c-a+1))),this.angle=u(0,360)*Math.PI/180,this.angularSpin=u(-0.2,.2),this.color=f[Math.floor(Math.random()*f.length)],this.rotateY=u(0,1),this.rotationDirection=u(0,1)?i.Positive:i.Negative;}var e,n;return e=t,(n=[{key:"update",value:function(){var t=this.getOptions(),e=t.gravity,n=t.wind,o=t.friction,a=t.opacity,c=t.drawShape;this.x+=this.vx,this.y+=this.vy,this.vy+=e,this.vx+=n,this.vx*=o,this.vy*=o,this.rotateY>=1&&this.rotationDirection===i.Positive?this.rotationDirection=i.Negative:this.rotateY<=-1&&this.rotationDirection===i.Negative&&(this.rotationDirection=i.Positive);var s=.1*this.rotationDirection;if(this.rotateY+=s,this.angle+=this.angularSpin,this.context.save(),this.context.translate(this.x,this.y),this.context.rotate(this.angle),this.context.scale(1,this.rotateY),this.context.rotate(this.angle),this.context.beginPath(),this.context.fillStyle=this.color,this.context.strokeStyle=this.color,this.context.globalAlpha=a,this.context.lineCap="round",this.context.lineWidth=2,c&&"function"==typeof c)c.call(this,this.context);else switch(this.shape){case r.Circle:this.context.beginPath(),this.context.arc(0,0,this.radius,0,2*Math.PI),this.context.fill();break;case r.Square:this.context.fillRect(-this.w/2,-this.h/2,this.w,this.h);break;case r.Strip:this.context.fillRect(-this.w/6,-this.h/2,this.w/3,this.h);}this.context.closePath(),this.context.restore();}}])&&f(e.prototype,n),t}();function p(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:true,configurable:true,writable:true}):t[e]=n,t}var v=function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,"canvas",void 0),p(this,"context",void 0),p(this,"getOptions",void 0),p(this,"x",0),p(this,"y",0),p(this,"w",0),p(this,"h",0),p(this,"lastNumberOfPieces",0),p(this,"tweenInitTime",Date.now()),p(this,"particles",[]),p(this,"particlesGenerated",0),p(this,"removeParticleAt",(function(t){r.particles.splice(t,1);})),p(this,"getParticle",(function(){var t=u(r.x,r.w+r.x),e=u(r.y,r.h+r.y);return new l(r.context,r.getOptions,t,e)})),p(this,"animate",(function(){var t=r.canvas,e=r.context,n=r.particlesGenerated,i=r.lastNumberOfPieces,o=r.getOptions(),a=o.run,c=o.recycle,s=o.numberOfPieces,u=o.debug,f=o.tweenFunction,h=o.tweenDuration;if(!a)return false;var l=r.particles.length,p=c?l:n,v=Date.now();if(p<s){i!==s&&(r.tweenInitTime=v,r.lastNumberOfPieces=s);for(var y=r.tweenInitTime,d=f(v-y>h?h:Math.max(0,v-y),p,s,h),b=Math.round(d-p),g=0;g<b;g++)r.particles.push(r.getParticle());r.particlesGenerated+=b;}return u&&(e.font="12px sans-serif",e.fillStyle="#333",e.textAlign="right",e.fillText("Particles: ".concat(l),t.width-10,t.height-20)),r.particles.forEach((function(e,n){e.update(),(e.y>t.height||e.y<-100||e.x>t.width+100||e.x<-100)&&(c&&p<=s?r.particles[n]=r.getParticle():r.removeParticleAt(n));})),l>0||p<s})),this.canvas=e;var i=this.canvas.getContext("2d");if(!i)throw new Error("Could not get canvas context");this.context=i,this.getOptions=n;};function y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r);}return n}function d(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?y(Object(n),true).forEach((function(e){g(t,e,n[e]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e));}));}return t}function b(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||false,r.configurable=true,"value"in r&&(r.writable=true),Object.defineProperty(t,r.key,r);}}function g(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:true,configurable:true,writable:true}):t[e]=n,t}var O={width:"undefined"!=typeof window?window.innerWidth:300,height:"undefined"!=typeof window?window.innerHeight:200,numberOfPieces:200,friction:.99,wind:0,gravity:.1,initialVelocityX:4,initialVelocityY:10,colors:["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#795548"],opacity:1,debug:false,tweenFunction:s.a.easeInOutQuad,tweenDuration:5e3,recycle:true,run:true},w=function(){function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),g(this,"canvas",void 0),g(this,"context",void 0),g(this,"_options",void 0),g(this,"generator",void 0),g(this,"rafId",void 0),g(this,"setOptionsWithDefaults",(function(t){var e={confettiSource:{x:0,y:0,w:r.canvas.width,h:0}};r._options=d(d(d({},e),O),t),Object.assign(r,t.confettiSource);})),g(this,"update",(function(){var t=r.options,e=t.run,n=t.onConfettiComplete,i=r.canvas,o=r.context;e&&(o.fillStyle="white",o.clearRect(0,0,i.width,i.height)),r.generator.animate()?r.rafId=requestAnimationFrame(r.update):(n&&"function"==typeof n&&r.generator.particlesGenerated>0&&n.call(r,r),r._options.run=false);})),g(this,"reset",(function(){r.generator&&r.generator.particlesGenerated>0&&(r.generator.particlesGenerated=0,r.generator.particles=[],r.generator.lastNumberOfPieces=0);})),g(this,"stop",(function(){r.options={run:false},r.rafId&&(cancelAnimationFrame(r.rafId),r.rafId=void 0);})),this.canvas=e;var i=this.canvas.getContext("2d");if(!i)throw new Error("Could not get canvas context");this.context=i,this.generator=new v(this.canvas,(function(){return r.options})),this.options=n,this.update();}var e,n;return e=t,(n=[{key:"options",get:function(){return this._options},set:function(t){var e=this._options&&this._options.run,n=this._options&&this._options.recycle;this.setOptionsWithDefaults(t),this.generator&&(Object.assign(this.generator,this.options.confettiSource),"boolean"==typeof t.recycle&&t.recycle&&false===n&&(this.generator.lastNumberOfPieces=this.generator.particles.length)),"boolean"==typeof t.run&&t.run&&false===e&&this.update();}}])&&b(e.prototype,n),t}();function m(t){return function(t){if(Array.isArray(t))return C(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||S(t)||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.")}()}function x(t){return (x="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})(t)}function P(){return (P=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);}return t}).apply(this,arguments)}function j(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r);}return n}function M(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?j(Object(n),true).forEach((function(e){T(t,e,n[e]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e));}));}return t}function I(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=true,i=false,o=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=true,o=t;}finally{try{r||null==c.return||c.return();}finally{if(i)throw o}}return n}(t,e)||S(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 S(t,e){if(t){if("string"==typeof t)return C(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return "Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(t,e):void 0}}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function D(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||false,r.configurable=true,"value"in r&&(r.writable=true),Object.defineProperty(t,r.key,r);}}function _(t,e){return (_=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function R(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if("function"==typeof Proxy)return true;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return false}}();return function(){var n,r=F(t);if(e){var i=F(this).constructor;n=Reflect.construct(r,arguments,i);}else n=r.apply(this,arguments);return k(this,n)}}function k(t,e){return !e||"object"!==x(e)&&"function"!=typeof e?A(t):e}function A(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function F(t){return (F=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function T(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:true,configurable:true,writable:true}):t[e]=n,t}var B=a.a.createRef(),N=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:true,configurable:true}}),e&&_(t,e);}(o,t);var e,n,i=R(o);function o(t){var e;D(this,o);for(var n=arguments.length,r=new Array(n>1?n-1:0),c=1;c<n;c++)r[c-1]=arguments[c];return T(A(e=i.call.apply(i,[this,t].concat(r))),"canvas",a.a.createRef()),T(A(e),"confetti",void 0),e.canvas=t.canvasRef||B,e}return e=o,(n=[{key:"componentDidMount",value:function(){if(this.canvas.current){var t=q(this.props)[0];this.confetti=new w(this.canvas.current,t);}}},{key:"componentDidUpdate",value:function(){var t=q(this.props)[0];this.confetti&&(this.confetti.options=t);}},{key:"componentWillUnmount",value:function(){this.confetti&&this.confetti.stop(),this.confetti=void 0;}},{key:"render",value:function(){var t=I(q(this.props),2),e=t[0],n=t[1],r=M({zIndex:2,position:"absolute",pointerEvents:"none",top:0,left:0,bottom:0,right:0},n.style);return a.a.createElement("canvas",P({width:e.width,height:e.height,ref:this.canvas},n,{style:r}))}}])&&E(e.prototype,n),o}(o.Component);function q(t){var e={},n={},r=[].concat(m(Object.keys(O)),["confettiSource","drawShape","onConfettiComplete"]),i=["canvasRef"];for(var o in t){var a=t[o];r.includes(o)?e[o]=a:i.includes(o)?i[o]=a:n[o]=a;}return [e,n,{}]}T(N,"defaultProps",M({},O)),T(N,"displayName","ReactConfetti");var Q=a.a.forwardRef((function(t,e){return a.a.createElement(N,P({canvasRef:e},t))}));e.default=Q;}]).default}));
|
|
159
2150
|
|
|
160
2151
|
} (reactConfetti_min));
|
|
161
2152
|
|
|
@@ -236,125 +2227,111 @@ const ConfettiWrapper = ({ show }) => {
|
|
|
236
2227
|
const { width, height } = useWindowSize();
|
|
237
2228
|
if (!show)
|
|
238
2229
|
return null;
|
|
239
|
-
return
|
|
2230
|
+
return React__default.createElement(Confetti, { width: width, height: height, recycle: false });
|
|
240
2231
|
};
|
|
241
2232
|
|
|
242
|
-
const AchievementContext = createContext(undefined);
|
|
243
|
-
const
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const [
|
|
258
|
-
const [
|
|
259
|
-
const
|
|
260
|
-
const
|
|
2233
|
+
const AchievementContext = React__default.createContext(undefined);
|
|
2234
|
+
const useAchievementContext = () => {
|
|
2235
|
+
const context = React__default.useContext(AchievementContext);
|
|
2236
|
+
if (!context) {
|
|
2237
|
+
throw new Error('useAchievementContext must be used within an AchievementProvider');
|
|
2238
|
+
}
|
|
2239
|
+
return context;
|
|
2240
|
+
};
|
|
2241
|
+
const AchievementProvider = ({ children, config, initialState = {}, storageKey = 'react-achievements', badgesButtonPosition = 'top-right', styles = {}, icons = {}, }) => {
|
|
2242
|
+
const dispatch = useDispatch();
|
|
2243
|
+
const metrics = useSelector((state) => state.achievements.metrics);
|
|
2244
|
+
const unlockedAchievementIds = useSelector((state) => state.achievements.unlockedAchievements);
|
|
2245
|
+
const notifications = useSelector((state) => state.notifications.notifications);
|
|
2246
|
+
const mergedStyles = React__default.useMemo(() => mergeDeep(defaultStyles, styles), [styles]);
|
|
2247
|
+
const [currentAchievement, setCurrentAchievement] = React__default.useState(null);
|
|
2248
|
+
const [showBadges, setShowBadges] = React__default.useState(false);
|
|
2249
|
+
const [showConfetti, setShowConfetti] = React__default.useState(false);
|
|
2250
|
+
const mergedIcons = React__default.useMemo(() => (Object.assign(Object.assign({}, defaultAchievementIcons), icons)), [icons]);
|
|
2251
|
+
const updateMetrics = useCallback((newMetrics) => {
|
|
2252
|
+
dispatch(setMetrics(typeof newMetrics === 'function' ? newMetrics(metrics) : newMetrics));
|
|
2253
|
+
}, [dispatch, metrics]);
|
|
2254
|
+
const resetStorage = useCallback(() => {
|
|
2255
|
+
localStorage.removeItem(storageKey);
|
|
2256
|
+
dispatch(resetAchievements());
|
|
2257
|
+
}, [dispatch, storageKey]);
|
|
2258
|
+
useEffect(() => {
|
|
2259
|
+
dispatch(initialize({ config, initialState, storageKey }));
|
|
2260
|
+
}, [dispatch, config, initialState, storageKey]);
|
|
261
2261
|
const checkAchievements = useCallback(() => {
|
|
262
2262
|
const newAchievements = [];
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
2263
|
+
if (!unlockedAchievementIds) {
|
|
2264
|
+
console.error('unlockedAchievements is undefined!');
|
|
2265
|
+
return;
|
|
2266
|
+
}
|
|
2267
|
+
Object.entries(config).forEach(([metricName, conditions]) => {
|
|
2268
|
+
const metricValues = metrics[metricName];
|
|
2269
|
+
if (!metricValues) {
|
|
2270
|
+
return;
|
|
2271
|
+
}
|
|
2272
|
+
conditions.forEach((condition) => {
|
|
2273
|
+
if (metricValues.some((value) => condition.isConditionMet(value)) &&
|
|
2274
|
+
!unlockedAchievementIds.includes(condition.achievementDetails.achievementId)) {
|
|
2275
|
+
newAchievements.push(condition.achievementDetails);
|
|
268
2276
|
}
|
|
269
2277
|
});
|
|
270
2278
|
});
|
|
271
2279
|
if (newAchievements.length > 0) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
localStorage.setItem(`${storageKey}-unlocked-achievements`, JSON.stringify(updated));
|
|
276
|
-
return updated;
|
|
277
|
-
});
|
|
278
|
-
setNewlyUnlockedAchievements(prev => {
|
|
279
|
-
const updated = [...prev, ...newlyUnlockedIds];
|
|
280
|
-
localStorage.setItem(`${storageKey}-newly-unlocked-achievements`, JSON.stringify(updated));
|
|
281
|
-
return updated;
|
|
2280
|
+
newAchievements.forEach((achievement) => {
|
|
2281
|
+
dispatch(unlockAchievement(achievement.achievementId));
|
|
2282
|
+
dispatch(addNotification(achievement));
|
|
282
2283
|
});
|
|
283
|
-
setAchievementQueue(prevQueue => [...prevQueue, ...newAchievements]);
|
|
284
2284
|
setShowConfetti(true);
|
|
285
2285
|
}
|
|
286
|
-
}, [config, metrics,
|
|
2286
|
+
}, [config, metrics, unlockedAchievementIds, dispatch]);
|
|
287
2287
|
useEffect(() => {
|
|
288
2288
|
checkAchievements();
|
|
289
2289
|
}, [metrics, checkAchievements]);
|
|
290
2290
|
useEffect(() => {
|
|
291
|
-
if (
|
|
292
|
-
|
|
293
|
-
setCurrentAchievement(nextAchievement);
|
|
294
|
-
setAchievementQueue(prevQueue => prevQueue.slice(1));
|
|
295
|
-
setNewlyUnlockedAchievements(prev => {
|
|
296
|
-
const updated = prev.filter(id => id !== nextAchievement.id);
|
|
297
|
-
localStorage.setItem(`${storageKey}-newly-unlocked-achievements`, JSON.stringify(updated));
|
|
298
|
-
return updated;
|
|
299
|
-
});
|
|
2291
|
+
if (notifications.length > 0 && !currentAchievement) {
|
|
2292
|
+
setCurrentAchievement(notifications[0]);
|
|
300
2293
|
}
|
|
301
|
-
}, [
|
|
2294
|
+
}, [notifications, currentAchievement]);
|
|
302
2295
|
const showBadgesModal = () => setShowBadges(true);
|
|
303
|
-
const getAchievements = (achievedIds) => {
|
|
304
|
-
return Object.values(config).flatMap(conditions => conditions
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
const updatedMetrics = typeof newMetrics === 'function' ? newMetrics(prevMetrics) : newMetrics;
|
|
311
|
-
localStorage.setItem(`${storageKey}-metrics`, JSON.stringify(updatedMetrics));
|
|
312
|
-
return updatedMetrics;
|
|
313
|
-
});
|
|
314
|
-
},
|
|
315
|
-
unlockedAchievements,
|
|
316
|
-
checkAchievements,
|
|
317
|
-
showBadgesModal
|
|
318
|
-
};
|
|
319
|
-
return (React.createElement(AchievementContext.Provider, { value: contextValue },
|
|
2296
|
+
const getAchievements = useCallback((achievedIds) => {
|
|
2297
|
+
return Object.values(config).flatMap((conditions) => conditions
|
|
2298
|
+
.filter((c) => achievedIds.includes(c.achievementDetails.achievementId))
|
|
2299
|
+
.map((c) => c.achievementDetails));
|
|
2300
|
+
}, [config]);
|
|
2301
|
+
const unlockedAchievementsDetails = getAchievements(unlockedAchievementIds);
|
|
2302
|
+
return (React__default.createElement(AchievementContext.Provider, { value: { updateMetrics, unlockedAchievements: unlockedAchievementIds, resetStorage } },
|
|
320
2303
|
children,
|
|
321
|
-
|
|
2304
|
+
React__default.createElement(AchievementModal$1, { isOpen: !!currentAchievement, achievement: currentAchievement, onClose: () => {
|
|
322
2305
|
setCurrentAchievement(null);
|
|
323
|
-
if (
|
|
324
|
-
|
|
2306
|
+
if (currentAchievement) {
|
|
2307
|
+
dispatch(clearNotifications());
|
|
325
2308
|
}
|
|
326
|
-
}, styles: mergedStyles.achievementModal }),
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
};
|
|
331
|
-
const useAchievement = () => {
|
|
332
|
-
const context = useContext(AchievementContext);
|
|
333
|
-
if (context === undefined) {
|
|
334
|
-
throw new Error('useAchievement must be used within an AchievementProvider');
|
|
335
|
-
}
|
|
336
|
-
return context;
|
|
2309
|
+
}, styles: mergedStyles.achievementModal, icons: mergedIcons }),
|
|
2310
|
+
React__default.createElement(BadgesModal$1, { isOpen: showBadges, achievements: unlockedAchievementsDetails, onClose: () => setShowBadges(false), styles: mergedStyles.badgesModal, icons: mergedIcons }),
|
|
2311
|
+
React__default.createElement(BadgesButton$1, { onClick: showBadgesModal, position: badgesButtonPosition, styles: mergedStyles.badgesButton, unlockedAchievements: unlockedAchievementsDetails }),
|
|
2312
|
+
React__default.createElement(ConfettiWrapper, { show: showConfetti || notifications.length > 0 })));
|
|
337
2313
|
};
|
|
338
|
-
|
|
2314
|
+
function isObject(item) {
|
|
2315
|
+
return item && typeof item === 'object' && !Array.isArray(item);
|
|
2316
|
+
}
|
|
339
2317
|
function mergeDeep(target, source) {
|
|
340
2318
|
const output = Object.assign({}, target);
|
|
341
2319
|
if (isObject(target) && isObject(source)) {
|
|
342
|
-
Object.keys(source).forEach(key => {
|
|
2320
|
+
Object.keys(source).forEach((key) => {
|
|
343
2321
|
if (isObject(source[key])) {
|
|
344
|
-
if (!(key in target))
|
|
345
|
-
|
|
346
|
-
|
|
2322
|
+
if (!(key in target)) {
|
|
2323
|
+
output[key] = source[key];
|
|
2324
|
+
}
|
|
2325
|
+
else {
|
|
347
2326
|
output[key] = mergeDeep(target[key], source[key]);
|
|
2327
|
+
}
|
|
348
2328
|
}
|
|
349
2329
|
else {
|
|
350
|
-
|
|
2330
|
+
output[key] = source[key];
|
|
351
2331
|
}
|
|
352
2332
|
});
|
|
353
2333
|
}
|
|
354
2334
|
return output;
|
|
355
2335
|
}
|
|
356
|
-
function isObject(item) {
|
|
357
|
-
return (item && typeof item === 'object' && !Array.isArray(item));
|
|
358
|
-
}
|
|
359
2336
|
|
|
360
|
-
export { AchievementProvider, ConfettiWrapper, useAchievement };
|
|
2337
|
+
export { AchievementProvider, ConfettiWrapper, achievementSlice$1 as achievementReducer, notificationSlice$1 as notificationReducer, useAchievementContext as useAchievement };
|