@rific/scroll-view 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,7 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
-
5
1
  // src/CustomList.tsx
6
2
  import { memo, useCallback as useCallback2, useContext as useContext4, useLayoutEffect as useLayoutEffect2, useMemo as useMemo2, useRef as useRef2 } from "react";
7
3
  import { Dimensions, View } from "react-native";
@@ -870,1568 +866,6 @@ var styles5 = StyleSheet4.create({
870
866
  input: { margin: 0 }
871
867
  });
872
868
 
873
- // node_modules/redux/dist/redux.mjs
874
- var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
875
- var ActionTypes = {
876
- INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
877
- REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
878
- PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
879
- };
880
- function isPlainObject(obj) {
881
- if (typeof obj !== "object" || obj === null)
882
- return false;
883
- let proto = obj;
884
- while (Object.getPrototypeOf(proto) !== null) {
885
- proto = Object.getPrototypeOf(proto);
886
- }
887
- return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
888
- }
889
- function compose(...funcs) {
890
- if (funcs.length === 0) {
891
- return (arg) => arg;
892
- }
893
- if (funcs.length === 1) {
894
- return funcs[0];
895
- }
896
- return funcs.reduce((a, b) => (...args) => a(b(...args)));
897
- }
898
- function isAction(action) {
899
- return isPlainObject(action) && "type" in action && typeof action.type === "string";
900
- }
901
-
902
- // node_modules/immer/dist/immer.mjs
903
- var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
904
- var DRAFTABLE = /* @__PURE__ */ Symbol.for("immer-draftable");
905
- var DRAFT_STATE = /* @__PURE__ */ Symbol.for("immer-state");
906
- var errors = process.env.NODE_ENV !== "production" ? [
907
- // All error codes, starting by 0:
908
- function(plugin) {
909
- return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
910
- },
911
- function(thing) {
912
- 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 '${thing}'`;
913
- },
914
- "This object has been frozen and should not be mutated",
915
- function(data) {
916
- return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
917
- },
918
- "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
919
- "Immer forbids circular references",
920
- "The first or second argument to `produce` must be a function",
921
- "The third argument to `produce` must be a function or undefined",
922
- "First argument to `createDraft` must be a plain object, an array, or an immerable object",
923
- "First argument to `finishDraft` must be a draft returned by `createDraft`",
924
- function(thing) {
925
- return `'current' expects a draft, got: ${thing}`;
926
- },
927
- "Object.defineProperty() cannot be used on an Immer draft",
928
- "Object.setPrototypeOf() cannot be used on an Immer draft",
929
- "Immer only supports deleting array indices",
930
- "Immer only supports setting array indices and the 'length' property",
931
- function(thing) {
932
- return `'original' expects a draft, got: ${thing}`;
933
- }
934
- // Note: if more errors are added, the errorOffset in Patches.ts should be increased
935
- // See Patches.ts for additional errors
936
- ] : [];
937
- function die(error, ...args) {
938
- if (process.env.NODE_ENV !== "production") {
939
- const e = errors[error];
940
- const msg = isFunction(e) ? e.apply(null, args) : e;
941
- throw new Error(`[Immer] ${msg}`);
942
- }
943
- throw new Error(
944
- `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
945
- );
946
- }
947
- var O = Object;
948
- var getPrototypeOf = O.getPrototypeOf;
949
- var CONSTRUCTOR = "constructor";
950
- var PROTOTYPE = "prototype";
951
- var CONFIGURABLE = "configurable";
952
- var ENUMERABLE = "enumerable";
953
- var WRITABLE = "writable";
954
- var VALUE = "value";
955
- var isDraft = (value) => !!value && !!value[DRAFT_STATE];
956
- function isDraftable(value) {
957
- if (!value)
958
- return false;
959
- return isPlainObject2(value) || isArray(value) || !!value[DRAFTABLE] || !!value[CONSTRUCTOR]?.[DRAFTABLE] || isMap(value) || isSet(value);
960
- }
961
- var objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString();
962
- var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
963
- function isPlainObject2(value) {
964
- if (!value || !isObjectish(value))
965
- return false;
966
- const proto = getPrototypeOf(value);
967
- if (proto === null || proto === O[PROTOTYPE])
968
- return true;
969
- const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
970
- if (Ctor === Object)
971
- return true;
972
- if (!isFunction(Ctor))
973
- return false;
974
- let ctorString = cachedCtorStrings.get(Ctor);
975
- if (ctorString === void 0) {
976
- ctorString = Function.toString.call(Ctor);
977
- cachedCtorStrings.set(Ctor, ctorString);
978
- }
979
- return ctorString === objectCtorString;
980
- }
981
- function each(obj, iter, strict = true) {
982
- if (getArchtype(obj) === 0) {
983
- const keys = strict ? Reflect.ownKeys(obj) : O.keys(obj);
984
- keys.forEach((key) => {
985
- iter(key, obj[key], obj);
986
- });
987
- } else {
988
- obj.forEach((entry, index) => iter(index, entry, obj));
989
- }
990
- }
991
- function getArchtype(thing) {
992
- const state = thing[DRAFT_STATE];
993
- return state ? state.type_ : isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
994
- }
995
- var has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop);
996
- var get = (thing, prop, type = getArchtype(thing)) => (
997
- // @ts-ignore
998
- type === 2 ? thing.get(prop) : thing[prop]
999
- );
1000
- var set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {
1001
- if (type === 2)
1002
- thing.set(propOrOldValue, value);
1003
- else if (type === 3) {
1004
- thing.add(value);
1005
- } else
1006
- thing[propOrOldValue] = value;
1007
- };
1008
- function is(x, y) {
1009
- if (x === y) {
1010
- return x !== 0 || 1 / x === 1 / y;
1011
- } else {
1012
- return x !== x && y !== y;
1013
- }
1014
- }
1015
- var isArray = Array.isArray;
1016
- var isMap = (target) => target instanceof Map;
1017
- var isSet = (target) => target instanceof Set;
1018
- var isObjectish = (target) => typeof target === "object";
1019
- var isFunction = (target) => typeof target === "function";
1020
- var isBoolean = (target) => typeof target === "boolean";
1021
- function isArrayIndex(value) {
1022
- const n = +value;
1023
- return Number.isInteger(n) && String(n) === value;
1024
- }
1025
- var latest = (state) => state.copy_ || state.base_;
1026
- var getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;
1027
- function shallowCopy(base, strict) {
1028
- if (isMap(base)) {
1029
- return new Map(base);
1030
- }
1031
- if (isSet(base)) {
1032
- return new Set(base);
1033
- }
1034
- if (isArray(base))
1035
- return Array[PROTOTYPE].slice.call(base);
1036
- const isPlain = isPlainObject2(base);
1037
- if (strict === true || strict === "class_only" && !isPlain) {
1038
- const descriptors = O.getOwnPropertyDescriptors(base);
1039
- delete descriptors[DRAFT_STATE];
1040
- let keys = Reflect.ownKeys(descriptors);
1041
- for (let i = 0; i < keys.length; i++) {
1042
- const key = keys[i];
1043
- const desc = descriptors[key];
1044
- if (desc[WRITABLE] === false) {
1045
- desc[WRITABLE] = true;
1046
- desc[CONFIGURABLE] = true;
1047
- }
1048
- if (desc.get || desc.set)
1049
- descriptors[key] = {
1050
- [CONFIGURABLE]: true,
1051
- [WRITABLE]: true,
1052
- // could live with !!desc.set as well here...
1053
- [ENUMERABLE]: desc[ENUMERABLE],
1054
- [VALUE]: base[key]
1055
- };
1056
- }
1057
- return O.create(getPrototypeOf(base), descriptors);
1058
- } else {
1059
- const proto = getPrototypeOf(base);
1060
- if (proto !== null && isPlain) {
1061
- return { ...base };
1062
- }
1063
- const obj = O.create(proto);
1064
- return O.assign(obj, base);
1065
- }
1066
- }
1067
- function freeze(obj, deep = false) {
1068
- if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))
1069
- return obj;
1070
- if (getArchtype(obj) > 1) {
1071
- O.defineProperties(obj, {
1072
- set: dontMutateMethodOverride,
1073
- add: dontMutateMethodOverride,
1074
- clear: dontMutateMethodOverride,
1075
- delete: dontMutateMethodOverride
1076
- });
1077
- }
1078
- O.freeze(obj);
1079
- if (deep)
1080
- each(
1081
- obj,
1082
- (_key, value) => {
1083
- freeze(value, true);
1084
- },
1085
- false
1086
- );
1087
- return obj;
1088
- }
1089
- function dontMutateFrozenCollections() {
1090
- die(2);
1091
- }
1092
- var dontMutateMethodOverride = {
1093
- [VALUE]: dontMutateFrozenCollections
1094
- };
1095
- function isFrozen(obj) {
1096
- if (obj === null || !isObjectish(obj))
1097
- return true;
1098
- return O.isFrozen(obj);
1099
- }
1100
- var PluginMapSet = "MapSet";
1101
- var PluginPatches = "Patches";
1102
- var PluginArrayMethods = "ArrayMethods";
1103
- var plugins = {};
1104
- function getPlugin(pluginKey) {
1105
- const plugin = plugins[pluginKey];
1106
- if (!plugin) {
1107
- die(0, pluginKey);
1108
- }
1109
- return plugin;
1110
- }
1111
- var isPluginLoaded = (pluginKey) => !!plugins[pluginKey];
1112
- var currentScope;
1113
- var getCurrentScope = () => currentScope;
1114
- var createScope = (parent_, immer_) => ({
1115
- drafts_: [],
1116
- parent_,
1117
- immer_,
1118
- // Whenever the modified draft contains a draft from another scope, we
1119
- // need to prevent auto-freezing so the unowned draft can be finalized.
1120
- canAutoFreeze_: true,
1121
- unfinalizedDrafts_: 0,
1122
- handledSet_: /* @__PURE__ */ new Set(),
1123
- processedForPatches_: /* @__PURE__ */ new Set(),
1124
- mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0,
1125
- arrayMethodsPlugin_: isPluginLoaded(PluginArrayMethods) ? getPlugin(PluginArrayMethods) : void 0
1126
- });
1127
- function usePatchesInScope(scope, patchListener) {
1128
- if (patchListener) {
1129
- scope.patchPlugin_ = getPlugin(PluginPatches);
1130
- scope.patches_ = [];
1131
- scope.inversePatches_ = [];
1132
- scope.patchListener_ = patchListener;
1133
- }
1134
- }
1135
- function revokeScope(scope) {
1136
- leaveScope(scope);
1137
- scope.drafts_.forEach(revokeDraft);
1138
- scope.drafts_ = null;
1139
- }
1140
- function leaveScope(scope) {
1141
- if (scope === currentScope) {
1142
- currentScope = scope.parent_;
1143
- }
1144
- }
1145
- var enterScope = (immer2) => currentScope = createScope(currentScope, immer2);
1146
- function revokeDraft(draft) {
1147
- const state = draft[DRAFT_STATE];
1148
- if (state.type_ === 0 || state.type_ === 1)
1149
- state.revoke_();
1150
- else
1151
- state.revoked_ = true;
1152
- }
1153
- function processResult(result, scope) {
1154
- scope.unfinalizedDrafts_ = scope.drafts_.length;
1155
- const baseDraft = scope.drafts_[0];
1156
- const isReplaced = result !== void 0 && result !== baseDraft;
1157
- if (isReplaced) {
1158
- if (baseDraft[DRAFT_STATE].modified_) {
1159
- revokeScope(scope);
1160
- die(4);
1161
- }
1162
- if (isDraftable(result)) {
1163
- result = finalize(scope, result);
1164
- }
1165
- const { patchPlugin_ } = scope;
1166
- if (patchPlugin_) {
1167
- patchPlugin_.generateReplacementPatches_(
1168
- baseDraft[DRAFT_STATE].base_,
1169
- result,
1170
- scope
1171
- );
1172
- }
1173
- } else {
1174
- result = finalize(scope, baseDraft);
1175
- }
1176
- maybeFreeze(scope, result, true);
1177
- revokeScope(scope);
1178
- if (scope.patches_) {
1179
- scope.patchListener_(scope.patches_, scope.inversePatches_);
1180
- }
1181
- return result !== NOTHING ? result : void 0;
1182
- }
1183
- function finalize(rootScope, value) {
1184
- if (isFrozen(value))
1185
- return value;
1186
- const state = value[DRAFT_STATE];
1187
- if (!state) {
1188
- const finalValue = handleValue(value, rootScope.handledSet_, rootScope);
1189
- return finalValue;
1190
- }
1191
- if (!isSameScope(state, rootScope)) {
1192
- return value;
1193
- }
1194
- if (!state.modified_) {
1195
- return state.base_;
1196
- }
1197
- if (!state.finalized_) {
1198
- const { callbacks_ } = state;
1199
- if (callbacks_) {
1200
- while (callbacks_.length > 0) {
1201
- const callback = callbacks_.pop();
1202
- callback(rootScope);
1203
- }
1204
- }
1205
- generatePatchesAndFinalize(state, rootScope);
1206
- }
1207
- return state.copy_;
1208
- }
1209
- function maybeFreeze(scope, value, deep = false) {
1210
- if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
1211
- freeze(value, deep);
1212
- }
1213
- }
1214
- function markStateFinalized(state) {
1215
- state.finalized_ = true;
1216
- state.scope_.unfinalizedDrafts_--;
1217
- }
1218
- var isSameScope = (state, rootScope) => state.scope_ === rootScope;
1219
- var EMPTY_LOCATIONS_RESULT = [];
1220
- function updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {
1221
- const parentCopy = latest(parent);
1222
- const parentType = parent.type_;
1223
- if (originalKey !== void 0) {
1224
- const currentValue = get(parentCopy, originalKey, parentType);
1225
- if (currentValue === draftValue) {
1226
- set(parentCopy, originalKey, finalizedValue, parentType);
1227
- return;
1228
- }
1229
- }
1230
- if (!parent.draftLocations_) {
1231
- const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();
1232
- each(parentCopy, (key, value) => {
1233
- if (isDraft(value)) {
1234
- const keys = draftLocations.get(value) || [];
1235
- keys.push(key);
1236
- draftLocations.set(value, keys);
1237
- }
1238
- });
1239
- }
1240
- const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;
1241
- for (const location of locations) {
1242
- set(parentCopy, location, finalizedValue, parentType);
1243
- }
1244
- }
1245
- function registerChildFinalizationCallback(parent, child, key) {
1246
- parent.callbacks_.push(function childCleanup(rootScope) {
1247
- const state = child;
1248
- if (!state || !isSameScope(state, rootScope)) {
1249
- return;
1250
- }
1251
- rootScope.mapSetPlugin_?.fixSetContents(state);
1252
- const finalizedValue = getFinalValue(state);
1253
- updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key);
1254
- generatePatchesAndFinalize(state, rootScope);
1255
- });
1256
- }
1257
- function generatePatchesAndFinalize(state, rootScope) {
1258
- const shouldFinalize = state.modified_ && !state.finalized_ && (state.type_ === 3 || state.type_ === 1 && state.allIndicesReassigned_ || (state.assigned_?.size ?? 0) > 0);
1259
- if (shouldFinalize) {
1260
- const { patchPlugin_ } = rootScope;
1261
- if (patchPlugin_) {
1262
- const basePath = patchPlugin_.getPath(state);
1263
- if (basePath) {
1264
- patchPlugin_.generatePatches_(state, basePath, rootScope);
1265
- }
1266
- }
1267
- markStateFinalized(state);
1268
- }
1269
- }
1270
- function handleCrossReference(target, key, value) {
1271
- const { scope_ } = target;
1272
- if (isDraft(value)) {
1273
- const state = value[DRAFT_STATE];
1274
- if (isSameScope(state, scope_)) {
1275
- state.callbacks_.push(function crossReferenceCleanup() {
1276
- prepareCopy(target);
1277
- const finalizedValue = getFinalValue(state);
1278
- updateDraftInParent(target, value, finalizedValue, key);
1279
- });
1280
- }
1281
- } else if (isDraftable(value)) {
1282
- target.callbacks_.push(function nestedDraftCleanup() {
1283
- const targetCopy = latest(target);
1284
- if (target.type_ === 3) {
1285
- if (targetCopy.has(value)) {
1286
- handleValue(value, scope_.handledSet_, scope_);
1287
- }
1288
- } else {
1289
- if (get(targetCopy, key, target.type_) === value) {
1290
- if (scope_.drafts_.length > 1 && (target.assigned_.get(key) ?? false) === true && target.copy_) {
1291
- handleValue(
1292
- get(target.copy_, key, target.type_),
1293
- scope_.handledSet_,
1294
- scope_
1295
- );
1296
- }
1297
- }
1298
- }
1299
- });
1300
- }
1301
- }
1302
- function handleValue(target, handledSet, rootScope) {
1303
- if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
1304
- return target;
1305
- }
1306
- if (isDraft(target) || handledSet.has(target) || !isDraftable(target) || isFrozen(target)) {
1307
- return target;
1308
- }
1309
- handledSet.add(target);
1310
- each(target, (key, value) => {
1311
- if (isDraft(value)) {
1312
- const state = value[DRAFT_STATE];
1313
- if (isSameScope(state, rootScope)) {
1314
- const updatedValue = getFinalValue(state);
1315
- set(target, key, updatedValue, target.type_);
1316
- markStateFinalized(state);
1317
- }
1318
- } else if (isDraftable(value)) {
1319
- handleValue(value, handledSet, rootScope);
1320
- }
1321
- });
1322
- return target;
1323
- }
1324
- function createProxyProxy(base, parent) {
1325
- const baseIsArray = isArray(base);
1326
- const state = {
1327
- type_: baseIsArray ? 1 : 0,
1328
- // Track which produce call this is associated with.
1329
- scope_: parent ? parent.scope_ : getCurrentScope(),
1330
- // True for both shallow and deep changes.
1331
- modified_: false,
1332
- // Used during finalization.
1333
- finalized_: false,
1334
- // Track which properties have been assigned (true) or deleted (false).
1335
- // actually instantiated in `prepareCopy()`
1336
- assigned_: void 0,
1337
- // The parent draft state.
1338
- parent_: parent,
1339
- // The base state.
1340
- base_: base,
1341
- // The base proxy.
1342
- draft_: null,
1343
- // set below
1344
- // The base copy with any updated values.
1345
- copy_: null,
1346
- // Called by the `produce` function.
1347
- revoke_: null,
1348
- isManual_: false,
1349
- // `callbacks` actually gets assigned in `createProxy`
1350
- callbacks_: void 0
1351
- };
1352
- let target = state;
1353
- let traps = objectTraps;
1354
- if (baseIsArray) {
1355
- target = [state];
1356
- traps = arrayTraps;
1357
- }
1358
- const { revoke, proxy } = Proxy.revocable(target, traps);
1359
- state.draft_ = proxy;
1360
- state.revoke_ = revoke;
1361
- return [proxy, state];
1362
- }
1363
- var objectTraps = {
1364
- get(state, prop) {
1365
- if (prop === DRAFT_STATE)
1366
- return state;
1367
- if (prop === "constructor" || prop === "__proto__") {
1368
- const source2 = latest(state);
1369
- const value2 = source2[prop];
1370
- return new Proxy(value2 || {}, {
1371
- get: (target, key) => {
1372
- if (key === "__proto__" || key === "prototype") {
1373
- return Object.freeze(/* @__PURE__ */ Object.create(null));
1374
- }
1375
- return Reflect.get(target, key);
1376
- },
1377
- set: () => {
1378
- return true;
1379
- },
1380
- apply: (target, thisArg, args) => {
1381
- return Reflect.apply(target, thisArg, args);
1382
- }
1383
- });
1384
- }
1385
- let arrayPlugin = state.scope_.arrayMethodsPlugin_;
1386
- const isArrayWithStringProp = state.type_ === 1 && typeof prop === "string";
1387
- if (isArrayWithStringProp) {
1388
- if (arrayPlugin?.isArrayOperationMethod(prop)) {
1389
- return arrayPlugin.createMethodInterceptor(state, prop);
1390
- }
1391
- }
1392
- const source = latest(state);
1393
- if (!has(source, prop, state.type_)) {
1394
- return readPropFromProto(state, source, prop);
1395
- }
1396
- const value = source[prop];
1397
- if (state.finalized_ || !isDraftable(value)) {
1398
- return value;
1399
- }
1400
- if (isArrayWithStringProp && state.operationMethod && arrayPlugin?.isMutatingArrayMethod(
1401
- state.operationMethod
1402
- ) && isArrayIndex(prop)) {
1403
- return value;
1404
- }
1405
- if (value === peek(state.base_, prop)) {
1406
- prepareCopy(state);
1407
- const childKey = state.type_ === 1 ? +prop : prop;
1408
- const childDraft = createProxy(state.scope_, value, state, childKey);
1409
- return state.copy_[childKey] = childDraft;
1410
- }
1411
- return value;
1412
- },
1413
- has(state, prop) {
1414
- if (prop === "constructor" || prop === "__proto__" || prop === "prototype") {
1415
- return false;
1416
- }
1417
- return prop in latest(state);
1418
- },
1419
- ownKeys(state) {
1420
- return Reflect.ownKeys(latest(state));
1421
- },
1422
- set(state, prop, value) {
1423
- if (prop === "constructor" || prop === "__proto__" || prop === "prototype") {
1424
- return true;
1425
- }
1426
- const desc = getDescriptorFromProto(latest(state), prop);
1427
- if (desc?.set) {
1428
- desc.set.call(state.draft_, value);
1429
- return true;
1430
- }
1431
- if (!state.modified_) {
1432
- const current2 = peek(latest(state), prop);
1433
- const currentState = current2?.[DRAFT_STATE];
1434
- if (currentState && currentState.base_ === value) {
1435
- state.copy_[prop] = value;
1436
- state.assigned_.set(prop, false);
1437
- return true;
1438
- }
1439
- if (is(value, current2) && (value !== void 0 || has(state.base_, prop, state.type_)))
1440
- return true;
1441
- prepareCopy(state);
1442
- markChanged(state);
1443
- }
1444
- if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'
1445
- (value !== void 0 || has(state.copy_, prop, state.type_)) || // special case: NaN
1446
- Number.isNaN(value) && Number.isNaN(state.copy_[prop]))
1447
- return true;
1448
- state.copy_[prop] = value;
1449
- state.assigned_.set(prop, true);
1450
- handleCrossReference(state, prop, value);
1451
- return true;
1452
- },
1453
- deleteProperty(state, prop) {
1454
- prepareCopy(state);
1455
- if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
1456
- state.assigned_.set(prop, false);
1457
- markChanged(state);
1458
- } else {
1459
- state.assigned_.delete(prop);
1460
- }
1461
- if (state.copy_) {
1462
- delete state.copy_[prop];
1463
- }
1464
- return true;
1465
- },
1466
- // Note: We never coerce `desc.value` into an Immer draft, because we can't make
1467
- // the same guarantee in ES5 mode.
1468
- getOwnPropertyDescriptor(state, prop) {
1469
- const owner = latest(state);
1470
- const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
1471
- if (!desc)
1472
- return desc;
1473
- return {
1474
- [WRITABLE]: true,
1475
- [CONFIGURABLE]: state.type_ !== 1 || prop !== "length",
1476
- [ENUMERABLE]: desc[ENUMERABLE],
1477
- [VALUE]: owner[prop]
1478
- };
1479
- },
1480
- defineProperty() {
1481
- die(11);
1482
- },
1483
- getPrototypeOf(state) {
1484
- return getPrototypeOf(state.base_);
1485
- },
1486
- setPrototypeOf() {
1487
- die(12);
1488
- }
1489
- };
1490
- var arrayTraps = {};
1491
- for (let key in objectTraps) {
1492
- let fn = objectTraps[key];
1493
- arrayTraps[key] = function() {
1494
- const args = arguments;
1495
- args[0] = args[0][0];
1496
- return fn.apply(this, args);
1497
- };
1498
- }
1499
- arrayTraps.deleteProperty = function(state, prop) {
1500
- if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop)))
1501
- die(13);
1502
- return arrayTraps.set.call(this, state, prop, void 0);
1503
- };
1504
- arrayTraps.set = function(state, prop, value) {
1505
- if (process.env.NODE_ENV !== "production" && prop !== "length" && isNaN(parseInt(prop)))
1506
- die(14);
1507
- return objectTraps.set.call(this, state[0], prop, value, state[0]);
1508
- };
1509
- function peek(draft, prop) {
1510
- const state = draft[DRAFT_STATE];
1511
- const source = state ? latest(state) : draft;
1512
- return source[prop];
1513
- }
1514
- function readPropFromProto(state, source, prop) {
1515
- const desc = getDescriptorFromProto(source, prop);
1516
- return desc ? VALUE in desc ? desc[VALUE] : (
1517
- // This is a very special case, if the prop is a getter defined by the
1518
- // prototype, we should invoke it with the draft as context!
1519
- desc.get?.call(state.draft_)
1520
- ) : void 0;
1521
- }
1522
- function getDescriptorFromProto(source, prop) {
1523
- if (!(prop in source))
1524
- return void 0;
1525
- let proto = getPrototypeOf(source);
1526
- while (proto) {
1527
- const desc = Object.getOwnPropertyDescriptor(proto, prop);
1528
- if (desc)
1529
- return desc;
1530
- proto = getPrototypeOf(proto);
1531
- }
1532
- return void 0;
1533
- }
1534
- function markChanged(state) {
1535
- if (!state.modified_) {
1536
- state.modified_ = true;
1537
- if (state.parent_) {
1538
- markChanged(state.parent_);
1539
- }
1540
- }
1541
- }
1542
- function prepareCopy(state) {
1543
- if (!state.copy_) {
1544
- state.assigned_ = /* @__PURE__ */ new Map();
1545
- state.copy_ = shallowCopy(
1546
- state.base_,
1547
- state.scope_.immer_.useStrictShallowCopy_
1548
- );
1549
- }
1550
- }
1551
- var Immer2 = class {
1552
- constructor(config) {
1553
- this.autoFreeze_ = true;
1554
- this.useStrictShallowCopy_ = false;
1555
- this.useStrictIteration_ = false;
1556
- this.produce = (base, recipe, patchListener) => {
1557
- if (isFunction(base) && !isFunction(recipe)) {
1558
- const defaultBase = recipe;
1559
- recipe = base;
1560
- const self = this;
1561
- return function curriedProduce(base2 = defaultBase, ...args) {
1562
- return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
1563
- };
1564
- }
1565
- if (!isFunction(recipe))
1566
- die(6);
1567
- if (patchListener !== void 0 && !isFunction(patchListener))
1568
- die(7);
1569
- let result;
1570
- if (isDraftable(base)) {
1571
- const scope = enterScope(this);
1572
- const proxy = createProxy(scope, base, void 0);
1573
- let hasError = true;
1574
- try {
1575
- result = recipe(proxy);
1576
- hasError = false;
1577
- } finally {
1578
- if (hasError)
1579
- revokeScope(scope);
1580
- else
1581
- leaveScope(scope);
1582
- }
1583
- usePatchesInScope(scope, patchListener);
1584
- return processResult(result, scope);
1585
- } else if (!base || !isObjectish(base)) {
1586
- result = recipe(base);
1587
- if (result === void 0)
1588
- result = base;
1589
- if (result === NOTHING)
1590
- result = void 0;
1591
- if (this.autoFreeze_)
1592
- freeze(result, true);
1593
- if (patchListener) {
1594
- const p = [];
1595
- const ip = [];
1596
- getPlugin(PluginPatches).generateReplacementPatches_(base, result, {
1597
- patches_: p,
1598
- inversePatches_: ip
1599
- });
1600
- patchListener(p, ip);
1601
- }
1602
- return result;
1603
- } else
1604
- die(1, base);
1605
- };
1606
- this.produceWithPatches = (base, recipe) => {
1607
- if (isFunction(base)) {
1608
- return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
1609
- }
1610
- let patches, inversePatches;
1611
- const result = this.produce(base, recipe, (p, ip) => {
1612
- patches = p;
1613
- inversePatches = ip;
1614
- });
1615
- return [result, patches, inversePatches];
1616
- };
1617
- if (isBoolean(config?.autoFreeze))
1618
- this.setAutoFreeze(config.autoFreeze);
1619
- if (isBoolean(config?.useStrictShallowCopy))
1620
- this.setUseStrictShallowCopy(config.useStrictShallowCopy);
1621
- if (isBoolean(config?.useStrictIteration))
1622
- this.setUseStrictIteration(config.useStrictIteration);
1623
- }
1624
- createDraft(base) {
1625
- if (!isDraftable(base))
1626
- die(8);
1627
- if (isDraft(base))
1628
- base = current(base);
1629
- const scope = enterScope(this);
1630
- const proxy = createProxy(scope, base, void 0);
1631
- proxy[DRAFT_STATE].isManual_ = true;
1632
- leaveScope(scope);
1633
- return proxy;
1634
- }
1635
- finishDraft(draft, patchListener) {
1636
- const state = draft && draft[DRAFT_STATE];
1637
- if (!state || !state.isManual_)
1638
- die(9);
1639
- const { scope_: scope } = state;
1640
- usePatchesInScope(scope, patchListener);
1641
- return processResult(void 0, scope);
1642
- }
1643
- /**
1644
- * Pass true to automatically freeze all copies created by Immer.
1645
- *
1646
- * By default, auto-freezing is enabled.
1647
- */
1648
- setAutoFreeze(value) {
1649
- this.autoFreeze_ = value;
1650
- }
1651
- /**
1652
- * Pass true to enable strict shallow copy.
1653
- *
1654
- * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
1655
- */
1656
- setUseStrictShallowCopy(value) {
1657
- this.useStrictShallowCopy_ = value;
1658
- }
1659
- /**
1660
- * Pass false to use faster iteration that skips non-enumerable properties
1661
- * but still handles symbols for compatibility.
1662
- *
1663
- * By default, strict iteration is enabled (includes all own properties).
1664
- */
1665
- setUseStrictIteration(value) {
1666
- this.useStrictIteration_ = value;
1667
- }
1668
- shouldUseStrictIteration() {
1669
- return this.useStrictIteration_;
1670
- }
1671
- applyPatches(base, patches) {
1672
- let i;
1673
- for (i = patches.length - 1; i >= 0; i--) {
1674
- const patch = patches[i];
1675
- if (patch.path.length === 0 && patch.op === "replace") {
1676
- base = patch.value;
1677
- break;
1678
- }
1679
- }
1680
- if (i > -1) {
1681
- patches = patches.slice(i + 1);
1682
- }
1683
- const applyPatchesImpl = getPlugin(PluginPatches).applyPatches_;
1684
- if (isDraft(base)) {
1685
- return applyPatchesImpl(base, patches);
1686
- }
1687
- return this.produce(
1688
- base,
1689
- (draft) => applyPatchesImpl(draft, patches)
1690
- );
1691
- }
1692
- };
1693
- function createProxy(rootScope, value, parent, key) {
1694
- const [draft, state] = isMap(value) ? getPlugin(PluginMapSet).proxyMap_(value, parent) : isSet(value) ? getPlugin(PluginMapSet).proxySet_(value, parent) : createProxyProxy(value, parent);
1695
- const scope = parent?.scope_ ?? getCurrentScope();
1696
- scope.drafts_.push(draft);
1697
- state.callbacks_ = parent?.callbacks_ ?? [];
1698
- state.key_ = key;
1699
- if (parent && key !== void 0) {
1700
- registerChildFinalizationCallback(parent, state, key);
1701
- } else {
1702
- state.callbacks_.push(function rootDraftCleanup(rootScope2) {
1703
- rootScope2.mapSetPlugin_?.fixSetContents(state);
1704
- const { patchPlugin_ } = rootScope2;
1705
- if (state.modified_ && patchPlugin_) {
1706
- patchPlugin_.generatePatches_(state, [], rootScope2);
1707
- }
1708
- });
1709
- }
1710
- return draft;
1711
- }
1712
- function current(value) {
1713
- if (!isDraft(value))
1714
- die(10, value);
1715
- return currentImpl(value);
1716
- }
1717
- function currentImpl(value) {
1718
- if (!isDraftable(value) || isFrozen(value))
1719
- return value;
1720
- const state = value[DRAFT_STATE];
1721
- let copy;
1722
- let strict = true;
1723
- if (state) {
1724
- if (!state.modified_)
1725
- return state.base_;
1726
- state.finalized_ = true;
1727
- copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
1728
- strict = state.scope_.immer_.shouldUseStrictIteration();
1729
- } else {
1730
- copy = shallowCopy(value, true);
1731
- }
1732
- each(
1733
- copy,
1734
- (key, childValue) => {
1735
- set(copy, key, currentImpl(childValue));
1736
- },
1737
- strict
1738
- );
1739
- if (state) {
1740
- state.finalized_ = false;
1741
- }
1742
- return copy;
1743
- }
1744
- var immer = new Immer2();
1745
- var produce = immer.produce;
1746
-
1747
- // node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs
1748
- var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
1749
- if (arguments.length === 0) return void 0;
1750
- if (typeof arguments[0] === "object") return compose;
1751
- return compose.apply(null, arguments);
1752
- };
1753
- var devToolsEnhancer = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__ : function() {
1754
- return function(noop3) {
1755
- return noop3;
1756
- };
1757
- };
1758
- var hasMatchFunction = (v) => {
1759
- return v && typeof v.match === "function";
1760
- };
1761
- function createAction(type, prepareAction) {
1762
- function actionCreator(...args) {
1763
- if (prepareAction) {
1764
- let prepared = prepareAction(...args);
1765
- if (!prepared) {
1766
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : "prepareAction did not return an object");
1767
- }
1768
- return {
1769
- type,
1770
- payload: prepared.payload,
1771
- ..."meta" in prepared && {
1772
- meta: prepared.meta
1773
- },
1774
- ..."error" in prepared && {
1775
- error: prepared.error
1776
- }
1777
- };
1778
- }
1779
- return {
1780
- type,
1781
- payload: args[0]
1782
- };
1783
- }
1784
- actionCreator.toString = () => `${type}`;
1785
- actionCreator.type = type;
1786
- actionCreator.match = (action) => isAction(action) && action.type === type;
1787
- return actionCreator;
1788
- }
1789
- function freezeDraftable(val) {
1790
- return isDraftable(val) ? produce(val, () => {
1791
- }) : val;
1792
- }
1793
- function getOrInsertComputed(map, key, compute) {
1794
- if (map.has(key)) return map.get(key);
1795
- return map.set(key, compute(key)).get(key);
1796
- }
1797
- function executeReducerBuilderCallback(builderCallback) {
1798
- const actionsMap = {};
1799
- const actionMatchers = [];
1800
- let defaultCaseReducer;
1801
- const builder = {
1802
- addCase(typeOrActionCreator, reducer) {
1803
- if (process.env.NODE_ENV !== "production") {
1804
- if (actionMatchers.length > 0) {
1805
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
1806
- }
1807
- if (defaultCaseReducer) {
1808
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
1809
- }
1810
- }
1811
- const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
1812
- if (!type) {
1813
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(28) : "`builder.addCase` cannot be called with an empty action type");
1814
- }
1815
- if (type in actionsMap) {
1816
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`);
1817
- }
1818
- actionsMap[type] = reducer;
1819
- return builder;
1820
- },
1821
- addAsyncThunk(asyncThunk, reducers) {
1822
- if (process.env.NODE_ENV !== "production") {
1823
- if (defaultCaseReducer) {
1824
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(43) : "`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");
1825
- }
1826
- }
1827
- if (reducers.pending) actionsMap[asyncThunk.pending.type] = reducers.pending;
1828
- if (reducers.rejected) actionsMap[asyncThunk.rejected.type] = reducers.rejected;
1829
- if (reducers.fulfilled) actionsMap[asyncThunk.fulfilled.type] = reducers.fulfilled;
1830
- if (reducers.settled) actionMatchers.push({
1831
- matcher: asyncThunk.settled,
1832
- reducer: reducers.settled
1833
- });
1834
- return builder;
1835
- },
1836
- addMatcher(matcher, reducer) {
1837
- if (process.env.NODE_ENV !== "production") {
1838
- if (defaultCaseReducer) {
1839
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
1840
- }
1841
- }
1842
- actionMatchers.push({
1843
- matcher,
1844
- reducer
1845
- });
1846
- return builder;
1847
- },
1848
- addDefaultCase(reducer) {
1849
- if (process.env.NODE_ENV !== "production") {
1850
- if (defaultCaseReducer) {
1851
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(31) : "`builder.addDefaultCase` can only be called once");
1852
- }
1853
- }
1854
- defaultCaseReducer = reducer;
1855
- return builder;
1856
- }
1857
- };
1858
- builderCallback(builder);
1859
- return [actionsMap, actionMatchers, defaultCaseReducer];
1860
- }
1861
- function isStateFunction(x) {
1862
- return typeof x === "function";
1863
- }
1864
- function createReducer(initialState, mapOrBuilderCallback) {
1865
- if (process.env.NODE_ENV !== "production") {
1866
- if (typeof mapOrBuilderCallback === "object") {
1867
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
1868
- }
1869
- }
1870
- let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] = executeReducerBuilderCallback(mapOrBuilderCallback);
1871
- let getInitialState;
1872
- if (isStateFunction(initialState)) {
1873
- getInitialState = () => freezeDraftable(initialState());
1874
- } else {
1875
- const frozenInitialState = freezeDraftable(initialState);
1876
- getInitialState = () => frozenInitialState;
1877
- }
1878
- function reducer(state = getInitialState(), action) {
1879
- let caseReducers = [actionsMap[action.type], ...finalActionMatchers.filter(({
1880
- matcher
1881
- }) => matcher(action)).map(({
1882
- reducer: reducer2
1883
- }) => reducer2)];
1884
- if (caseReducers.filter((cr) => !!cr).length === 0) {
1885
- caseReducers = [finalDefaultCaseReducer];
1886
- }
1887
- return caseReducers.reduce((previousState, caseReducer) => {
1888
- if (caseReducer) {
1889
- if (isDraft(previousState)) {
1890
- const draft = previousState;
1891
- const result = caseReducer(draft, action);
1892
- if (result === void 0) {
1893
- return previousState;
1894
- }
1895
- return result;
1896
- } else if (!isDraftable(previousState)) {
1897
- const result = caseReducer(previousState, action);
1898
- if (result === void 0) {
1899
- if (previousState === null) {
1900
- return previousState;
1901
- }
1902
- throw Error("A case reducer on a non-draftable value must not return undefined");
1903
- }
1904
- return result;
1905
- } else {
1906
- return produce(previousState, (draft) => {
1907
- return caseReducer(draft, action);
1908
- });
1909
- }
1910
- }
1911
- return previousState;
1912
- }, state);
1913
- }
1914
- reducer.getInitialState = getInitialState;
1915
- return reducer;
1916
- }
1917
- var matches = (matcher, action) => {
1918
- if (hasMatchFunction(matcher)) {
1919
- return matcher.match(action);
1920
- } else {
1921
- return matcher(action);
1922
- }
1923
- };
1924
- function isAnyOf(...matchers) {
1925
- return (action) => {
1926
- return matchers.some((matcher) => matches(matcher, action));
1927
- };
1928
- }
1929
- var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
1930
- var nanoid = (size = 21) => {
1931
- let id = "";
1932
- let i = size;
1933
- while (i--) {
1934
- id += urlAlphabet[Math.random() * 64 | 0];
1935
- }
1936
- return id;
1937
- };
1938
- var commonProperties = ["name", "message", "stack", "code"];
1939
- var RejectWithValue = class {
1940
- constructor(payload, meta) {
1941
- __publicField(this, "payload");
1942
- __publicField(this, "meta");
1943
- /*
1944
- type-only property to distinguish between RejectWithValue and FulfillWithMeta
1945
- does not exist at runtime
1946
- */
1947
- __publicField(this, "_type");
1948
- this.payload = payload;
1949
- this.meta = meta;
1950
- }
1951
- };
1952
- var FulfillWithMeta = class {
1953
- constructor(payload, meta) {
1954
- __publicField(this, "payload");
1955
- __publicField(this, "meta");
1956
- /*
1957
- type-only property to distinguish between RejectWithValue and FulfillWithMeta
1958
- does not exist at runtime
1959
- */
1960
- __publicField(this, "_type");
1961
- this.payload = payload;
1962
- this.meta = meta;
1963
- }
1964
- };
1965
- var miniSerializeError = (value) => {
1966
- if (typeof value === "object" && value !== null) {
1967
- const simpleError = {};
1968
- for (const property of commonProperties) {
1969
- if (typeof value[property] === "string") {
1970
- simpleError[property] = value[property];
1971
- }
1972
- }
1973
- return simpleError;
1974
- }
1975
- return {
1976
- message: String(value)
1977
- };
1978
- };
1979
- var externalAbortMessage = "External signal was aborted";
1980
- var createAsyncThunk = /* @__PURE__ */ (() => {
1981
- function createAsyncThunk2(typePrefix, payloadCreator, options) {
1982
- const fulfilled = createAction(typePrefix + "/fulfilled", (payload, requestId, arg, meta) => ({
1983
- payload,
1984
- meta: {
1985
- ...meta || {},
1986
- arg,
1987
- requestId,
1988
- requestStatus: "fulfilled"
1989
- }
1990
- }));
1991
- const pending = createAction(typePrefix + "/pending", (requestId, arg, meta) => ({
1992
- payload: void 0,
1993
- meta: {
1994
- ...meta || {},
1995
- arg,
1996
- requestId,
1997
- requestStatus: "pending"
1998
- }
1999
- }));
2000
- const rejected = createAction(typePrefix + "/rejected", (error, requestId, arg, payload, meta) => ({
2001
- payload,
2002
- error: (options && options.serializeError || miniSerializeError)(error || "Rejected"),
2003
- meta: {
2004
- ...meta || {},
2005
- arg,
2006
- requestId,
2007
- rejectedWithValue: !!payload,
2008
- requestStatus: "rejected",
2009
- aborted: error?.name === "AbortError",
2010
- condition: error?.name === "ConditionError"
2011
- }
2012
- }));
2013
- function actionCreator(arg, {
2014
- signal
2015
- } = {}) {
2016
- return (dispatch, getState, extra) => {
2017
- const requestId = options?.idGenerator ? options.idGenerator(arg) : nanoid();
2018
- const abortController = new AbortController();
2019
- let abortHandler;
2020
- let abortReason;
2021
- function abort(reason) {
2022
- abortReason = reason;
2023
- abortController.abort();
2024
- }
2025
- if (signal) {
2026
- if (signal.aborted) {
2027
- abort(externalAbortMessage);
2028
- } else {
2029
- signal.addEventListener("abort", () => abort(externalAbortMessage), {
2030
- once: true
2031
- });
2032
- }
2033
- }
2034
- const promise = (async function() {
2035
- let finalAction;
2036
- try {
2037
- let conditionResult = options?.condition?.(arg, {
2038
- getState,
2039
- extra
2040
- });
2041
- if (isThenable(conditionResult)) {
2042
- conditionResult = await conditionResult;
2043
- }
2044
- if (conditionResult === false || abortController.signal.aborted) {
2045
- throw {
2046
- name: "ConditionError",
2047
- message: "Aborted due to condition callback returning false."
2048
- };
2049
- }
2050
- const abortedPromise = new Promise((_, reject) => {
2051
- abortHandler = () => {
2052
- reject({
2053
- name: "AbortError",
2054
- message: abortReason || "Aborted"
2055
- });
2056
- };
2057
- abortController.signal.addEventListener("abort", abortHandler, {
2058
- once: true
2059
- });
2060
- });
2061
- dispatch(pending(requestId, arg, options?.getPendingMeta?.({
2062
- requestId,
2063
- arg
2064
- }, {
2065
- getState,
2066
- extra
2067
- })));
2068
- finalAction = await Promise.race([abortedPromise, Promise.resolve(payloadCreator(arg, {
2069
- dispatch,
2070
- getState,
2071
- extra,
2072
- requestId,
2073
- signal: abortController.signal,
2074
- abort,
2075
- rejectWithValue: ((value, meta) => {
2076
- return new RejectWithValue(value, meta);
2077
- }),
2078
- fulfillWithValue: ((value, meta) => {
2079
- return new FulfillWithMeta(value, meta);
2080
- })
2081
- })).then((result) => {
2082
- if (result instanceof RejectWithValue) {
2083
- throw result;
2084
- }
2085
- if (result instanceof FulfillWithMeta) {
2086
- return fulfilled(result.payload, requestId, arg, result.meta);
2087
- }
2088
- return fulfilled(result, requestId, arg);
2089
- })]);
2090
- } catch (err) {
2091
- finalAction = err instanceof RejectWithValue ? rejected(null, requestId, arg, err.payload, err.meta) : rejected(err, requestId, arg);
2092
- } finally {
2093
- if (abortHandler) {
2094
- abortController.signal.removeEventListener("abort", abortHandler);
2095
- }
2096
- }
2097
- const skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition;
2098
- if (!skipDispatch) {
2099
- dispatch(finalAction);
2100
- }
2101
- return finalAction;
2102
- })();
2103
- return Object.assign(promise, {
2104
- abort,
2105
- requestId,
2106
- arg,
2107
- unwrap() {
2108
- return promise.then(unwrapResult);
2109
- }
2110
- });
2111
- };
2112
- }
2113
- return Object.assign(actionCreator, {
2114
- pending,
2115
- rejected,
2116
- fulfilled,
2117
- settled: isAnyOf(rejected, fulfilled),
2118
- typePrefix
2119
- });
2120
- }
2121
- createAsyncThunk2.withTypes = () => createAsyncThunk2;
2122
- return createAsyncThunk2;
2123
- })();
2124
- function unwrapResult(action) {
2125
- if (action.meta && action.meta.rejectedWithValue) {
2126
- throw action.payload;
2127
- }
2128
- if (action.error) {
2129
- throw action.error;
2130
- }
2131
- return action.payload;
2132
- }
2133
- function isThenable(value) {
2134
- return value !== null && typeof value === "object" && typeof value.then === "function";
2135
- }
2136
- var asyncThunkSymbol = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
2137
- var asyncThunkCreator = {
2138
- [asyncThunkSymbol]: createAsyncThunk
2139
- };
2140
- function getType(slice2, actionKey) {
2141
- return `${slice2}/${actionKey}`;
2142
- }
2143
- function buildCreateSlice({
2144
- creators
2145
- } = {}) {
2146
- const cAT = creators?.asyncThunk?.[asyncThunkSymbol];
2147
- return function createSlice2(options) {
2148
- const {
2149
- name,
2150
- reducerPath = name
2151
- } = options;
2152
- if (!name) {
2153
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "`name` is a required option for createSlice");
2154
- }
2155
- if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
2156
- if (options.initialState === void 0) {
2157
- console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
2158
- }
2159
- }
2160
- const reducers = (typeof options.reducers === "function" ? options.reducers(buildReducerCreators()) : options.reducers) || {};
2161
- const reducerNames = Object.keys(reducers);
2162
- const context = {
2163
- sliceCaseReducersByName: {},
2164
- sliceCaseReducersByType: {},
2165
- actionCreators: {},
2166
- sliceMatchers: []
2167
- };
2168
- const contextMethods = {
2169
- addCase(typeOrActionCreator, reducer2) {
2170
- const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
2171
- if (!type) {
2172
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : "`context.addCase` cannot be called with an empty action type");
2173
- }
2174
- if (type in context.sliceCaseReducersByType) {
2175
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + type);
2176
- }
2177
- context.sliceCaseReducersByType[type] = reducer2;
2178
- return contextMethods;
2179
- },
2180
- addMatcher(matcher, reducer2) {
2181
- context.sliceMatchers.push({
2182
- matcher,
2183
- reducer: reducer2
2184
- });
2185
- return contextMethods;
2186
- },
2187
- exposeAction(name2, actionCreator) {
2188
- context.actionCreators[name2] = actionCreator;
2189
- return contextMethods;
2190
- },
2191
- exposeCaseReducer(name2, reducer2) {
2192
- context.sliceCaseReducersByName[name2] = reducer2;
2193
- return contextMethods;
2194
- }
2195
- };
2196
- reducerNames.forEach((reducerName) => {
2197
- const reducerDefinition = reducers[reducerName];
2198
- const reducerDetails = {
2199
- reducerName,
2200
- type: getType(name, reducerName),
2201
- createNotation: typeof options.reducers === "function"
2202
- };
2203
- if (isAsyncThunkSliceReducerDefinition(reducerDefinition)) {
2204
- handleThunkCaseReducerDefinition(reducerDetails, reducerDefinition, contextMethods, cAT);
2205
- } else {
2206
- handleNormalReducerDefinition(reducerDetails, reducerDefinition, contextMethods);
2207
- }
2208
- });
2209
- function buildReducer() {
2210
- if (process.env.NODE_ENV !== "production") {
2211
- if (typeof options.extraReducers === "object") {
2212
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
2213
- }
2214
- }
2215
- const [extraReducers = {}, actionMatchers = [], defaultCaseReducer = void 0] = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers];
2216
- const finalCaseReducers = {
2217
- ...extraReducers,
2218
- ...context.sliceCaseReducersByType
2219
- };
2220
- return createReducer(options.initialState, (builder) => {
2221
- for (let key in finalCaseReducers) {
2222
- builder.addCase(key, finalCaseReducers[key]);
2223
- }
2224
- for (let sM of context.sliceMatchers) {
2225
- builder.addMatcher(sM.matcher, sM.reducer);
2226
- }
2227
- for (let m of actionMatchers) {
2228
- builder.addMatcher(m.matcher, m.reducer);
2229
- }
2230
- if (defaultCaseReducer) {
2231
- builder.addDefaultCase(defaultCaseReducer);
2232
- }
2233
- });
2234
- }
2235
- const selectSelf = (state) => state;
2236
- const injectedSelectorCache = /* @__PURE__ */ new Map();
2237
- const injectedStateCache = /* @__PURE__ */ new WeakMap();
2238
- let _reducer;
2239
- function reducer(state, action) {
2240
- if (!_reducer) _reducer = buildReducer();
2241
- return _reducer(state, action);
2242
- }
2243
- function getInitialState() {
2244
- if (!_reducer) _reducer = buildReducer();
2245
- return _reducer.getInitialState();
2246
- }
2247
- function makeSelectorProps(reducerPath2, injected = false) {
2248
- function selectSlice(state) {
2249
- let sliceState = state[reducerPath2];
2250
- if (typeof sliceState === "undefined") {
2251
- if (injected) {
2252
- sliceState = getOrInsertComputed(injectedStateCache, selectSlice, getInitialState);
2253
- } else if (process.env.NODE_ENV !== "production") {
2254
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : "selectSlice returned undefined for an uninjected slice reducer");
2255
- }
2256
- }
2257
- return sliceState;
2258
- }
2259
- function getSelectors(selectState = selectSelf) {
2260
- const selectorCache = getOrInsertComputed(injectedSelectorCache, injected, () => /* @__PURE__ */ new WeakMap());
2261
- return getOrInsertComputed(selectorCache, selectState, () => {
2262
- const map = {};
2263
- for (const [name2, selector] of Object.entries(options.selectors ?? {})) {
2264
- map[name2] = wrapSelector(selector, selectState, () => getOrInsertComputed(injectedStateCache, selectState, getInitialState), injected);
2265
- }
2266
- return map;
2267
- });
2268
- }
2269
- return {
2270
- reducerPath: reducerPath2,
2271
- getSelectors,
2272
- get selectors() {
2273
- return getSelectors(selectSlice);
2274
- },
2275
- selectSlice
2276
- };
2277
- }
2278
- const slice2 = {
2279
- name,
2280
- reducer,
2281
- actions: context.actionCreators,
2282
- caseReducers: context.sliceCaseReducersByName,
2283
- getInitialState,
2284
- ...makeSelectorProps(reducerPath),
2285
- injectInto(injectable, {
2286
- reducerPath: pathOpt,
2287
- ...config
2288
- } = {}) {
2289
- const newReducerPath = pathOpt ?? reducerPath;
2290
- injectable.inject({
2291
- reducerPath: newReducerPath,
2292
- reducer
2293
- }, config);
2294
- return {
2295
- ...slice2,
2296
- ...makeSelectorProps(newReducerPath, true)
2297
- };
2298
- }
2299
- };
2300
- return slice2;
2301
- };
2302
- }
2303
- function wrapSelector(selector, selectState, getInitialState, injected) {
2304
- function wrapper(rootState, ...args) {
2305
- let sliceState = selectState(rootState);
2306
- if (typeof sliceState === "undefined") {
2307
- if (injected) {
2308
- sliceState = getInitialState();
2309
- } else if (process.env.NODE_ENV !== "production") {
2310
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "selectState returned undefined for an uninjected slice reducer");
2311
- }
2312
- }
2313
- return selector(sliceState, ...args);
2314
- }
2315
- wrapper.unwrapped = selector;
2316
- return wrapper;
2317
- }
2318
- var createSlice = /* @__PURE__ */ buildCreateSlice();
2319
- function buildReducerCreators() {
2320
- function asyncThunk(payloadCreator, config) {
2321
- return {
2322
- _reducerDefinitionType: "asyncThunk",
2323
- payloadCreator,
2324
- ...config
2325
- };
2326
- }
2327
- asyncThunk.withTypes = () => asyncThunk;
2328
- return {
2329
- reducer(caseReducer) {
2330
- return Object.assign({
2331
- // hack so the wrapping function has the same name as the original
2332
- // we need to create a wrapper so the `reducerDefinitionType` is not assigned to the original
2333
- [caseReducer.name](...args) {
2334
- return caseReducer(...args);
2335
- }
2336
- }[caseReducer.name], {
2337
- _reducerDefinitionType: "reducer"
2338
- /* reducer */
2339
- });
2340
- },
2341
- preparedReducer(prepare, reducer) {
2342
- return {
2343
- _reducerDefinitionType: "reducerWithPrepare",
2344
- prepare,
2345
- reducer
2346
- };
2347
- },
2348
- asyncThunk
2349
- };
2350
- }
2351
- function handleNormalReducerDefinition({
2352
- type,
2353
- reducerName,
2354
- createNotation
2355
- }, maybeReducerWithPrepare, context) {
2356
- let caseReducer;
2357
- let prepareCallback;
2358
- if ("reducer" in maybeReducerWithPrepare) {
2359
- if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) {
2360
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
2361
- }
2362
- caseReducer = maybeReducerWithPrepare.reducer;
2363
- prepareCallback = maybeReducerWithPrepare.prepare;
2364
- } else {
2365
- caseReducer = maybeReducerWithPrepare;
2366
- }
2367
- context.addCase(type, caseReducer).exposeCaseReducer(reducerName, caseReducer).exposeAction(reducerName, prepareCallback ? createAction(type, prepareCallback) : createAction(type));
2368
- }
2369
- function isAsyncThunkSliceReducerDefinition(reducerDefinition) {
2370
- return reducerDefinition._reducerDefinitionType === "asyncThunk";
2371
- }
2372
- function isCaseReducerWithPrepareDefinition(reducerDefinition) {
2373
- return reducerDefinition._reducerDefinitionType === "reducerWithPrepare";
2374
- }
2375
- function handleThunkCaseReducerDefinition({
2376
- type,
2377
- reducerName
2378
- }, reducerDefinition, context, cAT) {
2379
- if (!cAT) {
2380
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
2381
- }
2382
- const {
2383
- payloadCreator,
2384
- fulfilled,
2385
- pending,
2386
- rejected,
2387
- settled,
2388
- options
2389
- } = reducerDefinition;
2390
- const thunk = cAT(type, payloadCreator, options);
2391
- context.exposeAction(reducerName, thunk);
2392
- if (fulfilled) {
2393
- context.addCase(thunk.fulfilled, fulfilled);
2394
- }
2395
- if (pending) {
2396
- context.addCase(thunk.pending, pending);
2397
- }
2398
- if (rejected) {
2399
- context.addCase(thunk.rejected, rejected);
2400
- }
2401
- if (settled) {
2402
- context.addMatcher(thunk.settled, settled);
2403
- }
2404
- context.exposeCaseReducer(reducerName, {
2405
- fulfilled: fulfilled || noop,
2406
- pending: pending || noop,
2407
- rejected: rejected || noop,
2408
- settled: settled || noop
2409
- });
2410
- }
2411
- function noop() {
2412
- }
2413
- var listener = "listener";
2414
- var completed = "completed";
2415
- var cancelled = "cancelled";
2416
- var taskCancelled = `task-${cancelled}`;
2417
- var taskCompleted = `task-${completed}`;
2418
- var listenerCancelled = `${listener}-${cancelled}`;
2419
- var listenerCompleted = `${listener}-${completed}`;
2420
- var {
2421
- assign
2422
- } = Object;
2423
- var alm = "listenerMiddleware";
2424
- var addListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/add`), {
2425
- withTypes: () => addListener
2426
- });
2427
- var clearAllListeners = /* @__PURE__ */ createAction(`${alm}/removeAll`);
2428
- var removeListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/remove`), {
2429
- withTypes: () => removeListener
2430
- });
2431
- function formatProdErrorMessage(code) {
2432
- return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
2433
- }
2434
-
2435
869
  // src/ScrollViewSettingsContext.ts
