@amazon-devices/react-navigation__routers 7.0.1759135970 → 8.0.9000000000-rn-83

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.
Files changed (75) hide show
  1. package/SystemBundles/b6cc62e27d70be8722b0e7aef9fd04a870d49127e6c724fe934d1f8ca4ff8177.bundle +1298 -0
  2. package/SystemBundles/b6cc62e27d70be8722b0e7aef9fd04a870d49127e6c724fe934d1f8ca4ff8177.map +373 -0
  3. package/SystemModules/amzn__react-navigation__routers-8.modules.txt +9 -0
  4. package/SystemModules/amzn__react-navigation__routers-8.private.modules.txt +1 -0
  5. package/SystemModules/keplerscript-system-bundle-config.json +4 -4
  6. package/kepler-compatibility.json +2 -2
  7. package/lib/module/BaseRouter.js +6 -4
  8. package/lib/module/BaseRouter.js.map +1 -1
  9. package/lib/module/CommonActions.js +48 -7
  10. package/lib/module/CommonActions.js.map +1 -1
  11. package/lib/module/DrawerRouter.js +6 -6
  12. package/lib/module/DrawerRouter.js.map +1 -1
  13. package/lib/module/StackRouter.js +261 -80
  14. package/lib/module/StackRouter.js.map +1 -1
  15. package/lib/module/TabRouter.js +117 -34
  16. package/lib/module/TabRouter.js.map +1 -1
  17. package/lib/module/createParamsFromAction.js +16 -0
  18. package/lib/module/createParamsFromAction.js.map +1 -0
  19. package/lib/module/createRouteFromAction.js +21 -0
  20. package/lib/module/createRouteFromAction.js.map +1 -0
  21. package/lib/module/index.js +8 -6
  22. package/lib/module/index.js.map +1 -1
  23. package/lib/module/package.json +1 -0
  24. package/lib/module/types.js +2 -0
  25. package/lib/module/types.js.map +1 -1
  26. package/lib/typescript/package.json +1 -0
  27. package/lib/typescript/src/BaseRouter.d.ts +23 -20
  28. package/lib/typescript/src/BaseRouter.d.ts.map +1 -1
  29. package/lib/typescript/src/CommonActions.d.ts +66 -18
  30. package/lib/typescript/src/CommonActions.d.ts.map +1 -1
  31. package/lib/typescript/src/DrawerRouter.d.ts +18 -6
  32. package/lib/typescript/src/DrawerRouter.d.ts.map +1 -1
  33. package/lib/typescript/src/StackRouter.d.ts +73 -11
  34. package/lib/typescript/src/StackRouter.d.ts.map +1 -1
  35. package/lib/typescript/src/TabRouter.d.ts +24 -4
  36. package/lib/typescript/src/TabRouter.d.ts.map +1 -1
  37. package/lib/typescript/src/createParamsFromAction.d.ts +13 -0
  38. package/lib/typescript/src/createParamsFromAction.d.ts.map +1 -0
  39. package/lib/typescript/src/createRouteFromAction.d.ts +17 -0
  40. package/lib/typescript/src/createRouteFromAction.d.ts.map +1 -0
  41. package/lib/typescript/src/index.d.ts +4 -4
  42. package/lib/typescript/src/index.d.ts.map +1 -1
  43. package/lib/typescript/src/types.d.ts +1 -2
  44. package/lib/typescript/src/types.d.ts.map +1 -1
  45. package/oss-attribution/attribution.txt +0 -0
  46. package/oss-attribution/licenseInfos.json +1 -0
  47. package/package.json +80 -1
  48. package/src/BaseRouter.tsx +11 -6
  49. package/src/CommonActions.tsx +147 -56
  50. package/src/DrawerRouter.tsx +15 -13
  51. package/src/StackRouter.tsx +437 -199
  52. package/src/TabRouter.tsx +192 -53
  53. package/src/createParamsFromAction.tsx +22 -0
  54. package/src/createRouteFromAction.tsx +24 -0
  55. package/src/index.tsx +4 -4
  56. package/src/types.tsx +5 -5
  57. package/SystemBundles/2c2b2e72cf9d128296ac83ba53082313ac31f6e9fd98b8e87fe0af40e15fbec1.bundle +0 -3515
  58. package/SystemBundles/2c2b2e72cf9d128296ac83ba53082313ac31f6e9fd98b8e87fe0af40e15fbec1.map +0 -1
  59. package/SystemModules/amzn__react-navigation__routers-7.modules.txt +0 -21
  60. package/SystemModules/amzn__react-navigation__routers-7.private.modules.txt +0 -13
  61. package/THIRD_PARTY_NOTICES.txt +0 -24
  62. package/lib/commonjs/BaseRouter.js +0 -61
  63. package/lib/commonjs/BaseRouter.js.map +0 -1
  64. package/lib/commonjs/CommonActions.js +0 -53
  65. package/lib/commonjs/CommonActions.js.map +0 -1
  66. package/lib/commonjs/DrawerRouter.js +0 -154
  67. package/lib/commonjs/DrawerRouter.js.map +0 -1
  68. package/lib/commonjs/StackRouter.js +0 -310
  69. package/lib/commonjs/StackRouter.js.map +0 -1
  70. package/lib/commonjs/TabRouter.js +0 -253
  71. package/lib/commonjs/TabRouter.js.map +0 -1
  72. package/lib/commonjs/index.js +0 -80
  73. package/lib/commonjs/index.js.map +0 -1
  74. package/lib/commonjs/types.js +0 -6
  75. package/lib/commonjs/types.js.map +0 -1
