@rific/scroll-view 0.3.0 → 0.4.1

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