2436
870
  import { createContext as createContext2 } from "react";
2437
871
  var defaultScrollViewSettings = {
@@ -2447,15 +881,18 @@ var ScrollViewSettingsContext = createContext2({
2447
881
  });
2448
882
 
2449
883
  // src/redux/scrollViewSlice.ts
2450
- var slice = createSlice({
2451
- name: "scrollView",
2452
- initialState: defaultScrollViewSettings,
2453
- reducers: {
2454
- initialize: (_state, action) => action.payload
2455
- }
2456
- });
2457
- var scrollViewActions = slice.actions;
2458
- var scrollViewReducer = slice.reducer;
884
+ var createAction = (type) => {
885
+ const actionCreator = (payload) => ({ payload, type });
886
+ actionCreator.type = type;
887
+ actionCreator.match = (action) => action.type === type;
888
+ return actionCreator;
889
+ };
890
+ var initialize = createAction("scrollView/initialize");
891
+ var scrollViewActions = { initialize };
892
+ var scrollViewReducer = (state = defaultScrollViewSettings, action) => {
893
+ if (initialize.match(action)) return action.payload;
894
+ return state;
895
+ };
2459
896
 
2460
897
  // src/ScrollView.tsx
2461
898
  import { memo as memo3, useCallback as useCallback6, useContext as useContext9, useLayoutEffect as useLayoutEffect4, useMemo as useMemo4, useRef as useRef6 } from "react";
@@ -2734,7 +1171,7 @@ var ScrollViewSettingsProvider = ({ children, onChange, initialValue }) => {
2734
1171
  ...defaultScrollViewSettings,
2735
1172
  ...initialValue
2736
1173
  }));
2737
- const set2 = useCallback8(
1174
+ const set = useCallback8(
2738
1175
  (patch) => {
2739
1176
  setSettings((prev) => {
2740
1177
  const next = { ...prev, ...patch };
@@ -2744,7 +1181,7 @@ var ScrollViewSettingsProvider = ({ children, onChange, initialValue }) => {
2744
1181
  },
2745
1182
  [onChange]
2746
1183
  );
2747
- const ctx = useMemo6(() => ({ settings, set: set2 }), [settings, set2]);
1184
+ const ctx = useMemo6(() => ({ settings, set }), [settings, set]);
2748
1185
  return /* @__PURE__ */ jsx11(ScrollViewSettingsContext.Provider, { value: ctx, children });
2749
1186
  };
2750
1187