@@ -1,3515 +0,0 @@
1
- var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now(),__DEV__=false,process=this.process||{},__METRO_GLOBAL_PREFIX__='';process.env=process.env||{};process.env.NODE_ENV=process.env.NODE_ENV||"production";
2
- (function (global) {
3
- /**
4
- * Copyright (c) Meta Platforms, Inc. and affiliates.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE file in the root directory of this source tree.
8
- *
9
- * @polyfill
10
- * @nolint
11
- * @format
12
- */
13
-
14
- /* eslint-disable no-shadow, eqeqeq, curly, no-unused-vars, no-void, no-control-regex */
15
-
16
- /**
17
- * This pipes all of our console logging functions to native logging so that
18
- * JavaScript errors in required modules show up in Xcode via NSLog.
19
- */
20
- var inspect = function () {
21
- // Copyright Joyent, Inc. and other Node contributors.
22
- //
23
- // Permission is hereby granted, free of charge, to any person obtaining a
24
- // copy of this software and associated documentation files (the
25
- // "Software"), to deal in the Software without restriction, including
26
- // without limitation the rights to use, copy, modify, merge, publish,
27
- // distribute, sublicense, and/or sell copies of the Software, and to permit
28
- // persons to whom the Software is furnished to do so, subject to the
29
- // following conditions:
30
- //
31
- // The above copyright notice and this permission notice shall be included
32
- // in all copies or substantial portions of the Software.
33
- //
34
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
35
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
37
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
38
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
39
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
40
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
41
- //
42
- // https://github.com/joyent/node/blob/master/lib/util.js
43
-
44
- function inspect(obj, opts) {
45
- var ctx = {
46
- seen: [],
47
- formatValueCalls: 0,
48
- stylize: stylizeNoColor
49
- };
50
- return formatValue(ctx, obj, opts.depth);
51
- }
52
- function stylizeNoColor(str, styleType) {
53
- return str;
54
- }
55
- function arrayToHash(array) {
56
- var hash = {};
57
- array.forEach(function (val, idx) {
58
- hash[val] = true;
59
- });
60
- return hash;
61
- }
62
- function formatValue(ctx, value, recurseTimes) {
63
- ctx.formatValueCalls++;
64
- if (ctx.formatValueCalls > 200) {
65
- return `[TOO BIG formatValueCalls ${ctx.formatValueCalls} exceeded limit of 200]`;
66
- }
67
-
68
- // Primitive types cannot have properties
69
- var primitive = formatPrimitive(ctx, value);
70
- if (primitive) {
71
- return primitive;
72
- }
73
-
74
- // Look up the keys of the object.
75
- var keys = Object.keys(value);
76
- var visibleKeys = arrayToHash(keys);
77
-
78
- // IE doesn't make error fields non-enumerable
79
- // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
80
- if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
81
- return formatError(value);
82
- }
83
-
84
- // Some type of object without properties can be shortcutted.
85
- if (keys.length === 0) {
86
- if (isFunction(value)) {
87
- var name = value.name ? ': ' + value.name : '';
88
- return ctx.stylize('[Function' + name + ']', 'special');
89
- }
90
- if (isRegExp(value)) {
91
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
92
- }
93
- if (isDate(value)) {
94
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
95
- }
96
- if (isError(value)) {
97
- return formatError(value);
98
- }
99
- }
100
- var base = '',
101
- array = false,
102
- braces = ['{', '}'];
103
-
104
- // Make Array say that they are Array
105
- if (isArray(value)) {
106
- array = true;
107
- braces = ['[', ']'];
108
- }
109
-
110
- // Make functions say that they are functions
111
- if (isFunction(value)) {
112
- var n = value.name ? ': ' + value.name : '';
113
- base = ' [Function' + n + ']';
114
- }
115
-
116
- // Make RegExps say that they are RegExps
117
- if (isRegExp(value)) {
118
- base = ' ' + RegExp.prototype.toString.call(value);
119
- }
120
-
121
- // Make dates with properties first say the date
122
- if (isDate(value)) {
123
- base = ' ' + Date.prototype.toUTCString.call(value);
124
- }
125
-
126
- // Make error with message first say the error
127
- if (isError(value)) {
128
- base = ' ' + formatError(value);
129
- }
130
- if (keys.length === 0 && (!array || value.length == 0)) {
131
- return braces[0] + base + braces[1];
132
- }
133
- if (recurseTimes < 0) {
134
- if (isRegExp(value)) {
135
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
136
- } else {
137
- return ctx.stylize('[Object]', 'special');
138
- }
139
- }
140
- ctx.seen.push(value);
141
- var output;
142
- if (array) {
143
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
144
- } else {
145
- output = keys.map(function (key) {
146
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
147
- });
148
- }
149
- ctx.seen.pop();
150
- return reduceToSingleString(output, base, braces);
151
- }
152
- function formatPrimitive(ctx, value) {
153
- if (isUndefined(value)) return ctx.stylize('undefined', 'undefined');
154
- if (isString(value)) {
155
- var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
156
- return ctx.stylize(simple, 'string');
157
- }
158
- if (isNumber(value)) return ctx.stylize('' + value, 'number');
159
- if (isBoolean(value)) return ctx.stylize('' + value, 'boolean');
160
- // For some reason typeof null is "object", so special case here.
161
- if (isNull(value)) return ctx.stylize('null', 'null');
162
- }
163
- function formatError(value) {
164
- return '[' + Error.prototype.toString.call(value) + ']';
165
- }
166
- function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
167
- var output = [];
168
- for (var i = 0, l = value.length; i < l; ++i) {
169
- if (hasOwnProperty(value, String(i))) {
170
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
171
- } else {
172
- output.push('');
173
- }
174
- }
175
- keys.forEach(function (key) {
176
- if (!key.match(/^\d+$/)) {
177
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
178
- }
179
- });
180
- return output;
181
- }
182
- function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
183
- var name, str, desc;
184
- desc = Object.getOwnPropertyDescriptor(value, key) || {
185
- value: value[key]
186
- };
187
- if (desc.get) {
188
- if (desc.set) {
189
- str = ctx.stylize('[Getter/Setter]', 'special');
190
- } else {
191
- str = ctx.stylize('[Getter]', 'special');
192
- }
193
- } else {
194
- if (desc.set) {
195
- str = ctx.stylize('[Setter]', 'special');
196
- }
197
- }
198
- if (!hasOwnProperty(visibleKeys, key)) {
199
- name = '[' + key + ']';
200
- }
201
- if (!str) {
202
- if (ctx.seen.indexOf(desc.value) < 0) {
203
- if (isNull(recurseTimes)) {
204
- str = formatValue(ctx, desc.value, null);
205
- } else {
206
- str = formatValue(ctx, desc.value, recurseTimes - 1);
207
- }
208
- if (str.indexOf('\n') > -1) {
209
- if (array) {
210
- str = str.split('\n').map(function (line) {
211
- return ' ' + line;
212
- }).join('\n').substr(2);
213
- } else {
214
- str = '\n' + str.split('\n').map(function (line) {
215
- return ' ' + line;
216
- }).join('\n');
217
- }
218
- }
219
- } else {
220
- str = ctx.stylize('[Circular]', 'special');
221
- }
222
- }
223
- if (isUndefined(name)) {
224
- if (array && key.match(/^\d+$/)) {
225
- return str;
226
- }
227
- name = JSON.stringify('' + key);
228
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
229
- name = name.substr(1, name.length - 2);
230
- name = ctx.stylize(name, 'name');
231
- } else {
232
- name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
233
- name = ctx.stylize(name, 'string');
234
- }
235
- }
236
- return name + ': ' + str;
237
- }
238
- function reduceToSingleString(output, base, braces) {
239
- var numLinesEst = 0;
240
- var length = output.reduce(function (prev, cur) {
241
- numLinesEst++;
242
- if (cur.indexOf('\n') >= 0) numLinesEst++;
243
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
244
- }, 0);
245
- if (length > 60) {
246
- return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1];
247
- }
248
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
249
- }
250
-
251
- // NOTE: These type checking functions intentionally don't use `instanceof`
252
- // because it is fragile and can be easily faked with `Object.create()`.
253
- function isArray(ar) {
254
- return Array.isArray(ar);
255
- }
256
- function isBoolean(arg) {
257
- return typeof arg === 'boolean';
258
- }
259
- function isNull(arg) {
260
- return arg === null;
261
- }
262
- function isNumber(arg) {
263
- return typeof arg === 'number';
264
- }
265
- function isString(arg) {
266
- return typeof arg === 'string';
267
- }
268
- function isUndefined(arg) {
269
- return arg === undefined;
270
- }
271
- function isRegExp(re) {
272
- return isObject(re) && objectToString(re) === '[object RegExp]';
273
- }
274
- function isObject(arg) {
275
- return typeof arg === 'object' && arg !== null;
276
- }
277
- function isDate(d) {
278
- return isObject(d) && objectToString(d) === '[object Date]';
279
- }
280
- function isError(e) {
281
- return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error);
282
- }
283
- function isFunction(arg) {
284
- return typeof arg === 'function';
285
- }
286
- function objectToString(o) {
287
- return Object.prototype.toString.call(o);
288
- }
289
- function hasOwnProperty(obj, prop) {
290
- return Object.prototype.hasOwnProperty.call(obj, prop);
291
- }
292
- return inspect;
293
- }();
294
- var OBJECT_COLUMN_NAME = '(index)';
295
- var LOG_LEVELS = {
296
- trace: 0,
297
- info: 1,
298
- warn: 2,
299
- error: 3
300
- };
301
- var INSPECTOR_LEVELS = [];
302
- INSPECTOR_LEVELS[LOG_LEVELS.trace] = 'debug';
303
- INSPECTOR_LEVELS[LOG_LEVELS.info] = 'log';
304
- INSPECTOR_LEVELS[LOG_LEVELS.warn] = 'warning';
305
- INSPECTOR_LEVELS[LOG_LEVELS.error] = 'error';
306
-
307
- // Strip the inner function in getNativeLogFunction(), if in dev also
308
- // strip method printing to originalConsole.
309
- var INSPECTOR_FRAMES_TO_SKIP = 1;
310
- function getNativeLogFunction(level) {
311
- return function () {
312
- var str;
313
- if (arguments.length === 1 && typeof arguments[0] === 'string') {
314
- str = arguments[0];
315
- } else {
316
- str = Array.prototype.map.call(arguments, function (arg) {
317
- return inspect(arg, {
318
- depth: 10
319
- });
320
- }).join(', ');
321
- }
322
-
323
- // TRICKY
324
- // If more than one argument is provided, the code above collapses them all
325
- // into a single formatted string. This transform wraps string arguments in
326
- // single quotes (e.g. "foo" -> "'foo'") which then breaks the "Warning:"
327
- // check below. So it's important that we look at the first argument, rather
328
- // than the formatted argument string.
329
- var firstArg = arguments[0];
330
- var logLevel = level;
331
- if (typeof firstArg === 'string' && firstArg.slice(0, 9) === 'Warning: ' && logLevel >= LOG_LEVELS.error) {
332
- // React warnings use console.error so that a stack trace is shown,
333
- // but we don't (currently) want these to show a redbox
334
- // (Note: Logic duplicated in ExceptionsManager.js.)
335
- logLevel = LOG_LEVELS.warn;
336
- }
337
- if (global.__inspectorLog) {
338
- global.__inspectorLog(INSPECTOR_LEVELS[logLevel], str, [].slice.call(arguments), INSPECTOR_FRAMES_TO_SKIP);
339
- }
340
- if (groupStack.length) {
341
- str = groupFormat('', str);
342
- }
343
- global.nativeLoggingHook(str, logLevel);
344
- };
345
- }
346
- function repeat(element, n) {
347
- return Array.apply(null, Array(n)).map(function () {
348
- return element;
349
- });
350
- }
351
- function consoleTablePolyfill(rows) {
352
- // convert object -> array
353
- if (!Array.isArray(rows)) {
354
- var data = rows;
355
- rows = [];
356
- for (var key in data) {
357
- if (data.hasOwnProperty(key)) {
358
- var row = data[key];
359
- row[OBJECT_COLUMN_NAME] = key;
360
- rows.push(row);
361
- }
362
- }
363
- }
364
- if (rows.length === 0) {
365
- global.nativeLoggingHook('', LOG_LEVELS.info);
366
- return;
367
- }
368
- var columns = Object.keys(rows[0]).sort();
369
- var stringRows = [];
370
- var columnWidths = [];
371
-
372
- // Convert each cell to a string. Also
373
- // figure out max cell width for each column
374
- columns.forEach(function (k, i) {
375
- columnWidths[i] = k.length;
376
- for (var j = 0; j < rows.length; j++) {
377
- var cellStr = (rows[j][k] || '?').toString();
378
- stringRows[j] = stringRows[j] || [];
379
- stringRows[j][i] = cellStr;
380
- columnWidths[i] = Math.max(columnWidths[i], cellStr.length);
381
- }
382
- });
383
-
384
- // Join all elements in the row into a single string with | separators
385
- // (appends extra spaces to each cell to make separators | aligned)
386
- function joinRow(row, space) {
387
- var cells = row.map(function (cell, i) {
388
- var extraSpaces = repeat(' ', columnWidths[i] - cell.length).join('');
389
- return cell + extraSpaces;
390
- });
391
- space = space || ' ';
392
- return cells.join(space + '|' + space);
393
- }
394
- var separators = columnWidths.map(function (columnWidth) {
395
- return repeat('-', columnWidth).join('');
396
- });
397
- var separatorRow = joinRow(separators, '-');
398
- var header = joinRow(columns);
399
- var table = [header, separatorRow];
400
- for (var i = 0; i < rows.length; i++) {
401
- table.push(joinRow(stringRows[i]));
402
- }
403
-
404
- // Notice extra empty line at the beginning.
405
- // Native logging hook adds "RCTLog >" at the front of every
406
- // logged string, which would shift the header and screw up
407
- // the table
408
- global.nativeLoggingHook('\n' + table.join('\n'), LOG_LEVELS.info);
409
- }
410
- var GROUP_PAD = "\u2502"; // Box light vertical
411
- var GROUP_OPEN = "\u2510"; // Box light down+left
412
- var GROUP_CLOSE = "\u2518"; // Box light up+left
413
-
414
- var groupStack = [];
415
- function groupFormat(prefix, msg) {
416
- // Insert group formatting before the console message
417
- return groupStack.join('') + prefix + ' ' + (msg || '');
418
- }
419
- function consoleGroupPolyfill(label) {
420
- global.nativeLoggingHook(groupFormat(GROUP_OPEN, label), LOG_LEVELS.info);
421
- groupStack.push(GROUP_PAD);
422
- }
423
- function consoleGroupCollapsedPolyfill(label) {
424
- global.nativeLoggingHook(groupFormat(GROUP_CLOSE, label), LOG_LEVELS.info);
425
- groupStack.push(GROUP_PAD);
426
- }
427
- function consoleGroupEndPolyfill() {
428
- groupStack.pop();
429
- global.nativeLoggingHook(groupFormat(GROUP_CLOSE), LOG_LEVELS.info);
430
- }
431
- function consoleAssertPolyfill(expression, label) {
432
- if (!expression) {
433
- global.nativeLoggingHook('Assertion failed: ' + label, LOG_LEVELS.error);
434
- }
435
- }
436
- if (global.nativeLoggingHook) {
437
- var originalConsole = global.console;
438
- // Preserve the original `console` as `originalConsole`
439
-
440
- global.console = {
441
- error: getNativeLogFunction(LOG_LEVELS.error),
442
- info: getNativeLogFunction(LOG_LEVELS.info),
443
- log: getNativeLogFunction(LOG_LEVELS.info),
444
- warn: getNativeLogFunction(LOG_LEVELS.warn),
445
- trace: getNativeLogFunction(LOG_LEVELS.trace),
446
- debug: getNativeLogFunction(LOG_LEVELS.trace),
447
- table: consoleTablePolyfill,
448
- group: consoleGroupPolyfill,
449
- groupEnd: consoleGroupEndPolyfill,
450
- groupCollapsed: consoleGroupCollapsedPolyfill,
451
- assert: consoleAssertPolyfill
452
- };
453
- Object.defineProperty(console, '_isPolyfilled', {
454
- value: true,
455
- enumerable: false
456
- });
457
-
458
- // If available, also call the original `console` method since that is
459
- // sometimes useful. Ex: on OS X, this will let you see rich output in
460
- // the Safari Web Inspector console.
461
- } else if (!global.console) {
462
- var stub = function stub() {};
463
- var log = global.print || stub;
464
- global.console = {
465
- debug: log,
466
- error: log,
467
- info: log,
468
- log: log,
469
- trace: log,
470
- warn: log,
471
- assert: function assert(expression, label) {
472
- if (!expression) {
473
- log('Assertion failed: ' + label);
474
- }
475
- },
476
- clear: stub,
477
- dir: stub,
478
- dirxml: stub,
479
- group: stub,
480
- groupCollapsed: stub,
481
- groupEnd: stub,
482
- profile: stub,
483
- profileEnd: stub,
484
- table: stub
485
- };
486
- Object.defineProperty(console, '_isPolyfilled', {
487
- value: true,
488
- enumerable: false
489
- });
490
- }
491
- })(typeof globalThis !== 'undefined' ? globalThis : typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this);
492
- (function (global) {
493
- /**
494
- * Copyright (c) Meta Platforms, Inc. and affiliates.
495
- *
496
- * This source code is licensed under the MIT license found in the
497
- * LICENSE file in the root directory of this source tree.
498
- *
499
- * @format
500
- *
501
- * @polyfill
502
- */
503
-
504
- var _inGuard = 0;
505
- /**
506
- * This is the error handler that is called when we encounter an exception
507
- * when loading a module. This will report any errors encountered before
508
- * ExceptionsManager is configured.
509
- */
510
- var _globalHandler = function onError(e, isFatal) {
511
- throw e;
512
- };
513
-
514
- /**
515
- * The particular require runtime that we are using looks for a global
516
- * `ErrorUtils` object and if it exists, then it requires modules with the
517
- * error handler specified via ErrorUtils.setGlobalHandler by calling the
518
- * require function with applyWithGuard. Since the require module is loaded
519
- * before any of the modules, this ErrorUtils must be defined (and the handler
520
- * set) globally before requiring anything.
521
- */
522
- var ErrorUtils = {
523
- setGlobalHandler: function setGlobalHandler(fun) {
524
- _globalHandler = fun;
525
- },
526
- getGlobalHandler: function getGlobalHandler() {
527
- return _globalHandler;
528
- },
529
- reportError: function reportError(error) {
530
- _globalHandler && _globalHandler(error, false);
531
- },
532
- reportFatalError: function reportFatalError(error) {
533
- // NOTE: This has an untyped call site in Metro.
534
- _globalHandler && _globalHandler(error, true);
535
- },
536
- applyWithGuard: function applyWithGuard(fun, context, args,
537
- // Unused, but some code synced from www sets it to null.
538
- unused_onError,
539
- // Some callers pass a name here, which we ignore.
540
- unused_name) {
541
- try {
542
- _inGuard++;
543
- /* $FlowFixMe[incompatible-call] : TODO T48204745 (1) apply(context,
544
- * null) is fine. (2) array -> rest array should work */
545
- /* $FlowFixMe[incompatible-type] : TODO T48204745 (1) apply(context,
546
- * null) is fine. (2) array -> rest array should work */
547
- return fun.apply(context, args);
548
- } catch (e) {
549
- ErrorUtils.reportError(e);
550
- } finally {
551
- _inGuard--;
552
- }
553
- return null;
554
- },
555
- applyWithGuardIfNeeded: function applyWithGuardIfNeeded(fun, context, args) {
556
- if (ErrorUtils.inGuard()) {
557
- /* $FlowFixMe[incompatible-call] : TODO T48204745 (1) apply(context,
558
- * null) is fine. (2) array -> rest array should work */
559
- /* $FlowFixMe[incompatible-type] : TODO T48204745 (1) apply(context,
560
- * null) is fine. (2) array -> rest array should work */
561
- return fun.apply(context, args);
562
- } else {
563
- ErrorUtils.applyWithGuard(fun, context, args);
564
- }
565
- return null;
566
- },
567
- inGuard: function inGuard() {
568
- return !!_inGuard;
569
- },
570
- guard: function guard(fun, name, context) {
571
- var _ref;
572
- // TODO: (moti) T48204753 Make sure this warning is never hit and remove it - types
573
- // should be sufficient.
574
- if (typeof fun !== 'function') {
575
- console.warn('A function must be passed to ErrorUtils.guard, got ', fun);
576
- return null;
577
- }
578
- var guardName = (_ref = name != null ? name : fun.name) != null ? _ref : '<generated guard>';
579
- /* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
580
- * Flow's LTI update could not be added via codemod */
581
- function guarded() {
582
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
583
- args[_key] = arguments[_key];
584
- }
585
- return ErrorUtils.applyWithGuard(fun, context != null ? context : this, args, null, guardName);
586
- }
587
- return guarded;
588
- }
589
- };
590
- global.ErrorUtils = ErrorUtils;
591
- })(typeof globalThis !== 'undefined' ? globalThis : typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this);
592
- (function (global) {
593
- /**
594
- * Copyright (c) Meta Platforms, Inc. and affiliates.
595
- *
596
- * This source code is licensed under the MIT license found in the
597
- * LICENSE file in the root directory of this source tree.
598
- *
599
- * @format
600
- * @polyfill
601
- * @nolint
602
- */
603
-
604
- (function () {
605
- 'use strict';
606
-
607
- var hasOwnProperty = Object.prototype.hasOwnProperty;
608
-
609
- /**
610
- * Returns an array of the given object's own enumerable entries.
611
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
612
- */
613
- if (typeof Object.entries !== 'function') {
614
- Object.entries = function (object) {
615
- // `null` and `undefined` values are not allowed.
616
- if (object == null) {
617
- throw new TypeError('Object.entries called on non-object');
618
- }
619
- var entries = [];
620
- for (var key in object) {
621
- if (hasOwnProperty.call(object, key)) {
622
- entries.push([key, object[key]]);
623
- }
624
- }
625
- return entries;
626
- };
627
- }
628
-
629
- /**
630
- * Returns an array of the given object's own enumerable entries.
631
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values
632
- */
633
- if (typeof Object.values !== 'function') {
634
- Object.values = function (object) {
635
- // `null` and `undefined` values are not allowed.
636
- if (object == null) {
637
- throw new TypeError('Object.values called on non-object');
638
- }
639
- var values = [];
640
- for (var key in object) {
641
- if (hasOwnProperty.call(object, key)) {
642
- values.push(object[key]);
643
- }
644
- }
645
- return values;
646
- };
647
- }
648
- })();
649
- })(typeof globalThis !== 'undefined' ? globalThis : typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this);
650
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
651
- "use strict";
652
-
653
- Object.defineProperty(exports, "__esModule", {
654
- value: true
655
- });
656
- exports.default = undefined;
657
- /**
658
- * Base router object that can be used when writing custom routers.
659
- * This provides few helper methods to handle common actions such as `RESET`.
660
- */
661
- var BaseRouter = {
662
- getStateForAction: function getStateForAction(state, action) {
663
- switch (action.type) {
664
- case 'SET_PARAMS':
665
- {
666
- var index = action.source ? state.routes.findIndex(function (r) {
667
- return r.key === action.source;
668
- }) : state.index;
669
- if (index === -1) {
670
- return null;
671
- }
672
- return Object.assign({}, state, {
673
- routes: state.routes.map(function (r, i) {
674
- return i === index ? Object.assign({}, r, {
675
- params: Object.assign({}, r.params, action.payload.params)
676
- }) : r;
677
- })
678
- });
679
- }
680
- case 'RESET':
681
- {
682
- var nextState = action.payload;
683
- if (nextState.routes.length === 0 || nextState.routes.some(function (route) {
684
- return !state.routeNames.includes(route.name);
685
- })) {
686
- return null;
687
- }
688
- if (nextState.stale === false) {
689
- if (state.routeNames.length !== nextState.routeNames.length || nextState.routeNames.some(function (name) {
690
- return !state.routeNames.includes(name);
691
- })) {
692
- return null;
693
- }
694
- return Object.assign({}, nextState, {
695
- routes: nextState.routes.map(function (route) {
696
- return route.key ? route : Object.assign({}, route, {
697
- key: `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[0]).nanoid)()}`
698
- });
699
- })
700
- });
701
- }
702
- return nextState;
703
- }
704
- default:
705
- return null;
706
- }
707
- },
708
- shouldActionChangeFocus: function shouldActionChangeFocus(action) {
709
- return action.type === 'NAVIGATE';
710
- }
711
- };
712
- var _default = exports.default = BaseRouter;
713
- },"4e814a93075c75141026",["e03db9aacb1ee503cd26"]);
714
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
715
- Object.defineProperty(exports, "__esModule", {
716
- value: true
717
- });
718
- exports.nanoid = exports.customAlphabet = undefined;
719
- // This alphabet uses `A-Za-z0-9_-` symbols. The genetic algorithm helped
720
- // optimize the gzip compression for this alphabet.
721
- var urlAlphabet = 'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW';
722
- var customAlphabet = exports.customAlphabet = function customAlphabet(alphabet, size) {
723
- return function () {
724
- var id = '';
725
- // A compact alternative for `for (var i = 0; i < step; i++)`.
726
- var i = size;
727
- while (i--) {
728
- // `| 0` is more compact and faster than `Math.floor()`.
729
- id += alphabet[Math.random() * alphabet.length | 0];
730
- }
731
- return id;
732
- };
733
- };
734
- var nanoid = exports.nanoid = function nanoid() {
735
- var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 21;
736
- var id = '';
737
- // A compact alternative for `for (var i = 0; i < step; i++)`.
738
- var i = size;
739
- while (i--) {
740
- // `| 0` is more compact and faster than `Math.floor()`.
741
- id += urlAlphabet[Math.random() * 64 | 0];
742
- }
743
- return id;
744
- };
745
- },"e03db9aacb1ee503cd26",[]);
746
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
747
- "use strict";
748
-
749
- Object.defineProperty(exports, "__esModule", {
750
- value: true
751
- });
752
- exports.goBack = goBack;
753
- exports.navigate = navigate;
754
- exports.reset = reset;
755
- exports.setParams = setParams;
756
- function goBack() {
757
- return {
758
- type: 'GO_BACK'
759
- };
760
- }
761
-
762
- // eslint-disable-next-line no-redeclare
763
-
764
- // eslint-disable-next-line no-redeclare
765
- function navigate() {
766
- if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'string') {
767
- return {
768
- type: 'NAVIGATE',
769
- payload: {
770
- name: arguments.length <= 0 ? undefined : arguments[0],
771
- params: arguments.length <= 1 ? undefined : arguments[1]
772
- }
773
- };
774
- } else {
775
- var payload = (arguments.length <= 0 ? undefined : arguments[0]) || {};
776
- if (!payload.hasOwnProperty('key') && !payload.hasOwnProperty('name')) {
777
- throw new Error('You need to specify name or key when calling navigate with an object as the argument. See https://reactnavigation.org/docs/navigation-actions#navigate for usage.');
778
- }
779
- return {
780
- type: 'NAVIGATE',
781
- payload: payload
782
- };
783
- }
784
- }
785
- function reset(state) {
786
- return {
787
- type: 'RESET',
788
- payload: state
789
- };
790
- }
791
- function setParams(params) {
792
- return {
793
- type: 'SET_PARAMS',
794
- payload: {
795
- params: params
796
- }
797
- };
798
- }
799
- },"6224880bf3a3483be0e5",[]);
800
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
801
- "use strict";
802
-
803
- var _excluded = ["defaultStatus"];
804
- Object.defineProperty(exports, "__esModule", {
805
- value: true
806
- });
807
- exports.DrawerActions = undefined;
808
- exports.default = DrawerRouter;
809
- var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
810
- function _getRequireWildcardCache(e) {
811
- if ("function" != typeof WeakMap) return null;
812
- var r = new WeakMap(),
813
- t = new WeakMap();
814
- return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
815
- return e ? t : r;
816
- })(e);
817
- }
818
- function _interopRequireWildcard(e, r) {
819
- if (!r && e && e.__esModule) return e;
820
- if (null === e || "object" != typeof e && "function" != typeof e) return {
821
- default: e
822
- };
823
- var t = _getRequireWildcardCache(r);
824
- if (t && t.has(e)) return t.get(e);
825
- var n = {
826
- __proto__: null
827
- },
828
- a = Object.defineProperty && Object.getOwnPropertyDescriptor;
829
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
830
- var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
831
- i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
832
- }
833
- return n.default = e, t && t.set(e, n), n;
834
- }
835
- var DrawerActions = exports.DrawerActions = Object.assign({}, _TabRouter.TabActions, {
836
- openDrawer: function openDrawer() {
837
- return {
838
- type: 'OPEN_DRAWER'
839
- };
840
- },
841
- closeDrawer: function closeDrawer() {
842
- return {
843
- type: 'CLOSE_DRAWER'
844
- };
845
- },
846
- toggleDrawer: function toggleDrawer() {
847
- return {
848
- type: 'TOGGLE_DRAWER'
849
- };
850
- }
851
- });
852
- function DrawerRouter(_ref) {
853
- var _ref$defaultStatus = _ref.defaultStatus,
854
- defaultStatus = _ref$defaultStatus === undefined ? 'closed' : _ref$defaultStatus,
855
- rest = _$$_REQUIRE(_dependencyMap[1])(_ref, _excluded);
856
- var router = (0, _TabRouter.default)(rest);
857
- var isDrawerInHistory = function isDrawerInHistory(state) {
858
- var _state$history;
859
- return Boolean((_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.some(function (it) {
860
- return it.type === 'drawer';
861
- }));
862
- };
863
- var addDrawerToHistory = function addDrawerToHistory(state) {
864
- if (isDrawerInHistory(state)) {
865
- return state;
866
- }
867
- return Object.assign({}, state, {
868
- history: [].concat(_$$_REQUIRE(_dependencyMap[2])(state.history), [{
869
- type: 'drawer',
870
- status: defaultStatus === 'open' ? 'closed' : 'open'
871
- }])
872
- });
873
- };
874
- var removeDrawerFromHistory = function removeDrawerFromHistory(state) {
875
- if (!isDrawerInHistory(state)) {
876
- return state;
877
- }
878
- return Object.assign({}, state, {
879
- history: state.history.filter(function (it) {
880
- return it.type !== 'drawer';
881
- })
882
- });
883
- };
884
- var openDrawer = function openDrawer(state) {
885
- if (defaultStatus === 'open') {
886
- return removeDrawerFromHistory(state);
887
- }
888
- return addDrawerToHistory(state);
889
- };
890
- var closeDrawer = function closeDrawer(state) {
891
- if (defaultStatus === 'open') {
892
- return addDrawerToHistory(state);
893
- }
894
- return removeDrawerFromHistory(state);
895
- };
896
- return Object.assign({}, router, {
897
- type: 'drawer',
898
- getInitialState: function getInitialState(_ref2) {
899
- var routeNames = _ref2.routeNames,
900
- routeParamList = _ref2.routeParamList,
901
- routeGetIdList = _ref2.routeGetIdList;
902
- var state = router.getInitialState({
903
- routeNames: routeNames,
904
- routeParamList: routeParamList,
905
- routeGetIdList: routeGetIdList
906
- });
907
- return Object.assign({}, state, {
908
- default: defaultStatus,
909
- stale: false,
910
- type: 'drawer',
911
- key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`
912
- });
913
- },
914
- getRehydratedState: function getRehydratedState(partialState, _ref3) {
915
- var routeNames = _ref3.routeNames,
916
- routeParamList = _ref3.routeParamList,
917
- routeGetIdList = _ref3.routeGetIdList;
918
- if (partialState.stale === false) {
919
- return partialState;
920
- }
921
- var state = router.getRehydratedState(partialState, {
922
- routeNames: routeNames,
923
- routeParamList: routeParamList,
924
- routeGetIdList: routeGetIdList
925
- });
926
- if (isDrawerInHistory(partialState)) {
927
- // Re-sync the drawer entry in history to correct it if it was wrong
928
- state = removeDrawerFromHistory(state);
929
- state = addDrawerToHistory(state);
930
- }
931
- return Object.assign({}, state, {
932
- default: defaultStatus,
933
- type: 'drawer',
934
- key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`
935
- });
936
- },
937
- getStateForRouteFocus: function getStateForRouteFocus(state, key) {
938
- var result = router.getStateForRouteFocus(state, key);
939
- return closeDrawer(result);
940
- },
941
- getStateForAction: function getStateForAction(state, action, options) {
942
- switch (action.type) {
943
- case 'OPEN_DRAWER':
944
- return openDrawer(state);
945
- case 'CLOSE_DRAWER':
946
- return closeDrawer(state);
947
- case 'TOGGLE_DRAWER':
948
- if (isDrawerInHistory(state)) {
949
- return removeDrawerFromHistory(state);
950
- }
951
- return addDrawerToHistory(state);
952
- case 'JUMP_TO':
953
- case 'NAVIGATE':
954
- {
955
- var result = router.getStateForAction(state, action, options);
956
- if (result != null && result.index !== state.index) {
957
- return closeDrawer(result);
958
- }
959
- return result;
960
- }
961
- case 'GO_BACK':
962
- if (isDrawerInHistory(state)) {
963
- return removeDrawerFromHistory(state);
964
- }
965
- return router.getStateForAction(state, action, options);
966
- default:
967
- return router.getStateForAction(state, action, options);
968
- }
969
- },
970
- actionCreators: DrawerActions
971
- });
972
- }
973
- },"fbd71b33b1fab08b6b66",["c822e55e1302f6e881d8","288fc9023aadbf916360","c8d9faa50529497e8550","e03db9aacb1ee503cd26"]);
974
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
975
- "use strict";
976
-
977
- Object.defineProperty(exports, "__esModule", {
978
- value: true
979
- });
980
- exports.TabActions = undefined;
981
- exports.default = TabRouter;
982
- var _BaseRouter = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[0]));
983
- function _interopRequireDefault(e) {
984
- return e && e.__esModule ? e : {
985
- default: e
986
- };
987
- }
988
- var TYPE_ROUTE = 'route';
989
- var TabActions = exports.TabActions = {
990
- jumpTo: function jumpTo(name, params) {
991
- return {
992
- type: 'JUMP_TO',
993
- payload: {
994
- name: name,
995
- params: params
996
- }
997
- };
998
- }
999
- };
1000
- var getRouteHistory = function getRouteHistory(routes, index, backBehavior, initialRouteName) {
1001
- var history = [{
1002
- type: TYPE_ROUTE,
1003
- key: routes[index].key
1004
- }];
1005
- var initialRouteIndex;
1006
- switch (backBehavior) {
1007
- case 'order':
1008
- for (var i = index; i > 0; i--) {
1009
- history.unshift({
1010
- type: TYPE_ROUTE,
1011
- key: routes[i - 1].key
1012
- });
1013
- }
1014
- break;
1015
- case 'firstRoute':
1016
- if (index !== 0) {
1017
- history.unshift({
1018
- type: TYPE_ROUTE,
1019
- key: routes[0].key
1020
- });
1021
- }
1022
- break;
1023
- case 'initialRoute':
1024
- initialRouteIndex = routes.findIndex(function (route) {
1025
- return route.name === initialRouteName;
1026
- });
1027
- initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;
1028
- if (index !== initialRouteIndex) {
1029
- history.unshift({
1030
- type: TYPE_ROUTE,
1031
- key: routes[initialRouteIndex].key
1032
- });
1033
- }
1034
- break;
1035
- case 'history':
1036
- // The history will fill up on navigation
1037
- break;
1038
- }
1039
- return history;
1040
- };
1041
- var changeIndex = function changeIndex(state, index, backBehavior, initialRouteName) {
1042
- var history;
1043
- if (backBehavior === 'history') {
1044
- var currentKey = state.routes[index].key;
1045
- history = state.history.filter(function (it) {
1046
- return it.type === 'route' ? it.key !== currentKey : false;
1047
- }).concat({
1048
- type: TYPE_ROUTE,
1049
- key: currentKey
1050
- });
1051
- } else {
1052
- history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);
1053
- }
1054
- return Object.assign({}, state, {
1055
- index: index,
1056
- history: history
1057
- });
1058
- };
1059
- function TabRouter(_ref) {
1060
- var initialRouteName = _ref.initialRouteName,
1061
- _ref$backBehavior = _ref.backBehavior,
1062
- backBehavior = _ref$backBehavior === undefined ? 'firstRoute' : _ref$backBehavior;
1063
- var router = Object.assign({}, _BaseRouter.default, {
1064
- type: 'tab',
1065
- getInitialState: function getInitialState(_ref2) {
1066
- var routeNames = _ref2.routeNames,
1067
- routeParamList = _ref2.routeParamList;
1068
- var index = initialRouteName !== undefined && routeNames.includes(initialRouteName) ? routeNames.indexOf(initialRouteName) : 0;
1069
- var routes = routeNames.map(function (name) {
1070
- return {
1071
- name: name,
1072
- key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1073
- params: routeParamList[name]
1074
- };
1075
- });
1076
- var history = getRouteHistory(routes, index, backBehavior, initialRouteName);
1077
- return {
1078
- stale: false,
1079
- type: 'tab',
1080
- key: `tab-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1081
- index: index,
1082
- routeNames: routeNames,
1083
- history: history,
1084
- routes: routes
1085
- };
1086
- },
1087
- getRehydratedState: function getRehydratedState(partialState, _ref3) {
1088
- var _ref4, _ref5;
1089
- var routeNames = _ref3.routeNames,
1090
- routeParamList = _ref3.routeParamList;
1091
- var _state$routes, _state$history;
1092
- var state = partialState;
1093
- if (state.stale === false) {
1094
- return state;
1095
- }
1096
- var routes = routeNames.map(function (name) {
1097
- var route = state.routes.find(function (r) {
1098
- return r.name === name;
1099
- });
1100
- return Object.assign({}, route, {
1101
- name: name,
1102
- key: route && route.name === name && route.key ? route.key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1103
- params: routeParamList[name] !== undefined ? Object.assign({}, routeParamList[name], route ? route.params : undefined) : route ? route.params : undefined
1104
- });
1105
- });
1106
- var index = Math.min(Math.max(routeNames.indexOf((_state$routes = state.routes[(_ref4 = state === null || state === undefined ? undefined : state.index) != null ? _ref4 : 0]) === null || _state$routes === undefined ? undefined : _state$routes.name), 0), routes.length - 1);
1107
- var history = (_ref5 = (_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.filter(function (it) {
1108
- return routes.find(function (r) {
1109
- return r.key === it.key;
1110
- });
1111
- })) != null ? _ref5 : [];
1112
- return changeIndex({
1113
- stale: false,
1114
- type: 'tab',
1115
- key: `tab-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1116
- index: index,
1117
- routeNames: routeNames,
1118
- history: history,
1119
- routes: routes
1120
- }, index, backBehavior, initialRouteName);
1121
- },
1122
- getStateForRouteNamesChange: function getStateForRouteNamesChange(state, _ref6) {
1123
- var routeNames = _ref6.routeNames,
1124
- routeParamList = _ref6.routeParamList,
1125
- routeKeyChanges = _ref6.routeKeyChanges;
1126
- var routes = routeNames.map(function (name) {
1127
- return state.routes.find(function (r) {
1128
- return r.name === name && !routeKeyChanges.includes(r.name);
1129
- }) || {
1130
- name: name,
1131
- key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1132
- params: routeParamList[name]
1133
- };
1134
- });
1135
- var index = Math.max(0, routeNames.indexOf(state.routes[state.index].name));
1136
- var history = state.history.filter(
1137
- // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)
1138
- function (it) {
1139
- return it.type !== 'route' || routes.find(function (r) {
1140
- return r.key === it.key;
1141
- });
1142
- });
1143
- if (!history.length) {
1144
- history = getRouteHistory(routes, index, backBehavior, initialRouteName);
1145
- }
1146
- return Object.assign({}, state, {
1147
- history: history,
1148
- routeNames: routeNames,
1149
- routes: routes,
1150
- index: index
1151
- });
1152
- },
1153
- getStateForRouteFocus: function getStateForRouteFocus(state, key) {
1154
- var index = state.routes.findIndex(function (r) {
1155
- return r.key === key;
1156
- });
1157
- if (index === -1 || index === state.index) {
1158
- return state;
1159
- }
1160
- return changeIndex(state, index, backBehavior, initialRouteName);
1161
- },
1162
- getStateForAction: function getStateForAction(state, action, _ref7) {
1163
- var routeParamList = _ref7.routeParamList,
1164
- routeGetIdList = _ref7.routeGetIdList;
1165
- switch (action.type) {
1166
- case 'JUMP_TO':
1167
- case 'NAVIGATE':
1168
- {
1169
- var index = -1;
1170
- if (action.type === 'NAVIGATE' && action.payload.key) {
1171
- index = state.routes.findIndex(function (route) {
1172
- return route.key === action.payload.key;
1173
- });
1174
- } else {
1175
- index = state.routes.findIndex(function (route) {
1176
- return route.name === action.payload.name;
1177
- });
1178
- }
1179
- if (index === -1) {
1180
- return null;
1181
- }
1182
- return changeIndex(Object.assign({}, state, {
1183
- routes: state.routes.map(function (route, i) {
1184
- if (i !== index) {
1185
- return route;
1186
- }
1187
- var getId = routeGetIdList[route.name];
1188
- var currentId = getId === null || getId === undefined ? undefined : getId({
1189
- params: route.params
1190
- });
1191
- var nextId = getId === null || getId === undefined ? undefined : getId({
1192
- params: action.payload.params
1193
- });
1194
- var key = currentId === nextId ? route.key : `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`;
1195
- var params;
1196
- if (action.type === 'NAVIGATE' && action.payload.merge && currentId === nextId) {
1197
- params = action.payload.params !== undefined || routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], route.params, action.payload.params) : route.params;
1198
- } else {
1199
- params = routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], action.payload.params) : action.payload.params;
1200
- }
1201
- var path = action.type === 'NAVIGATE' && action.payload.path != null ? action.payload.path : route.path;
1202
- return params !== route.params || path !== route.path ? Object.assign({}, route, {
1203
- key: key,
1204
- path: path,
1205
- params: params
1206
- }) : route;
1207
- })
1208
- }), index, backBehavior, initialRouteName);
1209
- }
1210
- case 'GO_BACK':
1211
- {
1212
- if (state.history.length === 1) {
1213
- return null;
1214
- }
1215
- var previousKey = state.history[state.history.length - 2].key;
1216
- var _index = state.routes.findIndex(function (route) {
1217
- return route.key === previousKey;
1218
- });
1219
- if (_index === -1) {
1220
- return null;
1221
- }
1222
- return Object.assign({}, state, {
1223
- history: state.history.slice(0, -1),
1224
- index: _index
1225
- });
1226
- }
1227
- default:
1228
- return _BaseRouter.default.getStateForAction(state, action);
1229
- }
1230
- },
1231
- shouldActionChangeFocus: function shouldActionChangeFocus(action) {
1232
- return action.type === 'NAVIGATE';
1233
- },
1234
- actionCreators: TabActions
1235
- });
1236
- return router;
1237
- }
1238
- },"c822e55e1302f6e881d8",["4e814a93075c75141026","e03db9aacb1ee503cd26"]);
1239
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1240
- function _objectWithoutProperties(e, t) {
1241
- if (null == e) return {};
1242
- var o,
1243
- r,
1244
- i = _$$_REQUIRE(_dependencyMap[0])(e, t);
1245
- if (Object.getOwnPropertySymbols) {
1246
- var s = Object.getOwnPropertySymbols(e);
1247
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
1248
- }
1249
- return i;
1250
- }
1251
- module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
1252
- },"288fc9023aadbf916360",["227b8be7a5ddac0008f4"]);
1253
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1254
- function _objectWithoutPropertiesLoose(r, e) {
1255
- if (null == r) return {};
1256
- var t = {};
1257
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
1258
- if (e.includes(n)) continue;
1259
- t[n] = r[n];
1260
- }
1261
- return t;
1262
- }
1263
- module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
1264
- },"227b8be7a5ddac0008f4",[]);
1265
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1266
- function _toConsumableArray(r) {
1267
- return _$$_REQUIRE(_dependencyMap[0])(r) || _$$_REQUIRE(_dependencyMap[1])(r) || _$$_REQUIRE(_dependencyMap[2])(r) || _$$_REQUIRE(_dependencyMap[3])();
1268
- }
1269
- module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
1270
- },"c8d9faa50529497e8550",["fedf38594225d61ce364","caf268f6252e2825d074","bb86eb755213422b1850","e82afc4c0fee49992755"]);
1271
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1272
- function _arrayWithoutHoles(r) {
1273
- if (Array.isArray(r)) return _$$_REQUIRE(_dependencyMap[0])(r);
1274
- }
1275
- module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
1276
- },"fedf38594225d61ce364",["790be5d6822a112c9007"]);
1277
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1278
- function _arrayLikeToArray(r, a) {
1279
- (null == a || a > r.length) && (a = r.length);
1280
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
1281
- return n;
1282
- }
1283
- module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
1284
- },"790be5d6822a112c9007",[]);
1285
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1286
- function _iterableToArray(r) {
1287
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
1288
- }
1289
- module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
1290
- },"caf268f6252e2825d074",[]);
1291
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1292
- function _unsupportedIterableToArray(r, a) {
1293
- if (r) {
1294
- if ("string" == typeof r) return _$$_REQUIRE(_dependencyMap[0])(r, a);
1295
- var t = {}.toString.call(r).slice(8, -1);
1296
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _$$_REQUIRE(_dependencyMap[0])(r, a) : undefined;
1297
- }
1298
- }
1299
- module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
1300
- },"bb86eb755213422b1850",["790be5d6822a112c9007"]);
1301
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1302
- function _nonIterableSpread() {
1303
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1304
- }
1305
- module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
1306
- },"e82afc4c0fee49992755",[]);
1307
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1308
- "use strict";
1309
-
1310
- Object.defineProperty(exports, "__esModule", {
1311
- value: true
1312
- });
1313
- exports.StackActions = undefined;
1314
- exports.default = StackRouter;
1315
- var _BaseRouter = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[0]));
1316
- function _interopRequireDefault(e) {
1317
- return e && e.__esModule ? e : {
1318
- default: e
1319
- };
1320
- }
1321
- var StackActions = exports.StackActions = {
1322
- replace: function replace(name, params) {
1323
- return {
1324
- type: 'REPLACE',
1325
- payload: {
1326
- name: name,
1327
- params: params
1328
- }
1329
- };
1330
- },
1331
- push: function push(name, params) {
1332
- return {
1333
- type: 'PUSH',
1334
- payload: {
1335
- name: name,
1336
- params: params
1337
- }
1338
- };
1339
- },
1340
- pop: function pop() {
1341
- var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1342
- return {
1343
- type: 'POP',
1344
- payload: {
1345
- count: count
1346
- }
1347
- };
1348
- },
1349
- popToTop: function popToTop() {
1350
- return {
1351
- type: 'POP_TO_TOP'
1352
- };
1353
- }
1354
- };
1355
- function StackRouter(options) {
1356
- var router = Object.assign({}, _BaseRouter.default, {
1357
- type: 'stack',
1358
- getInitialState: function getInitialState(_ref) {
1359
- var routeNames = _ref.routeNames,
1360
- routeParamList = _ref.routeParamList;
1361
- var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
1362
- return {
1363
- stale: false,
1364
- type: 'stack',
1365
- key: `stack-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1366
- index: 0,
1367
- routeNames: routeNames,
1368
- routes: [{
1369
- key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1370
- name: initialRouteName,
1371
- params: routeParamList[initialRouteName]
1372
- }]
1373
- };
1374
- },
1375
- getRehydratedState: function getRehydratedState(partialState, _ref2) {
1376
- var routeNames = _ref2.routeNames,
1377
- routeParamList = _ref2.routeParamList;
1378
- var state = partialState;
1379
- if (state.stale === false) {
1380
- return state;
1381
- }
1382
- var routes = state.routes.filter(function (route) {
1383
- return routeNames.includes(route.name);
1384
- }).map(function (route) {
1385
- return Object.assign({}, route, {
1386
- key: route.key || `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1387
- params: routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], route.params) : route.params
1388
- });
1389
- });
1390
- if (routes.length === 0) {
1391
- var initialRouteName = options.initialRouteName !== undefined ? options.initialRouteName : routeNames[0];
1392
- routes.push({
1393
- key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1394
- name: initialRouteName,
1395
- params: routeParamList[initialRouteName]
1396
- });
1397
- }
1398
- return {
1399
- stale: false,
1400
- type: 'stack',
1401
- key: `stack-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1402
- index: routes.length - 1,
1403
- routeNames: routeNames,
1404
- routes: routes
1405
- };
1406
- },
1407
- getStateForRouteNamesChange: function getStateForRouteNamesChange(state, _ref3) {
1408
- var routeNames = _ref3.routeNames,
1409
- routeParamList = _ref3.routeParamList,
1410
- routeKeyChanges = _ref3.routeKeyChanges;
1411
- var routes = state.routes.filter(function (route) {
1412
- return routeNames.includes(route.name) && !routeKeyChanges.includes(route.name);
1413
- });
1414
- if (routes.length === 0) {
1415
- var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
1416
- routes.push({
1417
- key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1418
- name: initialRouteName,
1419
- params: routeParamList[initialRouteName]
1420
- });
1421
- }
1422
- return Object.assign({}, state, {
1423
- routeNames: routeNames,
1424
- routes: routes,
1425
- index: Math.min(state.index, routes.length - 1)
1426
- });
1427
- },
1428
- getStateForRouteFocus: function getStateForRouteFocus(state, key) {
1429
- var index = state.routes.findIndex(function (r) {
1430
- return r.key === key;
1431
- });
1432
- if (index === -1 || index === state.index) {
1433
- return state;
1434
- }
1435
- return Object.assign({}, state, {
1436
- index: index,
1437
- routes: state.routes.slice(0, index + 1)
1438
- });
1439
- },
1440
- getStateForAction: function getStateForAction(state, action, options) {
1441
- var routeParamList = options.routeParamList;
1442
- switch (action.type) {
1443
- case 'REPLACE':
1444
- {
1445
- var index = action.target === state.key && action.source ? state.routes.findIndex(function (r) {
1446
- return r.key === action.source;
1447
- }) : state.index;
1448
- if (index === -1) {
1449
- return null;
1450
- }
1451
- var _action$payload = action.payload,
1452
- name = _action$payload.name,
1453
- key = _action$payload.key,
1454
- params = _action$payload.params;
1455
- if (!state.routeNames.includes(name)) {
1456
- return null;
1457
- }
1458
- return Object.assign({}, state, {
1459
- routes: state.routes.map(function (route, i) {
1460
- return i === index ? {
1461
- key: key !== undefined ? key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1462
- name: name,
1463
- params: routeParamList[name] !== undefined ? Object.assign({}, routeParamList[name], params) : params
1464
- } : route;
1465
- })
1466
- });
1467
- }
1468
- case 'PUSH':
1469
- if (state.routeNames.includes(action.payload.name)) {
1470
- var getId = options.routeGetIdList[action.payload.name];
1471
- var id = getId === null || getId === undefined ? undefined : getId({
1472
- params: action.payload.params
1473
- });
1474
- var route = id ? state.routes.find(function (route) {
1475
- return route.name === action.payload.name && id === (getId === null || getId === undefined ? undefined : getId({
1476
- params: route.params
1477
- }));
1478
- }) : undefined;
1479
- var routes;
1480
- if (route) {
1481
- routes = state.routes.filter(function (r) {
1482
- return r.key !== route.key;
1483
- });
1484
- routes.push(Object.assign({}, route, {
1485
- params: routeParamList[action.payload.name] !== undefined ? Object.assign({}, routeParamList[action.payload.name], action.payload.params) : action.payload.params
1486
- }));
1487
- } else {
1488
- routes = [].concat(_$$_REQUIRE(_dependencyMap[2])(state.routes), [{
1489
- key: `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1490
- name: action.payload.name,
1491
- params: routeParamList[action.payload.name] !== undefined ? Object.assign({}, routeParamList[action.payload.name], action.payload.params) : action.payload.params
1492
- }]);
1493
- }
1494
- return Object.assign({}, state, {
1495
- index: routes.length - 1,
1496
- routes: routes
1497
- });
1498
- }
1499
- return null;
1500
- case 'POP':
1501
- {
1502
- var _index = action.target === state.key && action.source ? state.routes.findIndex(function (r) {
1503
- return r.key === action.source;
1504
- }) : state.index;
1505
- if (_index > 0) {
1506
- var count = Math.max(_index - action.payload.count + 1, 1);
1507
- var _routes = state.routes.slice(0, count).concat(state.routes.slice(_index + 1));
1508
- return Object.assign({}, state, {
1509
- index: _routes.length - 1,
1510
- routes: _routes
1511
- });
1512
- }
1513
- return null;
1514
- }
1515
- case 'POP_TO_TOP':
1516
- return router.getStateForAction(state, {
1517
- type: 'POP',
1518
- payload: {
1519
- count: state.routes.length - 1
1520
- }
1521
- }, options);
1522
- case 'NAVIGATE':
1523
- if (action.payload.name !== undefined && !state.routeNames.includes(action.payload.name)) {
1524
- return null;
1525
- }
1526
- if (action.payload.key || action.payload.name) {
1527
- var _action$payload$path;
1528
- // If the route already exists, navigate to that
1529
- var _index2 = -1;
1530
- var _getId =
1531
- // `getId` and `key` can't be used together
1532
- action.payload.key === undefined && action.payload.name !== undefined ? options.routeGetIdList[action.payload.name] : undefined;
1533
- var _id = _getId === null || _getId === undefined ? undefined : _getId({
1534
- params: action.payload.params
1535
- });
1536
- if (_id) {
1537
- _index2 = state.routes.findIndex(function (route) {
1538
- return route.name === action.payload.name && _id === (_getId === null || _getId === undefined ? undefined : _getId({
1539
- params: route.params
1540
- }));
1541
- });
1542
- } else if (state.routes[state.index].name === action.payload.name && action.payload.key === undefined || state.routes[state.index].key === action.payload.key) {
1543
- _index2 = state.index;
1544
- } else {
1545
- for (var i = state.routes.length - 1; i >= 0; i--) {
1546
- if (state.routes[i].name === action.payload.name && action.payload.key === undefined || state.routes[i].key === action.payload.key) {
1547
- _index2 = i;
1548
- break;
1549
- }
1550
- }
1551
- }
1552
- if (_index2 === -1 && action.payload.key && action.payload.name === undefined) {
1553
- return null;
1554
- }
1555
- if (_index2 === -1 && action.payload.name !== undefined) {
1556
- var _action$payload$key;
1557
- var _routes2 = [].concat(_$$_REQUIRE(_dependencyMap[2])(state.routes), [{
1558
- key: (_action$payload$key = action.payload.key) != null ? _action$payload$key : `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
1559
- name: action.payload.name,
1560
- path: action.payload.path,
1561
- params: routeParamList[action.payload.name] !== undefined ? Object.assign({}, routeParamList[action.payload.name], action.payload.params) : action.payload.params
1562
- }]);
1563
- return Object.assign({}, state, {
1564
- routes: _routes2,
1565
- index: _routes2.length - 1
1566
- });
1567
- }
1568
- var _route = state.routes[_index2];
1569
- var _params;
1570
- if (action.payload.merge) {
1571
- _params = action.payload.params !== undefined || routeParamList[_route.name] !== undefined ? Object.assign({}, routeParamList[_route.name], _route.params, action.payload.params) : _route.params;
1572
- } else {
1573
- _params = routeParamList[_route.name] !== undefined ? Object.assign({}, routeParamList[_route.name], action.payload.params) : action.payload.params;
1574
- }
1575
- return Object.assign({}, state, {
1576
- index: _index2,
1577
- routes: [].concat(_$$_REQUIRE(_dependencyMap[2])(state.routes.slice(0, _index2)), [_params !== _route.params || action.payload.path && action.payload.path !== _route.path ? Object.assign({}, _route, {
1578
- path: (_action$payload$path = action.payload.path) != null ? _action$payload$path : _route.path,
1579
- params: _params
1580
- }) : state.routes[_index2]])
1581
- });
1582
- }
1583
- return null;
1584
- case 'GO_BACK':
1585
- if (state.index > 0) {
1586
- return router.getStateForAction(state, {
1587
- type: 'POP',
1588
- payload: {
1589
- count: 1
1590
- },
1591
- target: action.target,
1592
- source: action.source
1593
- }, options);
1594
- }
1595
- return null;
1596
- default:
1597
- return _BaseRouter.default.getStateForAction(state, action);
1598
- }
1599
- },
1600
- actionCreators: StackActions
1601
- });
1602
- return router;
1603
- }
1604
- },"536b900fdd2382601bd3",["4e814a93075c75141026","e03db9aacb1ee503cd26","c8d9faa50529497e8550"]);
1605
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1606
- "use strict";
1607
-
1608
- Object.defineProperty(exports, "__esModule", {
1609
- value: true
1610
- });
1611
- var _exportNames = {
1612
- CommonActions: true,
1613
- BaseRouter: true,
1614
- DrawerActions: true,
1615
- DrawerRouter: true,
1616
- StackActions: true,
1617
- StackRouter: true,
1618
- TabActions: true,
1619
- TabRouter: true
1620
- };
1621
- Object.defineProperty(exports, "BaseRouter", {
1622
- enumerable: true,
1623
- get: function get() {
1624
- return _BaseRouter.default;
1625
- }
1626
- });
1627
- exports.CommonActions = undefined;
1628
- Object.defineProperty(exports, "DrawerActions", {
1629
- enumerable: true,
1630
- get: function get() {
1631
- return _DrawerRouter.DrawerActions;
1632
- }
1633
- });
1634
- Object.defineProperty(exports, "DrawerRouter", {
1635
- enumerable: true,
1636
- get: function get() {
1637
- return _DrawerRouter.default;
1638
- }
1639
- });
1640
- Object.defineProperty(exports, "StackActions", {
1641
- enumerable: true,
1642
- get: function get() {
1643
- return _StackRouter.StackActions;
1644
- }
1645
- });
1646
- Object.defineProperty(exports, "StackRouter", {
1647
- enumerable: true,
1648
- get: function get() {
1649
- return _StackRouter.default;
1650
- }
1651
- });
1652
- Object.defineProperty(exports, "TabActions", {
1653
- enumerable: true,
1654
- get: function get() {
1655
- return _TabRouter.TabActions;
1656
- }
1657
- });
1658
- Object.defineProperty(exports, "TabRouter", {
1659
- enumerable: true,
1660
- get: function get() {
1661
- return _TabRouter.default;
1662
- }
1663
- });
1664
- var CommonActions = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
1665
- exports.CommonActions = CommonActions;
1666
- var _BaseRouter = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[1]));
1667
- var _DrawerRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[2]));
1668
- var _StackRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[3]));
1669
- var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[4]));
1670
- Object.keys(_$$_REQUIRE(_dependencyMap[5])).forEach(function (key) {
1671
- if (key === "default" || key === "__esModule") return;
1672
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
1673
- if (key in exports && exports[key] === _$$_REQUIRE(_dependencyMap[5])[key]) return;
1674
- Object.defineProperty(exports, key, {
1675
- enumerable: true,
1676
- get: function get() {
1677
- return _$$_REQUIRE(_dependencyMap[5])[key];
1678
- }
1679
- });
1680
- });
1681
- function _interopRequireDefault(e) {
1682
- return e && e.__esModule ? e : {
1683
- default: e
1684
- };
1685
- }
1686
- function _getRequireWildcardCache(e) {
1687
- if ("function" != typeof WeakMap) return null;
1688
- var r = new WeakMap(),
1689
- t = new WeakMap();
1690
- return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
1691
- return e ? t : r;
1692
- })(e);
1693
- }
1694
- function _interopRequireWildcard(e, r) {
1695
- if (!r && e && e.__esModule) return e;
1696
- if (null === e || "object" != typeof e && "function" != typeof e) return {
1697
- default: e
1698
- };
1699
- var t = _getRequireWildcardCache(r);
1700
- if (t && t.has(e)) return t.get(e);
1701
- var n = {
1702
- __proto__: null
1703
- },
1704
- a = Object.defineProperty && Object.getOwnPropertyDescriptor;
1705
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
1706
- var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
1707
- i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
1708
- }
1709
- return n.default = e, t && t.set(e, n), n;
1710
- }
1711
- },"a0b9da8c3bf2cee70b92",["6224880bf3a3483be0e5","4e814a93075c75141026","fbd71b33b1fab08b6b66","536b900fdd2382601bd3","c822e55e1302f6e881d8","76321e829a38224d0f30"]);
1712
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1713
- "use strict";
1714
-
1715
- Object.defineProperty(exports, "__esModule", {
1716
- value: true
1717
- });
1718
- },"76321e829a38224d0f30",[]);
1719
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1720
- Object.defineProperty(exports, "__esModule", {
1721
- value: true
1722
- });
1723
- exports.default = undefined;
1724
- /**
1725
- * Base router object that can be used when writing custom routers.
1726
- * This provides few helper methods to handle common actions such as `RESET`.
1727
- */
1728
- var BaseRouter = {
1729
- getStateForAction: function getStateForAction(state, action) {
1730
- switch (action.type) {
1731
- case 'SET_PARAMS':
1732
- {
1733
- var index = action.source ? state.routes.findIndex(function (r) {
1734
- return r.key === action.source;
1735
- }) : state.index;
1736
- if (index === -1) {
1737
- return null;
1738
- }
1739
- return Object.assign({}, state, {
1740
- routes: state.routes.map(function (r, i) {
1741
- return i === index ? Object.assign({}, r, {
1742
- params: Object.assign({}, r.params, action.payload.params)
1743
- }) : r;
1744
- })
1745
- });
1746
- }
1747
- case 'RESET':
1748
- {
1749
- var nextState = action.payload;
1750
- if (nextState.routes.length === 0 || nextState.routes.some(function (route) {
1751
- return !state.routeNames.includes(route.name);
1752
- })) {
1753
- return null;
1754
- }
1755
- if (nextState.stale === false) {
1756
- if (state.routeNames.length !== nextState.routeNames.length || nextState.routeNames.some(function (name) {
1757
- return !state.routeNames.includes(name);
1758
- })) {
1759
- return null;
1760
- }
1761
- return Object.assign({}, nextState, {
1762
- routes: nextState.routes.map(function (route) {
1763
- return route.key ? route : Object.assign({}, route, {
1764
- key: `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[0]).nanoid)()}`
1765
- });
1766
- })
1767
- });
1768
- }
1769
- return nextState;
1770
- }
1771
- default:
1772
- return null;
1773
- }
1774
- },
1775
- shouldActionChangeFocus: function shouldActionChangeFocus(action) {
1776
- return action.type === 'NAVIGATE';
1777
- }
1778
- };
1779
- var _default = exports.default = BaseRouter;
1780
- },"b02ddfcf5d1b27936f8d",["e03db9aacb1ee503cd26"]);
1781
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1782
- Object.defineProperty(exports, "__esModule", {
1783
- value: true
1784
- });
1785
- exports.goBack = goBack;
1786
- exports.navigate = navigate;
1787
- exports.reset = reset;
1788
- exports.setParams = setParams;
1789
- function goBack() {
1790
- return {
1791
- type: 'GO_BACK'
1792
- };
1793
- }
1794
-
1795
- // eslint-disable-next-line no-redeclare
1796
-
1797
- // eslint-disable-next-line no-redeclare
1798
- function navigate() {
1799
- if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'string') {
1800
- return {
1801
- type: 'NAVIGATE',
1802
- payload: {
1803
- name: arguments.length <= 0 ? undefined : arguments[0],
1804
- params: arguments.length <= 1 ? undefined : arguments[1]
1805
- }
1806
- };
1807
- } else {
1808
- var payload = (arguments.length <= 0 ? undefined : arguments[0]) || {};
1809
- if (!payload.hasOwnProperty('key') && !payload.hasOwnProperty('name')) {
1810
- throw new Error('You need to specify name or key when calling navigate with an object as the argument. See https://reactnavigation.org/docs/navigation-actions#navigate for usage.');
1811
- }
1812
- return {
1813
- type: 'NAVIGATE',
1814
- payload: payload
1815
- };
1816
- }
1817
- }
1818
- function reset(state) {
1819
- return {
1820
- type: 'RESET',
1821
- payload: state
1822
- };
1823
- }
1824
- function setParams(params) {
1825
- return {
1826
- type: 'SET_PARAMS',
1827
- payload: {
1828
- params: params
1829
- }
1830
- };
1831
- }
1832
- },"6bfbc90eac4c2d2e67a4",[]);
1833
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1834
- Object.defineProperty(exports, "__esModule", {
1835
- value: true
1836
- });
1837
- exports.DrawerActions = undefined;
1838
- exports.default = DrawerRouter;
1839
- var _toConsumableArray2 = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
1840
- var _objectWithoutProperties2 = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[2]));
1841
- var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[3]));
1842
- var _excluded = ["defaultStatus"];
1843
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
1844
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
1845
- var DrawerActions = exports.DrawerActions = Object.assign({}, _TabRouter.TabActions, {
1846
- openDrawer: function openDrawer() {
1847
- return {
1848
- type: 'OPEN_DRAWER'
1849
- };
1850
- },
1851
- closeDrawer: function closeDrawer() {
1852
- return {
1853
- type: 'CLOSE_DRAWER'
1854
- };
1855
- },
1856
- toggleDrawer: function toggleDrawer() {
1857
- return {
1858
- type: 'TOGGLE_DRAWER'
1859
- };
1860
- }
1861
- });
1862
- function DrawerRouter(_ref) {
1863
- var _ref$defaultStatus = _ref.defaultStatus,
1864
- defaultStatus = _ref$defaultStatus === undefined ? 'closed' : _ref$defaultStatus,
1865
- rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
1866
- var router = (0, _TabRouter.default)(rest);
1867
- var isDrawerInHistory = function isDrawerInHistory(state) {
1868
- var _state$history;
1869
- return Boolean((_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.some(function (it) {
1870
- return it.type === 'drawer';
1871
- }));
1872
- };
1873
- var addDrawerToHistory = function addDrawerToHistory(state) {
1874
- if (isDrawerInHistory(state)) {
1875
- return state;
1876
- }
1877
- return Object.assign({}, state, {
1878
- history: [].concat((0, _toConsumableArray2.default)(state.history), [{
1879
- type: 'drawer',
1880
- status: defaultStatus === 'open' ? 'closed' : 'open'
1881
- }])
1882
- });
1883
- };
1884
- var removeDrawerFromHistory = function removeDrawerFromHistory(state) {
1885
- if (!isDrawerInHistory(state)) {
1886
- return state;
1887
- }
1888
- return Object.assign({}, state, {
1889
- history: state.history.filter(function (it) {
1890
- return it.type !== 'drawer';
1891
- })
1892
- });
1893
- };
1894
- var openDrawer = function openDrawer(state) {
1895
- if (defaultStatus === 'open') {
1896
- return removeDrawerFromHistory(state);
1897
- }
1898
- return addDrawerToHistory(state);
1899
- };
1900
- var closeDrawer = function closeDrawer(state) {
1901
- if (defaultStatus === 'open') {
1902
- return addDrawerToHistory(state);
1903
- }
1904
- return removeDrawerFromHistory(state);
1905
- };
1906
- return Object.assign({}, router, {
1907
- type: 'drawer',
1908
- getInitialState: function getInitialState(_ref2) {
1909
- var routeNames = _ref2.routeNames,
1910
- routeParamList = _ref2.routeParamList,
1911
- routeGetIdList = _ref2.routeGetIdList;
1912
- var state = router.getInitialState({
1913
- routeNames: routeNames,
1914
- routeParamList: routeParamList,
1915
- routeGetIdList: routeGetIdList
1916
- });
1917
- return Object.assign({}, state, {
1918
- default: defaultStatus,
1919
- stale: false,
1920
- type: 'drawer',
1921
- key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[4]).nanoid)()}`
1922
- });
1923
- },
1924
- getRehydratedState: function getRehydratedState(partialState, _ref3) {
1925
- var routeNames = _ref3.routeNames,
1926
- routeParamList = _ref3.routeParamList,
1927
- routeGetIdList = _ref3.routeGetIdList;
1928
- if (partialState.stale === false) {
1929
- return partialState;
1930
- }
1931
- var state = router.getRehydratedState(partialState, {
1932
- routeNames: routeNames,
1933
- routeParamList: routeParamList,
1934
- routeGetIdList: routeGetIdList
1935
- });
1936
- if (isDrawerInHistory(partialState)) {
1937
- // Re-sync the drawer entry in history to correct it if it was wrong
1938
- state = removeDrawerFromHistory(state);
1939
- state = addDrawerToHistory(state);
1940
- }
1941
- return Object.assign({}, state, {
1942
- default: defaultStatus,
1943
- type: 'drawer',
1944
- key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[4]).nanoid)()}`
1945
- });
1946
- },
1947
- getStateForRouteFocus: function getStateForRouteFocus(state, key) {
1948
- var result = router.getStateForRouteFocus(state, key);
1949
- return closeDrawer(result);
1950
- },
1951
- getStateForAction: function getStateForAction(state, action, options) {
1952
- switch (action.type) {
1953
- case 'OPEN_DRAWER':
1954
- return openDrawer(state);
1955
- case 'CLOSE_DRAWER':
1956
- return closeDrawer(state);
1957
- case 'TOGGLE_DRAWER':
1958
- if (isDrawerInHistory(state)) {
1959
- return removeDrawerFromHistory(state);
1960
- }
1961
- return addDrawerToHistory(state);
1962
- case 'JUMP_TO':
1963
- case 'NAVIGATE':
1964
- {
1965
- var result = router.getStateForAction(state, action, options);
1966
- if (result != null && result.index !== state.index) {
1967
- return closeDrawer(result);
1968
- }
1969
- return result;
1970
- }
1971
- case 'GO_BACK':
1972
- if (isDrawerInHistory(state)) {
1973
- return removeDrawerFromHistory(state);
1974
- }
1975
- return router.getStateForAction(state, action, options);
1976
- default:
1977
- return router.getStateForAction(state, action, options);
1978
- }
1979
- },
1980
- actionCreators: DrawerActions
1981
- });
1982
- }
1983
- },"36b338faa6c2364d674f",["e13c8413f9a5de8e772f","c8d9faa50529497e8550","288fc9023aadbf916360","88d6ccdfe66b5db63cff","e03db9aacb1ee503cd26"]);
1984
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1985
- function _interopRequireDefault(e) {
1986
- return e && e.__esModule ? e : {
1987
- "default": e
1988
- };
1989
- }
1990
- module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
1991
- },"e13c8413f9a5de8e772f",[]);
1992
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1993
- Object.defineProperty(exports, "__esModule", {
1994
- value: true
1995
- });
1996
- exports.TabActions = undefined;
1997
- exports.default = TabRouter;
1998
- var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
1999
- var TYPE_ROUTE = 'route';
2000
- var TabActions = exports.TabActions = {
2001
- jumpTo: function jumpTo(name, params) {
2002
- return {
2003
- type: 'JUMP_TO',
2004
- payload: {
2005
- name: name,
2006
- params: params
2007
- }
2008
- };
2009
- }
2010
- };
2011
- var getRouteHistory = function getRouteHistory(routes, index, backBehavior, initialRouteName) {
2012
- var history = [{
2013
- type: TYPE_ROUTE,
2014
- key: routes[index].key
2015
- }];
2016
- var initialRouteIndex;
2017
- switch (backBehavior) {
2018
- case 'order':
2019
- for (var i = index; i > 0; i--) {
2020
- history.unshift({
2021
- type: TYPE_ROUTE,
2022
- key: routes[i - 1].key
2023
- });
2024
- }
2025
- break;
2026
- case 'firstRoute':
2027
- if (index !== 0) {
2028
- history.unshift({
2029
- type: TYPE_ROUTE,
2030
- key: routes[0].key
2031
- });
2032
- }
2033
- break;
2034
- case 'initialRoute':
2035
- initialRouteIndex = routes.findIndex(function (route) {
2036
- return route.name === initialRouteName;
2037
- });
2038
- initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;
2039
- if (index !== initialRouteIndex) {
2040
- history.unshift({
2041
- type: TYPE_ROUTE,
2042
- key: routes[initialRouteIndex].key
2043
- });
2044
- }
2045
- break;
2046
- case 'history':
2047
- // The history will fill up on navigation
2048
- break;
2049
- }
2050
- return history;
2051
- };
2052
- var changeIndex = function changeIndex(state, index, backBehavior, initialRouteName) {
2053
- var history;
2054
- if (backBehavior === 'history') {
2055
- var currentKey = state.routes[index].key;
2056
- history = state.history.filter(function (it) {
2057
- return it.type === 'route' ? it.key !== currentKey : false;
2058
- }).concat({
2059
- type: TYPE_ROUTE,
2060
- key: currentKey
2061
- });
2062
- } else {
2063
- history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);
2064
- }
2065
- return Object.assign({}, state, {
2066
- index: index,
2067
- history: history
2068
- });
2069
- };
2070
- function TabRouter(_ref) {
2071
- var initialRouteName = _ref.initialRouteName,
2072
- _ref$backBehavior = _ref.backBehavior,
2073
- backBehavior = _ref$backBehavior === undefined ? 'firstRoute' : _ref$backBehavior;
2074
- var router = Object.assign({}, _BaseRouter.default, {
2075
- type: 'tab',
2076
- getInitialState: function getInitialState(_ref2) {
2077
- var routeNames = _ref2.routeNames,
2078
- routeParamList = _ref2.routeParamList;
2079
- var index = initialRouteName !== undefined && routeNames.includes(initialRouteName) ? routeNames.indexOf(initialRouteName) : 0;
2080
- var routes = routeNames.map(function (name) {
2081
- return {
2082
- name: name,
2083
- key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2084
- params: routeParamList[name]
2085
- };
2086
- });
2087
- var history = getRouteHistory(routes, index, backBehavior, initialRouteName);
2088
- return {
2089
- stale: false,
2090
- type: 'tab',
2091
- key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2092
- index: index,
2093
- routeNames: routeNames,
2094
- history: history,
2095
- routes: routes
2096
- };
2097
- },
2098
- getRehydratedState: function getRehydratedState(partialState, _ref3) {
2099
- var _ref4, _ref5;
2100
- var routeNames = _ref3.routeNames,
2101
- routeParamList = _ref3.routeParamList;
2102
- var _state$routes, _state$history;
2103
- var state = partialState;
2104
- if (state.stale === false) {
2105
- return state;
2106
- }
2107
- var routes = routeNames.map(function (name) {
2108
- var route = state.routes.find(function (r) {
2109
- return r.name === name;
2110
- });
2111
- return Object.assign({}, route, {
2112
- name: name,
2113
- key: route && route.name === name && route.key ? route.key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2114
- params: routeParamList[name] !== undefined ? Object.assign({}, routeParamList[name], route ? route.params : undefined) : route ? route.params : undefined
2115
- });
2116
- });
2117
- var index = Math.min(Math.max(routeNames.indexOf((_state$routes = state.routes[(_ref4 = state === null || state === undefined ? undefined : state.index) != null ? _ref4 : 0]) === null || _state$routes === undefined ? undefined : _state$routes.name), 0), routes.length - 1);
2118
- var history = (_ref5 = (_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.filter(function (it) {
2119
- return routes.find(function (r) {
2120
- return r.key === it.key;
2121
- });
2122
- })) != null ? _ref5 : [];
2123
- return changeIndex({
2124
- stale: false,
2125
- type: 'tab',
2126
- key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2127
- index: index,
2128
- routeNames: routeNames,
2129
- history: history,
2130
- routes: routes
2131
- }, index, backBehavior, initialRouteName);
2132
- },
2133
- getStateForRouteNamesChange: function getStateForRouteNamesChange(state, _ref6) {
2134
- var routeNames = _ref6.routeNames,
2135
- routeParamList = _ref6.routeParamList,
2136
- routeKeyChanges = _ref6.routeKeyChanges;
2137
- var routes = routeNames.map(function (name) {
2138
- return state.routes.find(function (r) {
2139
- return r.name === name && !routeKeyChanges.includes(r.name);
2140
- }) || {
2141
- name: name,
2142
- key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2143
- params: routeParamList[name]
2144
- };
2145
- });
2146
- var index = Math.max(0, routeNames.indexOf(state.routes[state.index].name));
2147
- var history = state.history.filter(
2148
- // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)
2149
- function (it) {
2150
- return it.type !== 'route' || routes.find(function (r) {
2151
- return r.key === it.key;
2152
- });
2153
- });
2154
- if (!history.length) {
2155
- history = getRouteHistory(routes, index, backBehavior, initialRouteName);
2156
- }
2157
- return Object.assign({}, state, {
2158
- history: history,
2159
- routeNames: routeNames,
2160
- routes: routes,
2161
- index: index
2162
- });
2163
- },
2164
- getStateForRouteFocus: function getStateForRouteFocus(state, key) {
2165
- var index = state.routes.findIndex(function (r) {
2166
- return r.key === key;
2167
- });
2168
- if (index === -1 || index === state.index) {
2169
- return state;
2170
- }
2171
- return changeIndex(state, index, backBehavior, initialRouteName);
2172
- },
2173
- getStateForAction: function getStateForAction(state, action, _ref7) {
2174
- var routeParamList = _ref7.routeParamList,
2175
- routeGetIdList = _ref7.routeGetIdList;
2176
- switch (action.type) {
2177
- case 'JUMP_TO':
2178
- case 'NAVIGATE':
2179
- {
2180
- var index = -1;
2181
- if (action.type === 'NAVIGATE' && action.payload.key) {
2182
- index = state.routes.findIndex(function (route) {
2183
- return route.key === action.payload.key;
2184
- });
2185
- } else {
2186
- index = state.routes.findIndex(function (route) {
2187
- return route.name === action.payload.name;
2188
- });
2189
- }
2190
- if (index === -1) {
2191
- return null;
2192
- }
2193
- return changeIndex(Object.assign({}, state, {
2194
- routes: state.routes.map(function (route, i) {
2195
- if (i !== index) {
2196
- return route;
2197
- }
2198
- var getId = routeGetIdList[route.name];
2199
- var currentId = getId === null || getId === undefined ? undefined : getId({
2200
- params: route.params
2201
- });
2202
- var nextId = getId === null || getId === undefined ? undefined : getId({
2203
- params: action.payload.params
2204
- });
2205
- var key = currentId === nextId ? route.key : `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`;
2206
- var params;
2207
- if (action.type === 'NAVIGATE' && action.payload.merge && currentId === nextId) {
2208
- params = action.payload.params !== undefined || routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], route.params, action.payload.params) : route.params;
2209
- } else {
2210
- params = routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], action.payload.params) : action.payload.params;
2211
- }
2212
- var path = action.type === 'NAVIGATE' && action.payload.path != null ? action.payload.path : route.path;
2213
- return params !== route.params || path !== route.path ? Object.assign({}, route, {
2214
- key: key,
2215
- path: path,
2216
- params: params
2217
- }) : route;
2218
- })
2219
- }), index, backBehavior, initialRouteName);
2220
- }
2221
- case 'GO_BACK':
2222
- {
2223
- if (state.history.length === 1) {
2224
- return null;
2225
- }
2226
- var previousKey = state.history[state.history.length - 2].key;
2227
- var _index = state.routes.findIndex(function (route) {
2228
- return route.key === previousKey;
2229
- });
2230
- if (_index === -1) {
2231
- return null;
2232
- }
2233
- return Object.assign({}, state, {
2234
- history: state.history.slice(0, -1),
2235
- index: _index
2236
- });
2237
- }
2238
- default:
2239
- return _BaseRouter.default.getStateForAction(state, action);
2240
- }
2241
- },
2242
- shouldActionChangeFocus: function shouldActionChangeFocus(action) {
2243
- return action.type === 'NAVIGATE';
2244
- },
2245
- actionCreators: TabActions
2246
- });
2247
- return router;
2248
- }
2249
- },"88d6ccdfe66b5db63cff",["e13c8413f9a5de8e772f","b02ddfcf5d1b27936f8d","e03db9aacb1ee503cd26"]);
2250
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2251
- Object.defineProperty(exports, "__esModule", {
2252
- value: true
2253
- });
2254
- exports.StackActions = undefined;
2255
- exports.default = StackRouter;
2256
- var _toConsumableArray2 = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
2257
- var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[2]));
2258
- var StackActions = exports.StackActions = {
2259
- replace: function replace(name, params) {
2260
- return {
2261
- type: 'REPLACE',
2262
- payload: {
2263
- name: name,
2264
- params: params
2265
- }
2266
- };
2267
- },
2268
- push: function push(name, params) {
2269
- return {
2270
- type: 'PUSH',
2271
- payload: {
2272
- name: name,
2273
- params: params
2274
- }
2275
- };
2276
- },
2277
- pop: function pop() {
2278
- var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2279
- return {
2280
- type: 'POP',
2281
- payload: {
2282
- count: count
2283
- }
2284
- };
2285
- },
2286
- popToTop: function popToTop() {
2287
- return {
2288
- type: 'POP_TO_TOP'
2289
- };
2290
- }
2291
- };
2292
- function StackRouter(options) {
2293
- var router = Object.assign({}, _BaseRouter.default, {
2294
- type: 'stack',
2295
- getInitialState: function getInitialState(_ref) {
2296
- var routeNames = _ref.routeNames,
2297
- routeParamList = _ref.routeParamList;
2298
- var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
2299
- return {
2300
- stale: false,
2301
- type: 'stack',
2302
- key: `stack-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
2303
- index: 0,
2304
- routeNames: routeNames,
2305
- routes: [{
2306
- key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
2307
- name: initialRouteName,
2308
- params: routeParamList[initialRouteName]
2309
- }]
2310
- };
2311
- },
2312
- getRehydratedState: function getRehydratedState(partialState, _ref2) {
2313
- var routeNames = _ref2.routeNames,
2314
- routeParamList = _ref2.routeParamList;
2315
- var state = partialState;
2316
- if (state.stale === false) {
2317
- return state;
2318
- }
2319
- var routes = state.routes.filter(function (route) {
2320
- return routeNames.includes(route.name);
2321
- }).map(function (route) {
2322
- return Object.assign({}, route, {
2323
- key: route.key || `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
2324
- params: routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], route.params) : route.params
2325
- });
2326
- });
2327
- if (routes.length === 0) {
2328
- var initialRouteName = options.initialRouteName !== undefined ? options.initialRouteName : routeNames[0];
2329
- routes.push({
2330
- key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
2331
- name: initialRouteName,
2332
- params: routeParamList[initialRouteName]
2333
- });
2334
- }
2335
- return {
2336
- stale: false,
2337
- type: 'stack',
2338
- key: `stack-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
2339
- index: routes.length - 1,
2340
- routeNames: routeNames,
2341
- routes: routes
2342
- };
2343
- },
2344
- getStateForRouteNamesChange: function getStateForRouteNamesChange(state, _ref3) {
2345
- var routeNames = _ref3.routeNames,
2346
- routeParamList = _ref3.routeParamList,
2347
- routeKeyChanges = _ref3.routeKeyChanges;
2348
- var routes = state.routes.filter(function (route) {
2349
- return routeNames.includes(route.name) && !routeKeyChanges.includes(route.name);
2350
- });
2351
- if (routes.length === 0) {
2352
- var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
2353
- routes.push({
2354
- key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
2355
- name: initialRouteName,
2356
- params: routeParamList[initialRouteName]
2357
- });
2358
- }
2359
- return Object.assign({}, state, {
2360
- routeNames: routeNames,
2361
- routes: routes,
2362
- index: Math.min(state.index, routes.length - 1)
2363
- });
2364
- },
2365
- getStateForRouteFocus: function getStateForRouteFocus(state, key) {
2366
- var index = state.routes.findIndex(function (r) {
2367
- return r.key === key;
2368
- });
2369
- if (index === -1 || index === state.index) {
2370
- return state;
2371
- }
2372
- return Object.assign({}, state, {
2373
- index: index,
2374
- routes: state.routes.slice(0, index + 1)
2375
- });
2376
- },
2377
- getStateForAction: function getStateForAction(state, action, options) {
2378
- var routeParamList = options.routeParamList;
2379
- switch (action.type) {
2380
- case 'REPLACE':
2381
- {
2382
- var index = action.target === state.key && action.source ? state.routes.findIndex(function (r) {
2383
- return r.key === action.source;
2384
- }) : state.index;
2385
- if (index === -1) {
2386
- return null;
2387
- }
2388
- var _action$payload = action.payload,
2389
- name = _action$payload.name,
2390
- key = _action$payload.key,
2391
- params = _action$payload.params;
2392
- if (!state.routeNames.includes(name)) {
2393
- return null;
2394
- }
2395
- return Object.assign({}, state, {
2396
- routes: state.routes.map(function (route, i) {
2397
- return i === index ? {
2398
- key: key !== undefined ? key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
2399
- name: name,
2400
- params: routeParamList[name] !== undefined ? Object.assign({}, routeParamList[name], params) : params
2401
- } : route;
2402
- })
2403
- });
2404
- }
2405
- case 'PUSH':
2406
- if (state.routeNames.includes(action.payload.name)) {
2407
- var getId = options.routeGetIdList[action.payload.name];
2408
- var id = getId === null || getId === undefined ? undefined : getId({
2409
- params: action.payload.params
2410
- });
2411
- var route = id ? state.routes.find(function (route) {
2412
- return route.name === action.payload.name && id === (getId === null || getId === undefined ? undefined : getId({
2413
- params: route.params
2414
- }));
2415
- }) : undefined;
2416
- var routes;
2417
- if (route) {
2418
- routes = state.routes.filter(function (r) {
2419
- return r.key !== route.key;
2420
- });
2421
- routes.push(Object.assign({}, route, {
2422
- params: routeParamList[action.payload.name] !== undefined ? Object.assign({}, routeParamList[action.payload.name], action.payload.params) : action.payload.params
2423
- }));
2424
- } else {
2425
- routes = [].concat((0, _toConsumableArray2.default)(state.routes), [{
2426
- key: `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
2427
- name: action.payload.name,
2428
- params: routeParamList[action.payload.name] !== undefined ? Object.assign({}, routeParamList[action.payload.name], action.payload.params) : action.payload.params
2429
- }]);
2430
- }
2431
- return Object.assign({}, state, {
2432
- index: routes.length - 1,
2433
- routes: routes
2434
- });
2435
- }
2436
- return null;
2437
- case 'POP':
2438
- {
2439
- var _index = action.target === state.key && action.source ? state.routes.findIndex(function (r) {
2440
- return r.key === action.source;
2441
- }) : state.index;
2442
- if (_index > 0) {
2443
- var count = Math.max(_index - action.payload.count + 1, 1);
2444
- var _routes = state.routes.slice(0, count).concat(state.routes.slice(_index + 1));
2445
- return Object.assign({}, state, {
2446
- index: _routes.length - 1,
2447
- routes: _routes
2448
- });
2449
- }
2450
- return null;
2451
- }
2452
- case 'POP_TO_TOP':
2453
- return router.getStateForAction(state, {
2454
- type: 'POP',
2455
- payload: {
2456
- count: state.routes.length - 1
2457
- }
2458
- }, options);
2459
- case 'NAVIGATE':
2460
- if (action.payload.name !== undefined && !state.routeNames.includes(action.payload.name)) {
2461
- return null;
2462
- }
2463
- if (action.payload.key || action.payload.name) {
2464
- var _action$payload$path;
2465
- // If the route already exists, navigate to that
2466
- var _index2 = -1;
2467
- var _getId =
2468
- // `getId` and `key` can't be used together
2469
- action.payload.key === undefined && action.payload.name !== undefined ? options.routeGetIdList[action.payload.name] : undefined;
2470
- var _id = _getId === null || _getId === undefined ? undefined : _getId({
2471
- params: action.payload.params
2472
- });
2473
- if (_id) {
2474
- _index2 = state.routes.findIndex(function (route) {
2475
- return route.name === action.payload.name && _id === (_getId === null || _getId === undefined ? undefined : _getId({
2476
- params: route.params
2477
- }));
2478
- });
2479
- } else if (state.routes[state.index].name === action.payload.name && action.payload.key === undefined || state.routes[state.index].key === action.payload.key) {
2480
- _index2 = state.index;
2481
- } else {
2482
- for (var i = state.routes.length - 1; i >= 0; i--) {
2483
- if (state.routes[i].name === action.payload.name && action.payload.key === undefined || state.routes[i].key === action.payload.key) {
2484
- _index2 = i;
2485
- break;
2486
- }
2487
- }
2488
- }
2489
- if (_index2 === -1 && action.payload.key && action.payload.name === undefined) {
2490
- return null;
2491
- }
2492
- if (_index2 === -1 && action.payload.name !== undefined) {
2493
- var _action$payload$key;
2494
- var _routes2 = [].concat((0, _toConsumableArray2.default)(state.routes), [{
2495
- key: (_action$payload$key = action.payload.key) != null ? _action$payload$key : `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
2496
- name: action.payload.name,
2497
- path: action.payload.path,
2498
- params: routeParamList[action.payload.name] !== undefined ? Object.assign({}, routeParamList[action.payload.name], action.payload.params) : action.payload.params
2499
- }]);
2500
- return Object.assign({}, state, {
2501
- routes: _routes2,
2502
- index: _routes2.length - 1
2503
- });
2504
- }
2505
- var _route = state.routes[_index2];
2506
- var _params;
2507
- if (action.payload.merge) {
2508
- _params = action.payload.params !== undefined || routeParamList[_route.name] !== undefined ? Object.assign({}, routeParamList[_route.name], _route.params, action.payload.params) : _route.params;
2509
- } else {
2510
- _params = routeParamList[_route.name] !== undefined ? Object.assign({}, routeParamList[_route.name], action.payload.params) : action.payload.params;
2511
- }
2512
- return Object.assign({}, state, {
2513
- index: _index2,
2514
- routes: [].concat((0, _toConsumableArray2.default)(state.routes.slice(0, _index2)), [_params !== _route.params || action.payload.path && action.payload.path !== _route.path ? Object.assign({}, _route, {
2515
- path: (_action$payload$path = action.payload.path) != null ? _action$payload$path : _route.path,
2516
- params: _params
2517
- }) : state.routes[_index2]])
2518
- });
2519
- }
2520
- return null;
2521
- case 'GO_BACK':
2522
- if (state.index > 0) {
2523
- return router.getStateForAction(state, {
2524
- type: 'POP',
2525
- payload: {
2526
- count: 1
2527
- },
2528
- target: action.target,
2529
- source: action.source
2530
- }, options);
2531
- }
2532
- return null;
2533
- default:
2534
- return _BaseRouter.default.getStateForAction(state, action);
2535
- }
2536
- },
2537
- actionCreators: StackActions
2538
- });
2539
- return router;
2540
- }
2541
- },"1d666e2a5547a2fa33f1",["e13c8413f9a5de8e772f","c8d9faa50529497e8550","b02ddfcf5d1b27936f8d","e03db9aacb1ee503cd26"]);
2542
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2543
- Object.defineProperty(exports, "__esModule", {
2544
- value: true
2545
- });
2546
- var _exportNames = {
2547
- CommonActions: true,
2548
- BaseRouter: true,
2549
- DrawerActions: true,
2550
- DrawerRouter: true,
2551
- StackActions: true,
2552
- StackRouter: true,
2553
- TabActions: true,
2554
- TabRouter: true
2555
- };
2556
- Object.defineProperty(exports, "BaseRouter", {
2557
- enumerable: true,
2558
- get: function get() {
2559
- return _BaseRouter.default;
2560
- }
2561
- });
2562
- exports.CommonActions = undefined;
2563
- Object.defineProperty(exports, "DrawerActions", {
2564
- enumerable: true,
2565
- get: function get() {
2566
- return _DrawerRouter.DrawerActions;
2567
- }
2568
- });
2569
- Object.defineProperty(exports, "DrawerRouter", {
2570
- enumerable: true,
2571
- get: function get() {
2572
- return _DrawerRouter.default;
2573
- }
2574
- });
2575
- Object.defineProperty(exports, "StackActions", {
2576
- enumerable: true,
2577
- get: function get() {
2578
- return _StackRouter.StackActions;
2579
- }
2580
- });
2581
- Object.defineProperty(exports, "StackRouter", {
2582
- enumerable: true,
2583
- get: function get() {
2584
- return _StackRouter.default;
2585
- }
2586
- });
2587
- Object.defineProperty(exports, "TabActions", {
2588
- enumerable: true,
2589
- get: function get() {
2590
- return _TabRouter.TabActions;
2591
- }
2592
- });
2593
- Object.defineProperty(exports, "TabRouter", {
2594
- enumerable: true,
2595
- get: function get() {
2596
- return _TabRouter.default;
2597
- }
2598
- });
2599
- var CommonActions = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
2600
- exports.CommonActions = CommonActions;
2601
- var _BaseRouter = _$$_REQUIRE(_dependencyMap[1])(_$$_REQUIRE(_dependencyMap[2]));
2602
- var _DrawerRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[3]));
2603
- var _StackRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[4]));
2604
- var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[5]));
2605
- Object.keys(_$$_REQUIRE(_dependencyMap[6])).forEach(function (key) {
2606
- if (key === "default" || key === "__esModule") return;
2607
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
2608
- if (key in exports && exports[key] === _$$_REQUIRE(_dependencyMap[6])[key]) return;
2609
- Object.defineProperty(exports, key, {
2610
- enumerable: true,
2611
- get: function get() {
2612
- return _$$_REQUIRE(_dependencyMap[6])[key];
2613
- }
2614
- });
2615
- });
2616
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
2617
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
2618
- },"e045dec1c8244fccaf7b",["6bfbc90eac4c2d2e67a4","e13c8413f9a5de8e772f","b02ddfcf5d1b27936f8d","36b338faa6c2364d674f","1d666e2a5547a2fa33f1","88d6ccdfe66b5db63cff","12c309785643d3823400"]);
2619
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2620
- Object.defineProperty(exports, "__esModule", {
2621
- value: true
2622
- });
2623
- },"12c309785643d3823400",[]);
2624
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2625
- Object.defineProperty(exports, "__esModule", {
2626
- value: true
2627
- });
2628
- exports.default = undefined;
2629
- /**
2630
- * Base router object that can be used when writing custom routers.
2631
- * This provides few helper methods to handle common actions such as `RESET`.
2632
- */
2633
- var BaseRouter = {
2634
- getStateForAction: function getStateForAction(state, action) {
2635
- switch (action.type) {
2636
- case 'SET_PARAMS':
2637
- {
2638
- var index = action.source ? state.routes.findIndex(function (r) {
2639
- return r.key === action.source;
2640
- }) : state.index;
2641
- if (index === -1) {
2642
- return null;
2643
- }
2644
- return Object.assign({}, state, {
2645
- routes: state.routes.map(function (r, i) {
2646
- return i === index ? Object.assign({}, r, {
2647
- params: Object.assign({}, r.params, action.payload.params)
2648
- }) : r;
2649
- })
2650
- });
2651
- }
2652
- case 'RESET':
2653
- {
2654
- var nextState = action.payload;
2655
- if (nextState.routes.length === 0 || nextState.routes.some(function (route) {
2656
- return !state.routeNames.includes(route.name);
2657
- })) {
2658
- return null;
2659
- }
2660
- if (nextState.stale === false) {
2661
- if (state.routeNames.length !== nextState.routeNames.length || nextState.routeNames.some(function (name) {
2662
- return !state.routeNames.includes(name);
2663
- })) {
2664
- return null;
2665
- }
2666
- return Object.assign({}, nextState, {
2667
- routes: nextState.routes.map(function (route) {
2668
- return route.key ? route : Object.assign({}, route, {
2669
- key: `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[0]).nanoid)()}`
2670
- });
2671
- })
2672
- });
2673
- }
2674
- return nextState;
2675
- }
2676
- default:
2677
- return null;
2678
- }
2679
- },
2680
- shouldActionChangeFocus: function shouldActionChangeFocus(action) {
2681
- return action.type === 'NAVIGATE';
2682
- }
2683
- };
2684
- var _default = exports.default = BaseRouter;
2685
- },"cc50ab09498b013d1d6d",["e03db9aacb1ee503cd26"]);
2686
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2687
- Object.defineProperty(exports, "__esModule", {
2688
- value: true
2689
- });
2690
- exports.goBack = goBack;
2691
- exports.navigate = navigate;
2692
- exports.reset = reset;
2693
- exports.setParams = setParams;
2694
- function goBack() {
2695
- return {
2696
- type: 'GO_BACK'
2697
- };
2698
- }
2699
-
2700
- // eslint-disable-next-line no-redeclare
2701
-
2702
- // eslint-disable-next-line no-redeclare
2703
- function navigate() {
2704
- if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'string') {
2705
- return {
2706
- type: 'NAVIGATE',
2707
- payload: {
2708
- name: arguments.length <= 0 ? undefined : arguments[0],
2709
- params: arguments.length <= 1 ? undefined : arguments[1]
2710
- }
2711
- };
2712
- } else {
2713
- var payload = (arguments.length <= 0 ? undefined : arguments[0]) || {};
2714
- if (!payload.hasOwnProperty('key') && !payload.hasOwnProperty('name')) {
2715
- throw new Error('You need to specify name or key when calling navigate with an object as the argument. See https://reactnavigation.org/docs/navigation-actions#navigate for usage.');
2716
- }
2717
- return {
2718
- type: 'NAVIGATE',
2719
- payload: payload
2720
- };
2721
- }
2722
- }
2723
- function reset(state) {
2724
- return {
2725
- type: 'RESET',
2726
- payload: state
2727
- };
2728
- }
2729
- function setParams(params) {
2730
- return {
2731
- type: 'SET_PARAMS',
2732
- payload: {
2733
- params: params
2734
- }
2735
- };
2736
- }
2737
- },"000944072e226c3923ad",[]);
2738
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2739
- Object.defineProperty(exports, "__esModule", {
2740
- value: true
2741
- });
2742
- exports.DrawerActions = undefined;
2743
- exports.default = DrawerRouter;
2744
- var _toConsumableArray2 = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
2745
- var _objectWithoutProperties2 = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[2]));
2746
- var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[3]));
2747
- var _excluded = ["defaultStatus"];
2748
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
2749
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
2750
- var DrawerActions = exports.DrawerActions = Object.assign({}, _TabRouter.TabActions, {
2751
- openDrawer: function openDrawer() {
2752
- return {
2753
- type: 'OPEN_DRAWER'
2754
- };
2755
- },
2756
- closeDrawer: function closeDrawer() {
2757
- return {
2758
- type: 'CLOSE_DRAWER'
2759
- };
2760
- },
2761
- toggleDrawer: function toggleDrawer() {
2762
- return {
2763
- type: 'TOGGLE_DRAWER'
2764
- };
2765
- }
2766
- });
2767
- function DrawerRouter(_ref) {
2768
- var _ref$defaultStatus = _ref.defaultStatus,
2769
- defaultStatus = _ref$defaultStatus === undefined ? 'closed' : _ref$defaultStatus,
2770
- rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
2771
- var router = (0, _TabRouter.default)(rest);
2772
- var isDrawerInHistory = function isDrawerInHistory(state) {
2773
- var _state$history;
2774
- return Boolean((_state$history = state.history) == null ? undefined : _state$history.some(function (it) {
2775
- return it.type === 'drawer';
2776
- }));
2777
- };
2778
- var addDrawerToHistory = function addDrawerToHistory(state) {
2779
- if (isDrawerInHistory(state)) {
2780
- return state;
2781
- }
2782
- return Object.assign({}, state, {
2783
- history: [].concat((0, _toConsumableArray2.default)(state.history), [{
2784
- type: 'drawer',
2785
- status: defaultStatus === 'open' ? 'closed' : 'open'
2786
- }])
2787
- });
2788
- };
2789
- var removeDrawerFromHistory = function removeDrawerFromHistory(state) {
2790
- if (!isDrawerInHistory(state)) {
2791
- return state;
2792
- }
2793
- return Object.assign({}, state, {
2794
- history: state.history.filter(function (it) {
2795
- return it.type !== 'drawer';
2796
- })
2797
- });
2798
- };
2799
- var openDrawer = function openDrawer(state) {
2800
- if (defaultStatus === 'open') {
2801
- return removeDrawerFromHistory(state);
2802
- }
2803
- return addDrawerToHistory(state);
2804
- };
2805
- var closeDrawer = function closeDrawer(state) {
2806
- if (defaultStatus === 'open') {
2807
- return addDrawerToHistory(state);
2808
- }
2809
- return removeDrawerFromHistory(state);
2810
- };
2811
- return Object.assign({}, router, {
2812
- type: 'drawer',
2813
- getInitialState: function getInitialState(_ref2) {
2814
- var routeNames = _ref2.routeNames,
2815
- routeParamList = _ref2.routeParamList,
2816
- routeGetIdList = _ref2.routeGetIdList;
2817
- var state = router.getInitialState({
2818
- routeNames: routeNames,
2819
- routeParamList: routeParamList,
2820
- routeGetIdList: routeGetIdList
2821
- });
2822
- return Object.assign({}, state, {
2823
- default: defaultStatus,
2824
- stale: false,
2825
- type: 'drawer',
2826
- key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[4]).nanoid)()}`
2827
- });
2828
- },
2829
- getRehydratedState: function getRehydratedState(partialState, _ref3) {
2830
- var routeNames = _ref3.routeNames,
2831
- routeParamList = _ref3.routeParamList,
2832
- routeGetIdList = _ref3.routeGetIdList;
2833
- if (partialState.stale === false) {
2834
- return partialState;
2835
- }
2836
- var state = router.getRehydratedState(partialState, {
2837
- routeNames: routeNames,
2838
- routeParamList: routeParamList,
2839
- routeGetIdList: routeGetIdList
2840
- });
2841
- if (isDrawerInHistory(partialState)) {
2842
- // Re-sync the drawer entry in history to correct it if it was wrong
2843
- state = removeDrawerFromHistory(state);
2844
- state = addDrawerToHistory(state);
2845
- }
2846
- return Object.assign({}, state, {
2847
- default: defaultStatus,
2848
- type: 'drawer',
2849
- key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[4]).nanoid)()}`
2850
- });
2851
- },
2852
- getStateForRouteFocus: function getStateForRouteFocus(state, key) {
2853
- var result = router.getStateForRouteFocus(state, key);
2854
- return closeDrawer(result);
2855
- },
2856
- getStateForAction: function getStateForAction(state, action, options) {
2857
- switch (action.type) {
2858
- case 'OPEN_DRAWER':
2859
- return openDrawer(state);
2860
- case 'CLOSE_DRAWER':
2861
- return closeDrawer(state);
2862
- case 'TOGGLE_DRAWER':
2863
- if (isDrawerInHistory(state)) {
2864
- return removeDrawerFromHistory(state);
2865
- }
2866
- return addDrawerToHistory(state);
2867
- case 'JUMP_TO':
2868
- case 'NAVIGATE':
2869
- {
2870
- var result = router.getStateForAction(state, action, options);
2871
- if (result != null && result.index !== state.index) {
2872
- return closeDrawer(result);
2873
- }
2874
- return result;
2875
- }
2876
- case 'GO_BACK':
2877
- if (isDrawerInHistory(state)) {
2878
- return removeDrawerFromHistory(state);
2879
- }
2880
- return router.getStateForAction(state, action, options);
2881
- default:
2882
- return router.getStateForAction(state, action, options);
2883
- }
2884
- },
2885
- actionCreators: DrawerActions
2886
- });
2887
- }
2888
- },"a84ba97c7150cdcf5967",["e13c8413f9a5de8e772f","c8d9faa50529497e8550","288fc9023aadbf916360","b409790239ad0cd46252","e03db9aacb1ee503cd26"]);
2889
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2890
- Object.defineProperty(exports, "__esModule", {
2891
- value: true
2892
- });
2893
- exports.TabActions = undefined;
2894
- exports.default = TabRouter;
2895
- var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
2896
- var TYPE_ROUTE = 'route';
2897
- var TabActions = exports.TabActions = {
2898
- jumpTo: function jumpTo(name, params) {
2899
- return {
2900
- type: 'JUMP_TO',
2901
- payload: {
2902
- name: name,
2903
- params: params
2904
- }
2905
- };
2906
- }
2907
- };
2908
- var getRouteHistory = function getRouteHistory(routes, index, backBehavior, initialRouteName) {
2909
- var history = [{
2910
- type: TYPE_ROUTE,
2911
- key: routes[index].key
2912
- }];
2913
- var initialRouteIndex;
2914
- switch (backBehavior) {
2915
- case 'order':
2916
- for (var i = index; i > 0; i--) {
2917
- history.unshift({
2918
- type: TYPE_ROUTE,
2919
- key: routes[i - 1].key
2920
- });
2921
- }
2922
- break;
2923
- case 'firstRoute':
2924
- if (index !== 0) {
2925
- history.unshift({
2926
- type: TYPE_ROUTE,
2927
- key: routes[0].key
2928
- });
2929
- }
2930
- break;
2931
- case 'initialRoute':
2932
- initialRouteIndex = routes.findIndex(function (route) {
2933
- return route.name === initialRouteName;
2934
- });
2935
- initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;
2936
- if (index !== initialRouteIndex) {
2937
- history.unshift({
2938
- type: TYPE_ROUTE,
2939
- key: routes[initialRouteIndex].key
2940
- });
2941
- }
2942
- break;
2943
- case 'history':
2944
- // The history will fill up on navigation
2945
- break;
2946
- }
2947
- return history;
2948
- };
2949
- var changeIndex = function changeIndex(state, index, backBehavior, initialRouteName) {
2950
- var history;
2951
- if (backBehavior === 'history') {
2952
- var currentKey = state.routes[index].key;
2953
- history = state.history.filter(function (it) {
2954
- return it.type === 'route' ? it.key !== currentKey : false;
2955
- }).concat({
2956
- type: TYPE_ROUTE,
2957
- key: currentKey
2958
- });
2959
- } else {
2960
- history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);
2961
- }
2962
- return Object.assign({}, state, {
2963
- index: index,
2964
- history: history
2965
- });
2966
- };
2967
- function TabRouter(_ref) {
2968
- var initialRouteName = _ref.initialRouteName,
2969
- _ref$backBehavior = _ref.backBehavior,
2970
- backBehavior = _ref$backBehavior === undefined ? 'firstRoute' : _ref$backBehavior;
2971
- var router = Object.assign({}, _BaseRouter.default, {
2972
- type: 'tab',
2973
- getInitialState: function getInitialState(_ref2) {
2974
- var routeNames = _ref2.routeNames,
2975
- routeParamList = _ref2.routeParamList;
2976
- var index = initialRouteName !== undefined && routeNames.includes(initialRouteName) ? routeNames.indexOf(initialRouteName) : 0;
2977
- var routes = routeNames.map(function (name) {
2978
- return {
2979
- name: name,
2980
- key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2981
- params: routeParamList[name]
2982
- };
2983
- });
2984
- var history = getRouteHistory(routes, index, backBehavior, initialRouteName);
2985
- return {
2986
- stale: false,
2987
- type: 'tab',
2988
- key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2989
- index: index,
2990
- routeNames: routeNames,
2991
- history: history,
2992
- routes: routes
2993
- };
2994
- },
2995
- getRehydratedState: function getRehydratedState(partialState, _ref3) {
2996
- var _state$routes, _state$index, _state$history$filter, _state$history;
2997
- var routeNames = _ref3.routeNames,
2998
- routeParamList = _ref3.routeParamList;
2999
- var state = partialState;
3000
- if (state.stale === false) {
3001
- return state;
3002
- }
3003
- var routes = routeNames.map(function (name) {
3004
- var route = state.routes.find(function (r) {
3005
- return r.name === name;
3006
- });
3007
- return Object.assign({}, route, {
3008
- name: name,
3009
- key: route && route.name === name && route.key ? route.key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
3010
- params: routeParamList[name] !== undefined ? Object.assign({}, routeParamList[name], route ? route.params : undefined) : route ? route.params : undefined
3011
- });
3012
- });
3013
- var index = Math.min(Math.max(routeNames.indexOf((_state$routes = state.routes[(_state$index = state == null ? undefined : state.index) != null ? _state$index : 0]) == null ? undefined : _state$routes.name), 0), routes.length - 1);
3014
- var history = (_state$history$filter = (_state$history = state.history) == null ? undefined : _state$history.filter(function (it) {
3015
- return routes.find(function (r) {
3016
- return r.key === it.key;
3017
- });
3018
- })) != null ? _state$history$filter : [];
3019
- return changeIndex({
3020
- stale: false,
3021
- type: 'tab',
3022
- key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
3023
- index: index,
3024
- routeNames: routeNames,
3025
- history: history,
3026
- routes: routes
3027
- }, index, backBehavior, initialRouteName);
3028
- },
3029
- getStateForRouteNamesChange: function getStateForRouteNamesChange(state, _ref4) {
3030
- var routeNames = _ref4.routeNames,
3031
- routeParamList = _ref4.routeParamList,
3032
- routeKeyChanges = _ref4.routeKeyChanges;
3033
- var routes = routeNames.map(function (name) {
3034
- return state.routes.find(function (r) {
3035
- return r.name === name && !routeKeyChanges.includes(r.name);
3036
- }) || {
3037
- name: name,
3038
- key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
3039
- params: routeParamList[name]
3040
- };
3041
- });
3042
- var index = Math.max(0, routeNames.indexOf(state.routes[state.index].name));
3043
- var history = state.history.filter(
3044
- // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)
3045
- function (it) {
3046
- return it.type !== 'route' || routes.find(function (r) {
3047
- return r.key === it.key;
3048
- });
3049
- });
3050
- if (!history.length) {
3051
- history = getRouteHistory(routes, index, backBehavior, initialRouteName);
3052
- }
3053
- return Object.assign({}, state, {
3054
- history: history,
3055
- routeNames: routeNames,
3056
- routes: routes,
3057
- index: index
3058
- });
3059
- },
3060
- getStateForRouteFocus: function getStateForRouteFocus(state, key) {
3061
- var index = state.routes.findIndex(function (r) {
3062
- return r.key === key;
3063
- });
3064
- if (index === -1 || index === state.index) {
3065
- return state;
3066
- }
3067
- return changeIndex(state, index, backBehavior, initialRouteName);
3068
- },
3069
- getStateForAction: function getStateForAction(state, action, _ref5) {
3070
- var routeParamList = _ref5.routeParamList,
3071
- routeGetIdList = _ref5.routeGetIdList;
3072
- switch (action.type) {
3073
- case 'JUMP_TO':
3074
- case 'NAVIGATE':
3075
- {
3076
- var index = -1;
3077
- if (action.type === 'NAVIGATE' && action.payload.key) {
3078
- index = state.routes.findIndex(function (route) {
3079
- return route.key === action.payload.key;
3080
- });
3081
- } else {
3082
- index = state.routes.findIndex(function (route) {
3083
- return route.name === action.payload.name;
3084
- });
3085
- }
3086
- if (index === -1) {
3087
- return null;
3088
- }
3089
- return changeIndex(Object.assign({}, state, {
3090
- routes: state.routes.map(function (route, i) {
3091
- if (i !== index) {
3092
- return route;
3093
- }
3094
- var getId = routeGetIdList[route.name];
3095
- var currentId = getId == null ? undefined : getId({
3096
- params: route.params
3097
- });
3098
- var nextId = getId == null ? undefined : getId({
3099
- params: action.payload.params
3100
- });
3101
- var key = currentId === nextId ? route.key : `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`;
3102
- var params;
3103
- if (action.type === 'NAVIGATE' && action.payload.merge && currentId === nextId) {
3104
- params = action.payload.params !== undefined || routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], route.params, action.payload.params) : route.params;
3105
- } else {
3106
- params = routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], action.payload.params) : action.payload.params;
3107
- }
3108
- var path = action.type === 'NAVIGATE' && action.payload.path != null ? action.payload.path : route.path;
3109
- return params !== route.params || path !== route.path ? Object.assign({}, route, {
3110
- key: key,
3111
- path: path,
3112
- params: params
3113
- }) : route;
3114
- })
3115
- }), index, backBehavior, initialRouteName);
3116
- }
3117
- case 'GO_BACK':
3118
- {
3119
- if (state.history.length === 1) {
3120
- return null;
3121
- }
3122
- var previousKey = state.history[state.history.length - 2].key;
3123
- var _index = state.routes.findIndex(function (route) {
3124
- return route.key === previousKey;
3125
- });
3126
- if (_index === -1) {
3127
- return null;
3128
- }
3129
- return Object.assign({}, state, {
3130
- history: state.history.slice(0, -1),
3131
- index: _index
3132
- });
3133
- }
3134
- default:
3135
- return _BaseRouter.default.getStateForAction(state, action);
3136
- }
3137
- },
3138
- shouldActionChangeFocus: function shouldActionChangeFocus(action) {
3139
- return action.type === 'NAVIGATE';
3140
- },
3141
- actionCreators: TabActions
3142
- });
3143
- return router;
3144
- }
3145
- },"b409790239ad0cd46252",["e13c8413f9a5de8e772f","cc50ab09498b013d1d6d","e03db9aacb1ee503cd26"]);
3146
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
3147
- Object.defineProperty(exports, "__esModule", {
3148
- value: true
3149
- });
3150
- exports.StackActions = undefined;
3151
- exports.default = StackRouter;
3152
- var _toConsumableArray2 = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
3153
- var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[2]));
3154
- var StackActions = exports.StackActions = {
3155
- replace: function replace(name, params) {
3156
- return {
3157
- type: 'REPLACE',
3158
- payload: {
3159
- name: name,
3160
- params: params
3161
- }
3162
- };
3163
- },
3164
- push: function push(name, params) {
3165
- return {
3166
- type: 'PUSH',
3167
- payload: {
3168
- name: name,
3169
- params: params
3170
- }
3171
- };
3172
- },
3173
- pop: function pop() {
3174
- var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
3175
- return {
3176
- type: 'POP',
3177
- payload: {
3178
- count: count
3179
- }
3180
- };
3181
- },
3182
- popToTop: function popToTop() {
3183
- return {
3184
- type: 'POP_TO_TOP'
3185
- };
3186
- }
3187
- };
3188
- function StackRouter(options) {
3189
- var router = Object.assign({}, _BaseRouter.default, {
3190
- type: 'stack',
3191
- getInitialState: function getInitialState(_ref) {
3192
- var routeNames = _ref.routeNames,
3193
- routeParamList = _ref.routeParamList;
3194
- var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
3195
- return {
3196
- stale: false,
3197
- type: 'stack',
3198
- key: `stack-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
3199
- index: 0,
3200
- routeNames: routeNames,
3201
- routes: [{
3202
- key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
3203
- name: initialRouteName,
3204
- params: routeParamList[initialRouteName]
3205
- }]
3206
- };
3207
- },
3208
- getRehydratedState: function getRehydratedState(partialState, _ref2) {
3209
- var routeNames = _ref2.routeNames,
3210
- routeParamList = _ref2.routeParamList;
3211
- var state = partialState;
3212
- if (state.stale === false) {
3213
- return state;
3214
- }
3215
- var routes = state.routes.filter(function (route) {
3216
- return routeNames.includes(route.name);
3217
- }).map(function (route) {
3218
- return Object.assign({}, route, {
3219
- key: route.key || `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
3220
- params: routeParamList[route.name] !== undefined ? Object.assign({}, routeParamList[route.name], route.params) : route.params
3221
- });
3222
- });
3223
- if (routes.length === 0) {
3224
- var initialRouteName = options.initialRouteName !== undefined ? options.initialRouteName : routeNames[0];
3225
- routes.push({
3226
- key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
3227
- name: initialRouteName,
3228
- params: routeParamList[initialRouteName]
3229
- });
3230
- }
3231
- return {
3232
- stale: false,
3233
- type: 'stack',
3234
- key: `stack-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
3235
- index: routes.length - 1,
3236
- routeNames: routeNames,
3237
- routes: routes
3238
- };
3239
- },
3240
- getStateForRouteNamesChange: function getStateForRouteNamesChange(state, _ref3) {
3241
- var routeNames = _ref3.routeNames,
3242
- routeParamList = _ref3.routeParamList,
3243
- routeKeyChanges = _ref3.routeKeyChanges;
3244
- var routes = state.routes.filter(function (route) {
3245
- return routeNames.includes(route.name) && !routeKeyChanges.includes(route.name);
3246
- });
3247
- if (routes.length === 0) {
3248
- var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
3249
- routes.push({
3250
- key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
3251
- name: initialRouteName,
3252
- params: routeParamList[initialRouteName]
3253
- });
3254
- }
3255
- return Object.assign({}, state, {
3256
- routeNames: routeNames,
3257
- routes: routes,
3258
- index: Math.min(state.index, routes.length - 1)
3259
- });
3260
- },
3261
- getStateForRouteFocus: function getStateForRouteFocus(state, key) {
3262
- var index = state.routes.findIndex(function (r) {
3263
- return r.key === key;
3264
- });
3265
- if (index === -1 || index === state.index) {
3266
- return state;
3267
- }
3268
- return Object.assign({}, state, {
3269
- index: index,
3270
- routes: state.routes.slice(0, index + 1)
3271
- });
3272
- },
3273
- getStateForAction: function getStateForAction(state, action, options) {
3274
- var routeParamList = options.routeParamList;
3275
- switch (action.type) {
3276
- case 'REPLACE':
3277
- {
3278
- var index = action.target === state.key && action.source ? state.routes.findIndex(function (r) {
3279
- return r.key === action.source;
3280
- }) : state.index;
3281
- if (index === -1) {
3282
- return null;
3283
- }
3284
- var _action$payload = action.payload,
3285
- name = _action$payload.name,
3286
- key = _action$payload.key,
3287
- params = _action$payload.params;
3288
- if (!state.routeNames.includes(name)) {
3289
- return null;
3290
- }
3291
- return Object.assign({}, state, {
3292
- routes: state.routes.map(function (route, i) {
3293
- return i === index ? {
3294
- key: key !== undefined ? key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
3295
- name: name,
3296
- params: routeParamList[name] !== undefined ? Object.assign({}, routeParamList[name], params) : params
3297
- } : route;
3298
- })
3299
- });
3300
- }
3301
- case 'PUSH':
3302
- if (state.routeNames.includes(action.payload.name)) {
3303
- var getId = options.routeGetIdList[action.payload.name];
3304
- var id = getId == null ? undefined : getId({
3305
- params: action.payload.params
3306
- });
3307
- var route = id ? state.routes.find(function (route) {
3308
- return route.name === action.payload.name && id === (getId == null ? undefined : getId({
3309
- params: route.params
3310
- }));
3311
- }) : undefined;
3312
- var routes;
3313
- if (route) {
3314
- routes = state.routes.filter(function (r) {
3315
- return r.key !== route.key;
3316
- });
3317
- routes.push(Object.assign({}, route, {
3318
- params: routeParamList[action.payload.name] !== undefined ? Object.assign({}, routeParamList[action.payload.name], action.payload.params) : action.payload.params
3319
- }));
3320
- } else {
3321
- routes = [].concat((0, _toConsumableArray2.default)(state.routes), [{
3322
- key: `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
3323
- name: action.payload.name,
3324
- params: routeParamList[action.payload.name] !== undefined ? Object.assign({}, routeParamList[action.payload.name], action.payload.params) : action.payload.params
3325
- }]);
3326
- }
3327
- return Object.assign({}, state, {
3328
- index: routes.length - 1,
3329
- routes: routes
3330
- });
3331
- }
3332
- return null;
3333
- case 'POP':
3334
- {
3335
- var _index = action.target === state.key && action.source ? state.routes.findIndex(function (r) {
3336
- return r.key === action.source;
3337
- }) : state.index;
3338
- if (_index > 0) {
3339
- var _count = Math.max(_index - action.payload.count + 1, 1);
3340
- var _routes = state.routes.slice(0, _count).concat(state.routes.slice(_index + 1));
3341
- return Object.assign({}, state, {
3342
- index: _routes.length - 1,
3343
- routes: _routes
3344
- });
3345
- }
3346
- return null;
3347
- }
3348
- case 'POP_TO_TOP':
3349
- return router.getStateForAction(state, {
3350
- type: 'POP',
3351
- payload: {
3352
- count: state.routes.length - 1
3353
- }
3354
- }, options);
3355
- case 'NAVIGATE':
3356
- if (action.payload.name !== undefined && !state.routeNames.includes(action.payload.name)) {
3357
- return null;
3358
- }
3359
- if (action.payload.key || action.payload.name) {
3360
- var _action$payload$path;
3361
- // If the route already exists, navigate to that
3362
- var _index2 = -1;
3363
- var _getId =
3364
- // `getId` and `key` can't be used together
3365
- action.payload.key === undefined && action.payload.name !== undefined ? options.routeGetIdList[action.payload.name] : undefined;
3366
- var _id = _getId == null ? undefined : _getId({
3367
- params: action.payload.params
3368
- });
3369
- if (_id) {
3370
- _index2 = state.routes.findIndex(function (route) {
3371
- return route.name === action.payload.name && _id === (_getId == null ? undefined : _getId({
3372
- params: route.params
3373
- }));
3374
- });
3375
- } else if (state.routes[state.index].name === action.payload.name && action.payload.key === undefined || state.routes[state.index].key === action.payload.key) {
3376
- _index2 = state.index;
3377
- } else {
3378
- for (var i = state.routes.length - 1; i >= 0; i--) {
3379
- if (state.routes[i].name === action.payload.name && action.payload.key === undefined || state.routes[i].key === action.payload.key) {
3380
- _index2 = i;
3381
- break;
3382
- }
3383
- }
3384
- }
3385
- if (_index2 === -1 && action.payload.key && action.payload.name === undefined) {
3386
- return null;
3387
- }
3388
- if (_index2 === -1 && action.payload.name !== undefined) {
3389
- var _action$payload$key;
3390
- var _routes2 = [].concat((0, _toConsumableArray2.default)(state.routes), [{
3391
- key: (_action$payload$key = action.payload.key) != null ? _action$payload$key : `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[3]).nanoid)()}`,
3392
- name: action.payload.name,
3393
- path: action.payload.path,
3394
- params: routeParamList[action.payload.name] !== undefined ? Object.assign({}, routeParamList[action.payload.name], action.payload.params) : action.payload.params
3395
- }]);
3396
- return Object.assign({}, state, {
3397
- routes: _routes2,
3398
- index: _routes2.length - 1
3399
- });
3400
- }
3401
- var _route = state.routes[_index2];
3402
- var _params;
3403
- if (action.payload.merge) {
3404
- _params = action.payload.params !== undefined || routeParamList[_route.name] !== undefined ? Object.assign({}, routeParamList[_route.name], _route.params, action.payload.params) : _route.params;
3405
- } else {
3406
- _params = routeParamList[_route.name] !== undefined ? Object.assign({}, routeParamList[_route.name], action.payload.params) : action.payload.params;
3407
- }
3408
- return Object.assign({}, state, {
3409
- index: _index2,
3410
- routes: [].concat((0, _toConsumableArray2.default)(state.routes.slice(0, _index2)), [_params !== _route.params || action.payload.path && action.payload.path !== _route.path ? Object.assign({}, _route, {
3411
- path: (_action$payload$path = action.payload.path) != null ? _action$payload$path : _route.path,
3412
- params: _params
3413
- }) : state.routes[_index2]])
3414
- });
3415
- }
3416
- return null;
3417
- case 'GO_BACK':
3418
- if (state.index > 0) {
3419
- return router.getStateForAction(state, {
3420
- type: 'POP',
3421
- payload: {
3422
- count: 1
3423
- },
3424
- target: action.target,
3425
- source: action.source
3426
- }, options);
3427
- }
3428
- return null;
3429
- default:
3430
- return _BaseRouter.default.getStateForAction(state, action);
3431
- }
3432
- },
3433
- actionCreators: StackActions
3434
- });
3435
- return router;
3436
- }
3437
- },"b83a4992ae2366e63a19",["e13c8413f9a5de8e772f","c8d9faa50529497e8550","cc50ab09498b013d1d6d","e03db9aacb1ee503cd26"]);
3438
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
3439
- Object.defineProperty(exports, "__esModule", {
3440
- value: true
3441
- });
3442
- var _exportNames = {
3443
- CommonActions: true,
3444
- BaseRouter: true,
3445
- DrawerActions: true,
3446
- DrawerRouter: true,
3447
- StackActions: true,
3448
- StackRouter: true,
3449
- TabActions: true,
3450
- TabRouter: true
3451
- };
3452
- Object.defineProperty(exports, "BaseRouter", {
3453
- enumerable: true,
3454
- get: function get() {
3455
- return _BaseRouter.default;
3456
- }
3457
- });
3458
- exports.CommonActions = undefined;
3459
- Object.defineProperty(exports, "DrawerActions", {
3460
- enumerable: true,
3461
- get: function get() {
3462
- return _DrawerRouter.DrawerActions;
3463
- }
3464
- });
3465
- Object.defineProperty(exports, "DrawerRouter", {
3466
- enumerable: true,
3467
- get: function get() {
3468
- return _DrawerRouter.default;
3469
- }
3470
- });
3471
- Object.defineProperty(exports, "StackActions", {
3472
- enumerable: true,
3473
- get: function get() {
3474
- return _StackRouter.StackActions;
3475
- }
3476
- });
3477
- Object.defineProperty(exports, "StackRouter", {
3478
- enumerable: true,
3479
- get: function get() {
3480
- return _StackRouter.default;
3481
- }
3482
- });
3483
- Object.defineProperty(exports, "TabActions", {
3484
- enumerable: true,
3485
- get: function get() {
3486
- return _TabRouter.TabActions;
3487
- }
3488
- });
3489
- Object.defineProperty(exports, "TabRouter", {
3490
- enumerable: true,
3491
- get: function get() {
3492
- return _TabRouter.default;
3493
- }
3494
- });
3495
- var CommonActions = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
3496
- exports.CommonActions = CommonActions;
3497
- var _BaseRouter = _$$_REQUIRE(_dependencyMap[1])(_$$_REQUIRE(_dependencyMap[2]));
3498
- var _DrawerRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[3]));
3499
- var _StackRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[4]));
3500
- var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[5]));
3501
- Object.keys(_$$_REQUIRE(_dependencyMap[6])).forEach(function (key) {
3502
- if (key === "default" || key === "__esModule") return;
3503
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
3504
- if (key in exports && exports[key] === _$$_REQUIRE(_dependencyMap[6])[key]) return;
3505
- Object.defineProperty(exports, key, {
3506
- enumerable: true,
3507
- get: function get() {
3508
- return _$$_REQUIRE(_dependencyMap[6])[key];
3509
- }
3510
- });
3511
- });
3512
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
3513
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
3514
- },"683d3e0e1152b4734793",["000944072e226c3923ad","e13c8413f9a5de8e772f","cc50ab09498b013d1d6d","a84ba97c7150cdcf5967","b83a4992ae2366e63a19","b409790239ad0cd46252","2ad167c587979ba4fdb7"]);
3515
- __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {},"2ad167c587979ba4fdb7",[]);