@amazon-devices/react-navigation__routers 7.0.9000000000 → 7.0.9000000001

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.
@@ -0,0 +1,2831 @@
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
+ global._majorVersionToNoVersionIdMap["16c6a0ad28ddd6ff83ec"] = "6cc26ebe1139d52af4d3";
4
+ global._majorVersionToNoVersionIdMap["4e814a93075c75141026"] = "c258e5bc01f444b02a2f";
5
+ global._majorVersionToNoVersionIdMap["6224880bf3a3483be0e5"] = "6b0bd1c9ea67b0b3e2ed";
6
+ global._majorVersionToNoVersionIdMap["fbd71b33b1fab08b6b66"] = "52f387a967cfde3b7e3d";
7
+ global._majorVersionToNoVersionIdMap["536b900fdd2382601bd3"] = "98f134d6d6fb1a1eb176";
8
+ global._majorVersionToNoVersionIdMap["c822e55e1302f6e881d8"] = "78e64f8354d943d7e210";
9
+ global._majorVersionToNoVersionIdMap["a0b9da8c3bf2cee70b92"] = "5fb9294c2ccbbc11804d";
10
+ global._majorVersionToNoVersionIdMap["76321e829a38224d0f30"] = "b71011de8b8a3cb15ab4";
11
+ global._majorVersionToNoVersionIdMap["b02ddfcf5d1b27936f8d"] = "32fd789b2b4e67ba3679";
12
+ global._majorVersionToNoVersionIdMap["6bfbc90eac4c2d2e67a4"] = "0060dd931905de8947f2";
13
+ global._majorVersionToNoVersionIdMap["36b338faa6c2364d674f"] = "2b770725127b9776e940";
14
+ global._majorVersionToNoVersionIdMap["1d666e2a5547a2fa33f1"] = "b4b91107e9e069bf6a04";
15
+ global._majorVersionToNoVersionIdMap["88d6ccdfe66b5db63cff"] = "dec21c689e6604dbbf6a";
16
+ global._majorVersionToNoVersionIdMap["e045dec1c8244fccaf7b"] = "38a8cc556e14fd685890";
17
+ global._majorVersionToNoVersionIdMap["12c309785643d3823400"] = "2bee182fbe6f2aca641e";
18
+ global._majorVersionToNoVersionIdMap["4b0b0231e9a50ac8651a"] = "6770b45f91f2db97b2e2";
19
+ global._majorVersionToNoVersionIdMap["cc50ab09498b013d1d6d"] = "46404a6d49463f9601d3";
20
+ global._majorVersionToNoVersionIdMap["000944072e226c3923ad"] = "cbb4d666ebd7ab852aa3";
21
+ global._majorVersionToNoVersionIdMap["a84ba97c7150cdcf5967"] = "06a5a1d28ce3fd05c417";
22
+ global._majorVersionToNoVersionIdMap["b83a4992ae2366e63a19"] = "fb17719fd282a08dfde9";
23
+ global._majorVersionToNoVersionIdMap["b409790239ad0cd46252"] = "8b1e20a6232a353c9981";
24
+ global._majorVersionToNoVersionIdMap["683d3e0e1152b4734793"] = "39eca4bd16c398373cc4";
25
+ global._majorVersionToNoVersionIdMap["2ad167c587979ba4fdb7"] = "347ca45e3641dd48caa1";
26
+ })(typeof globalThis !== 'undefined' ? globalThis : typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this);
27
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
28
+ "use strict";
29
+
30
+ Object.defineProperty(exports, "__esModule", {
31
+ value: true
32
+ });
33
+ exports.default = undefined;
34
+ /**
35
+ * Base router object that can be used when writing custom routers.
36
+ * This provides few helper methods to handle common actions such as `RESET`.
37
+ */
38
+ var BaseRouter = {
39
+ getStateForAction(state, action) {
40
+ switch (action.type) {
41
+ case 'SET_PARAMS':
42
+ {
43
+ var index = action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
44
+ if (index === -1) {
45
+ return null;
46
+ }
47
+ return {
48
+ ...state,
49
+ routes: state.routes.map((r, i) => i === index ? {
50
+ ...r,
51
+ params: {
52
+ ...r.params,
53
+ ...action.payload.params
54
+ }
55
+ } : r)
56
+ };
57
+ }
58
+ case 'RESET':
59
+ {
60
+ var nextState = action.payload;
61
+ if (nextState.routes.length === 0 || nextState.routes.some(route => !state.routeNames.includes(route.name))) {
62
+ return null;
63
+ }
64
+ if (nextState.stale === false) {
65
+ if (state.routeNames.length !== nextState.routeNames.length || nextState.routeNames.some(name => !state.routeNames.includes(name))) {
66
+ return null;
67
+ }
68
+ return {
69
+ ...nextState,
70
+ routes: nextState.routes.map(route => route.key ? route : {
71
+ ...route,
72
+ key: `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[0]).nanoid)()}`
73
+ })
74
+ };
75
+ }
76
+ return nextState;
77
+ }
78
+ default:
79
+ return null;
80
+ }
81
+ },
82
+ shouldActionChangeFocus(action) {
83
+ return action.type === 'NAVIGATE';
84
+ }
85
+ };
86
+ var _default = exports.default = BaseRouter;
87
+ },"4e814a93075c75141026",["e03db9aacb1ee503cd26"]);
88
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
89
+ Object.defineProperty(exports, "__esModule", {
90
+ value: true
91
+ });
92
+ exports.nanoid = exports.customAlphabet = undefined;
93
+ // This alphabet uses `A-Za-z0-9_-` symbols. The genetic algorithm helped
94
+ // optimize the gzip compression for this alphabet.
95
+ var urlAlphabet = 'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW';
96
+ var customAlphabet = (alphabet, size) => {
97
+ return () => {
98
+ var id = '';
99
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
100
+ var i = size;
101
+ while (i--) {
102
+ // `| 0` is more compact and faster than `Math.floor()`.
103
+ id += alphabet[Math.random() * alphabet.length | 0];
104
+ }
105
+ return id;
106
+ };
107
+ };
108
+ exports.customAlphabet = customAlphabet;
109
+ var nanoid = (size = 21) => {
110
+ var id = '';
111
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
112
+ var i = size;
113
+ while (i--) {
114
+ // `| 0` is more compact and faster than `Math.floor()`.
115
+ id += urlAlphabet[Math.random() * 64 | 0];
116
+ }
117
+ return id;
118
+ };
119
+ exports.nanoid = nanoid;
120
+ },"e03db9aacb1ee503cd26",[]);
121
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
122
+ "use strict";
123
+
124
+ Object.defineProperty(exports, "__esModule", {
125
+ value: true
126
+ });
127
+ exports.goBack = goBack;
128
+ exports.navigate = navigate;
129
+ exports.reset = reset;
130
+ exports.setParams = setParams;
131
+ function goBack() {
132
+ return {
133
+ type: 'GO_BACK'
134
+ };
135
+ }
136
+
137
+ // eslint-disable-next-line no-redeclare
138
+
139
+ // eslint-disable-next-line no-redeclare
140
+ function navigate(...args) {
141
+ if (typeof args[0] === 'string') {
142
+ return {
143
+ type: 'NAVIGATE',
144
+ payload: {
145
+ name: args[0],
146
+ params: args[1]
147
+ }
148
+ };
149
+ } else {
150
+ var payload = args[0] || {};
151
+ if (!payload.hasOwnProperty('key') && !payload.hasOwnProperty('name')) {
152
+ 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.');
153
+ }
154
+ return {
155
+ type: 'NAVIGATE',
156
+ payload
157
+ };
158
+ }
159
+ }
160
+ function reset(state) {
161
+ return {
162
+ type: 'RESET',
163
+ payload: state
164
+ };
165
+ }
166
+ function setParams(params) {
167
+ return {
168
+ type: 'SET_PARAMS',
169
+ payload: {
170
+ params
171
+ }
172
+ };
173
+ }
174
+ },"6224880bf3a3483be0e5",[]);
175
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
176
+ "use strict";
177
+
178
+ Object.defineProperty(exports, "__esModule", {
179
+ value: true
180
+ });
181
+ exports.DrawerActions = undefined;
182
+ exports.default = DrawerRouter;
183
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
184
+ function _getRequireWildcardCache(e) {
185
+ if ("function" != typeof WeakMap) return null;
186
+ var r = new WeakMap(),
187
+ t = new WeakMap();
188
+ return (_getRequireWildcardCache = function (e) {
189
+ return e ? t : r;
190
+ })(e);
191
+ }
192
+ function _interopRequireWildcard(e, r) {
193
+ if (!r && e && e.__esModule) return e;
194
+ if (null === e || "object" != typeof e && "function" != typeof e) return {
195
+ default: e
196
+ };
197
+ var t = _getRequireWildcardCache(r);
198
+ if (t && t.has(e)) return t.get(e);
199
+ var n = {
200
+ __proto__: null
201
+ },
202
+ a = Object.defineProperty && Object.getOwnPropertyDescriptor;
203
+ for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
204
+ var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
205
+ i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
206
+ }
207
+ return n.default = e, t && t.set(e, n), n;
208
+ }
209
+ var DrawerActions = exports.DrawerActions = {
210
+ ..._TabRouter.TabActions,
211
+ openDrawer() {
212
+ return {
213
+ type: 'OPEN_DRAWER'
214
+ };
215
+ },
216
+ closeDrawer() {
217
+ return {
218
+ type: 'CLOSE_DRAWER'
219
+ };
220
+ },
221
+ toggleDrawer() {
222
+ return {
223
+ type: 'TOGGLE_DRAWER'
224
+ };
225
+ }
226
+ };
227
+ function DrawerRouter({
228
+ defaultStatus = 'closed',
229
+ ...rest
230
+ }) {
231
+ var router = (0, _TabRouter.default)(rest);
232
+ var isDrawerInHistory = state => {
233
+ var _state$history;
234
+ return Boolean((_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.some(it => it.type === 'drawer'));
235
+ };
236
+ var addDrawerToHistory = state => {
237
+ if (isDrawerInHistory(state)) {
238
+ return state;
239
+ }
240
+ return {
241
+ ...state,
242
+ history: [...state.history, {
243
+ type: 'drawer',
244
+ status: defaultStatus === 'open' ? 'closed' : 'open'
245
+ }]
246
+ };
247
+ };
248
+ var removeDrawerFromHistory = state => {
249
+ if (!isDrawerInHistory(state)) {
250
+ return state;
251
+ }
252
+ return {
253
+ ...state,
254
+ history: state.history.filter(it => it.type !== 'drawer')
255
+ };
256
+ };
257
+ var openDrawer = state => {
258
+ if (defaultStatus === 'open') {
259
+ return removeDrawerFromHistory(state);
260
+ }
261
+ return addDrawerToHistory(state);
262
+ };
263
+ var closeDrawer = state => {
264
+ if (defaultStatus === 'open') {
265
+ return addDrawerToHistory(state);
266
+ }
267
+ return removeDrawerFromHistory(state);
268
+ };
269
+ return {
270
+ ...router,
271
+ type: 'drawer',
272
+ getInitialState({
273
+ routeNames,
274
+ routeParamList,
275
+ routeGetIdList
276
+ }) {
277
+ var state = router.getInitialState({
278
+ routeNames,
279
+ routeParamList,
280
+ routeGetIdList
281
+ });
282
+ return {
283
+ ...state,
284
+ default: defaultStatus,
285
+ stale: false,
286
+ type: 'drawer',
287
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
288
+ };
289
+ },
290
+ getRehydratedState(partialState, {
291
+ routeNames,
292
+ routeParamList,
293
+ routeGetIdList
294
+ }) {
295
+ if (partialState.stale === false) {
296
+ return partialState;
297
+ }
298
+ var state = router.getRehydratedState(partialState, {
299
+ routeNames,
300
+ routeParamList,
301
+ routeGetIdList
302
+ });
303
+ if (isDrawerInHistory(partialState)) {
304
+ // Re-sync the drawer entry in history to correct it if it was wrong
305
+ state = removeDrawerFromHistory(state);
306
+ state = addDrawerToHistory(state);
307
+ }
308
+ return {
309
+ ...state,
310
+ default: defaultStatus,
311
+ type: 'drawer',
312
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
313
+ };
314
+ },
315
+ getStateForRouteFocus(state, key) {
316
+ var result = router.getStateForRouteFocus(state, key);
317
+ return closeDrawer(result);
318
+ },
319
+ getStateForAction(state, action, options) {
320
+ switch (action.type) {
321
+ case 'OPEN_DRAWER':
322
+ return openDrawer(state);
323
+ case 'CLOSE_DRAWER':
324
+ return closeDrawer(state);
325
+ case 'TOGGLE_DRAWER':
326
+ if (isDrawerInHistory(state)) {
327
+ return removeDrawerFromHistory(state);
328
+ }
329
+ return addDrawerToHistory(state);
330
+ case 'JUMP_TO':
331
+ case 'NAVIGATE':
332
+ {
333
+ var result = router.getStateForAction(state, action, options);
334
+ if (result != null && result.index !== state.index) {
335
+ return closeDrawer(result);
336
+ }
337
+ return result;
338
+ }
339
+ case 'GO_BACK':
340
+ if (isDrawerInHistory(state)) {
341
+ return removeDrawerFromHistory(state);
342
+ }
343
+ return router.getStateForAction(state, action, options);
344
+ default:
345
+ return router.getStateForAction(state, action, options);
346
+ }
347
+ },
348
+ actionCreators: DrawerActions
349
+ };
350
+ }
351
+ },"fbd71b33b1fab08b6b66",["c822e55e1302f6e881d8","e03db9aacb1ee503cd26"]);
352
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
353
+ "use strict";
354
+
355
+ Object.defineProperty(exports, "__esModule", {
356
+ value: true
357
+ });
358
+ exports.TabActions = undefined;
359
+ exports.default = TabRouter;
360
+ var _BaseRouter = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[0]));
361
+ function _interopRequireDefault(e) {
362
+ return e && e.__esModule ? e : {
363
+ default: e
364
+ };
365
+ }
366
+ var TYPE_ROUTE = 'route';
367
+ var TabActions = exports.TabActions = {
368
+ jumpTo(name, params) {
369
+ return {
370
+ type: 'JUMP_TO',
371
+ payload: {
372
+ name,
373
+ params
374
+ }
375
+ };
376
+ }
377
+ };
378
+ var getRouteHistory = (routes, index, backBehavior, initialRouteName) => {
379
+ var history = [{
380
+ type: TYPE_ROUTE,
381
+ key: routes[index].key
382
+ }];
383
+ var initialRouteIndex;
384
+ switch (backBehavior) {
385
+ case 'order':
386
+ for (var i = index; i > 0; i--) {
387
+ history.unshift({
388
+ type: TYPE_ROUTE,
389
+ key: routes[i - 1].key
390
+ });
391
+ }
392
+ break;
393
+ case 'firstRoute':
394
+ if (index !== 0) {
395
+ history.unshift({
396
+ type: TYPE_ROUTE,
397
+ key: routes[0].key
398
+ });
399
+ }
400
+ break;
401
+ case 'initialRoute':
402
+ initialRouteIndex = routes.findIndex(route => route.name === initialRouteName);
403
+ initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;
404
+ if (index !== initialRouteIndex) {
405
+ history.unshift({
406
+ type: TYPE_ROUTE,
407
+ key: routes[initialRouteIndex].key
408
+ });
409
+ }
410
+ break;
411
+ case 'history':
412
+ // The history will fill up on navigation
413
+ break;
414
+ }
415
+ return history;
416
+ };
417
+ var changeIndex = (state, index, backBehavior, initialRouteName) => {
418
+ var history;
419
+ if (backBehavior === 'history') {
420
+ var currentKey = state.routes[index].key;
421
+ history = state.history.filter(it => it.type === 'route' ? it.key !== currentKey : false).concat({
422
+ type: TYPE_ROUTE,
423
+ key: currentKey
424
+ });
425
+ } else {
426
+ history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);
427
+ }
428
+ return {
429
+ ...state,
430
+ index,
431
+ history
432
+ };
433
+ };
434
+ function TabRouter({
435
+ initialRouteName,
436
+ backBehavior = 'firstRoute'
437
+ }) {
438
+ var router = {
439
+ ..._BaseRouter.default,
440
+ type: 'tab',
441
+ getInitialState({
442
+ routeNames,
443
+ routeParamList
444
+ }) {
445
+ var index = initialRouteName !== undefined && routeNames.includes(initialRouteName) ? routeNames.indexOf(initialRouteName) : 0;
446
+ var routes = routeNames.map(name => ({
447
+ name,
448
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
449
+ params: routeParamList[name]
450
+ }));
451
+ var history = getRouteHistory(routes, index, backBehavior, initialRouteName);
452
+ return {
453
+ stale: false,
454
+ type: 'tab',
455
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
456
+ index,
457
+ routeNames,
458
+ history,
459
+ routes
460
+ };
461
+ },
462
+ getRehydratedState(partialState, {
463
+ routeNames,
464
+ routeParamList
465
+ }) {
466
+ var _state$routes, _state$history;
467
+ var state = partialState;
468
+ if (state.stale === false) {
469
+ return state;
470
+ }
471
+ var routes = routeNames.map(name => {
472
+ var route = state.routes.find(r => r.name === name);
473
+ return {
474
+ ...route,
475
+ name,
476
+ key: route && route.name === name && route.key ? route.key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
477
+ params: routeParamList[name] !== undefined ? {
478
+ ...routeParamList[name],
479
+ ...(route ? route.params : undefined)
480
+ } : route ? route.params : undefined
481
+ };
482
+ });
483
+ var index = Math.min(Math.max(routeNames.indexOf((_state$routes = state.routes[(state === null || state === undefined ? undefined : state.index) ?? 0]) === null || _state$routes === undefined ? undefined : _state$routes.name), 0), routes.length - 1);
484
+ var history = ((_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.filter(it => routes.find(r => r.key === it.key))) ?? [];
485
+ return changeIndex({
486
+ stale: false,
487
+ type: 'tab',
488
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
489
+ index,
490
+ routeNames,
491
+ history,
492
+ routes
493
+ }, index, backBehavior, initialRouteName);
494
+ },
495
+ getStateForRouteNamesChange(state, {
496
+ routeNames,
497
+ routeParamList,
498
+ routeKeyChanges
499
+ }) {
500
+ var routes = routeNames.map(name => state.routes.find(r => r.name === name && !routeKeyChanges.includes(r.name)) || {
501
+ name,
502
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
503
+ params: routeParamList[name]
504
+ });
505
+ var index = Math.max(0, routeNames.indexOf(state.routes[state.index].name));
506
+ var history = state.history.filter(
507
+ // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)
508
+ it => it.type !== 'route' || routes.find(r => r.key === it.key));
509
+ if (!history.length) {
510
+ history = getRouteHistory(routes, index, backBehavior, initialRouteName);
511
+ }
512
+ return {
513
+ ...state,
514
+ history,
515
+ routeNames,
516
+ routes,
517
+ index
518
+ };
519
+ },
520
+ getStateForRouteFocus(state, key) {
521
+ var index = state.routes.findIndex(r => r.key === key);
522
+ if (index === -1 || index === state.index) {
523
+ return state;
524
+ }
525
+ return changeIndex(state, index, backBehavior, initialRouteName);
526
+ },
527
+ getStateForAction(state, action, {
528
+ routeParamList,
529
+ routeGetIdList
530
+ }) {
531
+ switch (action.type) {
532
+ case 'JUMP_TO':
533
+ case 'NAVIGATE':
534
+ {
535
+ var index = -1;
536
+ if (action.type === 'NAVIGATE' && action.payload.key) {
537
+ index = state.routes.findIndex(route => route.key === action.payload.key);
538
+ } else {
539
+ index = state.routes.findIndex(route => route.name === action.payload.name);
540
+ }
541
+ if (index === -1) {
542
+ return null;
543
+ }
544
+ return changeIndex({
545
+ ...state,
546
+ routes: state.routes.map((route, i) => {
547
+ if (i !== index) {
548
+ return route;
549
+ }
550
+ var getId = routeGetIdList[route.name];
551
+ var currentId = getId === null || getId === undefined ? undefined : getId({
552
+ params: route.params
553
+ });
554
+ var nextId = getId === null || getId === undefined ? undefined : getId({
555
+ params: action.payload.params
556
+ });
557
+ var key = currentId === nextId ? route.key : `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`;
558
+ var params;
559
+ if (action.type === 'NAVIGATE' && action.payload.merge && currentId === nextId) {
560
+ params = action.payload.params !== undefined || routeParamList[route.name] !== undefined ? {
561
+ ...routeParamList[route.name],
562
+ ...route.params,
563
+ ...action.payload.params
564
+ } : route.params;
565
+ } else {
566
+ params = routeParamList[route.name] !== undefined ? {
567
+ ...routeParamList[route.name],
568
+ ...action.payload.params
569
+ } : action.payload.params;
570
+ }
571
+ var path = action.type === 'NAVIGATE' && action.payload.path != null ? action.payload.path : route.path;
572
+ return params !== route.params || path !== route.path ? {
573
+ ...route,
574
+ key,
575
+ path,
576
+ params
577
+ } : route;
578
+ })
579
+ }, index, backBehavior, initialRouteName);
580
+ }
581
+ case 'GO_BACK':
582
+ {
583
+ if (state.history.length === 1) {
584
+ return null;
585
+ }
586
+ var previousKey = state.history[state.history.length - 2].key;
587
+ var _index = state.routes.findIndex(route => route.key === previousKey);
588
+ if (_index === -1) {
589
+ return null;
590
+ }
591
+ return {
592
+ ...state,
593
+ history: state.history.slice(0, -1),
594
+ index: _index
595
+ };
596
+ }
597
+ default:
598
+ return _BaseRouter.default.getStateForAction(state, action);
599
+ }
600
+ },
601
+ shouldActionChangeFocus(action) {
602
+ return action.type === 'NAVIGATE';
603
+ },
604
+ actionCreators: TabActions
605
+ };
606
+ return router;
607
+ }
608
+ },"c822e55e1302f6e881d8",["4e814a93075c75141026","e03db9aacb1ee503cd26"]);
609
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
610
+ "use strict";
611
+
612
+ Object.defineProperty(exports, "__esModule", {
613
+ value: true
614
+ });
615
+ exports.StackActions = undefined;
616
+ exports.default = StackRouter;
617
+ var _BaseRouter = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[0]));
618
+ function _interopRequireDefault(e) {
619
+ return e && e.__esModule ? e : {
620
+ default: e
621
+ };
622
+ }
623
+ var StackActions = exports.StackActions = {
624
+ replace(name, params) {
625
+ return {
626
+ type: 'REPLACE',
627
+ payload: {
628
+ name,
629
+ params
630
+ }
631
+ };
632
+ },
633
+ push(name, params) {
634
+ return {
635
+ type: 'PUSH',
636
+ payload: {
637
+ name,
638
+ params
639
+ }
640
+ };
641
+ },
642
+ pop(count = 1) {
643
+ return {
644
+ type: 'POP',
645
+ payload: {
646
+ count
647
+ }
648
+ };
649
+ },
650
+ popToTop() {
651
+ return {
652
+ type: 'POP_TO_TOP'
653
+ };
654
+ }
655
+ };
656
+ function StackRouter(options) {
657
+ var router = {
658
+ ..._BaseRouter.default,
659
+ type: 'stack',
660
+ getInitialState({
661
+ routeNames,
662
+ routeParamList
663
+ }) {
664
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
665
+ return {
666
+ stale: false,
667
+ type: 'stack',
668
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
669
+ index: 0,
670
+ routeNames,
671
+ routes: [{
672
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
673
+ name: initialRouteName,
674
+ params: routeParamList[initialRouteName]
675
+ }]
676
+ };
677
+ },
678
+ getRehydratedState(partialState, {
679
+ routeNames,
680
+ routeParamList
681
+ }) {
682
+ var state = partialState;
683
+ if (state.stale === false) {
684
+ return state;
685
+ }
686
+ var routes = state.routes.filter(route => routeNames.includes(route.name)).map(route => ({
687
+ ...route,
688
+ key: route.key || `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
689
+ params: routeParamList[route.name] !== undefined ? {
690
+ ...routeParamList[route.name],
691
+ ...route.params
692
+ } : route.params
693
+ }));
694
+ if (routes.length === 0) {
695
+ var initialRouteName = options.initialRouteName !== undefined ? options.initialRouteName : routeNames[0];
696
+ routes.push({
697
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
698
+ name: initialRouteName,
699
+ params: routeParamList[initialRouteName]
700
+ });
701
+ }
702
+ return {
703
+ stale: false,
704
+ type: 'stack',
705
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
706
+ index: routes.length - 1,
707
+ routeNames,
708
+ routes
709
+ };
710
+ },
711
+ getStateForRouteNamesChange(state, {
712
+ routeNames,
713
+ routeParamList,
714
+ routeKeyChanges
715
+ }) {
716
+ var routes = state.routes.filter(route => routeNames.includes(route.name) && !routeKeyChanges.includes(route.name));
717
+ if (routes.length === 0) {
718
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
719
+ routes.push({
720
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
721
+ name: initialRouteName,
722
+ params: routeParamList[initialRouteName]
723
+ });
724
+ }
725
+ return {
726
+ ...state,
727
+ routeNames,
728
+ routes,
729
+ index: Math.min(state.index, routes.length - 1)
730
+ };
731
+ },
732
+ getStateForRouteFocus(state, key) {
733
+ var index = state.routes.findIndex(r => r.key === key);
734
+ if (index === -1 || index === state.index) {
735
+ return state;
736
+ }
737
+ return {
738
+ ...state,
739
+ index,
740
+ routes: state.routes.slice(0, index + 1)
741
+ };
742
+ },
743
+ getStateForAction(state, action, options) {
744
+ var routeParamList = options.routeParamList;
745
+ switch (action.type) {
746
+ case 'REPLACE':
747
+ {
748
+ var index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
749
+ if (index === -1) {
750
+ return null;
751
+ }
752
+ var _action$payload = action.payload,
753
+ name = _action$payload.name,
754
+ key = _action$payload.key,
755
+ params = _action$payload.params;
756
+ if (!state.routeNames.includes(name)) {
757
+ return null;
758
+ }
759
+ return {
760
+ ...state,
761
+ routes: state.routes.map((route, i) => i === index ? {
762
+ key: key !== undefined ? key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
763
+ name,
764
+ params: routeParamList[name] !== undefined ? {
765
+ ...routeParamList[name],
766
+ ...params
767
+ } : params
768
+ } : route)
769
+ };
770
+ }
771
+ case 'PUSH':
772
+ if (state.routeNames.includes(action.payload.name)) {
773
+ var getId = options.routeGetIdList[action.payload.name];
774
+ var id = getId === null || getId === undefined ? undefined : getId({
775
+ params: action.payload.params
776
+ });
777
+ var route = id ? state.routes.find(route => route.name === action.payload.name && id === (getId === null || getId === undefined ? undefined : getId({
778
+ params: route.params
779
+ }))) : undefined;
780
+ var routes;
781
+ if (route) {
782
+ routes = state.routes.filter(r => r.key !== route.key);
783
+ routes.push({
784
+ ...route,
785
+ params: routeParamList[action.payload.name] !== undefined ? {
786
+ ...routeParamList[action.payload.name],
787
+ ...action.payload.params
788
+ } : action.payload.params
789
+ });
790
+ } else {
791
+ routes = [...state.routes, {
792
+ key: `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
793
+ name: action.payload.name,
794
+ params: routeParamList[action.payload.name] !== undefined ? {
795
+ ...routeParamList[action.payload.name],
796
+ ...action.payload.params
797
+ } : action.payload.params
798
+ }];
799
+ }
800
+ return {
801
+ ...state,
802
+ index: routes.length - 1,
803
+ routes
804
+ };
805
+ }
806
+ return null;
807
+ case 'POP':
808
+ {
809
+ var _index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
810
+ if (_index > 0) {
811
+ var count = Math.max(_index - action.payload.count + 1, 1);
812
+ var _routes = state.routes.slice(0, count).concat(state.routes.slice(_index + 1));
813
+ return {
814
+ ...state,
815
+ index: _routes.length - 1,
816
+ routes: _routes
817
+ };
818
+ }
819
+ return null;
820
+ }
821
+ case 'POP_TO_TOP':
822
+ return router.getStateForAction(state, {
823
+ type: 'POP',
824
+ payload: {
825
+ count: state.routes.length - 1
826
+ }
827
+ }, options);
828
+ case 'NAVIGATE':
829
+ if (action.payload.name !== undefined && !state.routeNames.includes(action.payload.name)) {
830
+ return null;
831
+ }
832
+ if (action.payload.key || action.payload.name) {
833
+ // If the route already exists, navigate to that
834
+ var _index2 = -1;
835
+ var _getId =
836
+ // `getId` and `key` can't be used together
837
+ action.payload.key === undefined && action.payload.name !== undefined ? options.routeGetIdList[action.payload.name] : undefined;
838
+ var _id = _getId === null || _getId === undefined ? undefined : _getId({
839
+ params: action.payload.params
840
+ });
841
+ if (_id) {
842
+ _index2 = state.routes.findIndex(route => route.name === action.payload.name && _id === (_getId === null || _getId === undefined ? undefined : _getId({
843
+ params: route.params
844
+ })));
845
+ } else if (state.routes[state.index].name === action.payload.name && action.payload.key === undefined || state.routes[state.index].key === action.payload.key) {
846
+ _index2 = state.index;
847
+ } else {
848
+ for (var i = state.routes.length - 1; i >= 0; i--) {
849
+ if (state.routes[i].name === action.payload.name && action.payload.key === undefined || state.routes[i].key === action.payload.key) {
850
+ _index2 = i;
851
+ break;
852
+ }
853
+ }
854
+ }
855
+ if (_index2 === -1 && action.payload.key && action.payload.name === undefined) {
856
+ return null;
857
+ }
858
+ if (_index2 === -1 && action.payload.name !== undefined) {
859
+ var _routes2 = [...state.routes, {
860
+ key: action.payload.key ?? `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
861
+ name: action.payload.name,
862
+ path: action.payload.path,
863
+ params: routeParamList[action.payload.name] !== undefined ? {
864
+ ...routeParamList[action.payload.name],
865
+ ...action.payload.params
866
+ } : action.payload.params
867
+ }];
868
+ return {
869
+ ...state,
870
+ routes: _routes2,
871
+ index: _routes2.length - 1
872
+ };
873
+ }
874
+ var _route = state.routes[_index2];
875
+ var _params;
876
+ if (action.payload.merge) {
877
+ _params = action.payload.params !== undefined || routeParamList[_route.name] !== undefined ? {
878
+ ...routeParamList[_route.name],
879
+ ..._route.params,
880
+ ...action.payload.params
881
+ } : _route.params;
882
+ } else {
883
+ _params = routeParamList[_route.name] !== undefined ? {
884
+ ...routeParamList[_route.name],
885
+ ...action.payload.params
886
+ } : action.payload.params;
887
+ }
888
+ return {
889
+ ...state,
890
+ index: _index2,
891
+ routes: [...state.routes.slice(0, _index2), _params !== _route.params || action.payload.path && action.payload.path !== _route.path ? {
892
+ ..._route,
893
+ path: action.payload.path ?? _route.path,
894
+ params: _params
895
+ } : state.routes[_index2]]
896
+ };
897
+ }
898
+ return null;
899
+ case 'GO_BACK':
900
+ if (state.index > 0) {
901
+ return router.getStateForAction(state, {
902
+ type: 'POP',
903
+ payload: {
904
+ count: 1
905
+ },
906
+ target: action.target,
907
+ source: action.source
908
+ }, options);
909
+ }
910
+ return null;
911
+ default:
912
+ return _BaseRouter.default.getStateForAction(state, action);
913
+ }
914
+ },
915
+ actionCreators: StackActions
916
+ };
917
+ return router;
918
+ }
919
+ },"536b900fdd2382601bd3",["4e814a93075c75141026","e03db9aacb1ee503cd26"]);
920
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
921
+ "use strict";
922
+
923
+ Object.defineProperty(exports, "__esModule", {
924
+ value: true
925
+ });
926
+ var _exportNames = {
927
+ CommonActions: true,
928
+ BaseRouter: true,
929
+ DrawerActions: true,
930
+ DrawerRouter: true,
931
+ StackActions: true,
932
+ StackRouter: true,
933
+ TabActions: true,
934
+ TabRouter: true
935
+ };
936
+ Object.defineProperty(exports, "BaseRouter", {
937
+ enumerable: true,
938
+ get: function () {
939
+ return _BaseRouter.default;
940
+ }
941
+ });
942
+ exports.CommonActions = undefined;
943
+ Object.defineProperty(exports, "DrawerActions", {
944
+ enumerable: true,
945
+ get: function () {
946
+ return _DrawerRouter.DrawerActions;
947
+ }
948
+ });
949
+ Object.defineProperty(exports, "DrawerRouter", {
950
+ enumerable: true,
951
+ get: function () {
952
+ return _DrawerRouter.default;
953
+ }
954
+ });
955
+ Object.defineProperty(exports, "StackActions", {
956
+ enumerable: true,
957
+ get: function () {
958
+ return _StackRouter.StackActions;
959
+ }
960
+ });
961
+ Object.defineProperty(exports, "StackRouter", {
962
+ enumerable: true,
963
+ get: function () {
964
+ return _StackRouter.default;
965
+ }
966
+ });
967
+ Object.defineProperty(exports, "TabActions", {
968
+ enumerable: true,
969
+ get: function () {
970
+ return _TabRouter.TabActions;
971
+ }
972
+ });
973
+ Object.defineProperty(exports, "TabRouter", {
974
+ enumerable: true,
975
+ get: function () {
976
+ return _TabRouter.default;
977
+ }
978
+ });
979
+ var CommonActions = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
980
+ exports.CommonActions = CommonActions;
981
+ var _BaseRouter = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[1]));
982
+ var _DrawerRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[2]));
983
+ var _StackRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[3]));
984
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[4]));
985
+ Object.keys(_$$_REQUIRE(_dependencyMap[5])).forEach(function (key) {
986
+ if (key === "default" || key === "__esModule") return;
987
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
988
+ if (key in exports && exports[key] === _$$_REQUIRE(_dependencyMap[5])[key]) return;
989
+ Object.defineProperty(exports, key, {
990
+ enumerable: true,
991
+ get: function () {
992
+ return _$$_REQUIRE(_dependencyMap[5])[key];
993
+ }
994
+ });
995
+ });
996
+ function _interopRequireDefault(e) {
997
+ return e && e.__esModule ? e : {
998
+ default: e
999
+ };
1000
+ }
1001
+ function _getRequireWildcardCache(e) {
1002
+ if ("function" != typeof WeakMap) return null;
1003
+ var r = new WeakMap(),
1004
+ t = new WeakMap();
1005
+ return (_getRequireWildcardCache = function (e) {
1006
+ return e ? t : r;
1007
+ })(e);
1008
+ }
1009
+ function _interopRequireWildcard(e, r) {
1010
+ if (!r && e && e.__esModule) return e;
1011
+ if (null === e || "object" != typeof e && "function" != typeof e) return {
1012
+ default: e
1013
+ };
1014
+ var t = _getRequireWildcardCache(r);
1015
+ if (t && t.has(e)) return t.get(e);
1016
+ var n = {
1017
+ __proto__: null
1018
+ },
1019
+ a = Object.defineProperty && Object.getOwnPropertyDescriptor;
1020
+ for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
1021
+ var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
1022
+ i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
1023
+ }
1024
+ return n.default = e, t && t.set(e, n), n;
1025
+ }
1026
+ },"a0b9da8c3bf2cee70b92",["6224880bf3a3483be0e5","4e814a93075c75141026","fbd71b33b1fab08b6b66","536b900fdd2382601bd3","c822e55e1302f6e881d8","76321e829a38224d0f30"]);
1027
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1028
+ "use strict";
1029
+
1030
+ Object.defineProperty(exports, "__esModule", {
1031
+ value: true
1032
+ });
1033
+ },"76321e829a38224d0f30",[]);
1034
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1035
+ Object.defineProperty(exports, "__esModule", {
1036
+ value: true
1037
+ });
1038
+ exports.default = undefined;
1039
+ /**
1040
+ * Base router object that can be used when writing custom routers.
1041
+ * This provides few helper methods to handle common actions such as `RESET`.
1042
+ */
1043
+ var BaseRouter = {
1044
+ getStateForAction(state, action) {
1045
+ switch (action.type) {
1046
+ case 'SET_PARAMS':
1047
+ {
1048
+ var index = action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
1049
+ if (index === -1) {
1050
+ return null;
1051
+ }
1052
+ return {
1053
+ ...state,
1054
+ routes: state.routes.map((r, i) => i === index ? {
1055
+ ...r,
1056
+ params: {
1057
+ ...r.params,
1058
+ ...action.payload.params
1059
+ }
1060
+ } : r)
1061
+ };
1062
+ }
1063
+ case 'RESET':
1064
+ {
1065
+ var nextState = action.payload;
1066
+ if (nextState.routes.length === 0 || nextState.routes.some(route => !state.routeNames.includes(route.name))) {
1067
+ return null;
1068
+ }
1069
+ if (nextState.stale === false) {
1070
+ if (state.routeNames.length !== nextState.routeNames.length || nextState.routeNames.some(name => !state.routeNames.includes(name))) {
1071
+ return null;
1072
+ }
1073
+ return {
1074
+ ...nextState,
1075
+ routes: nextState.routes.map(route => route.key ? route : {
1076
+ ...route,
1077
+ key: `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[0]).nanoid)()}`
1078
+ })
1079
+ };
1080
+ }
1081
+ return nextState;
1082
+ }
1083
+ default:
1084
+ return null;
1085
+ }
1086
+ },
1087
+ shouldActionChangeFocus(action) {
1088
+ return action.type === 'NAVIGATE';
1089
+ }
1090
+ };
1091
+ var _default = exports.default = BaseRouter;
1092
+ },"b02ddfcf5d1b27936f8d",["e03db9aacb1ee503cd26"]);
1093
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1094
+ Object.defineProperty(exports, "__esModule", {
1095
+ value: true
1096
+ });
1097
+ exports.goBack = goBack;
1098
+ exports.navigate = navigate;
1099
+ exports.reset = reset;
1100
+ exports.setParams = setParams;
1101
+ function goBack() {
1102
+ return {
1103
+ type: 'GO_BACK'
1104
+ };
1105
+ }
1106
+
1107
+ // eslint-disable-next-line no-redeclare
1108
+
1109
+ // eslint-disable-next-line no-redeclare
1110
+ function navigate(...args) {
1111
+ if (typeof args[0] === 'string') {
1112
+ return {
1113
+ type: 'NAVIGATE',
1114
+ payload: {
1115
+ name: args[0],
1116
+ params: args[1]
1117
+ }
1118
+ };
1119
+ } else {
1120
+ var payload = args[0] || {};
1121
+ if (!payload.hasOwnProperty('key') && !payload.hasOwnProperty('name')) {
1122
+ 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.');
1123
+ }
1124
+ return {
1125
+ type: 'NAVIGATE',
1126
+ payload
1127
+ };
1128
+ }
1129
+ }
1130
+ function reset(state) {
1131
+ return {
1132
+ type: 'RESET',
1133
+ payload: state
1134
+ };
1135
+ }
1136
+ function setParams(params) {
1137
+ return {
1138
+ type: 'SET_PARAMS',
1139
+ payload: {
1140
+ params
1141
+ }
1142
+ };
1143
+ }
1144
+ },"6bfbc90eac4c2d2e67a4",[]);
1145
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1146
+ Object.defineProperty(exports, "__esModule", {
1147
+ value: true
1148
+ });
1149
+ exports.DrawerActions = undefined;
1150
+ exports.default = DrawerRouter;
1151
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
1152
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
1153
+ var DrawerActions = exports.DrawerActions = {
1154
+ ..._TabRouter.TabActions,
1155
+ openDrawer() {
1156
+ return {
1157
+ type: 'OPEN_DRAWER'
1158
+ };
1159
+ },
1160
+ closeDrawer() {
1161
+ return {
1162
+ type: 'CLOSE_DRAWER'
1163
+ };
1164
+ },
1165
+ toggleDrawer() {
1166
+ return {
1167
+ type: 'TOGGLE_DRAWER'
1168
+ };
1169
+ }
1170
+ };
1171
+ function DrawerRouter({
1172
+ defaultStatus = 'closed',
1173
+ ...rest
1174
+ }) {
1175
+ var router = (0, _TabRouter.default)(rest);
1176
+ var isDrawerInHistory = state => {
1177
+ var _state$history;
1178
+ return Boolean((_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.some(it => it.type === 'drawer'));
1179
+ };
1180
+ var addDrawerToHistory = state => {
1181
+ if (isDrawerInHistory(state)) {
1182
+ return state;
1183
+ }
1184
+ return {
1185
+ ...state,
1186
+ history: [...state.history, {
1187
+ type: 'drawer',
1188
+ status: defaultStatus === 'open' ? 'closed' : 'open'
1189
+ }]
1190
+ };
1191
+ };
1192
+ var removeDrawerFromHistory = state => {
1193
+ if (!isDrawerInHistory(state)) {
1194
+ return state;
1195
+ }
1196
+ return {
1197
+ ...state,
1198
+ history: state.history.filter(it => it.type !== 'drawer')
1199
+ };
1200
+ };
1201
+ var openDrawer = state => {
1202
+ if (defaultStatus === 'open') {
1203
+ return removeDrawerFromHistory(state);
1204
+ }
1205
+ return addDrawerToHistory(state);
1206
+ };
1207
+ var closeDrawer = state => {
1208
+ if (defaultStatus === 'open') {
1209
+ return addDrawerToHistory(state);
1210
+ }
1211
+ return removeDrawerFromHistory(state);
1212
+ };
1213
+ return {
1214
+ ...router,
1215
+ type: 'drawer',
1216
+ getInitialState({
1217
+ routeNames,
1218
+ routeParamList,
1219
+ routeGetIdList
1220
+ }) {
1221
+ var state = router.getInitialState({
1222
+ routeNames,
1223
+ routeParamList,
1224
+ routeGetIdList
1225
+ });
1226
+ return {
1227
+ ...state,
1228
+ default: defaultStatus,
1229
+ stale: false,
1230
+ type: 'drawer',
1231
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
1232
+ };
1233
+ },
1234
+ getRehydratedState(partialState, {
1235
+ routeNames,
1236
+ routeParamList,
1237
+ routeGetIdList
1238
+ }) {
1239
+ if (partialState.stale === false) {
1240
+ return partialState;
1241
+ }
1242
+ var state = router.getRehydratedState(partialState, {
1243
+ routeNames,
1244
+ routeParamList,
1245
+ routeGetIdList
1246
+ });
1247
+ if (isDrawerInHistory(partialState)) {
1248
+ // Re-sync the drawer entry in history to correct it if it was wrong
1249
+ state = removeDrawerFromHistory(state);
1250
+ state = addDrawerToHistory(state);
1251
+ }
1252
+ return {
1253
+ ...state,
1254
+ default: defaultStatus,
1255
+ type: 'drawer',
1256
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
1257
+ };
1258
+ },
1259
+ getStateForRouteFocus(state, key) {
1260
+ var result = router.getStateForRouteFocus(state, key);
1261
+ return closeDrawer(result);
1262
+ },
1263
+ getStateForAction(state, action, options) {
1264
+ switch (action.type) {
1265
+ case 'OPEN_DRAWER':
1266
+ return openDrawer(state);
1267
+ case 'CLOSE_DRAWER':
1268
+ return closeDrawer(state);
1269
+ case 'TOGGLE_DRAWER':
1270
+ if (isDrawerInHistory(state)) {
1271
+ return removeDrawerFromHistory(state);
1272
+ }
1273
+ return addDrawerToHistory(state);
1274
+ case 'JUMP_TO':
1275
+ case 'NAVIGATE':
1276
+ {
1277
+ var result = router.getStateForAction(state, action, options);
1278
+ if (result != null && result.index !== state.index) {
1279
+ return closeDrawer(result);
1280
+ }
1281
+ return result;
1282
+ }
1283
+ case 'GO_BACK':
1284
+ if (isDrawerInHistory(state)) {
1285
+ return removeDrawerFromHistory(state);
1286
+ }
1287
+ return router.getStateForAction(state, action, options);
1288
+ default:
1289
+ return router.getStateForAction(state, action, options);
1290
+ }
1291
+ },
1292
+ actionCreators: DrawerActions
1293
+ };
1294
+ }
1295
+ },"36b338faa6c2364d674f",["88d6ccdfe66b5db63cff","e03db9aacb1ee503cd26"]);
1296
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1297
+ Object.defineProperty(exports, "__esModule", {
1298
+ value: true
1299
+ });
1300
+ exports.TabActions = undefined;
1301
+ exports.default = TabRouter;
1302
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
1303
+ var TYPE_ROUTE = 'route';
1304
+ var TabActions = exports.TabActions = {
1305
+ jumpTo(name, params) {
1306
+ return {
1307
+ type: 'JUMP_TO',
1308
+ payload: {
1309
+ name,
1310
+ params
1311
+ }
1312
+ };
1313
+ }
1314
+ };
1315
+ var getRouteHistory = (routes, index, backBehavior, initialRouteName) => {
1316
+ var history = [{
1317
+ type: TYPE_ROUTE,
1318
+ key: routes[index].key
1319
+ }];
1320
+ var initialRouteIndex;
1321
+ switch (backBehavior) {
1322
+ case 'order':
1323
+ for (var i = index; i > 0; i--) {
1324
+ history.unshift({
1325
+ type: TYPE_ROUTE,
1326
+ key: routes[i - 1].key
1327
+ });
1328
+ }
1329
+ break;
1330
+ case 'firstRoute':
1331
+ if (index !== 0) {
1332
+ history.unshift({
1333
+ type: TYPE_ROUTE,
1334
+ key: routes[0].key
1335
+ });
1336
+ }
1337
+ break;
1338
+ case 'initialRoute':
1339
+ initialRouteIndex = routes.findIndex(route => route.name === initialRouteName);
1340
+ initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;
1341
+ if (index !== initialRouteIndex) {
1342
+ history.unshift({
1343
+ type: TYPE_ROUTE,
1344
+ key: routes[initialRouteIndex].key
1345
+ });
1346
+ }
1347
+ break;
1348
+ case 'history':
1349
+ // The history will fill up on navigation
1350
+ break;
1351
+ }
1352
+ return history;
1353
+ };
1354
+ var changeIndex = (state, index, backBehavior, initialRouteName) => {
1355
+ var history;
1356
+ if (backBehavior === 'history') {
1357
+ var currentKey = state.routes[index].key;
1358
+ history = state.history.filter(it => it.type === 'route' ? it.key !== currentKey : false).concat({
1359
+ type: TYPE_ROUTE,
1360
+ key: currentKey
1361
+ });
1362
+ } else {
1363
+ history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);
1364
+ }
1365
+ return {
1366
+ ...state,
1367
+ index,
1368
+ history
1369
+ };
1370
+ };
1371
+ function TabRouter({
1372
+ initialRouteName,
1373
+ backBehavior = 'firstRoute'
1374
+ }) {
1375
+ var router = {
1376
+ ..._BaseRouter.default,
1377
+ type: 'tab',
1378
+ getInitialState({
1379
+ routeNames,
1380
+ routeParamList
1381
+ }) {
1382
+ var index = initialRouteName !== undefined && routeNames.includes(initialRouteName) ? routeNames.indexOf(initialRouteName) : 0;
1383
+ var routes = routeNames.map(name => ({
1384
+ name,
1385
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1386
+ params: routeParamList[name]
1387
+ }));
1388
+ var history = getRouteHistory(routes, index, backBehavior, initialRouteName);
1389
+ return {
1390
+ stale: false,
1391
+ type: 'tab',
1392
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1393
+ index,
1394
+ routeNames,
1395
+ history,
1396
+ routes
1397
+ };
1398
+ },
1399
+ getRehydratedState(partialState, {
1400
+ routeNames,
1401
+ routeParamList
1402
+ }) {
1403
+ var _state$routes, _state$history;
1404
+ var state = partialState;
1405
+ if (state.stale === false) {
1406
+ return state;
1407
+ }
1408
+ var routes = routeNames.map(name => {
1409
+ var route = state.routes.find(r => r.name === name);
1410
+ return {
1411
+ ...route,
1412
+ name,
1413
+ key: route && route.name === name && route.key ? route.key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1414
+ params: routeParamList[name] !== undefined ? {
1415
+ ...routeParamList[name],
1416
+ ...(route ? route.params : undefined)
1417
+ } : route ? route.params : undefined
1418
+ };
1419
+ });
1420
+ var index = Math.min(Math.max(routeNames.indexOf((_state$routes = state.routes[(state === null || state === undefined ? undefined : state.index) ?? 0]) === null || _state$routes === undefined ? undefined : _state$routes.name), 0), routes.length - 1);
1421
+ var history = ((_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.filter(it => routes.find(r => r.key === it.key))) ?? [];
1422
+ return changeIndex({
1423
+ stale: false,
1424
+ type: 'tab',
1425
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1426
+ index,
1427
+ routeNames,
1428
+ history,
1429
+ routes
1430
+ }, index, backBehavior, initialRouteName);
1431
+ },
1432
+ getStateForRouteNamesChange(state, {
1433
+ routeNames,
1434
+ routeParamList,
1435
+ routeKeyChanges
1436
+ }) {
1437
+ var routes = routeNames.map(name => state.routes.find(r => r.name === name && !routeKeyChanges.includes(r.name)) || {
1438
+ name,
1439
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1440
+ params: routeParamList[name]
1441
+ });
1442
+ var index = Math.max(0, routeNames.indexOf(state.routes[state.index].name));
1443
+ var history = state.history.filter(
1444
+ // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)
1445
+ it => it.type !== 'route' || routes.find(r => r.key === it.key));
1446
+ if (!history.length) {
1447
+ history = getRouteHistory(routes, index, backBehavior, initialRouteName);
1448
+ }
1449
+ return {
1450
+ ...state,
1451
+ history,
1452
+ routeNames,
1453
+ routes,
1454
+ index
1455
+ };
1456
+ },
1457
+ getStateForRouteFocus(state, key) {
1458
+ var index = state.routes.findIndex(r => r.key === key);
1459
+ if (index === -1 || index === state.index) {
1460
+ return state;
1461
+ }
1462
+ return changeIndex(state, index, backBehavior, initialRouteName);
1463
+ },
1464
+ getStateForAction(state, action, {
1465
+ routeParamList,
1466
+ routeGetIdList
1467
+ }) {
1468
+ switch (action.type) {
1469
+ case 'JUMP_TO':
1470
+ case 'NAVIGATE':
1471
+ {
1472
+ var index = -1;
1473
+ if (action.type === 'NAVIGATE' && action.payload.key) {
1474
+ index = state.routes.findIndex(route => route.key === action.payload.key);
1475
+ } else {
1476
+ index = state.routes.findIndex(route => route.name === action.payload.name);
1477
+ }
1478
+ if (index === -1) {
1479
+ return null;
1480
+ }
1481
+ return changeIndex({
1482
+ ...state,
1483
+ routes: state.routes.map((route, i) => {
1484
+ if (i !== index) {
1485
+ return route;
1486
+ }
1487
+ var getId = routeGetIdList[route.name];
1488
+ var currentId = getId === null || getId === undefined ? undefined : getId({
1489
+ params: route.params
1490
+ });
1491
+ var nextId = getId === null || getId === undefined ? undefined : getId({
1492
+ params: action.payload.params
1493
+ });
1494
+ var key = currentId === nextId ? route.key : `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`;
1495
+ var params;
1496
+ if (action.type === 'NAVIGATE' && action.payload.merge && currentId === nextId) {
1497
+ params = action.payload.params !== undefined || routeParamList[route.name] !== undefined ? {
1498
+ ...routeParamList[route.name],
1499
+ ...route.params,
1500
+ ...action.payload.params
1501
+ } : route.params;
1502
+ } else {
1503
+ params = routeParamList[route.name] !== undefined ? {
1504
+ ...routeParamList[route.name],
1505
+ ...action.payload.params
1506
+ } : action.payload.params;
1507
+ }
1508
+ var path = action.type === 'NAVIGATE' && action.payload.path != null ? action.payload.path : route.path;
1509
+ return params !== route.params || path !== route.path ? {
1510
+ ...route,
1511
+ key,
1512
+ path,
1513
+ params
1514
+ } : route;
1515
+ })
1516
+ }, index, backBehavior, initialRouteName);
1517
+ }
1518
+ case 'GO_BACK':
1519
+ {
1520
+ if (state.history.length === 1) {
1521
+ return null;
1522
+ }
1523
+ var previousKey = state.history[state.history.length - 2].key;
1524
+ var _index = state.routes.findIndex(route => route.key === previousKey);
1525
+ if (_index === -1) {
1526
+ return null;
1527
+ }
1528
+ return {
1529
+ ...state,
1530
+ history: state.history.slice(0, -1),
1531
+ index: _index
1532
+ };
1533
+ }
1534
+ default:
1535
+ return _BaseRouter.default.getStateForAction(state, action);
1536
+ }
1537
+ },
1538
+ shouldActionChangeFocus(action) {
1539
+ return action.type === 'NAVIGATE';
1540
+ },
1541
+ actionCreators: TabActions
1542
+ };
1543
+ return router;
1544
+ }
1545
+ },"88d6ccdfe66b5db63cff",["d3b57c8ff490ba8c7c47","b02ddfcf5d1b27936f8d","e03db9aacb1ee503cd26"]);
1546
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1547
+ function _interopRequireDefault(e) {
1548
+ return e && e.__esModule ? e : {
1549
+ "default": e
1550
+ };
1551
+ }
1552
+ module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
1553
+ },"d3b57c8ff490ba8c7c47",[]);
1554
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1555
+ Object.defineProperty(exports, "__esModule", {
1556
+ value: true
1557
+ });
1558
+ exports.StackActions = undefined;
1559
+ exports.default = StackRouter;
1560
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
1561
+ var StackActions = exports.StackActions = {
1562
+ replace(name, params) {
1563
+ return {
1564
+ type: 'REPLACE',
1565
+ payload: {
1566
+ name,
1567
+ params
1568
+ }
1569
+ };
1570
+ },
1571
+ push(name, params) {
1572
+ return {
1573
+ type: 'PUSH',
1574
+ payload: {
1575
+ name,
1576
+ params
1577
+ }
1578
+ };
1579
+ },
1580
+ pop(count = 1) {
1581
+ return {
1582
+ type: 'POP',
1583
+ payload: {
1584
+ count
1585
+ }
1586
+ };
1587
+ },
1588
+ popToTop() {
1589
+ return {
1590
+ type: 'POP_TO_TOP'
1591
+ };
1592
+ }
1593
+ };
1594
+ function StackRouter(options) {
1595
+ var router = {
1596
+ ..._BaseRouter.default,
1597
+ type: 'stack',
1598
+ getInitialState({
1599
+ routeNames,
1600
+ routeParamList
1601
+ }) {
1602
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
1603
+ return {
1604
+ stale: false,
1605
+ type: 'stack',
1606
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1607
+ index: 0,
1608
+ routeNames,
1609
+ routes: [{
1610
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1611
+ name: initialRouteName,
1612
+ params: routeParamList[initialRouteName]
1613
+ }]
1614
+ };
1615
+ },
1616
+ getRehydratedState(partialState, {
1617
+ routeNames,
1618
+ routeParamList
1619
+ }) {
1620
+ var state = partialState;
1621
+ if (state.stale === false) {
1622
+ return state;
1623
+ }
1624
+ var routes = state.routes.filter(route => routeNames.includes(route.name)).map(route => ({
1625
+ ...route,
1626
+ key: route.key || `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1627
+ params: routeParamList[route.name] !== undefined ? {
1628
+ ...routeParamList[route.name],
1629
+ ...route.params
1630
+ } : route.params
1631
+ }));
1632
+ if (routes.length === 0) {
1633
+ var initialRouteName = options.initialRouteName !== undefined ? options.initialRouteName : routeNames[0];
1634
+ routes.push({
1635
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1636
+ name: initialRouteName,
1637
+ params: routeParamList[initialRouteName]
1638
+ });
1639
+ }
1640
+ return {
1641
+ stale: false,
1642
+ type: 'stack',
1643
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1644
+ index: routes.length - 1,
1645
+ routeNames,
1646
+ routes
1647
+ };
1648
+ },
1649
+ getStateForRouteNamesChange(state, {
1650
+ routeNames,
1651
+ routeParamList,
1652
+ routeKeyChanges
1653
+ }) {
1654
+ var routes = state.routes.filter(route => routeNames.includes(route.name) && !routeKeyChanges.includes(route.name));
1655
+ if (routes.length === 0) {
1656
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
1657
+ routes.push({
1658
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1659
+ name: initialRouteName,
1660
+ params: routeParamList[initialRouteName]
1661
+ });
1662
+ }
1663
+ return {
1664
+ ...state,
1665
+ routeNames,
1666
+ routes,
1667
+ index: Math.min(state.index, routes.length - 1)
1668
+ };
1669
+ },
1670
+ getStateForRouteFocus(state, key) {
1671
+ var index = state.routes.findIndex(r => r.key === key);
1672
+ if (index === -1 || index === state.index) {
1673
+ return state;
1674
+ }
1675
+ return {
1676
+ ...state,
1677
+ index,
1678
+ routes: state.routes.slice(0, index + 1)
1679
+ };
1680
+ },
1681
+ getStateForAction(state, action, options) {
1682
+ var routeParamList = options.routeParamList;
1683
+ switch (action.type) {
1684
+ case 'REPLACE':
1685
+ {
1686
+ var index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
1687
+ if (index === -1) {
1688
+ return null;
1689
+ }
1690
+ var _action$payload = action.payload,
1691
+ name = _action$payload.name,
1692
+ key = _action$payload.key,
1693
+ params = _action$payload.params;
1694
+ if (!state.routeNames.includes(name)) {
1695
+ return null;
1696
+ }
1697
+ return {
1698
+ ...state,
1699
+ routes: state.routes.map((route, i) => i === index ? {
1700
+ key: key !== undefined ? key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1701
+ name,
1702
+ params: routeParamList[name] !== undefined ? {
1703
+ ...routeParamList[name],
1704
+ ...params
1705
+ } : params
1706
+ } : route)
1707
+ };
1708
+ }
1709
+ case 'PUSH':
1710
+ if (state.routeNames.includes(action.payload.name)) {
1711
+ var getId = options.routeGetIdList[action.payload.name];
1712
+ var id = getId === null || getId === undefined ? undefined : getId({
1713
+ params: action.payload.params
1714
+ });
1715
+ var route = id ? state.routes.find(route => route.name === action.payload.name && id === (getId === null || getId === undefined ? undefined : getId({
1716
+ params: route.params
1717
+ }))) : undefined;
1718
+ var routes;
1719
+ if (route) {
1720
+ routes = state.routes.filter(r => r.key !== route.key);
1721
+ routes.push({
1722
+ ...route,
1723
+ params: routeParamList[action.payload.name] !== undefined ? {
1724
+ ...routeParamList[action.payload.name],
1725
+ ...action.payload.params
1726
+ } : action.payload.params
1727
+ });
1728
+ } else {
1729
+ routes = [...state.routes, {
1730
+ key: `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1731
+ name: action.payload.name,
1732
+ params: routeParamList[action.payload.name] !== undefined ? {
1733
+ ...routeParamList[action.payload.name],
1734
+ ...action.payload.params
1735
+ } : action.payload.params
1736
+ }];
1737
+ }
1738
+ return {
1739
+ ...state,
1740
+ index: routes.length - 1,
1741
+ routes
1742
+ };
1743
+ }
1744
+ return null;
1745
+ case 'POP':
1746
+ {
1747
+ var _index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
1748
+ if (_index > 0) {
1749
+ var count = Math.max(_index - action.payload.count + 1, 1);
1750
+ var _routes = state.routes.slice(0, count).concat(state.routes.slice(_index + 1));
1751
+ return {
1752
+ ...state,
1753
+ index: _routes.length - 1,
1754
+ routes: _routes
1755
+ };
1756
+ }
1757
+ return null;
1758
+ }
1759
+ case 'POP_TO_TOP':
1760
+ return router.getStateForAction(state, {
1761
+ type: 'POP',
1762
+ payload: {
1763
+ count: state.routes.length - 1
1764
+ }
1765
+ }, options);
1766
+ case 'NAVIGATE':
1767
+ if (action.payload.name !== undefined && !state.routeNames.includes(action.payload.name)) {
1768
+ return null;
1769
+ }
1770
+ if (action.payload.key || action.payload.name) {
1771
+ // If the route already exists, navigate to that
1772
+ var _index2 = -1;
1773
+ var _getId =
1774
+ // `getId` and `key` can't be used together
1775
+ action.payload.key === undefined && action.payload.name !== undefined ? options.routeGetIdList[action.payload.name] : undefined;
1776
+ var _id = _getId === null || _getId === undefined ? undefined : _getId({
1777
+ params: action.payload.params
1778
+ });
1779
+ if (_id) {
1780
+ _index2 = state.routes.findIndex(route => route.name === action.payload.name && _id === (_getId === null || _getId === undefined ? undefined : _getId({
1781
+ params: route.params
1782
+ })));
1783
+ } else if (state.routes[state.index].name === action.payload.name && action.payload.key === undefined || state.routes[state.index].key === action.payload.key) {
1784
+ _index2 = state.index;
1785
+ } else {
1786
+ for (var i = state.routes.length - 1; i >= 0; i--) {
1787
+ if (state.routes[i].name === action.payload.name && action.payload.key === undefined || state.routes[i].key === action.payload.key) {
1788
+ _index2 = i;
1789
+ break;
1790
+ }
1791
+ }
1792
+ }
1793
+ if (_index2 === -1 && action.payload.key && action.payload.name === undefined) {
1794
+ return null;
1795
+ }
1796
+ if (_index2 === -1 && action.payload.name !== undefined) {
1797
+ var _routes2 = [...state.routes, {
1798
+ key: action.payload.key ?? `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1799
+ name: action.payload.name,
1800
+ path: action.payload.path,
1801
+ params: routeParamList[action.payload.name] !== undefined ? {
1802
+ ...routeParamList[action.payload.name],
1803
+ ...action.payload.params
1804
+ } : action.payload.params
1805
+ }];
1806
+ return {
1807
+ ...state,
1808
+ routes: _routes2,
1809
+ index: _routes2.length - 1
1810
+ };
1811
+ }
1812
+ var _route = state.routes[_index2];
1813
+ var _params;
1814
+ if (action.payload.merge) {
1815
+ _params = action.payload.params !== undefined || routeParamList[_route.name] !== undefined ? {
1816
+ ...routeParamList[_route.name],
1817
+ ..._route.params,
1818
+ ...action.payload.params
1819
+ } : _route.params;
1820
+ } else {
1821
+ _params = routeParamList[_route.name] !== undefined ? {
1822
+ ...routeParamList[_route.name],
1823
+ ...action.payload.params
1824
+ } : action.payload.params;
1825
+ }
1826
+ return {
1827
+ ...state,
1828
+ index: _index2,
1829
+ routes: [...state.routes.slice(0, _index2), _params !== _route.params || action.payload.path && action.payload.path !== _route.path ? {
1830
+ ..._route,
1831
+ path: action.payload.path ?? _route.path,
1832
+ params: _params
1833
+ } : state.routes[_index2]]
1834
+ };
1835
+ }
1836
+ return null;
1837
+ case 'GO_BACK':
1838
+ if (state.index > 0) {
1839
+ return router.getStateForAction(state, {
1840
+ type: 'POP',
1841
+ payload: {
1842
+ count: 1
1843
+ },
1844
+ target: action.target,
1845
+ source: action.source
1846
+ }, options);
1847
+ }
1848
+ return null;
1849
+ default:
1850
+ return _BaseRouter.default.getStateForAction(state, action);
1851
+ }
1852
+ },
1853
+ actionCreators: StackActions
1854
+ };
1855
+ return router;
1856
+ }
1857
+ },"1d666e2a5547a2fa33f1",["d3b57c8ff490ba8c7c47","b02ddfcf5d1b27936f8d","e03db9aacb1ee503cd26"]);
1858
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1859
+ Object.defineProperty(exports, "__esModule", {
1860
+ value: true
1861
+ });
1862
+ var _exportNames = {
1863
+ CommonActions: true,
1864
+ BaseRouter: true,
1865
+ DrawerActions: true,
1866
+ DrawerRouter: true,
1867
+ StackActions: true,
1868
+ StackRouter: true,
1869
+ TabActions: true,
1870
+ TabRouter: true
1871
+ };
1872
+ Object.defineProperty(exports, "BaseRouter", {
1873
+ enumerable: true,
1874
+ get: function () {
1875
+ return _BaseRouter.default;
1876
+ }
1877
+ });
1878
+ exports.CommonActions = undefined;
1879
+ Object.defineProperty(exports, "DrawerActions", {
1880
+ enumerable: true,
1881
+ get: function () {
1882
+ return _DrawerRouter.DrawerActions;
1883
+ }
1884
+ });
1885
+ Object.defineProperty(exports, "DrawerRouter", {
1886
+ enumerable: true,
1887
+ get: function () {
1888
+ return _DrawerRouter.default;
1889
+ }
1890
+ });
1891
+ Object.defineProperty(exports, "StackActions", {
1892
+ enumerable: true,
1893
+ get: function () {
1894
+ return _StackRouter.StackActions;
1895
+ }
1896
+ });
1897
+ Object.defineProperty(exports, "StackRouter", {
1898
+ enumerable: true,
1899
+ get: function () {
1900
+ return _StackRouter.default;
1901
+ }
1902
+ });
1903
+ Object.defineProperty(exports, "TabActions", {
1904
+ enumerable: true,
1905
+ get: function () {
1906
+ return _TabRouter.TabActions;
1907
+ }
1908
+ });
1909
+ Object.defineProperty(exports, "TabRouter", {
1910
+ enumerable: true,
1911
+ get: function () {
1912
+ return _TabRouter.default;
1913
+ }
1914
+ });
1915
+ var CommonActions = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
1916
+ exports.CommonActions = CommonActions;
1917
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[1])(_$$_REQUIRE(_dependencyMap[2]));
1918
+ var _DrawerRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[3]));
1919
+ var _StackRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[4]));
1920
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[5]));
1921
+ Object.keys(_$$_REQUIRE(_dependencyMap[6])).forEach(function (key) {
1922
+ if (key === "default" || key === "__esModule") return;
1923
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
1924
+ if (key in exports && exports[key] === _$$_REQUIRE(_dependencyMap[6])[key]) return;
1925
+ Object.defineProperty(exports, key, {
1926
+ enumerable: true,
1927
+ get: function () {
1928
+ return _$$_REQUIRE(_dependencyMap[6])[key];
1929
+ }
1930
+ });
1931
+ });
1932
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
1933
+ },"e045dec1c8244fccaf7b",["6bfbc90eac4c2d2e67a4","d3b57c8ff490ba8c7c47","b02ddfcf5d1b27936f8d","36b338faa6c2364d674f","1d666e2a5547a2fa33f1","88d6ccdfe66b5db63cff","12c309785643d3823400"]);
1934
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1935
+ Object.defineProperty(exports, "__esModule", {
1936
+ value: true
1937
+ });
1938
+ },"12c309785643d3823400",[]);
1939
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1940
+ Object.defineProperty(exports, "__esModule", {
1941
+ value: true
1942
+ });
1943
+ exports.default = undefined;
1944
+ /**
1945
+ * Base router object that can be used when writing custom routers.
1946
+ * This provides few helper methods to handle common actions such as `RESET`.
1947
+ */
1948
+ var BaseRouter = {
1949
+ getStateForAction(state, action) {
1950
+ switch (action.type) {
1951
+ case 'SET_PARAMS':
1952
+ {
1953
+ var index = action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
1954
+ if (index === -1) {
1955
+ return null;
1956
+ }
1957
+ return {
1958
+ ...state,
1959
+ routes: state.routes.map((r, i) => i === index ? {
1960
+ ...r,
1961
+ params: {
1962
+ ...r.params,
1963
+ ...action.payload.params
1964
+ }
1965
+ } : r)
1966
+ };
1967
+ }
1968
+ case 'RESET':
1969
+ {
1970
+ var nextState = action.payload;
1971
+ if (nextState.routes.length === 0 || nextState.routes.some(route => !state.routeNames.includes(route.name))) {
1972
+ return null;
1973
+ }
1974
+ if (nextState.stale === false) {
1975
+ if (state.routeNames.length !== nextState.routeNames.length || nextState.routeNames.some(name => !state.routeNames.includes(name))) {
1976
+ return null;
1977
+ }
1978
+ return {
1979
+ ...nextState,
1980
+ routes: nextState.routes.map(route => route.key ? route : {
1981
+ ...route,
1982
+ key: `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[0]).nanoid)()}`
1983
+ })
1984
+ };
1985
+ }
1986
+ return nextState;
1987
+ }
1988
+ default:
1989
+ return null;
1990
+ }
1991
+ },
1992
+ shouldActionChangeFocus(action) {
1993
+ return action.type === 'NAVIGATE';
1994
+ }
1995
+ };
1996
+ var _default = exports.default = BaseRouter;
1997
+ },"cc50ab09498b013d1d6d",["e03db9aacb1ee503cd26"]);
1998
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1999
+ Object.defineProperty(exports, "__esModule", {
2000
+ value: true
2001
+ });
2002
+ exports.goBack = goBack;
2003
+ exports.navigate = navigate;
2004
+ exports.reset = reset;
2005
+ exports.setParams = setParams;
2006
+ function goBack() {
2007
+ return {
2008
+ type: 'GO_BACK'
2009
+ };
2010
+ }
2011
+
2012
+ // eslint-disable-next-line no-redeclare
2013
+
2014
+ // eslint-disable-next-line no-redeclare
2015
+ function navigate(...args) {
2016
+ if (typeof args[0] === 'string') {
2017
+ return {
2018
+ type: 'NAVIGATE',
2019
+ payload: {
2020
+ name: args[0],
2021
+ params: args[1]
2022
+ }
2023
+ };
2024
+ } else {
2025
+ var payload = args[0] || {};
2026
+ if (!payload.hasOwnProperty('key') && !payload.hasOwnProperty('name')) {
2027
+ 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.');
2028
+ }
2029
+ return {
2030
+ type: 'NAVIGATE',
2031
+ payload
2032
+ };
2033
+ }
2034
+ }
2035
+ function reset(state) {
2036
+ return {
2037
+ type: 'RESET',
2038
+ payload: state
2039
+ };
2040
+ }
2041
+ function setParams(params) {
2042
+ return {
2043
+ type: 'SET_PARAMS',
2044
+ payload: {
2045
+ params
2046
+ }
2047
+ };
2048
+ }
2049
+ },"000944072e226c3923ad",[]);
2050
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2051
+ Object.defineProperty(exports, "__esModule", {
2052
+ value: true
2053
+ });
2054
+ exports.DrawerActions = undefined;
2055
+ exports.default = DrawerRouter;
2056
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
2057
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
2058
+ var DrawerActions = exports.DrawerActions = {
2059
+ ..._TabRouter.TabActions,
2060
+ openDrawer() {
2061
+ return {
2062
+ type: 'OPEN_DRAWER'
2063
+ };
2064
+ },
2065
+ closeDrawer() {
2066
+ return {
2067
+ type: 'CLOSE_DRAWER'
2068
+ };
2069
+ },
2070
+ toggleDrawer() {
2071
+ return {
2072
+ type: 'TOGGLE_DRAWER'
2073
+ };
2074
+ }
2075
+ };
2076
+ function DrawerRouter({
2077
+ defaultStatus = 'closed',
2078
+ ...rest
2079
+ }) {
2080
+ var router = (0, _TabRouter.default)(rest);
2081
+ var isDrawerInHistory = state => Boolean(state.history?.some(it => it.type === 'drawer'));
2082
+ var addDrawerToHistory = state => {
2083
+ if (isDrawerInHistory(state)) {
2084
+ return state;
2085
+ }
2086
+ return {
2087
+ ...state,
2088
+ history: [...state.history, {
2089
+ type: 'drawer',
2090
+ status: defaultStatus === 'open' ? 'closed' : 'open'
2091
+ }]
2092
+ };
2093
+ };
2094
+ var removeDrawerFromHistory = state => {
2095
+ if (!isDrawerInHistory(state)) {
2096
+ return state;
2097
+ }
2098
+ return {
2099
+ ...state,
2100
+ history: state.history.filter(it => it.type !== 'drawer')
2101
+ };
2102
+ };
2103
+ var openDrawer = state => {
2104
+ if (defaultStatus === 'open') {
2105
+ return removeDrawerFromHistory(state);
2106
+ }
2107
+ return addDrawerToHistory(state);
2108
+ };
2109
+ var closeDrawer = state => {
2110
+ if (defaultStatus === 'open') {
2111
+ return addDrawerToHistory(state);
2112
+ }
2113
+ return removeDrawerFromHistory(state);
2114
+ };
2115
+ return {
2116
+ ...router,
2117
+ type: 'drawer',
2118
+ getInitialState({
2119
+ routeNames,
2120
+ routeParamList,
2121
+ routeGetIdList
2122
+ }) {
2123
+ var state = router.getInitialState({
2124
+ routeNames,
2125
+ routeParamList,
2126
+ routeGetIdList
2127
+ });
2128
+ return {
2129
+ ...state,
2130
+ default: defaultStatus,
2131
+ stale: false,
2132
+ type: 'drawer',
2133
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
2134
+ };
2135
+ },
2136
+ getRehydratedState(partialState, {
2137
+ routeNames,
2138
+ routeParamList,
2139
+ routeGetIdList
2140
+ }) {
2141
+ if (partialState.stale === false) {
2142
+ return partialState;
2143
+ }
2144
+ var state = router.getRehydratedState(partialState, {
2145
+ routeNames,
2146
+ routeParamList,
2147
+ routeGetIdList
2148
+ });
2149
+ if (isDrawerInHistory(partialState)) {
2150
+ // Re-sync the drawer entry in history to correct it if it was wrong
2151
+ state = removeDrawerFromHistory(state);
2152
+ state = addDrawerToHistory(state);
2153
+ }
2154
+ return {
2155
+ ...state,
2156
+ default: defaultStatus,
2157
+ type: 'drawer',
2158
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
2159
+ };
2160
+ },
2161
+ getStateForRouteFocus(state, key) {
2162
+ var result = router.getStateForRouteFocus(state, key);
2163
+ return closeDrawer(result);
2164
+ },
2165
+ getStateForAction(state, action, options) {
2166
+ switch (action.type) {
2167
+ case 'OPEN_DRAWER':
2168
+ return openDrawer(state);
2169
+ case 'CLOSE_DRAWER':
2170
+ return closeDrawer(state);
2171
+ case 'TOGGLE_DRAWER':
2172
+ if (isDrawerInHistory(state)) {
2173
+ return removeDrawerFromHistory(state);
2174
+ }
2175
+ return addDrawerToHistory(state);
2176
+ case 'JUMP_TO':
2177
+ case 'NAVIGATE':
2178
+ {
2179
+ var result = router.getStateForAction(state, action, options);
2180
+ if (result != null && result.index !== state.index) {
2181
+ return closeDrawer(result);
2182
+ }
2183
+ return result;
2184
+ }
2185
+ case 'GO_BACK':
2186
+ if (isDrawerInHistory(state)) {
2187
+ return removeDrawerFromHistory(state);
2188
+ }
2189
+ return router.getStateForAction(state, action, options);
2190
+ default:
2191
+ return router.getStateForAction(state, action, options);
2192
+ }
2193
+ },
2194
+ actionCreators: DrawerActions
2195
+ };
2196
+ }
2197
+ },"a84ba97c7150cdcf5967",["b409790239ad0cd46252","e03db9aacb1ee503cd26"]);
2198
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2199
+ Object.defineProperty(exports, "__esModule", {
2200
+ value: true
2201
+ });
2202
+ exports.TabActions = undefined;
2203
+ exports.default = TabRouter;
2204
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
2205
+ var TYPE_ROUTE = 'route';
2206
+ var TabActions = exports.TabActions = {
2207
+ jumpTo(name, params) {
2208
+ return {
2209
+ type: 'JUMP_TO',
2210
+ payload: {
2211
+ name,
2212
+ params
2213
+ }
2214
+ };
2215
+ }
2216
+ };
2217
+ var getRouteHistory = (routes, index, backBehavior, initialRouteName) => {
2218
+ var history = [{
2219
+ type: TYPE_ROUTE,
2220
+ key: routes[index].key
2221
+ }];
2222
+ var initialRouteIndex;
2223
+ switch (backBehavior) {
2224
+ case 'order':
2225
+ for (var i = index; i > 0; i--) {
2226
+ history.unshift({
2227
+ type: TYPE_ROUTE,
2228
+ key: routes[i - 1].key
2229
+ });
2230
+ }
2231
+ break;
2232
+ case 'firstRoute':
2233
+ if (index !== 0) {
2234
+ history.unshift({
2235
+ type: TYPE_ROUTE,
2236
+ key: routes[0].key
2237
+ });
2238
+ }
2239
+ break;
2240
+ case 'initialRoute':
2241
+ initialRouteIndex = routes.findIndex(route => route.name === initialRouteName);
2242
+ initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;
2243
+ if (index !== initialRouteIndex) {
2244
+ history.unshift({
2245
+ type: TYPE_ROUTE,
2246
+ key: routes[initialRouteIndex].key
2247
+ });
2248
+ }
2249
+ break;
2250
+ case 'history':
2251
+ // The history will fill up on navigation
2252
+ break;
2253
+ }
2254
+ return history;
2255
+ };
2256
+ var changeIndex = (state, index, backBehavior, initialRouteName) => {
2257
+ var history;
2258
+ if (backBehavior === 'history') {
2259
+ var currentKey = state.routes[index].key;
2260
+ history = state.history.filter(it => it.type === 'route' ? it.key !== currentKey : false).concat({
2261
+ type: TYPE_ROUTE,
2262
+ key: currentKey
2263
+ });
2264
+ } else {
2265
+ history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);
2266
+ }
2267
+ return {
2268
+ ...state,
2269
+ index,
2270
+ history
2271
+ };
2272
+ };
2273
+ function TabRouter({
2274
+ initialRouteName,
2275
+ backBehavior = 'firstRoute'
2276
+ }) {
2277
+ var router = {
2278
+ ..._BaseRouter.default,
2279
+ type: 'tab',
2280
+ getInitialState({
2281
+ routeNames,
2282
+ routeParamList
2283
+ }) {
2284
+ var index = initialRouteName !== undefined && routeNames.includes(initialRouteName) ? routeNames.indexOf(initialRouteName) : 0;
2285
+ var routes = routeNames.map(name => ({
2286
+ name,
2287
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2288
+ params: routeParamList[name]
2289
+ }));
2290
+ var history = getRouteHistory(routes, index, backBehavior, initialRouteName);
2291
+ return {
2292
+ stale: false,
2293
+ type: 'tab',
2294
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2295
+ index,
2296
+ routeNames,
2297
+ history,
2298
+ routes
2299
+ };
2300
+ },
2301
+ getRehydratedState(partialState, {
2302
+ routeNames,
2303
+ routeParamList
2304
+ }) {
2305
+ var state = partialState;
2306
+ if (state.stale === false) {
2307
+ return state;
2308
+ }
2309
+ var routes = routeNames.map(name => {
2310
+ var route = state.routes.find(r => r.name === name);
2311
+ return {
2312
+ ...route,
2313
+ name,
2314
+ key: route && route.name === name && route.key ? route.key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2315
+ params: routeParamList[name] !== undefined ? {
2316
+ ...routeParamList[name],
2317
+ ...(route ? route.params : undefined)
2318
+ } : route ? route.params : undefined
2319
+ };
2320
+ });
2321
+ var index = Math.min(Math.max(routeNames.indexOf(state.routes[state?.index ?? 0]?.name), 0), routes.length - 1);
2322
+ var history = state.history?.filter(it => routes.find(r => r.key === it.key)) ?? [];
2323
+ return changeIndex({
2324
+ stale: false,
2325
+ type: 'tab',
2326
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2327
+ index,
2328
+ routeNames,
2329
+ history,
2330
+ routes
2331
+ }, index, backBehavior, initialRouteName);
2332
+ },
2333
+ getStateForRouteNamesChange(state, {
2334
+ routeNames,
2335
+ routeParamList,
2336
+ routeKeyChanges
2337
+ }) {
2338
+ var routes = routeNames.map(name => state.routes.find(r => r.name === name && !routeKeyChanges.includes(r.name)) || {
2339
+ name,
2340
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2341
+ params: routeParamList[name]
2342
+ });
2343
+ var index = Math.max(0, routeNames.indexOf(state.routes[state.index].name));
2344
+ var history = state.history.filter(
2345
+ // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)
2346
+ it => it.type !== 'route' || routes.find(r => r.key === it.key));
2347
+ if (!history.length) {
2348
+ history = getRouteHistory(routes, index, backBehavior, initialRouteName);
2349
+ }
2350
+ return {
2351
+ ...state,
2352
+ history,
2353
+ routeNames,
2354
+ routes,
2355
+ index
2356
+ };
2357
+ },
2358
+ getStateForRouteFocus(state, key) {
2359
+ var index = state.routes.findIndex(r => r.key === key);
2360
+ if (index === -1 || index === state.index) {
2361
+ return state;
2362
+ }
2363
+ return changeIndex(state, index, backBehavior, initialRouteName);
2364
+ },
2365
+ getStateForAction(state, action, {
2366
+ routeParamList,
2367
+ routeGetIdList
2368
+ }) {
2369
+ switch (action.type) {
2370
+ case 'JUMP_TO':
2371
+ case 'NAVIGATE':
2372
+ {
2373
+ var index = -1;
2374
+ if (action.type === 'NAVIGATE' && action.payload.key) {
2375
+ index = state.routes.findIndex(route => route.key === action.payload.key);
2376
+ } else {
2377
+ index = state.routes.findIndex(route => route.name === action.payload.name);
2378
+ }
2379
+ if (index === -1) {
2380
+ return null;
2381
+ }
2382
+ return changeIndex({
2383
+ ...state,
2384
+ routes: state.routes.map((route, i) => {
2385
+ if (i !== index) {
2386
+ return route;
2387
+ }
2388
+ var getId = routeGetIdList[route.name];
2389
+ var currentId = getId?.({
2390
+ params: route.params
2391
+ });
2392
+ var nextId = getId?.({
2393
+ params: action.payload.params
2394
+ });
2395
+ var key = currentId === nextId ? route.key : `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`;
2396
+ var params;
2397
+ if (action.type === 'NAVIGATE' && action.payload.merge && currentId === nextId) {
2398
+ params = action.payload.params !== undefined || routeParamList[route.name] !== undefined ? {
2399
+ ...routeParamList[route.name],
2400
+ ...route.params,
2401
+ ...action.payload.params
2402
+ } : route.params;
2403
+ } else {
2404
+ params = routeParamList[route.name] !== undefined ? {
2405
+ ...routeParamList[route.name],
2406
+ ...action.payload.params
2407
+ } : action.payload.params;
2408
+ }
2409
+ var path = action.type === 'NAVIGATE' && action.payload.path != null ? action.payload.path : route.path;
2410
+ return params !== route.params || path !== route.path ? {
2411
+ ...route,
2412
+ key,
2413
+ path,
2414
+ params
2415
+ } : route;
2416
+ })
2417
+ }, index, backBehavior, initialRouteName);
2418
+ }
2419
+ case 'GO_BACK':
2420
+ {
2421
+ if (state.history.length === 1) {
2422
+ return null;
2423
+ }
2424
+ var previousKey = state.history[state.history.length - 2].key;
2425
+ var _index = state.routes.findIndex(route => route.key === previousKey);
2426
+ if (_index === -1) {
2427
+ return null;
2428
+ }
2429
+ return {
2430
+ ...state,
2431
+ history: state.history.slice(0, -1),
2432
+ index: _index
2433
+ };
2434
+ }
2435
+ default:
2436
+ return _BaseRouter.default.getStateForAction(state, action);
2437
+ }
2438
+ },
2439
+ shouldActionChangeFocus(action) {
2440
+ return action.type === 'NAVIGATE';
2441
+ },
2442
+ actionCreators: TabActions
2443
+ };
2444
+ return router;
2445
+ }
2446
+ },"b409790239ad0cd46252",["d3b57c8ff490ba8c7c47","cc50ab09498b013d1d6d","e03db9aacb1ee503cd26"]);
2447
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2448
+ Object.defineProperty(exports, "__esModule", {
2449
+ value: true
2450
+ });
2451
+ exports.StackActions = undefined;
2452
+ exports.default = StackRouter;
2453
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
2454
+ var StackActions = exports.StackActions = {
2455
+ replace(name, params) {
2456
+ return {
2457
+ type: 'REPLACE',
2458
+ payload: {
2459
+ name,
2460
+ params
2461
+ }
2462
+ };
2463
+ },
2464
+ push(name, params) {
2465
+ return {
2466
+ type: 'PUSH',
2467
+ payload: {
2468
+ name,
2469
+ params
2470
+ }
2471
+ };
2472
+ },
2473
+ pop(count = 1) {
2474
+ return {
2475
+ type: 'POP',
2476
+ payload: {
2477
+ count
2478
+ }
2479
+ };
2480
+ },
2481
+ popToTop() {
2482
+ return {
2483
+ type: 'POP_TO_TOP'
2484
+ };
2485
+ }
2486
+ };
2487
+ function StackRouter(options) {
2488
+ var router = {
2489
+ ..._BaseRouter.default,
2490
+ type: 'stack',
2491
+ getInitialState({
2492
+ routeNames,
2493
+ routeParamList
2494
+ }) {
2495
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
2496
+ return {
2497
+ stale: false,
2498
+ type: 'stack',
2499
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2500
+ index: 0,
2501
+ routeNames,
2502
+ routes: [{
2503
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2504
+ name: initialRouteName,
2505
+ params: routeParamList[initialRouteName]
2506
+ }]
2507
+ };
2508
+ },
2509
+ getRehydratedState(partialState, {
2510
+ routeNames,
2511
+ routeParamList
2512
+ }) {
2513
+ var state = partialState;
2514
+ if (state.stale === false) {
2515
+ return state;
2516
+ }
2517
+ var routes = state.routes.filter(route => routeNames.includes(route.name)).map(route => ({
2518
+ ...route,
2519
+ key: route.key || `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2520
+ params: routeParamList[route.name] !== undefined ? {
2521
+ ...routeParamList[route.name],
2522
+ ...route.params
2523
+ } : route.params
2524
+ }));
2525
+ if (routes.length === 0) {
2526
+ var initialRouteName = options.initialRouteName !== undefined ? options.initialRouteName : routeNames[0];
2527
+ routes.push({
2528
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2529
+ name: initialRouteName,
2530
+ params: routeParamList[initialRouteName]
2531
+ });
2532
+ }
2533
+ return {
2534
+ stale: false,
2535
+ type: 'stack',
2536
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2537
+ index: routes.length - 1,
2538
+ routeNames,
2539
+ routes
2540
+ };
2541
+ },
2542
+ getStateForRouteNamesChange(state, {
2543
+ routeNames,
2544
+ routeParamList,
2545
+ routeKeyChanges
2546
+ }) {
2547
+ var routes = state.routes.filter(route => routeNames.includes(route.name) && !routeKeyChanges.includes(route.name));
2548
+ if (routes.length === 0) {
2549
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
2550
+ routes.push({
2551
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2552
+ name: initialRouteName,
2553
+ params: routeParamList[initialRouteName]
2554
+ });
2555
+ }
2556
+ return {
2557
+ ...state,
2558
+ routeNames,
2559
+ routes,
2560
+ index: Math.min(state.index, routes.length - 1)
2561
+ };
2562
+ },
2563
+ getStateForRouteFocus(state, key) {
2564
+ var index = state.routes.findIndex(r => r.key === key);
2565
+ if (index === -1 || index === state.index) {
2566
+ return state;
2567
+ }
2568
+ return {
2569
+ ...state,
2570
+ index,
2571
+ routes: state.routes.slice(0, index + 1)
2572
+ };
2573
+ },
2574
+ getStateForAction(state, action, options) {
2575
+ var routeParamList = options.routeParamList;
2576
+ switch (action.type) {
2577
+ case 'REPLACE':
2578
+ {
2579
+ var index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
2580
+ if (index === -1) {
2581
+ return null;
2582
+ }
2583
+ var _action$payload = action.payload,
2584
+ name = _action$payload.name,
2585
+ key = _action$payload.key,
2586
+ params = _action$payload.params;
2587
+ if (!state.routeNames.includes(name)) {
2588
+ return null;
2589
+ }
2590
+ return {
2591
+ ...state,
2592
+ routes: state.routes.map((route, i) => i === index ? {
2593
+ key: key !== undefined ? key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2594
+ name,
2595
+ params: routeParamList[name] !== undefined ? {
2596
+ ...routeParamList[name],
2597
+ ...params
2598
+ } : params
2599
+ } : route)
2600
+ };
2601
+ }
2602
+ case 'PUSH':
2603
+ if (state.routeNames.includes(action.payload.name)) {
2604
+ var getId = options.routeGetIdList[action.payload.name];
2605
+ var id = getId?.({
2606
+ params: action.payload.params
2607
+ });
2608
+ var route = id ? state.routes.find(route => route.name === action.payload.name && id === getId?.({
2609
+ params: route.params
2610
+ })) : undefined;
2611
+ var routes;
2612
+ if (route) {
2613
+ routes = state.routes.filter(r => r.key !== route.key);
2614
+ routes.push({
2615
+ ...route,
2616
+ params: routeParamList[action.payload.name] !== undefined ? {
2617
+ ...routeParamList[action.payload.name],
2618
+ ...action.payload.params
2619
+ } : action.payload.params
2620
+ });
2621
+ } else {
2622
+ routes = [...state.routes, {
2623
+ key: `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2624
+ name: action.payload.name,
2625
+ params: routeParamList[action.payload.name] !== undefined ? {
2626
+ ...routeParamList[action.payload.name],
2627
+ ...action.payload.params
2628
+ } : action.payload.params
2629
+ }];
2630
+ }
2631
+ return {
2632
+ ...state,
2633
+ index: routes.length - 1,
2634
+ routes
2635
+ };
2636
+ }
2637
+ return null;
2638
+ case 'POP':
2639
+ {
2640
+ var _index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
2641
+ if (_index > 0) {
2642
+ var _count = Math.max(_index - action.payload.count + 1, 1);
2643
+ var _routes = state.routes.slice(0, _count).concat(state.routes.slice(_index + 1));
2644
+ return {
2645
+ ...state,
2646
+ index: _routes.length - 1,
2647
+ routes: _routes
2648
+ };
2649
+ }
2650
+ return null;
2651
+ }
2652
+ case 'POP_TO_TOP':
2653
+ return router.getStateForAction(state, {
2654
+ type: 'POP',
2655
+ payload: {
2656
+ count: state.routes.length - 1
2657
+ }
2658
+ }, options);
2659
+ case 'NAVIGATE':
2660
+ if (action.payload.name !== undefined && !state.routeNames.includes(action.payload.name)) {
2661
+ return null;
2662
+ }
2663
+ if (action.payload.key || action.payload.name) {
2664
+ // If the route already exists, navigate to that
2665
+ var _index2 = -1;
2666
+ var _getId =
2667
+ // `getId` and `key` can't be used together
2668
+ action.payload.key === undefined && action.payload.name !== undefined ? options.routeGetIdList[action.payload.name] : undefined;
2669
+ var _id = _getId?.({
2670
+ params: action.payload.params
2671
+ });
2672
+ if (_id) {
2673
+ _index2 = state.routes.findIndex(route => route.name === action.payload.name && _id === _getId?.({
2674
+ params: route.params
2675
+ }));
2676
+ } else if (state.routes[state.index].name === action.payload.name && action.payload.key === undefined || state.routes[state.index].key === action.payload.key) {
2677
+ _index2 = state.index;
2678
+ } else {
2679
+ for (var i = state.routes.length - 1; i >= 0; i--) {
2680
+ if (state.routes[i].name === action.payload.name && action.payload.key === undefined || state.routes[i].key === action.payload.key) {
2681
+ _index2 = i;
2682
+ break;
2683
+ }
2684
+ }
2685
+ }
2686
+ if (_index2 === -1 && action.payload.key && action.payload.name === undefined) {
2687
+ return null;
2688
+ }
2689
+ if (_index2 === -1 && action.payload.name !== undefined) {
2690
+ var _routes2 = [...state.routes, {
2691
+ key: action.payload.key ?? `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2692
+ name: action.payload.name,
2693
+ path: action.payload.path,
2694
+ params: routeParamList[action.payload.name] !== undefined ? {
2695
+ ...routeParamList[action.payload.name],
2696
+ ...action.payload.params
2697
+ } : action.payload.params
2698
+ }];
2699
+ return {
2700
+ ...state,
2701
+ routes: _routes2,
2702
+ index: _routes2.length - 1
2703
+ };
2704
+ }
2705
+ var _route = state.routes[_index2];
2706
+ var _params;
2707
+ if (action.payload.merge) {
2708
+ _params = action.payload.params !== undefined || routeParamList[_route.name] !== undefined ? {
2709
+ ...routeParamList[_route.name],
2710
+ ..._route.params,
2711
+ ...action.payload.params
2712
+ } : _route.params;
2713
+ } else {
2714
+ _params = routeParamList[_route.name] !== undefined ? {
2715
+ ...routeParamList[_route.name],
2716
+ ...action.payload.params
2717
+ } : action.payload.params;
2718
+ }
2719
+ return {
2720
+ ...state,
2721
+ index: _index2,
2722
+ routes: [...state.routes.slice(0, _index2), _params !== _route.params || action.payload.path && action.payload.path !== _route.path ? {
2723
+ ..._route,
2724
+ path: action.payload.path ?? _route.path,
2725
+ params: _params
2726
+ } : state.routes[_index2]]
2727
+ };
2728
+ }
2729
+ return null;
2730
+ case 'GO_BACK':
2731
+ if (state.index > 0) {
2732
+ return router.getStateForAction(state, {
2733
+ type: 'POP',
2734
+ payload: {
2735
+ count: 1
2736
+ },
2737
+ target: action.target,
2738
+ source: action.source
2739
+ }, options);
2740
+ }
2741
+ return null;
2742
+ default:
2743
+ return _BaseRouter.default.getStateForAction(state, action);
2744
+ }
2745
+ },
2746
+ actionCreators: StackActions
2747
+ };
2748
+ return router;
2749
+ }
2750
+ },"b83a4992ae2366e63a19",["d3b57c8ff490ba8c7c47","cc50ab09498b013d1d6d","e03db9aacb1ee503cd26"]);
2751
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2752
+ Object.defineProperty(exports, "__esModule", {
2753
+ value: true
2754
+ });
2755
+ var _exportNames = {
2756
+ CommonActions: true,
2757
+ BaseRouter: true,
2758
+ DrawerActions: true,
2759
+ DrawerRouter: true,
2760
+ StackActions: true,
2761
+ StackRouter: true,
2762
+ TabActions: true,
2763
+ TabRouter: true
2764
+ };
2765
+ Object.defineProperty(exports, "BaseRouter", {
2766
+ enumerable: true,
2767
+ get: function () {
2768
+ return _BaseRouter.default;
2769
+ }
2770
+ });
2771
+ exports.CommonActions = undefined;
2772
+ Object.defineProperty(exports, "DrawerActions", {
2773
+ enumerable: true,
2774
+ get: function () {
2775
+ return _DrawerRouter.DrawerActions;
2776
+ }
2777
+ });
2778
+ Object.defineProperty(exports, "DrawerRouter", {
2779
+ enumerable: true,
2780
+ get: function () {
2781
+ return _DrawerRouter.default;
2782
+ }
2783
+ });
2784
+ Object.defineProperty(exports, "StackActions", {
2785
+ enumerable: true,
2786
+ get: function () {
2787
+ return _StackRouter.StackActions;
2788
+ }
2789
+ });
2790
+ Object.defineProperty(exports, "StackRouter", {
2791
+ enumerable: true,
2792
+ get: function () {
2793
+ return _StackRouter.default;
2794
+ }
2795
+ });
2796
+ Object.defineProperty(exports, "TabActions", {
2797
+ enumerable: true,
2798
+ get: function () {
2799
+ return _TabRouter.TabActions;
2800
+ }
2801
+ });
2802
+ Object.defineProperty(exports, "TabRouter", {
2803
+ enumerable: true,
2804
+ get: function () {
2805
+ return _TabRouter.default;
2806
+ }
2807
+ });
2808
+ var CommonActions = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
2809
+ exports.CommonActions = CommonActions;
2810
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[1])(_$$_REQUIRE(_dependencyMap[2]));
2811
+ var _DrawerRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[3]));
2812
+ var _StackRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[4]));
2813
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[5]));
2814
+ Object.keys(_$$_REQUIRE(_dependencyMap[6])).forEach(function (key) {
2815
+ if (key === "default" || key === "__esModule") return;
2816
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
2817
+ if (key in exports && exports[key] === _$$_REQUIRE(_dependencyMap[6])[key]) return;
2818
+ Object.defineProperty(exports, key, {
2819
+ enumerable: true,
2820
+ get: function () {
2821
+ return _$$_REQUIRE(_dependencyMap[6])[key];
2822
+ }
2823
+ });
2824
+ });
2825
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
2826
+ },"683d3e0e1152b4734793",["000944072e226c3923ad","d3b57c8ff490ba8c7c47","cc50ab09498b013d1d6d","a84ba97c7150cdcf5967","b83a4992ae2366e63a19","b409790239ad0cd46252","2ad167c587979ba4fdb7"]);
2827
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2828
+ Object.defineProperty(exports, "__esModule", {
2829
+ value: true
2830
+ });
2831
+ },"2ad167c587979ba4fdb7",[]);