1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | (function (global, factory) {
|
8 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/platform-browser')) :
|
9 | typeof define === 'function' && define.amd ? define('@angular/router', ['exports', '@angular/common', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/platform-browser'], factory) :
|
10 | (global = global || self, factory((global.ng = global.ng || {}, global.ng.router = {}), global.ng.common, global.ng.core, global.rxjs, global.rxjs.operators, global.ng.platformBrowser));
|
11 | }(this, function (exports, common, core, rxjs, operators, platformBrowser) { 'use strict';
|
12 |
|
13 | |
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | var extendStatics = function(d, b) {
|
30 | extendStatics = Object.setPrototypeOf ||
|
31 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
32 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
33 | return extendStatics(d, b);
|
34 | };
|
35 |
|
36 | function __extends(d, b) {
|
37 | extendStatics(d, b);
|
38 | function __() { this.constructor = d; }
|
39 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
40 | }
|
41 |
|
42 | var __assign = function() {
|
43 | __assign = Object.assign || function __assign(t) {
|
44 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
45 | s = arguments[i];
|
46 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
47 | }
|
48 | return t;
|
49 | };
|
50 | return __assign.apply(this, arguments);
|
51 | };
|
52 |
|
53 | function __decorate(decorators, target, key, desc) {
|
54 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
55 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
56 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
57 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
58 | }
|
59 |
|
60 | function __param(paramIndex, decorator) {
|
61 | return function (target, key) { decorator(target, key, paramIndex); }
|
62 | }
|
63 |
|
64 | function __metadata(metadataKey, metadataValue) {
|
65 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
66 | }
|
67 |
|
68 | function __values(o) {
|
69 | var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
70 | if (m) return m.call(o);
|
71 | return {
|
72 | next: function () {
|
73 | if (o && i >= o.length) o = void 0;
|
74 | return { value: o && o[i++], done: !o };
|
75 | }
|
76 | };
|
77 | }
|
78 |
|
79 | function __read(o, n) {
|
80 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
81 | if (!m) return o;
|
82 | var i = m.call(o), r, ar = [], e;
|
83 | try {
|
84 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
85 | }
|
86 | catch (error) { e = { error: error }; }
|
87 | finally {
|
88 | try {
|
89 | if (r && !r.done && (m = i["return"])) m.call(i);
|
90 | }
|
91 | finally { if (e) throw e.error; }
|
92 | }
|
93 | return ar;
|
94 | }
|
95 |
|
96 | function __spread() {
|
97 | for (var ar = [], i = 0; i < arguments.length; i++)
|
98 | ar = ar.concat(__read(arguments[i]));
|
99 | return ar;
|
100 | }
|
101 |
|
102 | |
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | |
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 | var RouterEvent = (function () {
|
132 | function RouterEvent(
|
133 | /** @docsNotRequired */
|
134 | id,
|
135 | /** @docsNotRequired */
|
136 | url) {
|
137 | this.id = id;
|
138 | this.url = url;
|
139 | }
|
140 | return RouterEvent;
|
141 | }());
|
142 | |
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 | var NavigationStart = (function (_super) {
|
150 | __extends(NavigationStart, _super);
|
151 | function NavigationStart(
|
152 | /** @docsNotRequired */
|
153 | id,
|
154 | /** @docsNotRequired */
|
155 | url,
|
156 | /** @docsNotRequired */
|
157 | navigationTrigger,
|
158 | /** @docsNotRequired */
|
159 | restoredState) {
|
160 | if (navigationTrigger === void 0) { navigationTrigger = 'imperative'; }
|
161 | if (restoredState === void 0) { restoredState = null; }
|
162 | var _this = _super.call(this, id, url) || this;
|
163 | _this.navigationTrigger = navigationTrigger;
|
164 | _this.restoredState = restoredState;
|
165 | return _this;
|
166 | }
|
167 |
|
168 | NavigationStart.prototype.toString = function () { return "NavigationStart(id: " + this.id + ", url: '" + this.url + "')"; };
|
169 | return NavigationStart;
|
170 | }(RouterEvent));
|
171 | |
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 | var NavigationEnd = (function (_super) {
|
179 | __extends(NavigationEnd, _super);
|
180 | function NavigationEnd(
|
181 | /** @docsNotRequired */
|
182 | id,
|
183 | /** @docsNotRequired */
|
184 | url,
|
185 | /** @docsNotRequired */
|
186 | urlAfterRedirects) {
|
187 | var _this = _super.call(this, id, url) || this;
|
188 | _this.urlAfterRedirects = urlAfterRedirects;
|
189 | return _this;
|
190 | }
|
191 |
|
192 | NavigationEnd.prototype.toString = function () {
|
193 | return "NavigationEnd(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "')";
|
194 | };
|
195 | return NavigationEnd;
|
196 | }(RouterEvent));
|
197 | |
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 | var NavigationCancel = (function (_super) {
|
205 | __extends(NavigationCancel, _super);
|
206 | function NavigationCancel(
|
207 | /** @docsNotRequired */
|
208 | id,
|
209 | /** @docsNotRequired */
|
210 | url,
|
211 | /** @docsNotRequired */
|
212 | reason) {
|
213 | var _this = _super.call(this, id, url) || this;
|
214 | _this.reason = reason;
|
215 | return _this;
|
216 | }
|
217 |
|
218 | NavigationCancel.prototype.toString = function () { return "NavigationCancel(id: " + this.id + ", url: '" + this.url + "')"; };
|
219 | return NavigationCancel;
|
220 | }(RouterEvent));
|
221 | |
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 | var NavigationError = (function (_super) {
|
229 | __extends(NavigationError, _super);
|
230 | function NavigationError(
|
231 | /** @docsNotRequired */
|
232 | id,
|
233 | /** @docsNotRequired */
|
234 | url,
|
235 | /** @docsNotRequired */
|
236 | error) {
|
237 | var _this = _super.call(this, id, url) || this;
|
238 | _this.error = error;
|
239 | return _this;
|
240 | }
|
241 |
|
242 | NavigationError.prototype.toString = function () {
|
243 | return "NavigationError(id: " + this.id + ", url: '" + this.url + "', error: " + this.error + ")";
|
244 | };
|
245 | return NavigationError;
|
246 | }(RouterEvent));
|
247 | |
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 | var RoutesRecognized = (function (_super) {
|
255 | __extends(RoutesRecognized, _super);
|
256 | function RoutesRecognized(
|
257 | /** @docsNotRequired */
|
258 | id,
|
259 | /** @docsNotRequired */
|
260 | url,
|
261 | /** @docsNotRequired */
|
262 | urlAfterRedirects,
|
263 | /** @docsNotRequired */
|
264 | state) {
|
265 | var _this = _super.call(this, id, url) || this;
|
266 | _this.urlAfterRedirects = urlAfterRedirects;
|
267 | _this.state = state;
|
268 | return _this;
|
269 | }
|
270 |
|
271 | RoutesRecognized.prototype.toString = function () {
|
272 | return "RoutesRecognized(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "', state: " + this.state + ")";
|
273 | };
|
274 | return RoutesRecognized;
|
275 | }(RouterEvent));
|
276 | |
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 | var GuardsCheckStart = (function (_super) {
|
284 | __extends(GuardsCheckStart, _super);
|
285 | function GuardsCheckStart(
|
286 | /** @docsNotRequired */
|
287 | id,
|
288 | /** @docsNotRequired */
|
289 | url,
|
290 | /** @docsNotRequired */
|
291 | urlAfterRedirects,
|
292 | /** @docsNotRequired */
|
293 | state) {
|
294 | var _this = _super.call(this, id, url) || this;
|
295 | _this.urlAfterRedirects = urlAfterRedirects;
|
296 | _this.state = state;
|
297 | return _this;
|
298 | }
|
299 | GuardsCheckStart.prototype.toString = function () {
|
300 | return "GuardsCheckStart(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "', state: " + this.state + ")";
|
301 | };
|
302 | return GuardsCheckStart;
|
303 | }(RouterEvent));
|
304 | |
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 | var GuardsCheckEnd = (function (_super) {
|
312 | __extends(GuardsCheckEnd, _super);
|
313 | function GuardsCheckEnd(
|
314 | /** @docsNotRequired */
|
315 | id,
|
316 | /** @docsNotRequired */
|
317 | url,
|
318 | /** @docsNotRequired */
|
319 | urlAfterRedirects,
|
320 | /** @docsNotRequired */
|
321 | state,
|
322 | /** @docsNotRequired */
|
323 | shouldActivate) {
|
324 | var _this = _super.call(this, id, url) || this;
|
325 | _this.urlAfterRedirects = urlAfterRedirects;
|
326 | _this.state = state;
|
327 | _this.shouldActivate = shouldActivate;
|
328 | return _this;
|
329 | }
|
330 | GuardsCheckEnd.prototype.toString = function () {
|
331 | return "GuardsCheckEnd(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "', state: " + this.state + ", shouldActivate: " + this.shouldActivate + ")";
|
332 | };
|
333 | return GuardsCheckEnd;
|
334 | }(RouterEvent));
|
335 | |
336 |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 | var ResolveStart = (function (_super) {
|
346 | __extends(ResolveStart, _super);
|
347 | function ResolveStart(
|
348 | /** @docsNotRequired */
|
349 | id,
|
350 | /** @docsNotRequired */
|
351 | url,
|
352 | /** @docsNotRequired */
|
353 | urlAfterRedirects,
|
354 | /** @docsNotRequired */
|
355 | state) {
|
356 | var _this = _super.call(this, id, url) || this;
|
357 | _this.urlAfterRedirects = urlAfterRedirects;
|
358 | _this.state = state;
|
359 | return _this;
|
360 | }
|
361 | ResolveStart.prototype.toString = function () {
|
362 | return "ResolveStart(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "', state: " + this.state + ")";
|
363 | };
|
364 | return ResolveStart;
|
365 | }(RouterEvent));
|
366 | |
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 | var ResolveEnd = (function (_super) {
|
375 | __extends(ResolveEnd, _super);
|
376 | function ResolveEnd(
|
377 | /** @docsNotRequired */
|
378 | id,
|
379 | /** @docsNotRequired */
|
380 | url,
|
381 | /** @docsNotRequired */
|
382 | urlAfterRedirects,
|
383 | /** @docsNotRequired */
|
384 | state) {
|
385 | var _this = _super.call(this, id, url) || this;
|
386 | _this.urlAfterRedirects = urlAfterRedirects;
|
387 | _this.state = state;
|
388 | return _this;
|
389 | }
|
390 | ResolveEnd.prototype.toString = function () {
|
391 | return "ResolveEnd(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "', state: " + this.state + ")";
|
392 | };
|
393 | return ResolveEnd;
|
394 | }(RouterEvent));
|
395 | |
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 | var RouteConfigLoadStart = (function () {
|
403 | function RouteConfigLoadStart(
|
404 | /** @docsNotRequired */
|
405 | route) {
|
406 | this.route = route;
|
407 | }
|
408 | RouteConfigLoadStart.prototype.toString = function () { return "RouteConfigLoadStart(path: " + this.route.path + ")"; };
|
409 | return RouteConfigLoadStart;
|
410 | }());
|
411 | |
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 | var RouteConfigLoadEnd = (function () {
|
419 | function RouteConfigLoadEnd(
|
420 | /** @docsNotRequired */
|
421 | route) {
|
422 | this.route = route;
|
423 | }
|
424 | RouteConfigLoadEnd.prototype.toString = function () { return "RouteConfigLoadEnd(path: " + this.route.path + ")"; };
|
425 | return RouteConfigLoadEnd;
|
426 | }());
|
427 | |
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 | var ChildActivationStart = (function () {
|
436 | function ChildActivationStart(
|
437 | /** @docsNotRequired */
|
438 | snapshot) {
|
439 | this.snapshot = snapshot;
|
440 | }
|
441 | ChildActivationStart.prototype.toString = function () {
|
442 | var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
|
443 | return "ChildActivationStart(path: '" + path + "')";
|
444 | };
|
445 | return ChildActivationStart;
|
446 | }());
|
447 | |
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 | var ChildActivationEnd = (function () {
|
456 | function ChildActivationEnd(
|
457 | /** @docsNotRequired */
|
458 | snapshot) {
|
459 | this.snapshot = snapshot;
|
460 | }
|
461 | ChildActivationEnd.prototype.toString = function () {
|
462 | var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
|
463 | return "ChildActivationEnd(path: '" + path + "')";
|
464 | };
|
465 | return ChildActivationEnd;
|
466 | }());
|
467 | |
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 | var ActivationStart = (function () {
|
476 | function ActivationStart(
|
477 | /** @docsNotRequired */
|
478 | snapshot) {
|
479 | this.snapshot = snapshot;
|
480 | }
|
481 | ActivationStart.prototype.toString = function () {
|
482 | var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
|
483 | return "ActivationStart(path: '" + path + "')";
|
484 | };
|
485 | return ActivationStart;
|
486 | }());
|
487 | |
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 | var ActivationEnd = (function () {
|
496 | function ActivationEnd(
|
497 | /** @docsNotRequired */
|
498 | snapshot) {
|
499 | this.snapshot = snapshot;
|
500 | }
|
501 | ActivationEnd.prototype.toString = function () {
|
502 | var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
|
503 | return "ActivationEnd(path: '" + path + "')";
|
504 | };
|
505 | return ActivationEnd;
|
506 | }());
|
507 | |
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 | var Scroll = (function () {
|
515 | function Scroll(
|
516 | /** @docsNotRequired */
|
517 | routerEvent,
|
518 | /** @docsNotRequired */
|
519 | position,
|
520 | /** @docsNotRequired */
|
521 | anchor) {
|
522 | this.routerEvent = routerEvent;
|
523 | this.position = position;
|
524 | this.anchor = anchor;
|
525 | }
|
526 | Scroll.prototype.toString = function () {
|
527 | var pos = this.position ? this.position[0] + ", " + this.position[1] : null;
|
528 | return "Scroll(anchor: '" + this.anchor + "', position: '" + pos + "')";
|
529 | };
|
530 | return Scroll;
|
531 | }());
|
532 |
|
533 | |
534 |
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 | |
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 | var ɵEmptyOutletComponent = (function () {
|
550 | function ɵEmptyOutletComponent() {
|
551 | }
|
552 | ɵEmptyOutletComponent = __decorate([
|
553 | core.Component({ template: "<router-outlet></router-outlet>" })
|
554 | ], ɵEmptyOutletComponent);
|
555 | return ɵEmptyOutletComponent;
|
556 | }());
|
557 |
|
558 | |
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 | |
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 | var PRIMARY_OUTLET = 'primary';
|
573 | var ParamsAsMap = (function () {
|
574 | function ParamsAsMap(params) {
|
575 | this.params = params || {};
|
576 | }
|
577 | ParamsAsMap.prototype.has = function (name) { return this.params.hasOwnProperty(name); };
|
578 | ParamsAsMap.prototype.get = function (name) {
|
579 | if (this.has(name)) {
|
580 | var v = this.params[name];
|
581 | return Array.isArray(v) ? v[0] : v;
|
582 | }
|
583 | return null;
|
584 | };
|
585 | ParamsAsMap.prototype.getAll = function (name) {
|
586 | if (this.has(name)) {
|
587 | var v = this.params[name];
|
588 | return Array.isArray(v) ? v : [v];
|
589 | }
|
590 | return [];
|
591 | };
|
592 | Object.defineProperty(ParamsAsMap.prototype, "keys", {
|
593 | get: function () { return Object.keys(this.params); },
|
594 | enumerable: true,
|
595 | configurable: true
|
596 | });
|
597 | return ParamsAsMap;
|
598 | }());
|
599 | |
600 |
|
601 |
|
602 |
|
603 |
|
604 | function convertToParamMap(params) {
|
605 | return new ParamsAsMap(params);
|
606 | }
|
607 | var NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
|
608 | function navigationCancelingError(message) {
|
609 | var error = Error('NavigationCancelingError: ' + message);
|
610 | error[NAVIGATION_CANCELING_ERROR] = true;
|
611 | return error;
|
612 | }
|
613 | function isNavigationCancelingError(error) {
|
614 | return error && error[NAVIGATION_CANCELING_ERROR];
|
615 | }
|
616 |
|
617 | function defaultUrlMatcher(segments, segmentGroup, route) {
|
618 | var parts = route.path.split('/');
|
619 | if (parts.length > segments.length) {
|
620 |
|
621 | return null;
|
622 | }
|
623 | if (route.pathMatch === 'full' &&
|
624 | (segmentGroup.hasChildren() || parts.length < segments.length)) {
|
625 |
|
626 | return null;
|
627 | }
|
628 | var posParams = {};
|
629 |
|
630 | for (var index = 0; index < parts.length; index++) {
|
631 | var part = parts[index];
|
632 | var segment = segments[index];
|
633 | var isParameter = part.startsWith(':');
|
634 | if (isParameter) {
|
635 | posParams[part.substring(1)] = segment;
|
636 | }
|
637 | else if (part !== segment.path) {
|
638 |
|
639 | return null;
|
640 | }
|
641 | }
|
642 | return { consumed: segments.slice(0, parts.length), posParams: posParams };
|
643 | }
|
644 |
|
645 | |
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 | var LoadedRouterConfig = (function () {
|
653 | function LoadedRouterConfig(routes, module) {
|
654 | this.routes = routes;
|
655 | this.module = module;
|
656 | }
|
657 | return LoadedRouterConfig;
|
658 | }());
|
659 | function validateConfig(config, parentPath) {
|
660 | if (parentPath === void 0) { parentPath = ''; }
|
661 |
|
662 | for (var i = 0; i < config.length; i++) {
|
663 | var route = config[i];
|
664 | var fullPath = getFullPath(parentPath, route);
|
665 | validateNode(route, fullPath);
|
666 | }
|
667 | }
|
668 | function validateNode(route, fullPath) {
|
669 | if (!route) {
|
670 | throw new Error("\n Invalid configuration of route '" + fullPath + "': Encountered undefined route.\n The reason might be an extra comma.\n\n Example:\n const routes: Routes = [\n { path: '', redirectTo: '/dashboard', pathMatch: 'full' },\n { path: 'dashboard', component: DashboardComponent },, << two commas\n { path: 'detail/:id', component: HeroDetailComponent }\n ];\n ");
|
671 | }
|
672 | if (Array.isArray(route)) {
|
673 | throw new Error("Invalid configuration of route '" + fullPath + "': Array cannot be specified");
|
674 | }
|
675 | if (!route.component && !route.children && !route.loadChildren &&
|
676 | (route.outlet && route.outlet !== PRIMARY_OUTLET)) {
|
677 | throw new Error("Invalid configuration of route '" + fullPath + "': a componentless route without children or loadChildren cannot have a named outlet set");
|
678 | }
|
679 | if (route.redirectTo && route.children) {
|
680 | throw new Error("Invalid configuration of route '" + fullPath + "': redirectTo and children cannot be used together");
|
681 | }
|
682 | if (route.redirectTo && route.loadChildren) {
|
683 | throw new Error("Invalid configuration of route '" + fullPath + "': redirectTo and loadChildren cannot be used together");
|
684 | }
|
685 | if (route.children && route.loadChildren) {
|
686 | throw new Error("Invalid configuration of route '" + fullPath + "': children and loadChildren cannot be used together");
|
687 | }
|
688 | if (route.redirectTo && route.component) {
|
689 | throw new Error("Invalid configuration of route '" + fullPath + "': redirectTo and component cannot be used together");
|
690 | }
|
691 | if (route.path && route.matcher) {
|
692 | throw new Error("Invalid configuration of route '" + fullPath + "': path and matcher cannot be used together");
|
693 | }
|
694 | if (route.redirectTo === void 0 && !route.component && !route.children && !route.loadChildren) {
|
695 | throw new Error("Invalid configuration of route '" + fullPath + "'. One of the following must be provided: component, redirectTo, children or loadChildren");
|
696 | }
|
697 | if (route.path === void 0 && route.matcher === void 0) {
|
698 | throw new Error("Invalid configuration of route '" + fullPath + "': routes must have either a path or a matcher specified");
|
699 | }
|
700 | if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
|
701 | throw new Error("Invalid configuration of route '" + fullPath + "': path cannot start with a slash");
|
702 | }
|
703 | if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
|
704 | var exp = "The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.";
|
705 | throw new Error("Invalid configuration of route '{path: \"" + fullPath + "\", redirectTo: \"" + route.redirectTo + "\"}': please provide 'pathMatch'. " + exp);
|
706 | }
|
707 | if (route.pathMatch !== void 0 && route.pathMatch !== 'full' && route.pathMatch !== 'prefix') {
|
708 | throw new Error("Invalid configuration of route '" + fullPath + "': pathMatch can only be set to 'prefix' or 'full'");
|
709 | }
|
710 | if (route.children) {
|
711 | validateConfig(route.children, fullPath);
|
712 | }
|
713 | }
|
714 | function getFullPath(parentPath, currentRoute) {
|
715 | if (!currentRoute) {
|
716 | return parentPath;
|
717 | }
|
718 | if (!parentPath && !currentRoute.path) {
|
719 | return '';
|
720 | }
|
721 | else if (parentPath && !currentRoute.path) {
|
722 | return parentPath + "/";
|
723 | }
|
724 | else if (!parentPath && currentRoute.path) {
|
725 | return currentRoute.path;
|
726 | }
|
727 | else {
|
728 | return parentPath + "/" + currentRoute.path;
|
729 | }
|
730 | }
|
731 | |
732 |
|
733 |
|
734 | function standardizeConfig(r) {
|
735 | var children = r.children && r.children.map(standardizeConfig);
|
736 | var c = children ? __assign({}, r, { children: children }) : __assign({}, r);
|
737 | if (!c.component && (children || c.loadChildren) && (c.outlet && c.outlet !== PRIMARY_OUTLET)) {
|
738 | c.component = ɵEmptyOutletComponent;
|
739 | }
|
740 | return c;
|
741 | }
|
742 |
|
743 | |
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 | function shallowEqualArrays(a, b) {
|
751 | if (a.length !== b.length)
|
752 | return false;
|
753 | for (var i = 0; i < a.length; ++i) {
|
754 | if (!shallowEqual(a[i], b[i]))
|
755 | return false;
|
756 | }
|
757 | return true;
|
758 | }
|
759 | function shallowEqual(a, b) {
|
760 |
|
761 |
|
762 |
|
763 |
|
764 | var k1 = Object.keys(a);
|
765 | var k2 = Object.keys(b);
|
766 | if (!k1 || !k2 || k1.length != k2.length) {
|
767 | return false;
|
768 | }
|
769 | var key;
|
770 | for (var i = 0; i < k1.length; i++) {
|
771 | key = k1[i];
|
772 | if (a[key] !== b[key]) {
|
773 | return false;
|
774 | }
|
775 | }
|
776 | return true;
|
777 | }
|
778 | |
779 |
|
780 |
|
781 | function flatten(arr) {
|
782 | return Array.prototype.concat.apply([], arr);
|
783 | }
|
784 | |
785 |
|
786 |
|
787 | function last(a) {
|
788 | return a.length > 0 ? a[a.length - 1] : null;
|
789 | }
|
790 | function forEach(map, callback) {
|
791 | for (var prop in map) {
|
792 | if (map.hasOwnProperty(prop)) {
|
793 | callback(map[prop], prop);
|
794 | }
|
795 | }
|
796 | }
|
797 | function waitForMap(obj, fn) {
|
798 | if (Object.keys(obj).length === 0) {
|
799 | return rxjs.of({});
|
800 | }
|
801 | var waitHead = [];
|
802 | var waitTail = [];
|
803 | var res = {};
|
804 | forEach(obj, function (a, k) {
|
805 | var mapped = fn(k, a).pipe(operators.map(function (r) { return res[k] = r; }));
|
806 | if (k === PRIMARY_OUTLET) {
|
807 | waitHead.push(mapped);
|
808 | }
|
809 | else {
|
810 | waitTail.push(mapped);
|
811 | }
|
812 | });
|
813 |
|
814 | return rxjs.of.apply(null, waitHead.concat(waitTail)).pipe(operators.concatAll(), operators.last(), operators.map(function () { return res; }));
|
815 | }
|
816 | function wrapIntoObservable(value) {
|
817 | if (core.ɵisObservable(value)) {
|
818 | return value;
|
819 | }
|
820 | if (core.ɵisPromise(value)) {
|
821 |
|
822 |
|
823 |
|
824 | return rxjs.from(Promise.resolve(value));
|
825 | }
|
826 | return rxjs.of(value);
|
827 | }
|
828 |
|
829 | |
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 | function createEmptyUrlTree() {
|
837 | return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
|
838 | }
|
839 | function containsTree(container, containee, exact) {
|
840 | if (exact) {
|
841 | return equalQueryParams(container.queryParams, containee.queryParams) &&
|
842 | equalSegmentGroups(container.root, containee.root);
|
843 | }
|
844 | return containsQueryParams(container.queryParams, containee.queryParams) &&
|
845 | containsSegmentGroup(container.root, containee.root);
|
846 | }
|
847 | function equalQueryParams(container, containee) {
|
848 |
|
849 | return shallowEqual(container, containee);
|
850 | }
|
851 | function equalSegmentGroups(container, containee) {
|
852 | if (!equalPath(container.segments, containee.segments))
|
853 | return false;
|
854 | if (container.numberOfChildren !== containee.numberOfChildren)
|
855 | return false;
|
856 | for (var c in containee.children) {
|
857 | if (!container.children[c])
|
858 | return false;
|
859 | if (!equalSegmentGroups(container.children[c], containee.children[c]))
|
860 | return false;
|
861 | }
|
862 | return true;
|
863 | }
|
864 | function containsQueryParams(container, containee) {
|
865 |
|
866 | return Object.keys(containee).length <= Object.keys(container).length &&
|
867 | Object.keys(containee).every(function (key) { return containee[key] === container[key]; });
|
868 | }
|
869 | function containsSegmentGroup(container, containee) {
|
870 | return containsSegmentGroupHelper(container, containee, containee.segments);
|
871 | }
|
872 | function containsSegmentGroupHelper(container, containee, containeePaths) {
|
873 | if (container.segments.length > containeePaths.length) {
|
874 | var current = container.segments.slice(0, containeePaths.length);
|
875 | if (!equalPath(current, containeePaths))
|
876 | return false;
|
877 | if (containee.hasChildren())
|
878 | return false;
|
879 | return true;
|
880 | }
|
881 | else if (container.segments.length === containeePaths.length) {
|
882 | if (!equalPath(container.segments, containeePaths))
|
883 | return false;
|
884 | for (var c in containee.children) {
|
885 | if (!container.children[c])
|
886 | return false;
|
887 | if (!containsSegmentGroup(container.children[c], containee.children[c]))
|
888 | return false;
|
889 | }
|
890 | return true;
|
891 | }
|
892 | else {
|
893 | var current = containeePaths.slice(0, container.segments.length);
|
894 | var next = containeePaths.slice(container.segments.length);
|
895 | if (!equalPath(container.segments, current))
|
896 | return false;
|
897 | if (!container.children[PRIMARY_OUTLET])
|
898 | return false;
|
899 | return containsSegmentGroupHelper(container.children[PRIMARY_OUTLET], containee, next);
|
900 | }
|
901 | }
|
902 | |
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 | var UrlTree = (function () {
|
933 |
|
934 | function UrlTree(
|
935 | /** The root segment group of the URL tree */
|
936 | root,
|
937 | /** The query params of the URL */
|
938 | queryParams,
|
939 | /** The fragment of the URL */
|
940 | fragment) {
|
941 | this.root = root;
|
942 | this.queryParams = queryParams;
|
943 | this.fragment = fragment;
|
944 | }
|
945 | Object.defineProperty(UrlTree.prototype, "queryParamMap", {
|
946 | get: function () {
|
947 | if (!this._queryParamMap) {
|
948 | this._queryParamMap = convertToParamMap(this.queryParams);
|
949 | }
|
950 | return this._queryParamMap;
|
951 | },
|
952 | enumerable: true,
|
953 | configurable: true
|
954 | });
|
955 |
|
956 | UrlTree.prototype.toString = function () { return DEFAULT_SERIALIZER.serialize(this); };
|
957 | return UrlTree;
|
958 | }());
|
959 | |
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 | var UrlSegmentGroup = (function () {
|
969 | function UrlSegmentGroup(
|
970 | /** The URL segments of this group. See `UrlSegment` for more information */
|
971 | segments,
|
972 | /** The list of children of this group */
|
973 | children) {
|
974 | var _this = this;
|
975 | this.segments = segments;
|
976 | this.children = children;
|
977 |
|
978 | this.parent = null;
|
979 | forEach(children, function (v, k) { return v.parent = _this; });
|
980 | }
|
981 |
|
982 | UrlSegmentGroup.prototype.hasChildren = function () { return this.numberOfChildren > 0; };
|
983 | Object.defineProperty(UrlSegmentGroup.prototype, "numberOfChildren", {
|
984 |
|
985 | get: function () { return Object.keys(this.children).length; },
|
986 | enumerable: true,
|
987 | configurable: true
|
988 | });
|
989 |
|
990 | UrlSegmentGroup.prototype.toString = function () { return serializePaths(this); };
|
991 | return UrlSegmentGroup;
|
992 | }());
|
993 | |
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 | var UrlSegment = (function () {
|
1020 | function UrlSegment(
|
1021 | /** The path part of a URL segment */
|
1022 | path,
|
1023 | /** The matrix parameters associated with a segment */
|
1024 | parameters) {
|
1025 | this.path = path;
|
1026 | this.parameters = parameters;
|
1027 | }
|
1028 | Object.defineProperty(UrlSegment.prototype, "parameterMap", {
|
1029 | get: function () {
|
1030 | if (!this._parameterMap) {
|
1031 | this._parameterMap = convertToParamMap(this.parameters);
|
1032 | }
|
1033 | return this._parameterMap;
|
1034 | },
|
1035 | enumerable: true,
|
1036 | configurable: true
|
1037 | });
|
1038 |
|
1039 | UrlSegment.prototype.toString = function () { return serializePath(this); };
|
1040 | return UrlSegment;
|
1041 | }());
|
1042 | function equalSegments(as, bs) {
|
1043 | return equalPath(as, bs) && as.every(function (a, i) { return shallowEqual(a.parameters, bs[i].parameters); });
|
1044 | }
|
1045 | function equalPath(as, bs) {
|
1046 | if (as.length !== bs.length)
|
1047 | return false;
|
1048 | return as.every(function (a, i) { return a.path === bs[i].path; });
|
1049 | }
|
1050 | function mapChildrenIntoArray(segment, fn) {
|
1051 | var res = [];
|
1052 | forEach(segment.children, function (child, childOutlet) {
|
1053 | if (childOutlet === PRIMARY_OUTLET) {
|
1054 | res = res.concat(fn(child, childOutlet));
|
1055 | }
|
1056 | });
|
1057 | forEach(segment.children, function (child, childOutlet) {
|
1058 | if (childOutlet !== PRIMARY_OUTLET) {
|
1059 | res = res.concat(fn(child, childOutlet));
|
1060 | }
|
1061 | });
|
1062 | return res;
|
1063 | }
|
1064 | |
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 | var UrlSerializer = (function () {
|
1077 | function UrlSerializer() {
|
1078 | }
|
1079 | return UrlSerializer;
|
1080 | }());
|
1081 | |
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 | var DefaultUrlSerializer = (function () {
|
1100 | function DefaultUrlSerializer() {
|
1101 | }
|
1102 |
|
1103 | DefaultUrlSerializer.prototype.parse = function (url) {
|
1104 | var p = new UrlParser(url);
|
1105 | return new UrlTree(p.parseRootSegment(), p.parseQueryParams(), p.parseFragment());
|
1106 | };
|
1107 |
|
1108 | DefaultUrlSerializer.prototype.serialize = function (tree) {
|
1109 | var segment = "/" + serializeSegment(tree.root, true);
|
1110 | var query = serializeQueryParams(tree.queryParams);
|
1111 | var fragment = typeof tree.fragment === "string" ? "#" + encodeUriFragment(tree.fragment) : '';
|
1112 | return "" + segment + query + fragment;
|
1113 | };
|
1114 | return DefaultUrlSerializer;
|
1115 | }());
|
1116 | var DEFAULT_SERIALIZER = new DefaultUrlSerializer();
|
1117 | function serializePaths(segment) {
|
1118 | return segment.segments.map(function (p) { return serializePath(p); }).join('/');
|
1119 | }
|
1120 | function serializeSegment(segment, root) {
|
1121 | if (!segment.hasChildren()) {
|
1122 | return serializePaths(segment);
|
1123 | }
|
1124 | if (root) {
|
1125 | var primary = segment.children[PRIMARY_OUTLET] ?
|
1126 | serializeSegment(segment.children[PRIMARY_OUTLET], false) :
|
1127 | '';
|
1128 | var children_1 = [];
|
1129 | forEach(segment.children, function (v, k) {
|
1130 | if (k !== PRIMARY_OUTLET) {
|
1131 | children_1.push(k + ":" + serializeSegment(v, false));
|
1132 | }
|
1133 | });
|
1134 | return children_1.length > 0 ? primary + "(" + children_1.join('//') + ")" : primary;
|
1135 | }
|
1136 | else {
|
1137 | var children = mapChildrenIntoArray(segment, function (v, k) {
|
1138 | if (k === PRIMARY_OUTLET) {
|
1139 | return [serializeSegment(segment.children[PRIMARY_OUTLET], false)];
|
1140 | }
|
1141 | return [k + ":" + serializeSegment(v, false)];
|
1142 | });
|
1143 | return serializePaths(segment) + "/(" + children.join('//') + ")";
|
1144 | }
|
1145 | }
|
1146 | |
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 | function encodeUriString(s) {
|
1153 | return encodeURIComponent(s)
|
1154 | .replace(/%40/g, '@')
|
1155 | .replace(/%3A/gi, ':')
|
1156 | .replace(/%24/g, '$')
|
1157 | .replace(/%2C/gi, ',');
|
1158 | }
|
1159 | |
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 | function encodeUriQuery(s) {
|
1166 | return encodeUriString(s).replace(/%3B/gi, ';');
|
1167 | }
|
1168 | |
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 | function encodeUriFragment(s) {
|
1175 | return encodeURI(s);
|
1176 | }
|
1177 | |
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 | function encodeUriSegment(s) {
|
1185 | return encodeUriString(s).replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/%26/gi, '&');
|
1186 | }
|
1187 | function decode(s) {
|
1188 | return decodeURIComponent(s);
|
1189 | }
|
1190 |
|
1191 |
|
1192 | function decodeQuery(s) {
|
1193 | return decode(s.replace(/\+/g, '%20'));
|
1194 | }
|
1195 | function serializePath(path) {
|
1196 | return "" + encodeUriSegment(path.path) + serializeMatrixParams(path.parameters);
|
1197 | }
|
1198 | function serializeMatrixParams(params) {
|
1199 | return Object.keys(params)
|
1200 | .map(function (key) { return ";" + encodeUriSegment(key) + "=" + encodeUriSegment(params[key]); })
|
1201 | .join('');
|
1202 | }
|
1203 | function serializeQueryParams(params) {
|
1204 | var strParams = Object.keys(params).map(function (name) {
|
1205 | var value = params[name];
|
1206 | return Array.isArray(value) ?
|
1207 | value.map(function (v) { return encodeUriQuery(name) + "=" + encodeUriQuery(v); }).join('&') :
|
1208 | encodeUriQuery(name) + "=" + encodeUriQuery(value);
|
1209 | });
|
1210 | return strParams.length ? "?" + strParams.join("&") : '';
|
1211 | }
|
1212 | var SEGMENT_RE = /^[^\/()?;=#]+/;
|
1213 | function matchSegments(str) {
|
1214 | var match = str.match(SEGMENT_RE);
|
1215 | return match ? match[0] : '';
|
1216 | }
|
1217 | var QUERY_PARAM_RE = /^[^=?&#]+/;
|
1218 |
|
1219 | function matchQueryParams(str) {
|
1220 | var match = str.match(QUERY_PARAM_RE);
|
1221 | return match ? match[0] : '';
|
1222 | }
|
1223 | var QUERY_PARAM_VALUE_RE = /^[^?&#]+/;
|
1224 |
|
1225 | function matchUrlQueryParamValue(str) {
|
1226 | var match = str.match(QUERY_PARAM_VALUE_RE);
|
1227 | return match ? match[0] : '';
|
1228 | }
|
1229 | var UrlParser = (function () {
|
1230 | function UrlParser(url) {
|
1231 | this.url = url;
|
1232 | this.remaining = url;
|
1233 | }
|
1234 | UrlParser.prototype.parseRootSegment = function () {
|
1235 | this.consumeOptional('/');
|
1236 | if (this.remaining === '' || this.peekStartsWith('?') || this.peekStartsWith('#')) {
|
1237 | return new UrlSegmentGroup([], {});
|
1238 | }
|
1239 |
|
1240 | return new UrlSegmentGroup([], this.parseChildren());
|
1241 | };
|
1242 | UrlParser.prototype.parseQueryParams = function () {
|
1243 | var params = {};
|
1244 | if (this.consumeOptional('?')) {
|
1245 | do {
|
1246 | this.parseQueryParam(params);
|
1247 | } while (this.consumeOptional('&'));
|
1248 | }
|
1249 | return params;
|
1250 | };
|
1251 | UrlParser.prototype.parseFragment = function () {
|
1252 | return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null;
|
1253 | };
|
1254 | UrlParser.prototype.parseChildren = function () {
|
1255 | if (this.remaining === '') {
|
1256 | return {};
|
1257 | }
|
1258 | this.consumeOptional('/');
|
1259 | var segments = [];
|
1260 | if (!this.peekStartsWith('(')) {
|
1261 | segments.push(this.parseSegment());
|
1262 | }
|
1263 | while (this.peekStartsWith('/') && !this.peekStartsWith('//') && !this.peekStartsWith('/(')) {
|
1264 | this.capture('/');
|
1265 | segments.push(this.parseSegment());
|
1266 | }
|
1267 | var children = {};
|
1268 | if (this.peekStartsWith('/(')) {
|
1269 | this.capture('/');
|
1270 | children = this.parseParens(true);
|
1271 | }
|
1272 | var res = {};
|
1273 | if (this.peekStartsWith('(')) {
|
1274 | res = this.parseParens(false);
|
1275 | }
|
1276 | if (segments.length > 0 || Object.keys(children).length > 0) {
|
1277 | res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children);
|
1278 | }
|
1279 | return res;
|
1280 | };
|
1281 |
|
1282 |
|
1283 | UrlParser.prototype.parseSegment = function () {
|
1284 | var path = matchSegments(this.remaining);
|
1285 | if (path === '' && this.peekStartsWith(';')) {
|
1286 | throw new Error("Empty path url segment cannot have parameters: '" + this.remaining + "'.");
|
1287 | }
|
1288 | this.capture(path);
|
1289 | return new UrlSegment(decode(path), this.parseMatrixParams());
|
1290 | };
|
1291 | UrlParser.prototype.parseMatrixParams = function () {
|
1292 | var params = {};
|
1293 | while (this.consumeOptional(';')) {
|
1294 | this.parseParam(params);
|
1295 | }
|
1296 | return params;
|
1297 | };
|
1298 | UrlParser.prototype.parseParam = function (params) {
|
1299 | var key = matchSegments(this.remaining);
|
1300 | if (!key) {
|
1301 | return;
|
1302 | }
|
1303 | this.capture(key);
|
1304 | var value = '';
|
1305 | if (this.consumeOptional('=')) {
|
1306 | var valueMatch = matchSegments(this.remaining);
|
1307 | if (valueMatch) {
|
1308 | value = valueMatch;
|
1309 | this.capture(value);
|
1310 | }
|
1311 | }
|
1312 | params[decode(key)] = decode(value);
|
1313 | };
|
1314 |
|
1315 | UrlParser.prototype.parseQueryParam = function (params) {
|
1316 | var key = matchQueryParams(this.remaining);
|
1317 | if (!key) {
|
1318 | return;
|
1319 | }
|
1320 | this.capture(key);
|
1321 | var value = '';
|
1322 | if (this.consumeOptional('=')) {
|
1323 | var valueMatch = matchUrlQueryParamValue(this.remaining);
|
1324 | if (valueMatch) {
|
1325 | value = valueMatch;
|
1326 | this.capture(value);
|
1327 | }
|
1328 | }
|
1329 | var decodedKey = decodeQuery(key);
|
1330 | var decodedVal = decodeQuery(value);
|
1331 | if (params.hasOwnProperty(decodedKey)) {
|
1332 |
|
1333 | var currentVal = params[decodedKey];
|
1334 | if (!Array.isArray(currentVal)) {
|
1335 | currentVal = [currentVal];
|
1336 | params[decodedKey] = currentVal;
|
1337 | }
|
1338 | currentVal.push(decodedVal);
|
1339 | }
|
1340 | else {
|
1341 |
|
1342 | params[decodedKey] = decodedVal;
|
1343 | }
|
1344 | };
|
1345 |
|
1346 | UrlParser.prototype.parseParens = function (allowPrimary) {
|
1347 | var segments = {};
|
1348 | this.capture('(');
|
1349 | while (!this.consumeOptional(')') && this.remaining.length > 0) {
|
1350 | var path = matchSegments(this.remaining);
|
1351 | var next = this.remaining[path.length];
|
1352 |
|
1353 |
|
1354 | if (next !== '/' && next !== ')' && next !== ';') {
|
1355 | throw new Error("Cannot parse url '" + this.url + "'");
|
1356 | }
|
1357 | var outletName = undefined;
|
1358 | if (path.indexOf(':') > -1) {
|
1359 | outletName = path.substr(0, path.indexOf(':'));
|
1360 | this.capture(outletName);
|
1361 | this.capture(':');
|
1362 | }
|
1363 | else if (allowPrimary) {
|
1364 | outletName = PRIMARY_OUTLET;
|
1365 | }
|
1366 | var children = this.parseChildren();
|
1367 | segments[outletName] = Object.keys(children).length === 1 ? children[PRIMARY_OUTLET] :
|
1368 | new UrlSegmentGroup([], children);
|
1369 | this.consumeOptional('//');
|
1370 | }
|
1371 | return segments;
|
1372 | };
|
1373 | UrlParser.prototype.peekStartsWith = function (str) { return this.remaining.startsWith(str); };
|
1374 |
|
1375 | UrlParser.prototype.consumeOptional = function (str) {
|
1376 | if (this.peekStartsWith(str)) {
|
1377 | this.remaining = this.remaining.substring(str.length);
|
1378 | return true;
|
1379 | }
|
1380 | return false;
|
1381 | };
|
1382 | UrlParser.prototype.capture = function (str) {
|
1383 | if (!this.consumeOptional(str)) {
|
1384 | throw new Error("Expected \"" + str + "\".");
|
1385 | }
|
1386 | };
|
1387 | return UrlParser;
|
1388 | }());
|
1389 |
|
1390 | |
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 | var Tree = (function () {
|
1398 | function Tree(root) {
|
1399 | this._root = root;
|
1400 | }
|
1401 | Object.defineProperty(Tree.prototype, "root", {
|
1402 | get: function () { return this._root.value; },
|
1403 | enumerable: true,
|
1404 | configurable: true
|
1405 | });
|
1406 | |
1407 |
|
1408 |
|
1409 | Tree.prototype.parent = function (t) {
|
1410 | var p = this.pathFromRoot(t);
|
1411 | return p.length > 1 ? p[p.length - 2] : null;
|
1412 | };
|
1413 | |
1414 |
|
1415 |
|
1416 | Tree.prototype.children = function (t) {
|
1417 | var n = findNode(t, this._root);
|
1418 | return n ? n.children.map(function (t) { return t.value; }) : [];
|
1419 | };
|
1420 | |
1421 |
|
1422 |
|
1423 | Tree.prototype.firstChild = function (t) {
|
1424 | var n = findNode(t, this._root);
|
1425 | return n && n.children.length > 0 ? n.children[0].value : null;
|
1426 | };
|
1427 | |
1428 |
|
1429 |
|
1430 | Tree.prototype.siblings = function (t) {
|
1431 | var p = findPath(t, this._root);
|
1432 | if (p.length < 2)
|
1433 | return [];
|
1434 | var c = p[p.length - 2].children.map(function (c) { return c.value; });
|
1435 | return c.filter(function (cc) { return cc !== t; });
|
1436 | };
|
1437 | |
1438 |
|
1439 |
|
1440 | Tree.prototype.pathFromRoot = function (t) { return findPath(t, this._root).map(function (s) { return s.value; }); };
|
1441 | return Tree;
|
1442 | }());
|
1443 |
|
1444 | function findNode(value, node) {
|
1445 | var e_1, _a;
|
1446 | if (value === node.value)
|
1447 | return node;
|
1448 | try {
|
1449 | for (var _b = __values(node.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
1450 | var child = _c.value;
|
1451 | var node_1 = findNode(value, child);
|
1452 | if (node_1)
|
1453 | return node_1;
|
1454 | }
|
1455 | }
|
1456 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
1457 | finally {
|
1458 | try {
|
1459 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
1460 | }
|
1461 | finally { if (e_1) throw e_1.error; }
|
1462 | }
|
1463 | return null;
|
1464 | }
|
1465 |
|
1466 | function findPath(value, node) {
|
1467 | var e_2, _a;
|
1468 | if (value === node.value)
|
1469 | return [node];
|
1470 | try {
|
1471 | for (var _b = __values(node.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
1472 | var child = _c.value;
|
1473 | var path = findPath(value, child);
|
1474 | if (path.length) {
|
1475 | path.unshift(node);
|
1476 | return path;
|
1477 | }
|
1478 | }
|
1479 | }
|
1480 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
1481 | finally {
|
1482 | try {
|
1483 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
1484 | }
|
1485 | finally { if (e_2) throw e_2.error; }
|
1486 | }
|
1487 | return [];
|
1488 | }
|
1489 | var TreeNode = (function () {
|
1490 | function TreeNode(value, children) {
|
1491 | this.value = value;
|
1492 | this.children = children;
|
1493 | }
|
1494 | TreeNode.prototype.toString = function () { return "TreeNode(" + this.value + ")"; };
|
1495 | return TreeNode;
|
1496 | }());
|
1497 |
|
1498 | function nodeChildrenAsMap(node) {
|
1499 | var map = {};
|
1500 | if (node) {
|
1501 | node.children.forEach(function (child) { return map[child.value.outlet] = child; });
|
1502 | }
|
1503 | return map;
|
1504 | }
|
1505 |
|
1506 | |
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 | |
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 | var RouterState = (function (_super) {
|
1542 | __extends(RouterState, _super);
|
1543 |
|
1544 | function RouterState(root,
|
1545 | /** The current snapshot of the router state */
|
1546 | snapshot) {
|
1547 | var _this = _super.call(this, root) || this;
|
1548 | _this.snapshot = snapshot;
|
1549 | setRouterState(_this, root);
|
1550 | return _this;
|
1551 | }
|
1552 | RouterState.prototype.toString = function () { return this.snapshot.toString(); };
|
1553 | return RouterState;
|
1554 | }(Tree));
|
1555 | function createEmptyState(urlTree, rootComponent) {
|
1556 | var snapshot = createEmptyStateSnapshot(urlTree, rootComponent);
|
1557 | var emptyUrl = new rxjs.BehaviorSubject([new UrlSegment('', {})]);
|
1558 | var emptyParams = new rxjs.BehaviorSubject({});
|
1559 | var emptyData = new rxjs.BehaviorSubject({});
|
1560 | var emptyQueryParams = new rxjs.BehaviorSubject({});
|
1561 | var fragment = new rxjs.BehaviorSubject('');
|
1562 | var activated = new ActivatedRoute(emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root);
|
1563 | activated.snapshot = snapshot.root;
|
1564 | return new RouterState(new TreeNode(activated, []), snapshot);
|
1565 | }
|
1566 | function createEmptyStateSnapshot(urlTree, rootComponent) {
|
1567 | var emptyParams = {};
|
1568 | var emptyData = {};
|
1569 | var emptyQueryParams = {};
|
1570 | var fragment = '';
|
1571 | var activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, urlTree.root, -1, {});
|
1572 | return new RouterStateSnapshot('', new TreeNode(activated, []));
|
1573 | }
|
1574 | |
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 | var ActivatedRoute = (function () {
|
1586 |
|
1587 | function ActivatedRoute(
|
1588 | /** An observable of the URL segments matched by this route */
|
1589 | url,
|
1590 | /** An observable of the matrix parameters scoped to this route */
|
1591 | params,
|
1592 | /** An observable of the query parameters shared by all the routes */
|
1593 | queryParams,
|
1594 | /** An observable of the URL fragment shared by all the routes */
|
1595 | fragment,
|
1596 | /** An observable of the static and resolved data of this route. */
|
1597 | data,
|
1598 | /** The outlet name of the route. It's a constant */
|
1599 | outlet,
|
1600 | /** The component of the route. It's a constant */
|
1601 | // TODO(vsavkin): remove |string
|
1602 | component, futureSnapshot) {
|
1603 | this.url = url;
|
1604 | this.params = params;
|
1605 | this.queryParams = queryParams;
|
1606 | this.fragment = fragment;
|
1607 | this.data = data;
|
1608 | this.outlet = outlet;
|
1609 | this.component = component;
|
1610 | this._futureSnapshot = futureSnapshot;
|
1611 | }
|
1612 | Object.defineProperty(ActivatedRoute.prototype, "routeConfig", {
|
1613 |
|
1614 | get: function () { return this._futureSnapshot.routeConfig; },
|
1615 | enumerable: true,
|
1616 | configurable: true
|
1617 | });
|
1618 | Object.defineProperty(ActivatedRoute.prototype, "root", {
|
1619 |
|
1620 | get: function () { return this._routerState.root; },
|
1621 | enumerable: true,
|
1622 | configurable: true
|
1623 | });
|
1624 | Object.defineProperty(ActivatedRoute.prototype, "parent", {
|
1625 |
|
1626 | get: function () { return this._routerState.parent(this); },
|
1627 | enumerable: true,
|
1628 | configurable: true
|
1629 | });
|
1630 | Object.defineProperty(ActivatedRoute.prototype, "firstChild", {
|
1631 |
|
1632 | get: function () { return this._routerState.firstChild(this); },
|
1633 | enumerable: true,
|
1634 | configurable: true
|
1635 | });
|
1636 | Object.defineProperty(ActivatedRoute.prototype, "children", {
|
1637 |
|
1638 | get: function () { return this._routerState.children(this); },
|
1639 | enumerable: true,
|
1640 | configurable: true
|
1641 | });
|
1642 | Object.defineProperty(ActivatedRoute.prototype, "pathFromRoot", {
|
1643 |
|
1644 | get: function () { return this._routerState.pathFromRoot(this); },
|
1645 | enumerable: true,
|
1646 | configurable: true
|
1647 | });
|
1648 | Object.defineProperty(ActivatedRoute.prototype, "paramMap", {
|
1649 | get: function () {
|
1650 | if (!this._paramMap) {
|
1651 | this._paramMap = this.params.pipe(operators.map(function (p) { return convertToParamMap(p); }));
|
1652 | }
|
1653 | return this._paramMap;
|
1654 | },
|
1655 | enumerable: true,
|
1656 | configurable: true
|
1657 | });
|
1658 | Object.defineProperty(ActivatedRoute.prototype, "queryParamMap", {
|
1659 | get: function () {
|
1660 | if (!this._queryParamMap) {
|
1661 | this._queryParamMap =
|
1662 | this.queryParams.pipe(operators.map(function (p) { return convertToParamMap(p); }));
|
1663 | }
|
1664 | return this._queryParamMap;
|
1665 | },
|
1666 | enumerable: true,
|
1667 | configurable: true
|
1668 | });
|
1669 | ActivatedRoute.prototype.toString = function () {
|
1670 | return this.snapshot ? this.snapshot.toString() : "Future(" + this._futureSnapshot + ")";
|
1671 | };
|
1672 | return ActivatedRoute;
|
1673 | }());
|
1674 | |
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 | function inheritedParamsDataResolve(route, paramsInheritanceStrategy) {
|
1680 | if (paramsInheritanceStrategy === void 0) { paramsInheritanceStrategy = 'emptyOnly'; }
|
1681 | var pathFromRoot = route.pathFromRoot;
|
1682 | var inheritingStartingFrom = 0;
|
1683 | if (paramsInheritanceStrategy !== 'always') {
|
1684 | inheritingStartingFrom = pathFromRoot.length - 1;
|
1685 | while (inheritingStartingFrom >= 1) {
|
1686 | var current = pathFromRoot[inheritingStartingFrom];
|
1687 | var parent_1 = pathFromRoot[inheritingStartingFrom - 1];
|
1688 |
|
1689 | if (current.routeConfig && current.routeConfig.path === '') {
|
1690 | inheritingStartingFrom--;
|
1691 |
|
1692 | }
|
1693 | else if (!parent_1.component) {
|
1694 | inheritingStartingFrom--;
|
1695 | }
|
1696 | else {
|
1697 | break;
|
1698 | }
|
1699 | }
|
1700 | }
|
1701 | return flattenInherited(pathFromRoot.slice(inheritingStartingFrom));
|
1702 | }
|
1703 |
|
1704 | function flattenInherited(pathFromRoot) {
|
1705 | return pathFromRoot.reduce(function (res, curr) {
|
1706 | var params = __assign({}, res.params, curr.params);
|
1707 | var data = __assign({}, res.data, curr.data);
|
1708 | var resolve = __assign({}, res.resolve, curr._resolvedData);
|
1709 | return { params: params, data: data, resolve: resolve };
|
1710 | }, { params: {}, data: {}, resolve: {} });
|
1711 | }
|
1712 | |
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 | var ActivatedRouteSnapshot = (function () {
|
1733 |
|
1734 | function ActivatedRouteSnapshot(
|
1735 | /** The URL segments matched by this route */
|
1736 | url,
|
1737 | /** The matrix parameters scoped to this route */
|
1738 | params,
|
1739 | /** The query parameters shared by all the routes */
|
1740 | queryParams,
|
1741 | /** The URL fragment shared by all the routes */
|
1742 | fragment,
|
1743 | /** The static and resolved data of this route */
|
1744 | data,
|
1745 | /** The outlet name of the route */
|
1746 | outlet,
|
1747 | /** The component of the route */
|
1748 | component, routeConfig, urlSegment, lastPathIndex, resolve) {
|
1749 | this.url = url;
|
1750 | this.params = params;
|
1751 | this.queryParams = queryParams;
|
1752 | this.fragment = fragment;
|
1753 | this.data = data;
|
1754 | this.outlet = outlet;
|
1755 | this.component = component;
|
1756 | this.routeConfig = routeConfig;
|
1757 | this._urlSegment = urlSegment;
|
1758 | this._lastPathIndex = lastPathIndex;
|
1759 | this._resolve = resolve;
|
1760 | }
|
1761 | Object.defineProperty(ActivatedRouteSnapshot.prototype, "root", {
|
1762 |
|
1763 | get: function () { return this._routerState.root; },
|
1764 | enumerable: true,
|
1765 | configurable: true
|
1766 | });
|
1767 | Object.defineProperty(ActivatedRouteSnapshot.prototype, "parent", {
|
1768 |
|
1769 | get: function () { return this._routerState.parent(this); },
|
1770 | enumerable: true,
|
1771 | configurable: true
|
1772 | });
|
1773 | Object.defineProperty(ActivatedRouteSnapshot.prototype, "firstChild", {
|
1774 |
|
1775 | get: function () { return this._routerState.firstChild(this); },
|
1776 | enumerable: true,
|
1777 | configurable: true
|
1778 | });
|
1779 | Object.defineProperty(ActivatedRouteSnapshot.prototype, "children", {
|
1780 |
|
1781 | get: function () { return this._routerState.children(this); },
|
1782 | enumerable: true,
|
1783 | configurable: true
|
1784 | });
|
1785 | Object.defineProperty(ActivatedRouteSnapshot.prototype, "pathFromRoot", {
|
1786 |
|
1787 | get: function () { return this._routerState.pathFromRoot(this); },
|
1788 | enumerable: true,
|
1789 | configurable: true
|
1790 | });
|
1791 | Object.defineProperty(ActivatedRouteSnapshot.prototype, "paramMap", {
|
1792 | get: function () {
|
1793 | if (!this._paramMap) {
|
1794 | this._paramMap = convertToParamMap(this.params);
|
1795 | }
|
1796 | return this._paramMap;
|
1797 | },
|
1798 | enumerable: true,
|
1799 | configurable: true
|
1800 | });
|
1801 | Object.defineProperty(ActivatedRouteSnapshot.prototype, "queryParamMap", {
|
1802 | get: function () {
|
1803 | if (!this._queryParamMap) {
|
1804 | this._queryParamMap = convertToParamMap(this.queryParams);
|
1805 | }
|
1806 | return this._queryParamMap;
|
1807 | },
|
1808 | enumerable: true,
|
1809 | configurable: true
|
1810 | });
|
1811 | ActivatedRouteSnapshot.prototype.toString = function () {
|
1812 | var url = this.url.map(function (segment) { return segment.toString(); }).join('/');
|
1813 | var matched = this.routeConfig ? this.routeConfig.path : '';
|
1814 | return "Route(url:'" + url + "', path:'" + matched + "')";
|
1815 | };
|
1816 | return ActivatedRouteSnapshot;
|
1817 | }());
|
1818 | |
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 |
|
1830 |
|
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 | var RouterStateSnapshot = (function (_super) {
|
1846 | __extends(RouterStateSnapshot, _super);
|
1847 |
|
1848 | function RouterStateSnapshot(
|
1849 | /** The url from which this snapshot was created */
|
1850 | url, root) {
|
1851 | var _this = _super.call(this, root) || this;
|
1852 | _this.url = url;
|
1853 | setRouterState(_this, root);
|
1854 | return _this;
|
1855 | }
|
1856 | RouterStateSnapshot.prototype.toString = function () { return serializeNode(this._root); };
|
1857 | return RouterStateSnapshot;
|
1858 | }(Tree));
|
1859 | function setRouterState(state, node) {
|
1860 | node.value._routerState = state;
|
1861 | node.children.forEach(function (c) { return setRouterState(state, c); });
|
1862 | }
|
1863 | function serializeNode(node) {
|
1864 | var c = node.children.length > 0 ? " { " + node.children.map(serializeNode).join(', ') + " } " : '';
|
1865 | return "" + node.value + c;
|
1866 | }
|
1867 | |
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 | function advanceActivatedRoute(route) {
|
1873 | if (route.snapshot) {
|
1874 | var currentSnapshot = route.snapshot;
|
1875 | var nextSnapshot = route._futureSnapshot;
|
1876 | route.snapshot = nextSnapshot;
|
1877 | if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) {
|
1878 | route.queryParams.next(nextSnapshot.queryParams);
|
1879 | }
|
1880 | if (currentSnapshot.fragment !== nextSnapshot.fragment) {
|
1881 | route.fragment.next(nextSnapshot.fragment);
|
1882 | }
|
1883 | if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) {
|
1884 | route.params.next(nextSnapshot.params);
|
1885 | }
|
1886 | if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) {
|
1887 | route.url.next(nextSnapshot.url);
|
1888 | }
|
1889 | if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) {
|
1890 | route.data.next(nextSnapshot.data);
|
1891 | }
|
1892 | }
|
1893 | else {
|
1894 | route.snapshot = route._futureSnapshot;
|
1895 |
|
1896 | route.data.next(route._futureSnapshot.data);
|
1897 | }
|
1898 | }
|
1899 | function equalParamsAndUrlSegments(a, b) {
|
1900 | var equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url);
|
1901 | var parentsMismatch = !a.parent !== !b.parent;
|
1902 | return equalUrlParams && !parentsMismatch &&
|
1903 | (!a.parent || equalParamsAndUrlSegments(a.parent, b.parent));
|
1904 | }
|
1905 |
|
1906 | |
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 | function createRouterState(routeReuseStrategy, curr, prevState) {
|
1914 | var root = createNode(routeReuseStrategy, curr._root, prevState ? prevState._root : undefined);
|
1915 | return new RouterState(root, curr);
|
1916 | }
|
1917 | function createNode(routeReuseStrategy, curr, prevState) {
|
1918 |
|
1919 | if (prevState && routeReuseStrategy.shouldReuseRoute(curr.value, prevState.value.snapshot)) {
|
1920 | var value = prevState.value;
|
1921 | value._futureSnapshot = curr.value;
|
1922 | var children = createOrReuseChildren(routeReuseStrategy, curr, prevState);
|
1923 | return new TreeNode(value, children);
|
1924 |
|
1925 | }
|
1926 | else {
|
1927 | var detachedRouteHandle = routeReuseStrategy.retrieve(curr.value);
|
1928 | if (detachedRouteHandle) {
|
1929 | var tree = detachedRouteHandle.route;
|
1930 | setFutureSnapshotsOfActivatedRoutes(curr, tree);
|
1931 | return tree;
|
1932 | }
|
1933 | else {
|
1934 | var value = createActivatedRoute(curr.value);
|
1935 | var children = curr.children.map(function (c) { return createNode(routeReuseStrategy, c); });
|
1936 | return new TreeNode(value, children);
|
1937 | }
|
1938 | }
|
1939 | }
|
1940 | function setFutureSnapshotsOfActivatedRoutes(curr, result) {
|
1941 | if (curr.value.routeConfig !== result.value.routeConfig) {
|
1942 | throw new Error('Cannot reattach ActivatedRouteSnapshot created from a different route');
|
1943 | }
|
1944 | if (curr.children.length !== result.children.length) {
|
1945 | throw new Error('Cannot reattach ActivatedRouteSnapshot with a different number of children');
|
1946 | }
|
1947 | result.value._futureSnapshot = curr.value;
|
1948 | for (var i = 0; i < curr.children.length; ++i) {
|
1949 | setFutureSnapshotsOfActivatedRoutes(curr.children[i], result.children[i]);
|
1950 | }
|
1951 | }
|
1952 | function createOrReuseChildren(routeReuseStrategy, curr, prevState) {
|
1953 | return curr.children.map(function (child) {
|
1954 | var e_1, _a;
|
1955 | try {
|
1956 | for (var _b = __values(prevState.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
1957 | var p = _c.value;
|
1958 | if (routeReuseStrategy.shouldReuseRoute(p.value.snapshot, child.value)) {
|
1959 | return createNode(routeReuseStrategy, child, p);
|
1960 | }
|
1961 | }
|
1962 | }
|
1963 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
1964 | finally {
|
1965 | try {
|
1966 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
1967 | }
|
1968 | finally { if (e_1) throw e_1.error; }
|
1969 | }
|
1970 | return createNode(routeReuseStrategy, child);
|
1971 | });
|
1972 | }
|
1973 | function createActivatedRoute(c) {
|
1974 | return new ActivatedRoute(new rxjs.BehaviorSubject(c.url), new rxjs.BehaviorSubject(c.params), new rxjs.BehaviorSubject(c.queryParams), new rxjs.BehaviorSubject(c.fragment), new rxjs.BehaviorSubject(c.data), c.outlet, c.component, c);
|
1975 | }
|
1976 |
|
1977 | |
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 | function createUrlTree(route, urlTree, commands, queryParams, fragment) {
|
1985 | if (commands.length === 0) {
|
1986 | return tree(urlTree.root, urlTree.root, urlTree, queryParams, fragment);
|
1987 | }
|
1988 | var nav = computeNavigation(commands);
|
1989 | if (nav.toRoot()) {
|
1990 | return tree(urlTree.root, new UrlSegmentGroup([], {}), urlTree, queryParams, fragment);
|
1991 | }
|
1992 | var startingPosition = findStartingPosition(nav, urlTree, route);
|
1993 | var segmentGroup = startingPosition.processChildren ?
|
1994 | updateSegmentGroupChildren(startingPosition.segmentGroup, startingPosition.index, nav.commands) :
|
1995 | updateSegmentGroup(startingPosition.segmentGroup, startingPosition.index, nav.commands);
|
1996 | return tree(startingPosition.segmentGroup, segmentGroup, urlTree, queryParams, fragment);
|
1997 | }
|
1998 | function isMatrixParams(command) {
|
1999 | return typeof command === 'object' && command != null && !command.outlets && !command.segmentPath;
|
2000 | }
|
2001 | function tree(oldSegmentGroup, newSegmentGroup, urlTree, queryParams, fragment) {
|
2002 | var qp = {};
|
2003 | if (queryParams) {
|
2004 | forEach(queryParams, function (value, name) {
|
2005 | qp[name] = Array.isArray(value) ? value.map(function (v) { return "" + v; }) : "" + value;
|
2006 | });
|
2007 | }
|
2008 | if (urlTree.root === oldSegmentGroup) {
|
2009 | return new UrlTree(newSegmentGroup, qp, fragment);
|
2010 | }
|
2011 | return new UrlTree(replaceSegment(urlTree.root, oldSegmentGroup, newSegmentGroup), qp, fragment);
|
2012 | }
|
2013 | function replaceSegment(current, oldSegment, newSegment) {
|
2014 | var children = {};
|
2015 | forEach(current.children, function (c, outletName) {
|
2016 | if (c === oldSegment) {
|
2017 | children[outletName] = newSegment;
|
2018 | }
|
2019 | else {
|
2020 | children[outletName] = replaceSegment(c, oldSegment, newSegment);
|
2021 | }
|
2022 | });
|
2023 | return new UrlSegmentGroup(current.segments, children);
|
2024 | }
|
2025 | var Navigation = (function () {
|
2026 | function Navigation(isAbsolute, numberOfDoubleDots, commands) {
|
2027 | this.isAbsolute = isAbsolute;
|
2028 | this.numberOfDoubleDots = numberOfDoubleDots;
|
2029 | this.commands = commands;
|
2030 | if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
|
2031 | throw new Error('Root segment cannot have matrix parameters');
|
2032 | }
|
2033 | var cmdWithOutlet = commands.find(function (c) { return typeof c === 'object' && c != null && c.outlets; });
|
2034 | if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
|
2035 | throw new Error('{outlets:{}} has to be the last command');
|
2036 | }
|
2037 | }
|
2038 | Navigation.prototype.toRoot = function () {
|
2039 | return this.isAbsolute && this.commands.length === 1 && this.commands[0] == '/';
|
2040 | };
|
2041 | return Navigation;
|
2042 | }());
|
2043 |
|
2044 | function computeNavigation(commands) {
|
2045 | if ((typeof commands[0] === 'string') && commands.length === 1 && commands[0] === '/') {
|
2046 | return new Navigation(true, 0, commands);
|
2047 | }
|
2048 | var numberOfDoubleDots = 0;
|
2049 | var isAbsolute = false;
|
2050 | var res = commands.reduce(function (res, cmd, cmdIdx) {
|
2051 | if (typeof cmd === 'object' && cmd != null) {
|
2052 | if (cmd.outlets) {
|
2053 | var outlets_1 = {};
|
2054 | forEach(cmd.outlets, function (commands, name) {
|
2055 | outlets_1[name] = typeof commands === 'string' ? commands.split('/') : commands;
|
2056 | });
|
2057 | return __spread(res, [{ outlets: outlets_1 }]);
|
2058 | }
|
2059 | if (cmd.segmentPath) {
|
2060 | return __spread(res, [cmd.segmentPath]);
|
2061 | }
|
2062 | }
|
2063 | if (!(typeof cmd === 'string')) {
|
2064 | return __spread(res, [cmd]);
|
2065 | }
|
2066 | if (cmdIdx === 0) {
|
2067 | cmd.split('/').forEach(function (urlPart, partIndex) {
|
2068 | if (partIndex == 0 && urlPart === '.') ;
|
2069 | else if (partIndex == 0 && urlPart === '') {
|
2070 | isAbsolute = true;
|
2071 | }
|
2072 | else if (urlPart === '..') {
|
2073 | numberOfDoubleDots++;
|
2074 | }
|
2075 | else if (urlPart != '') {
|
2076 | res.push(urlPart);
|
2077 | }
|
2078 | });
|
2079 | return res;
|
2080 | }
|
2081 | return __spread(res, [cmd]);
|
2082 | }, []);
|
2083 | return new Navigation(isAbsolute, numberOfDoubleDots, res);
|
2084 | }
|
2085 | var Position = (function () {
|
2086 | function Position(segmentGroup, processChildren, index) {
|
2087 | this.segmentGroup = segmentGroup;
|
2088 | this.processChildren = processChildren;
|
2089 | this.index = index;
|
2090 | }
|
2091 | return Position;
|
2092 | }());
|
2093 | function findStartingPosition(nav, tree, route) {
|
2094 | if (nav.isAbsolute) {
|
2095 | return new Position(tree.root, true, 0);
|
2096 | }
|
2097 | if (route.snapshot._lastPathIndex === -1) {
|
2098 | return new Position(route.snapshot._urlSegment, true, 0);
|
2099 | }
|
2100 | var modifier = isMatrixParams(nav.commands[0]) ? 0 : 1;
|
2101 | var index = route.snapshot._lastPathIndex + modifier;
|
2102 | return createPositionApplyingDoubleDots(route.snapshot._urlSegment, index, nav.numberOfDoubleDots);
|
2103 | }
|
2104 | function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
|
2105 | var g = group;
|
2106 | var ci = index;
|
2107 | var dd = numberOfDoubleDots;
|
2108 | while (dd > ci) {
|
2109 | dd -= ci;
|
2110 | g = g.parent;
|
2111 | if (!g) {
|
2112 | throw new Error('Invalid number of \'../\'');
|
2113 | }
|
2114 | ci = g.segments.length;
|
2115 | }
|
2116 | return new Position(g, false, ci - dd);
|
2117 | }
|
2118 | function getPath(command) {
|
2119 | if (typeof command === 'object' && command != null && command.outlets) {
|
2120 | return command.outlets[PRIMARY_OUTLET];
|
2121 | }
|
2122 | return "" + command;
|
2123 | }
|
2124 | function getOutlets(commands) {
|
2125 | var _a, _b;
|
2126 | if (!(typeof commands[0] === 'object'))
|
2127 | return _a = {}, _a[PRIMARY_OUTLET] = commands, _a;
|
2128 | if (commands[0].outlets === undefined)
|
2129 | return _b = {}, _b[PRIMARY_OUTLET] = commands, _b;
|
2130 | return commands[0].outlets;
|
2131 | }
|
2132 | function updateSegmentGroup(segmentGroup, startIndex, commands) {
|
2133 | if (!segmentGroup) {
|
2134 | segmentGroup = new UrlSegmentGroup([], {});
|
2135 | }
|
2136 | if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
|
2137 | return updateSegmentGroupChildren(segmentGroup, startIndex, commands);
|
2138 | }
|
2139 | var m = prefixedWith(segmentGroup, startIndex, commands);
|
2140 | var slicedCommands = commands.slice(m.commandIndex);
|
2141 | if (m.match && m.pathIndex < segmentGroup.segments.length) {
|
2142 | var g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {});
|
2143 | g.children[PRIMARY_OUTLET] =
|
2144 | new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children);
|
2145 | return updateSegmentGroupChildren(g, 0, slicedCommands);
|
2146 | }
|
2147 | else if (m.match && slicedCommands.length === 0) {
|
2148 | return new UrlSegmentGroup(segmentGroup.segments, {});
|
2149 | }
|
2150 | else if (m.match && !segmentGroup.hasChildren()) {
|
2151 | return createNewSegmentGroup(segmentGroup, startIndex, commands);
|
2152 | }
|
2153 | else if (m.match) {
|
2154 | return updateSegmentGroupChildren(segmentGroup, 0, slicedCommands);
|
2155 | }
|
2156 | else {
|
2157 | return createNewSegmentGroup(segmentGroup, startIndex, commands);
|
2158 | }
|
2159 | }
|
2160 | function updateSegmentGroupChildren(segmentGroup, startIndex, commands) {
|
2161 | if (commands.length === 0) {
|
2162 | return new UrlSegmentGroup(segmentGroup.segments, {});
|
2163 | }
|
2164 | else {
|
2165 | var outlets_2 = getOutlets(commands);
|
2166 | var children_1 = {};
|
2167 | forEach(outlets_2, function (commands, outlet) {
|
2168 | if (commands !== null) {
|
2169 | children_1[outlet] = updateSegmentGroup(segmentGroup.children[outlet], startIndex, commands);
|
2170 | }
|
2171 | });
|
2172 | forEach(segmentGroup.children, function (child, childOutlet) {
|
2173 | if (outlets_2[childOutlet] === undefined) {
|
2174 | children_1[childOutlet] = child;
|
2175 | }
|
2176 | });
|
2177 | return new UrlSegmentGroup(segmentGroup.segments, children_1);
|
2178 | }
|
2179 | }
|
2180 | function prefixedWith(segmentGroup, startIndex, commands) {
|
2181 | var currentCommandIndex = 0;
|
2182 | var currentPathIndex = startIndex;
|
2183 | var noMatch = { match: false, pathIndex: 0, commandIndex: 0 };
|
2184 | while (currentPathIndex < segmentGroup.segments.length) {
|
2185 | if (currentCommandIndex >= commands.length)
|
2186 | return noMatch;
|
2187 | var path = segmentGroup.segments[currentPathIndex];
|
2188 | var curr = getPath(commands[currentCommandIndex]);
|
2189 | var next = currentCommandIndex < commands.length - 1 ? commands[currentCommandIndex + 1] : null;
|
2190 | if (currentPathIndex > 0 && curr === undefined)
|
2191 | break;
|
2192 | if (curr && next && (typeof next === 'object') && next.outlets === undefined) {
|
2193 | if (!compare(curr, next, path))
|
2194 | return noMatch;
|
2195 | currentCommandIndex += 2;
|
2196 | }
|
2197 | else {
|
2198 | if (!compare(curr, {}, path))
|
2199 | return noMatch;
|
2200 | currentCommandIndex++;
|
2201 | }
|
2202 | currentPathIndex++;
|
2203 | }
|
2204 | return { match: true, pathIndex: currentPathIndex, commandIndex: currentCommandIndex };
|
2205 | }
|
2206 | function createNewSegmentGroup(segmentGroup, startIndex, commands) {
|
2207 | var paths = segmentGroup.segments.slice(0, startIndex);
|
2208 | var i = 0;
|
2209 | while (i < commands.length) {
|
2210 | if (typeof commands[i] === 'object' && commands[i].outlets !== undefined) {
|
2211 | var children = createNewSegmentChildren(commands[i].outlets);
|
2212 | return new UrlSegmentGroup(paths, children);
|
2213 | }
|
2214 |
|
2215 | if (i === 0 && isMatrixParams(commands[0])) {
|
2216 | var p = segmentGroup.segments[startIndex];
|
2217 | paths.push(new UrlSegment(p.path, commands[0]));
|
2218 | i++;
|
2219 | continue;
|
2220 | }
|
2221 | var curr = getPath(commands[i]);
|
2222 | var next = (i < commands.length - 1) ? commands[i + 1] : null;
|
2223 | if (curr && next && isMatrixParams(next)) {
|
2224 | paths.push(new UrlSegment(curr, stringify(next)));
|
2225 | i += 2;
|
2226 | }
|
2227 | else {
|
2228 | paths.push(new UrlSegment(curr, {}));
|
2229 | i++;
|
2230 | }
|
2231 | }
|
2232 | return new UrlSegmentGroup(paths, {});
|
2233 | }
|
2234 | function createNewSegmentChildren(outlets) {
|
2235 | var children = {};
|
2236 | forEach(outlets, function (commands, outlet) {
|
2237 | if (commands !== null) {
|
2238 | children[outlet] = createNewSegmentGroup(new UrlSegmentGroup([], {}), 0, commands);
|
2239 | }
|
2240 | });
|
2241 | return children;
|
2242 | }
|
2243 | function stringify(params) {
|
2244 | var res = {};
|
2245 | forEach(params, function (v, k) { return res[k] = "" + v; });
|
2246 | return res;
|
2247 | }
|
2248 | function compare(path, params, segment) {
|
2249 | return path == segment.path && shallowEqual(params, segment.parameters);
|
2250 | }
|
2251 |
|
2252 | |
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 | var activateRoutes = function (rootContexts, routeReuseStrategy, forwardEvent) {
|
2260 | return operators.map(function (t) {
|
2261 | new ActivateRoutes(routeReuseStrategy, t.targetRouterState, t.currentRouterState, forwardEvent)
|
2262 | .activate(rootContexts);
|
2263 | return t;
|
2264 | });
|
2265 | };
|
2266 | var ActivateRoutes = (function () {
|
2267 | function ActivateRoutes(routeReuseStrategy, futureState, currState, forwardEvent) {
|
2268 | this.routeReuseStrategy = routeReuseStrategy;
|
2269 | this.futureState = futureState;
|
2270 | this.currState = currState;
|
2271 | this.forwardEvent = forwardEvent;
|
2272 | }
|
2273 | ActivateRoutes.prototype.activate = function (parentContexts) {
|
2274 | var futureRoot = this.futureState._root;
|
2275 | var currRoot = this.currState ? this.currState._root : null;
|
2276 | this.deactivateChildRoutes(futureRoot, currRoot, parentContexts);
|
2277 | advanceActivatedRoute(this.futureState.root);
|
2278 | this.activateChildRoutes(futureRoot, currRoot, parentContexts);
|
2279 | };
|
2280 |
|
2281 | ActivateRoutes.prototype.deactivateChildRoutes = function (futureNode, currNode, contexts) {
|
2282 | var _this = this;
|
2283 | var children = nodeChildrenAsMap(currNode);
|
2284 |
|
2285 | futureNode.children.forEach(function (futureChild) {
|
2286 | var childOutletName = futureChild.value.outlet;
|
2287 | _this.deactivateRoutes(futureChild, children[childOutletName], contexts);
|
2288 | delete children[childOutletName];
|
2289 | });
|
2290 |
|
2291 | forEach(children, function (v, childName) {
|
2292 | _this.deactivateRouteAndItsChildren(v, contexts);
|
2293 | });
|
2294 | };
|
2295 | ActivateRoutes.prototype.deactivateRoutes = function (futureNode, currNode, parentContext) {
|
2296 | var future = futureNode.value;
|
2297 | var curr = currNode ? currNode.value : null;
|
2298 | if (future === curr) {
|
2299 |
|
2300 | if (future.component) {
|
2301 |
|
2302 | var context = parentContext.getContext(future.outlet);
|
2303 | if (context) {
|
2304 | this.deactivateChildRoutes(futureNode, currNode, context.children);
|
2305 | }
|
2306 | }
|
2307 | else {
|
2308 |
|
2309 | this.deactivateChildRoutes(futureNode, currNode, parentContext);
|
2310 | }
|
2311 | }
|
2312 | else {
|
2313 | if (curr) {
|
2314 |
|
2315 | this.deactivateRouteAndItsChildren(currNode, parentContext);
|
2316 | }
|
2317 | }
|
2318 | };
|
2319 | ActivateRoutes.prototype.deactivateRouteAndItsChildren = function (route, parentContexts) {
|
2320 | if (this.routeReuseStrategy.shouldDetach(route.value.snapshot)) {
|
2321 | this.detachAndStoreRouteSubtree(route, parentContexts);
|
2322 | }
|
2323 | else {
|
2324 | this.deactivateRouteAndOutlet(route, parentContexts);
|
2325 | }
|
2326 | };
|
2327 | ActivateRoutes.prototype.detachAndStoreRouteSubtree = function (route, parentContexts) {
|
2328 | var context = parentContexts.getContext(route.value.outlet);
|
2329 | if (context && context.outlet) {
|
2330 | var componentRef = context.outlet.detach();
|
2331 | var contexts = context.children.onOutletDeactivated();
|
2332 | this.routeReuseStrategy.store(route.value.snapshot, { componentRef: componentRef, route: route, contexts: contexts });
|
2333 | }
|
2334 | };
|
2335 | ActivateRoutes.prototype.deactivateRouteAndOutlet = function (route, parentContexts) {
|
2336 | var _this = this;
|
2337 | var context = parentContexts.getContext(route.value.outlet);
|
2338 | if (context) {
|
2339 | var children = nodeChildrenAsMap(route);
|
2340 | var contexts_1 = route.value.component ? context.children : parentContexts;
|
2341 | forEach(children, function (v, k) { return _this.deactivateRouteAndItsChildren(v, contexts_1); });
|
2342 | if (context.outlet) {
|
2343 |
|
2344 | context.outlet.deactivate();
|
2345 |
|
2346 | context.children.onOutletDeactivated();
|
2347 | }
|
2348 | }
|
2349 | };
|
2350 | ActivateRoutes.prototype.activateChildRoutes = function (futureNode, currNode, contexts) {
|
2351 | var _this = this;
|
2352 | var children = nodeChildrenAsMap(currNode);
|
2353 | futureNode.children.forEach(function (c) {
|
2354 | _this.activateRoutes(c, children[c.value.outlet], contexts);
|
2355 | _this.forwardEvent(new ActivationEnd(c.value.snapshot));
|
2356 | });
|
2357 | if (futureNode.children.length) {
|
2358 | this.forwardEvent(new ChildActivationEnd(futureNode.value.snapshot));
|
2359 | }
|
2360 | };
|
2361 | ActivateRoutes.prototype.activateRoutes = function (futureNode, currNode, parentContexts) {
|
2362 | var future = futureNode.value;
|
2363 | var curr = currNode ? currNode.value : null;
|
2364 | advanceActivatedRoute(future);
|
2365 |
|
2366 | if (future === curr) {
|
2367 | if (future.component) {
|
2368 |
|
2369 | var context = parentContexts.getOrCreateContext(future.outlet);
|
2370 | this.activateChildRoutes(futureNode, currNode, context.children);
|
2371 | }
|
2372 | else {
|
2373 |
|
2374 | this.activateChildRoutes(futureNode, currNode, parentContexts);
|
2375 | }
|
2376 | }
|
2377 | else {
|
2378 | if (future.component) {
|
2379 |
|
2380 | var context = parentContexts.getOrCreateContext(future.outlet);
|
2381 | if (this.routeReuseStrategy.shouldAttach(future.snapshot)) {
|
2382 | var stored = this.routeReuseStrategy.retrieve(future.snapshot);
|
2383 | this.routeReuseStrategy.store(future.snapshot, null);
|
2384 | context.children.onOutletReAttached(stored.contexts);
|
2385 | context.attachRef = stored.componentRef;
|
2386 | context.route = stored.route.value;
|
2387 | if (context.outlet) {
|
2388 |
|
2389 |
|
2390 | context.outlet.attach(stored.componentRef, stored.route.value);
|
2391 | }
|
2392 | advanceActivatedRouteNodeAndItsChildren(stored.route);
|
2393 | }
|
2394 | else {
|
2395 | var config = parentLoadedConfig(future.snapshot);
|
2396 | var cmpFactoryResolver = config ? config.module.componentFactoryResolver : null;
|
2397 | context.attachRef = null;
|
2398 | context.route = future;
|
2399 | context.resolver = cmpFactoryResolver;
|
2400 | if (context.outlet) {
|
2401 |
|
2402 |
|
2403 | context.outlet.activateWith(future, cmpFactoryResolver);
|
2404 | }
|
2405 | this.activateChildRoutes(futureNode, null, context.children);
|
2406 | }
|
2407 | }
|
2408 | else {
|
2409 |
|
2410 | this.activateChildRoutes(futureNode, null, parentContexts);
|
2411 | }
|
2412 | }
|
2413 | };
|
2414 | return ActivateRoutes;
|
2415 | }());
|
2416 | function advanceActivatedRouteNodeAndItsChildren(node) {
|
2417 | advanceActivatedRoute(node.value);
|
2418 | node.children.forEach(advanceActivatedRouteNodeAndItsChildren);
|
2419 | }
|
2420 | function parentLoadedConfig(snapshot) {
|
2421 | for (var s = snapshot.parent; s; s = s.parent) {
|
2422 | var route = s.routeConfig;
|
2423 | if (route && route._loadedConfig)
|
2424 | return route._loadedConfig;
|
2425 | if (route && route.component)
|
2426 | return null;
|
2427 | }
|
2428 | return null;
|
2429 | }
|
2430 |
|
2431 | |
2432 |
|
2433 |
|
2434 |
|
2435 |
|
2436 |
|
2437 |
|
2438 | |
2439 |
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 |
|
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 | function isFunction(v) {
|
2452 | return typeof v === 'function';
|
2453 | }
|
2454 | function isBoolean(v) {
|
2455 | return typeof v === 'boolean';
|
2456 | }
|
2457 | function isUrlTree(v) {
|
2458 | return v instanceof UrlTree;
|
2459 | }
|
2460 | function isCanLoad(guard) {
|
2461 | return guard && isFunction(guard.canLoad);
|
2462 | }
|
2463 | function isCanActivate(guard) {
|
2464 | return guard && isFunction(guard.canActivate);
|
2465 | }
|
2466 | function isCanActivateChild(guard) {
|
2467 | return guard && isFunction(guard.canActivateChild);
|
2468 | }
|
2469 | function isCanDeactivate(guard) {
|
2470 | return guard && isFunction(guard.canDeactivate);
|
2471 | }
|
2472 |
|
2473 | |
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 |
|
2479 |
|
2480 | var NoMatch = (function () {
|
2481 | function NoMatch(segmentGroup) {
|
2482 | this.segmentGroup = segmentGroup || null;
|
2483 | }
|
2484 | return NoMatch;
|
2485 | }());
|
2486 | var AbsoluteRedirect = (function () {
|
2487 | function AbsoluteRedirect(urlTree) {
|
2488 | this.urlTree = urlTree;
|
2489 | }
|
2490 | return AbsoluteRedirect;
|
2491 | }());
|
2492 | function noMatch(segmentGroup) {
|
2493 | return new rxjs.Observable(function (obs) { return obs.error(new NoMatch(segmentGroup)); });
|
2494 | }
|
2495 | function absoluteRedirect(newTree) {
|
2496 | return new rxjs.Observable(function (obs) { return obs.error(new AbsoluteRedirect(newTree)); });
|
2497 | }
|
2498 | function namedOutletsRedirect(redirectTo) {
|
2499 | return new rxjs.Observable(function (obs) { return obs.error(new Error("Only absolute redirects can have named outlets. redirectTo: '" + redirectTo + "'")); });
|
2500 | }
|
2501 | function canLoadFails(route) {
|
2502 | return new rxjs.Observable(function (obs) { return obs.error(navigationCancelingError("Cannot load children because the guard of the route \"path: '" + route.path + "'\" returned false")); });
|
2503 | }
|
2504 | |
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 | function applyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) {
|
2510 | return new ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config).apply();
|
2511 | }
|
2512 | var ApplyRedirects = (function () {
|
2513 | function ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) {
|
2514 | this.configLoader = configLoader;
|
2515 | this.urlSerializer = urlSerializer;
|
2516 | this.urlTree = urlTree;
|
2517 | this.config = config;
|
2518 | this.allowRedirects = true;
|
2519 | this.ngModule = moduleInjector.get(core.NgModuleRef);
|
2520 | }
|
2521 | ApplyRedirects.prototype.apply = function () {
|
2522 | var _this = this;
|
2523 | var expanded$ = this.expandSegmentGroup(this.ngModule, this.config, this.urlTree.root, PRIMARY_OUTLET);
|
2524 | var urlTrees$ = expanded$.pipe(operators.map(function (rootSegmentGroup) { return _this.createUrlTree(rootSegmentGroup, _this.urlTree.queryParams, _this.urlTree.fragment); }));
|
2525 | return urlTrees$.pipe(operators.catchError(function (e) {
|
2526 | if (e instanceof AbsoluteRedirect) {
|
2527 |
|
2528 | _this.allowRedirects = false;
|
2529 |
|
2530 | return _this.match(e.urlTree);
|
2531 | }
|
2532 | if (e instanceof NoMatch) {
|
2533 | throw _this.noMatchError(e);
|
2534 | }
|
2535 | throw e;
|
2536 | }));
|
2537 | };
|
2538 | ApplyRedirects.prototype.match = function (tree) {
|
2539 | var _this = this;
|
2540 | var expanded$ = this.expandSegmentGroup(this.ngModule, this.config, tree.root, PRIMARY_OUTLET);
|
2541 | var mapped$ = expanded$.pipe(operators.map(function (rootSegmentGroup) {
|
2542 | return _this.createUrlTree(rootSegmentGroup, tree.queryParams, tree.fragment);
|
2543 | }));
|
2544 | return mapped$.pipe(operators.catchError(function (e) {
|
2545 | if (e instanceof NoMatch) {
|
2546 | throw _this.noMatchError(e);
|
2547 | }
|
2548 | throw e;
|
2549 | }));
|
2550 | };
|
2551 | ApplyRedirects.prototype.noMatchError = function (e) {
|
2552 | return new Error("Cannot match any routes. URL Segment: '" + e.segmentGroup + "'");
|
2553 | };
|
2554 | ApplyRedirects.prototype.createUrlTree = function (rootCandidate, queryParams, fragment) {
|
2555 | var _a;
|
2556 | var root = rootCandidate.segments.length > 0 ?
|
2557 | new UrlSegmentGroup([], (_a = {}, _a[PRIMARY_OUTLET] = rootCandidate, _a)) :
|
2558 | rootCandidate;
|
2559 | return new UrlTree(root, queryParams, fragment);
|
2560 | };
|
2561 | ApplyRedirects.prototype.expandSegmentGroup = function (ngModule, routes, segmentGroup, outlet) {
|
2562 | if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
|
2563 | return this.expandChildren(ngModule, routes, segmentGroup)
|
2564 | .pipe(operators.map(function (children) { return new UrlSegmentGroup([], children); }));
|
2565 | }
|
2566 | return this.expandSegment(ngModule, segmentGroup, routes, segmentGroup.segments, outlet, true);
|
2567 | };
|
2568 |
|
2569 | ApplyRedirects.prototype.expandChildren = function (ngModule, routes, segmentGroup) {
|
2570 | var _this = this;
|
2571 | return waitForMap(segmentGroup.children, function (childOutlet, child) { return _this.expandSegmentGroup(ngModule, routes, child, childOutlet); });
|
2572 | };
|
2573 | ApplyRedirects.prototype.expandSegment = function (ngModule, segmentGroup, routes, segments, outlet, allowRedirects) {
|
2574 | var _this = this;
|
2575 | return rxjs.of.apply(void 0, __spread(routes)).pipe(operators.map(function (r) {
|
2576 | var expanded$ = _this.expandSegmentAgainstRoute(ngModule, segmentGroup, routes, r, segments, outlet, allowRedirects);
|
2577 | return expanded$.pipe(operators.catchError(function (e) {
|
2578 | if (e instanceof NoMatch) {
|
2579 |
|
2580 |
|
2581 | return rxjs.of(null);
|
2582 | }
|
2583 | throw e;
|
2584 | }));
|
2585 | }), operators.concatAll(), operators.first(function (s) { return !!s; }), operators.catchError(function (e, _) {
|
2586 | if (e instanceof rxjs.EmptyError || e.name === 'EmptyError') {
|
2587 | if (_this.noLeftoversInUrl(segmentGroup, segments, outlet)) {
|
2588 | return rxjs.of(new UrlSegmentGroup([], {}));
|
2589 | }
|
2590 | throw new NoMatch(segmentGroup);
|
2591 | }
|
2592 | throw e;
|
2593 | }));
|
2594 | };
|
2595 | ApplyRedirects.prototype.noLeftoversInUrl = function (segmentGroup, segments, outlet) {
|
2596 | return segments.length === 0 && !segmentGroup.children[outlet];
|
2597 | };
|
2598 | ApplyRedirects.prototype.expandSegmentAgainstRoute = function (ngModule, segmentGroup, routes, route, paths, outlet, allowRedirects) {
|
2599 | if (getOutlet(route) !== outlet) {
|
2600 | return noMatch(segmentGroup);
|
2601 | }
|
2602 | if (route.redirectTo === undefined) {
|
2603 | return this.matchSegmentAgainstRoute(ngModule, segmentGroup, route, paths);
|
2604 | }
|
2605 | if (allowRedirects && this.allowRedirects) {
|
2606 | return this.expandSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, paths, outlet);
|
2607 | }
|
2608 | return noMatch(segmentGroup);
|
2609 | };
|
2610 | ApplyRedirects.prototype.expandSegmentAgainstRouteUsingRedirect = function (ngModule, segmentGroup, routes, route, segments, outlet) {
|
2611 | if (route.path === '**') {
|
2612 | return this.expandWildCardWithParamsAgainstRouteUsingRedirect(ngModule, routes, route, outlet);
|
2613 | }
|
2614 | return this.expandRegularSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet);
|
2615 | };
|
2616 | ApplyRedirects.prototype.expandWildCardWithParamsAgainstRouteUsingRedirect = function (ngModule, routes, route, outlet) {
|
2617 | var _this = this;
|
2618 | var newTree = this.applyRedirectCommands([], route.redirectTo, {});
|
2619 | if (route.redirectTo.startsWith('/')) {
|
2620 | return absoluteRedirect(newTree);
|
2621 | }
|
2622 | return this.lineralizeSegments(route, newTree).pipe(operators.mergeMap(function (newSegments) {
|
2623 | var group = new UrlSegmentGroup(newSegments, {});
|
2624 | return _this.expandSegment(ngModule, group, routes, newSegments, outlet, false);
|
2625 | }));
|
2626 | };
|
2627 | ApplyRedirects.prototype.expandRegularSegmentAgainstRouteUsingRedirect = function (ngModule, segmentGroup, routes, route, segments, outlet) {
|
2628 | var _this = this;
|
2629 | var _a = match(segmentGroup, route, segments), matched = _a.matched, consumedSegments = _a.consumedSegments, lastChild = _a.lastChild, positionalParamSegments = _a.positionalParamSegments;
|
2630 | if (!matched)
|
2631 | return noMatch(segmentGroup);
|
2632 | var newTree = this.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments);
|
2633 | if (route.redirectTo.startsWith('/')) {
|
2634 | return absoluteRedirect(newTree);
|
2635 | }
|
2636 | return this.lineralizeSegments(route, newTree).pipe(operators.mergeMap(function (newSegments) {
|
2637 | return _this.expandSegment(ngModule, segmentGroup, routes, newSegments.concat(segments.slice(lastChild)), outlet, false);
|
2638 | }));
|
2639 | };
|
2640 | ApplyRedirects.prototype.matchSegmentAgainstRoute = function (ngModule, rawSegmentGroup, route, segments) {
|
2641 | var _this = this;
|
2642 | if (route.path === '**') {
|
2643 | if (route.loadChildren) {
|
2644 | return this.configLoader.load(ngModule.injector, route)
|
2645 | .pipe(operators.map(function (cfg) {
|
2646 | route._loadedConfig = cfg;
|
2647 | return new UrlSegmentGroup(segments, {});
|
2648 | }));
|
2649 | }
|
2650 | return rxjs.of(new UrlSegmentGroup(segments, {}));
|
2651 | }
|
2652 | var _a = match(rawSegmentGroup, route, segments), matched = _a.matched, consumedSegments = _a.consumedSegments, lastChild = _a.lastChild;
|
2653 | if (!matched)
|
2654 | return noMatch(rawSegmentGroup);
|
2655 | var rawSlicedSegments = segments.slice(lastChild);
|
2656 | var childConfig$ = this.getChildConfig(ngModule, route, segments);
|
2657 | return childConfig$.pipe(operators.mergeMap(function (routerConfig) {
|
2658 | var childModule = routerConfig.module;
|
2659 | var childConfig = routerConfig.routes;
|
2660 | var _a = split(rawSegmentGroup, consumedSegments, rawSlicedSegments, childConfig), segmentGroup = _a.segmentGroup, slicedSegments = _a.slicedSegments;
|
2661 | if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
|
2662 | var expanded$_1 = _this.expandChildren(childModule, childConfig, segmentGroup);
|
2663 | return expanded$_1.pipe(operators.map(function (children) { return new UrlSegmentGroup(consumedSegments, children); }));
|
2664 | }
|
2665 | if (childConfig.length === 0 && slicedSegments.length === 0) {
|
2666 | return rxjs.of(new UrlSegmentGroup(consumedSegments, {}));
|
2667 | }
|
2668 | var expanded$ = _this.expandSegment(childModule, segmentGroup, childConfig, slicedSegments, PRIMARY_OUTLET, true);
|
2669 | return expanded$.pipe(operators.map(function (cs) {
|
2670 | return new UrlSegmentGroup(consumedSegments.concat(cs.segments), cs.children);
|
2671 | }));
|
2672 | }));
|
2673 | };
|
2674 | ApplyRedirects.prototype.getChildConfig = function (ngModule, route, segments) {
|
2675 | var _this = this;
|
2676 | if (route.children) {
|
2677 |
|
2678 | return rxjs.of(new LoadedRouterConfig(route.children, ngModule));
|
2679 | }
|
2680 | if (route.loadChildren) {
|
2681 |
|
2682 | if (route._loadedConfig !== undefined) {
|
2683 | return rxjs.of(route._loadedConfig);
|
2684 | }
|
2685 | return runCanLoadGuard(ngModule.injector, route, segments)
|
2686 | .pipe(operators.mergeMap(function (shouldLoad) {
|
2687 | if (shouldLoad) {
|
2688 | return _this.configLoader.load(ngModule.injector, route)
|
2689 | .pipe(operators.map(function (cfg) {
|
2690 | route._loadedConfig = cfg;
|
2691 | return cfg;
|
2692 | }));
|
2693 | }
|
2694 | return canLoadFails(route);
|
2695 | }));
|
2696 | }
|
2697 | return rxjs.of(new LoadedRouterConfig([], ngModule));
|
2698 | };
|
2699 | ApplyRedirects.prototype.lineralizeSegments = function (route, urlTree) {
|
2700 | var res = [];
|
2701 | var c = urlTree.root;
|
2702 | while (true) {
|
2703 | res = res.concat(c.segments);
|
2704 | if (c.numberOfChildren === 0) {
|
2705 | return rxjs.of(res);
|
2706 | }
|
2707 | if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) {
|
2708 | return namedOutletsRedirect(route.redirectTo);
|
2709 | }
|
2710 | c = c.children[PRIMARY_OUTLET];
|
2711 | }
|
2712 | };
|
2713 | ApplyRedirects.prototype.applyRedirectCommands = function (segments, redirectTo, posParams) {
|
2714 | return this.applyRedirectCreatreUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
|
2715 | };
|
2716 | ApplyRedirects.prototype.applyRedirectCreatreUrlTree = function (redirectTo, urlTree, segments, posParams) {
|
2717 | var newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);
|
2718 | return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);
|
2719 | };
|
2720 | ApplyRedirects.prototype.createQueryParams = function (redirectToParams, actualParams) {
|
2721 | var res = {};
|
2722 | forEach(redirectToParams, function (v, k) {
|
2723 | var copySourceValue = typeof v === 'string' && v.startsWith(':');
|
2724 | if (copySourceValue) {
|
2725 | var sourceName = v.substring(1);
|
2726 | res[k] = actualParams[sourceName];
|
2727 | }
|
2728 | else {
|
2729 | res[k] = v;
|
2730 | }
|
2731 | });
|
2732 | return res;
|
2733 | };
|
2734 | ApplyRedirects.prototype.createSegmentGroup = function (redirectTo, group, segments, posParams) {
|
2735 | var _this = this;
|
2736 | var updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams);
|
2737 | var children = {};
|
2738 | forEach(group.children, function (child, name) {
|
2739 | children[name] = _this.createSegmentGroup(redirectTo, child, segments, posParams);
|
2740 | });
|
2741 | return new UrlSegmentGroup(updatedSegments, children);
|
2742 | };
|
2743 | ApplyRedirects.prototype.createSegments = function (redirectTo, redirectToSegments, actualSegments, posParams) {
|
2744 | var _this = this;
|
2745 | return redirectToSegments.map(function (s) { return s.path.startsWith(':') ? _this.findPosParam(redirectTo, s, posParams) :
|
2746 | _this.findOrReturn(s, actualSegments); });
|
2747 | };
|
2748 | ApplyRedirects.prototype.findPosParam = function (redirectTo, redirectToUrlSegment, posParams) {
|
2749 | var pos = posParams[redirectToUrlSegment.path.substring(1)];
|
2750 | if (!pos)
|
2751 | throw new Error("Cannot redirect to '" + redirectTo + "'. Cannot find '" + redirectToUrlSegment.path + "'.");
|
2752 | return pos;
|
2753 | };
|
2754 | ApplyRedirects.prototype.findOrReturn = function (redirectToUrlSegment, actualSegments) {
|
2755 | var e_1, _a;
|
2756 | var idx = 0;
|
2757 | try {
|
2758 | for (var actualSegments_1 = __values(actualSegments), actualSegments_1_1 = actualSegments_1.next(); !actualSegments_1_1.done; actualSegments_1_1 = actualSegments_1.next()) {
|
2759 | var s = actualSegments_1_1.value;
|
2760 | if (s.path === redirectToUrlSegment.path) {
|
2761 | actualSegments.splice(idx);
|
2762 | return s;
|
2763 | }
|
2764 | idx++;
|
2765 | }
|
2766 | }
|
2767 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
2768 | finally {
|
2769 | try {
|
2770 | if (actualSegments_1_1 && !actualSegments_1_1.done && (_a = actualSegments_1.return)) _a.call(actualSegments_1);
|
2771 | }
|
2772 | finally { if (e_1) throw e_1.error; }
|
2773 | }
|
2774 | return redirectToUrlSegment;
|
2775 | };
|
2776 | return ApplyRedirects;
|
2777 | }());
|
2778 | function runCanLoadGuard(moduleInjector, route, segments) {
|
2779 | var canLoad = route.canLoad;
|
2780 | if (!canLoad || canLoad.length === 0)
|
2781 | return rxjs.of(true);
|
2782 | var obs = rxjs.from(canLoad).pipe(operators.map(function (injectionToken) {
|
2783 | var guard = moduleInjector.get(injectionToken);
|
2784 | var guardVal;
|
2785 | if (isCanLoad(guard)) {
|
2786 | guardVal = guard.canLoad(route, segments);
|
2787 | }
|
2788 | else if (isFunction(guard)) {
|
2789 | guardVal = guard(route, segments);
|
2790 | }
|
2791 | else {
|
2792 | throw new Error('Invalid CanLoad guard');
|
2793 | }
|
2794 | return wrapIntoObservable(guardVal);
|
2795 | }));
|
2796 | return obs.pipe(operators.concatAll(), operators.every(function (result) { return result === true; }));
|
2797 | }
|
2798 | function match(segmentGroup, route, segments) {
|
2799 | if (route.path === '') {
|
2800 | if ((route.pathMatch === 'full') && (segmentGroup.hasChildren() || segments.length > 0)) {
|
2801 | return { matched: false, consumedSegments: [], lastChild: 0, positionalParamSegments: {} };
|
2802 | }
|
2803 | return { matched: true, consumedSegments: [], lastChild: 0, positionalParamSegments: {} };
|
2804 | }
|
2805 | var matcher = route.matcher || defaultUrlMatcher;
|
2806 | var res = matcher(segments, segmentGroup, route);
|
2807 | if (!res) {
|
2808 | return {
|
2809 | matched: false,
|
2810 | consumedSegments: [],
|
2811 | lastChild: 0,
|
2812 | positionalParamSegments: {},
|
2813 | };
|
2814 | }
|
2815 | return {
|
2816 | matched: true,
|
2817 | consumedSegments: res.consumed,
|
2818 | lastChild: res.consumed.length,
|
2819 | positionalParamSegments: res.posParams,
|
2820 | };
|
2821 | }
|
2822 | function split(segmentGroup, consumedSegments, slicedSegments, config) {
|
2823 | if (slicedSegments.length > 0 &&
|
2824 | containsEmptyPathRedirectsWithNamedOutlets(segmentGroup, slicedSegments, config)) {
|
2825 | var s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptySegments(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));
|
2826 | return { segmentGroup: mergeTrivialChildren(s), slicedSegments: [] };
|
2827 | }
|
2828 | if (slicedSegments.length === 0 &&
|
2829 | containsEmptyPathRedirects(segmentGroup, slicedSegments, config)) {
|
2830 | var s = new UrlSegmentGroup(segmentGroup.segments, addEmptySegmentsToChildrenIfNeeded(segmentGroup, slicedSegments, config, segmentGroup.children));
|
2831 | return { segmentGroup: mergeTrivialChildren(s), slicedSegments: slicedSegments };
|
2832 | }
|
2833 | return { segmentGroup: segmentGroup, slicedSegments: slicedSegments };
|
2834 | }
|
2835 | function mergeTrivialChildren(s) {
|
2836 | if (s.numberOfChildren === 1 && s.children[PRIMARY_OUTLET]) {
|
2837 | var c = s.children[PRIMARY_OUTLET];
|
2838 | return new UrlSegmentGroup(s.segments.concat(c.segments), c.children);
|
2839 | }
|
2840 | return s;
|
2841 | }
|
2842 | function addEmptySegmentsToChildrenIfNeeded(segmentGroup, slicedSegments, routes, children) {
|
2843 | var e_2, _a;
|
2844 | var res = {};
|
2845 | try {
|
2846 | for (var routes_1 = __values(routes), routes_1_1 = routes_1.next(); !routes_1_1.done; routes_1_1 = routes_1.next()) {
|
2847 | var r = routes_1_1.value;
|
2848 | if (isEmptyPathRedirect(segmentGroup, slicedSegments, r) && !children[getOutlet(r)]) {
|
2849 | res[getOutlet(r)] = new UrlSegmentGroup([], {});
|
2850 | }
|
2851 | }
|
2852 | }
|
2853 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
2854 | finally {
|
2855 | try {
|
2856 | if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
|
2857 | }
|
2858 | finally { if (e_2) throw e_2.error; }
|
2859 | }
|
2860 | return __assign({}, children, res);
|
2861 | }
|
2862 | function createChildrenForEmptySegments(routes, primarySegmentGroup) {
|
2863 | var e_3, _a;
|
2864 | var res = {};
|
2865 | res[PRIMARY_OUTLET] = primarySegmentGroup;
|
2866 | try {
|
2867 | for (var routes_2 = __values(routes), routes_2_1 = routes_2.next(); !routes_2_1.done; routes_2_1 = routes_2.next()) {
|
2868 | var r = routes_2_1.value;
|
2869 | if (r.path === '' && getOutlet(r) !== PRIMARY_OUTLET) {
|
2870 | res[getOutlet(r)] = new UrlSegmentGroup([], {});
|
2871 | }
|
2872 | }
|
2873 | }
|
2874 | catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
2875 | finally {
|
2876 | try {
|
2877 | if (routes_2_1 && !routes_2_1.done && (_a = routes_2.return)) _a.call(routes_2);
|
2878 | }
|
2879 | finally { if (e_3) throw e_3.error; }
|
2880 | }
|
2881 | return res;
|
2882 | }
|
2883 | function containsEmptyPathRedirectsWithNamedOutlets(segmentGroup, segments, routes) {
|
2884 | return routes.some(function (r) { return isEmptyPathRedirect(segmentGroup, segments, r) && getOutlet(r) !== PRIMARY_OUTLET; });
|
2885 | }
|
2886 | function containsEmptyPathRedirects(segmentGroup, segments, routes) {
|
2887 | return routes.some(function (r) { return isEmptyPathRedirect(segmentGroup, segments, r); });
|
2888 | }
|
2889 | function isEmptyPathRedirect(segmentGroup, segments, r) {
|
2890 | if ((segmentGroup.hasChildren() || segments.length > 0) && r.pathMatch === 'full') {
|
2891 | return false;
|
2892 | }
|
2893 | return r.path === '' && r.redirectTo !== undefined;
|
2894 | }
|
2895 | function getOutlet(route) {
|
2896 | return route.outlet || PRIMARY_OUTLET;
|
2897 | }
|
2898 |
|
2899 | |
2900 |
|
2901 |
|
2902 |
|
2903 |
|
2904 |
|
2905 |
|
2906 | function applyRedirects$1(moduleInjector, configLoader, urlSerializer, config) {
|
2907 | return function (source) {
|
2908 | return source.pipe(operators.switchMap(function (t) { return applyRedirects(moduleInjector, configLoader, urlSerializer, t.extractedUrl, config)
|
2909 | .pipe(operators.map(function (urlAfterRedirects) { return (__assign({}, t, { urlAfterRedirects: urlAfterRedirects })); })); }));
|
2910 | };
|
2911 | }
|
2912 |
|
2913 | |
2914 |
|
2915 |
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 | var CanActivate = (function () {
|
2921 | function CanActivate(path) {
|
2922 | this.path = path;
|
2923 | this.route = this.path[this.path.length - 1];
|
2924 | }
|
2925 | return CanActivate;
|
2926 | }());
|
2927 | var CanDeactivate = (function () {
|
2928 | function CanDeactivate(component, route) {
|
2929 | this.component = component;
|
2930 | this.route = route;
|
2931 | }
|
2932 | return CanDeactivate;
|
2933 | }());
|
2934 | function getAllRouteGuards(future, curr, parentContexts) {
|
2935 | var futureRoot = future._root;
|
2936 | var currRoot = curr ? curr._root : null;
|
2937 | return getChildRouteGuards(futureRoot, currRoot, parentContexts, [futureRoot.value]);
|
2938 | }
|
2939 | function getCanActivateChild(p) {
|
2940 | var canActivateChild = p.routeConfig ? p.routeConfig.canActivateChild : null;
|
2941 | if (!canActivateChild || canActivateChild.length === 0)
|
2942 | return null;
|
2943 | return { node: p, guards: canActivateChild };
|
2944 | }
|
2945 | function getToken(token, snapshot, moduleInjector) {
|
2946 | var config = getClosestLoadedConfig(snapshot);
|
2947 | var injector = config ? config.module.injector : moduleInjector;
|
2948 | return injector.get(token);
|
2949 | }
|
2950 | function getClosestLoadedConfig(snapshot) {
|
2951 | if (!snapshot)
|
2952 | return null;
|
2953 | for (var s = snapshot.parent; s; s = s.parent) {
|
2954 | var route = s.routeConfig;
|
2955 | if (route && route._loadedConfig)
|
2956 | return route._loadedConfig;
|
2957 | }
|
2958 | return null;
|
2959 | }
|
2960 | function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks) {
|
2961 | if (checks === void 0) { checks = {
|
2962 | canDeactivateChecks: [],
|
2963 | canActivateChecks: []
|
2964 | }; }
|
2965 | var prevChildren = nodeChildrenAsMap(currNode);
|
2966 |
|
2967 | futureNode.children.forEach(function (c) {
|
2968 | getRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]), checks);
|
2969 | delete prevChildren[c.value.outlet];
|
2970 | });
|
2971 |
|
2972 | forEach(prevChildren, function (v, k) {
|
2973 | return deactivateRouteAndItsChildren(v, contexts.getContext(k), checks);
|
2974 | });
|
2975 | return checks;
|
2976 | }
|
2977 | function getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks) {
|
2978 | if (checks === void 0) { checks = {
|
2979 | canDeactivateChecks: [],
|
2980 | canActivateChecks: []
|
2981 | }; }
|
2982 | var future = futureNode.value;
|
2983 | var curr = currNode ? currNode.value : null;
|
2984 | var context = parentContexts ? parentContexts.getContext(futureNode.value.outlet) : null;
|
2985 |
|
2986 | if (curr && future.routeConfig === curr.routeConfig) {
|
2987 | var shouldRun = shouldRunGuardsAndResolvers(curr, future, future.routeConfig.runGuardsAndResolvers);
|
2988 | if (shouldRun) {
|
2989 | checks.canActivateChecks.push(new CanActivate(futurePath));
|
2990 | }
|
2991 | else {
|
2992 |
|
2993 | future.data = curr.data;
|
2994 | future._resolvedData = curr._resolvedData;
|
2995 | }
|
2996 |
|
2997 | if (future.component) {
|
2998 | getChildRouteGuards(futureNode, currNode, context ? context.children : null, futurePath, checks);
|
2999 |
|
3000 | }
|
3001 | else {
|
3002 | getChildRouteGuards(futureNode, currNode, parentContexts, futurePath, checks);
|
3003 | }
|
3004 | if (shouldRun) {
|
3005 | var component = context && context.outlet && context.outlet.component || null;
|
3006 | checks.canDeactivateChecks.push(new CanDeactivate(component, curr));
|
3007 | }
|
3008 | }
|
3009 | else {
|
3010 | if (curr) {
|
3011 | deactivateRouteAndItsChildren(currNode, context, checks);
|
3012 | }
|
3013 | checks.canActivateChecks.push(new CanActivate(futurePath));
|
3014 |
|
3015 | if (future.component) {
|
3016 | getChildRouteGuards(futureNode, null, context ? context.children : null, futurePath, checks);
|
3017 |
|
3018 | }
|
3019 | else {
|
3020 | getChildRouteGuards(futureNode, null, parentContexts, futurePath, checks);
|
3021 | }
|
3022 | }
|
3023 | return checks;
|
3024 | }
|
3025 | function shouldRunGuardsAndResolvers(curr, future, mode) {
|
3026 | if (typeof mode === 'function') {
|
3027 | return mode(curr, future);
|
3028 | }
|
3029 | switch (mode) {
|
3030 | case 'pathParamsChange':
|
3031 | return !equalPath(curr.url, future.url);
|
3032 | case 'pathParamsOrQueryParamsChange':
|
3033 | return !equalPath(curr.url, future.url) ||
|
3034 | !shallowEqual(curr.queryParams, future.queryParams);
|
3035 | case 'always':
|
3036 | return true;
|
3037 | case 'paramsOrQueryParamsChange':
|
3038 | return !equalParamsAndUrlSegments(curr, future) ||
|
3039 | !shallowEqual(curr.queryParams, future.queryParams);
|
3040 | case 'paramsChange':
|
3041 | default:
|
3042 | return !equalParamsAndUrlSegments(curr, future);
|
3043 | }
|
3044 | }
|
3045 | function deactivateRouteAndItsChildren(route, context, checks) {
|
3046 | var children = nodeChildrenAsMap(route);
|
3047 | var r = route.value;
|
3048 | forEach(children, function (node, childName) {
|
3049 | if (!r.component) {
|
3050 | deactivateRouteAndItsChildren(node, context, checks);
|
3051 | }
|
3052 | else if (context) {
|
3053 | deactivateRouteAndItsChildren(node, context.children.getContext(childName), checks);
|
3054 | }
|
3055 | else {
|
3056 | deactivateRouteAndItsChildren(node, null, checks);
|
3057 | }
|
3058 | });
|
3059 | if (!r.component) {
|
3060 | checks.canDeactivateChecks.push(new CanDeactivate(null, r));
|
3061 | }
|
3062 | else if (context && context.outlet && context.outlet.isActivated) {
|
3063 | checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, r));
|
3064 | }
|
3065 | else {
|
3066 | checks.canDeactivateChecks.push(new CanDeactivate(null, r));
|
3067 | }
|
3068 | }
|
3069 |
|
3070 | |
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 | var INITIAL_VALUE = Symbol('INITIAL_VALUE');
|
3078 | function prioritizedGuardValue() {
|
3079 | return operators.switchMap(function (obs) {
|
3080 | return rxjs.combineLatest.apply(void 0, __spread(obs.map(function (o) { return o.pipe(operators.take(1), operators.startWith(INITIAL_VALUE)); }))).pipe(operators.scan(function (acc, list) {
|
3081 | var isPending = false;
|
3082 | return list.reduce(function (innerAcc, val, i) {
|
3083 | if (innerAcc !== INITIAL_VALUE)
|
3084 | return innerAcc;
|
3085 |
|
3086 | if (val === INITIAL_VALUE)
|
3087 | isPending = true;
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 | if (!isPending) {
|
3093 |
|
3094 |
|
3095 | if (val === false)
|
3096 | return val;
|
3097 | if (i === list.length - 1 || isUrlTree(val)) {
|
3098 | return val;
|
3099 | }
|
3100 | }
|
3101 | return innerAcc;
|
3102 | }, acc);
|
3103 | }, INITIAL_VALUE), operators.filter(function (item) { return item !== INITIAL_VALUE; }), operators.map(function (item) { return isUrlTree(item) ? item : item === true; }),
|
3104 | operators.take(1));
|
3105 | });
|
3106 | }
|
3107 |
|
3108 | |
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 | function checkGuards(moduleInjector, forwardEvent) {
|
3116 | return function (source) {
|
3117 | return source.pipe(operators.mergeMap(function (t) {
|
3118 | var targetSnapshot = t.targetSnapshot, currentSnapshot = t.currentSnapshot, _a = t.guards, canActivateChecks = _a.canActivateChecks, canDeactivateChecks = _a.canDeactivateChecks;
|
3119 | if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
|
3120 | return rxjs.of(__assign({}, t, { guardsResult: true }));
|
3121 | }
|
3122 | return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, moduleInjector)
|
3123 | .pipe(operators.mergeMap(function (canDeactivate) {
|
3124 | return canDeactivate && isBoolean(canDeactivate) ?
|
3125 | runCanActivateChecks(targetSnapshot, canActivateChecks, moduleInjector, forwardEvent) :
|
3126 | rxjs.of(canDeactivate);
|
3127 | }), operators.map(function (guardsResult) { return (__assign({}, t, { guardsResult: guardsResult })); }));
|
3128 | }));
|
3129 | };
|
3130 | }
|
3131 | function runCanDeactivateChecks(checks, futureRSS, currRSS, moduleInjector) {
|
3132 | return rxjs.from(checks).pipe(operators.mergeMap(function (check) {
|
3133 | return runCanDeactivate(check.component, check.route, currRSS, futureRSS, moduleInjector);
|
3134 | }), operators.first(function (result) { return result !== true; }, true));
|
3135 | }
|
3136 | function runCanActivateChecks(futureSnapshot, checks, moduleInjector, forwardEvent) {
|
3137 | return rxjs.from(checks).pipe(operators.concatMap(function (check) {
|
3138 | return rxjs.from([
|
3139 | fireChildActivationStart(check.route.parent, forwardEvent),
|
3140 | fireActivationStart(check.route, forwardEvent),
|
3141 | runCanActivateChild(futureSnapshot, check.path, moduleInjector),
|
3142 | runCanActivate(futureSnapshot, check.route, moduleInjector)
|
3143 | ])
|
3144 | .pipe(operators.concatAll(), operators.first(function (result) {
|
3145 | return result !== true;
|
3146 | }, true));
|
3147 | }), operators.first(function (result) { return result !== true; }, true));
|
3148 | }
|
3149 | |
3150 |
|
3151 |
|
3152 |
|
3153 |
|
3154 |
|
3155 |
|
3156 |
|
3157 | function fireActivationStart(snapshot, forwardEvent) {
|
3158 | if (snapshot !== null && forwardEvent) {
|
3159 | forwardEvent(new ActivationStart(snapshot));
|
3160 | }
|
3161 | return rxjs.of(true);
|
3162 | }
|
3163 | |
3164 |
|
3165 |
|
3166 |
|
3167 |
|
3168 |
|
3169 |
|
3170 |
|
3171 | function fireChildActivationStart(snapshot, forwardEvent) {
|
3172 | if (snapshot !== null && forwardEvent) {
|
3173 | forwardEvent(new ChildActivationStart(snapshot));
|
3174 | }
|
3175 | return rxjs.of(true);
|
3176 | }
|
3177 | function runCanActivate(futureRSS, futureARS, moduleInjector) {
|
3178 | var canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
|
3179 | if (!canActivate || canActivate.length === 0)
|
3180 | return rxjs.of(true);
|
3181 | var canActivateObservables = canActivate.map(function (c) {
|
3182 | return rxjs.defer(function () {
|
3183 | var guard = getToken(c, futureARS, moduleInjector);
|
3184 | var observable;
|
3185 | if (isCanActivate(guard)) {
|
3186 | observable = wrapIntoObservable(guard.canActivate(futureARS, futureRSS));
|
3187 | }
|
3188 | else if (isFunction(guard)) {
|
3189 | observable = wrapIntoObservable(guard(futureARS, futureRSS));
|
3190 | }
|
3191 | else {
|
3192 | throw new Error('Invalid CanActivate guard');
|
3193 | }
|
3194 | return observable.pipe(operators.first());
|
3195 | });
|
3196 | });
|
3197 | return rxjs.of(canActivateObservables).pipe(prioritizedGuardValue());
|
3198 | }
|
3199 | function runCanActivateChild(futureRSS, path, moduleInjector) {
|
3200 | var futureARS = path[path.length - 1];
|
3201 | var canActivateChildGuards = path.slice(0, path.length - 1)
|
3202 | .reverse()
|
3203 | .map(function (p) { return getCanActivateChild(p); })
|
3204 | .filter(function (_) { return _ !== null; });
|
3205 | var canActivateChildGuardsMapped = canActivateChildGuards.map(function (d) {
|
3206 | return rxjs.defer(function () {
|
3207 | var guardsMapped = d.guards.map(function (c) {
|
3208 | var guard = getToken(c, d.node, moduleInjector);
|
3209 | var observable;
|
3210 | if (isCanActivateChild(guard)) {
|
3211 | observable = wrapIntoObservable(guard.canActivateChild(futureARS, futureRSS));
|
3212 | }
|
3213 | else if (isFunction(guard)) {
|
3214 | observable = wrapIntoObservable(guard(futureARS, futureRSS));
|
3215 | }
|
3216 | else {
|
3217 | throw new Error('Invalid CanActivateChild guard');
|
3218 | }
|
3219 | return observable.pipe(operators.first());
|
3220 | });
|
3221 | return rxjs.of(guardsMapped).pipe(prioritizedGuardValue());
|
3222 | });
|
3223 | });
|
3224 | return rxjs.of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
|
3225 | }
|
3226 | function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector) {
|
3227 | var canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
|
3228 | if (!canDeactivate || canDeactivate.length === 0)
|
3229 | return rxjs.of(true);
|
3230 | var canDeactivateObservables = canDeactivate.map(function (c) {
|
3231 | var guard = getToken(c, currARS, moduleInjector);
|
3232 | var observable;
|
3233 | if (isCanDeactivate(guard)) {
|
3234 | observable =
|
3235 | wrapIntoObservable(guard.canDeactivate(component, currARS, currRSS, futureRSS));
|
3236 | }
|
3237 | else if (isFunction(guard)) {
|
3238 | observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS));
|
3239 | }
|
3240 | else {
|
3241 | throw new Error('Invalid CanDeactivate guard');
|
3242 | }
|
3243 | return observable.pipe(operators.first());
|
3244 | });
|
3245 | return rxjs.of(canDeactivateObservables).pipe(prioritizedGuardValue());
|
3246 | }
|
3247 |
|
3248 | |
3249 |
|
3250 |
|
3251 |
|
3252 |
|
3253 |
|
3254 |
|
3255 | var NoMatch$1 = (function () {
|
3256 | function NoMatch() {
|
3257 | }
|
3258 | return NoMatch;
|
3259 | }());
|
3260 | function recognize(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution) {
|
3261 | if (paramsInheritanceStrategy === void 0) { paramsInheritanceStrategy = 'emptyOnly'; }
|
3262 | if (relativeLinkResolution === void 0) { relativeLinkResolution = 'legacy'; }
|
3263 | return new Recognizer(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution)
|
3264 | .recognize();
|
3265 | }
|
3266 | var Recognizer = (function () {
|
3267 | function Recognizer(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution) {
|
3268 | this.rootComponentType = rootComponentType;
|
3269 | this.config = config;
|
3270 | this.urlTree = urlTree;
|
3271 | this.url = url;
|
3272 | this.paramsInheritanceStrategy = paramsInheritanceStrategy;
|
3273 | this.relativeLinkResolution = relativeLinkResolution;
|
3274 | }
|
3275 | Recognizer.prototype.recognize = function () {
|
3276 | try {
|
3277 | var rootSegmentGroup = split$1(this.urlTree.root, [], [], this.config, this.relativeLinkResolution).segmentGroup;
|
3278 | var children = this.processSegmentGroup(this.config, rootSegmentGroup, PRIMARY_OUTLET);
|
3279 | var root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze(__assign({}, this.urlTree.queryParams)), this.urlTree.fragment, {}, PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, {});
|
3280 | var rootNode = new TreeNode(root, children);
|
3281 | var routeState = new RouterStateSnapshot(this.url, rootNode);
|
3282 | this.inheritParamsAndData(routeState._root);
|
3283 | return rxjs.of(routeState);
|
3284 | }
|
3285 | catch (e) {
|
3286 | return new rxjs.Observable(function (obs) { return obs.error(e); });
|
3287 | }
|
3288 | };
|
3289 | Recognizer.prototype.inheritParamsAndData = function (routeNode) {
|
3290 | var _this = this;
|
3291 | var route = routeNode.value;
|
3292 | var i = inheritedParamsDataResolve(route, this.paramsInheritanceStrategy);
|
3293 | route.params = Object.freeze(i.params);
|
3294 | route.data = Object.freeze(i.data);
|
3295 | routeNode.children.forEach(function (n) { return _this.inheritParamsAndData(n); });
|
3296 | };
|
3297 | Recognizer.prototype.processSegmentGroup = function (config, segmentGroup, outlet) {
|
3298 | if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
|
3299 | return this.processChildren(config, segmentGroup);
|
3300 | }
|
3301 | return this.processSegment(config, segmentGroup, segmentGroup.segments, outlet);
|
3302 | };
|
3303 | Recognizer.prototype.processChildren = function (config, segmentGroup) {
|
3304 | var _this = this;
|
3305 | var children = mapChildrenIntoArray(segmentGroup, function (child, childOutlet) { return _this.processSegmentGroup(config, child, childOutlet); });
|
3306 | checkOutletNameUniqueness(children);
|
3307 | sortActivatedRouteSnapshots(children);
|
3308 | return children;
|
3309 | };
|
3310 | Recognizer.prototype.processSegment = function (config, segmentGroup, segments, outlet) {
|
3311 | var e_1, _a;
|
3312 | try {
|
3313 | for (var config_1 = __values(config), config_1_1 = config_1.next(); !config_1_1.done; config_1_1 = config_1.next()) {
|
3314 | var r = config_1_1.value;
|
3315 | try {
|
3316 | return this.processSegmentAgainstRoute(r, segmentGroup, segments, outlet);
|
3317 | }
|
3318 | catch (e) {
|
3319 | if (!(e instanceof NoMatch$1))
|
3320 | throw e;
|
3321 | }
|
3322 | }
|
3323 | }
|
3324 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
3325 | finally {
|
3326 | try {
|
3327 | if (config_1_1 && !config_1_1.done && (_a = config_1.return)) _a.call(config_1);
|
3328 | }
|
3329 | finally { if (e_1) throw e_1.error; }
|
3330 | }
|
3331 | if (this.noLeftoversInUrl(segmentGroup, segments, outlet)) {
|
3332 | return [];
|
3333 | }
|
3334 | throw new NoMatch$1();
|
3335 | };
|
3336 | Recognizer.prototype.noLeftoversInUrl = function (segmentGroup, segments, outlet) {
|
3337 | return segments.length === 0 && !segmentGroup.children[outlet];
|
3338 | };
|
3339 | Recognizer.prototype.processSegmentAgainstRoute = function (route, rawSegment, segments, outlet) {
|
3340 | if (route.redirectTo)
|
3341 | throw new NoMatch$1();
|
3342 | if ((route.outlet || PRIMARY_OUTLET) !== outlet)
|
3343 | throw new NoMatch$1();
|
3344 | var snapshot;
|
3345 | var consumedSegments = [];
|
3346 | var rawSlicedSegments = [];
|
3347 | if (route.path === '**') {
|
3348 | var params = segments.length > 0 ? last(segments).parameters : {};
|
3349 | snapshot = new ActivatedRouteSnapshot(segments, params, Object.freeze(__assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), outlet, route.component, route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + segments.length, getResolve(route));
|
3350 | }
|
3351 | else {
|
3352 | var result = match$1(rawSegment, route, segments);
|
3353 | consumedSegments = result.consumedSegments;
|
3354 | rawSlicedSegments = segments.slice(result.lastChild);
|
3355 | snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(__assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), outlet, route.component, route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + consumedSegments.length, getResolve(route));
|
3356 | }
|
3357 | var childConfig = getChildConfig(route);
|
3358 | var _a = split$1(rawSegment, consumedSegments, rawSlicedSegments, childConfig, this.relativeLinkResolution), segmentGroup = _a.segmentGroup, slicedSegments = _a.slicedSegments;
|
3359 | if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
|
3360 | var children_1 = this.processChildren(childConfig, segmentGroup);
|
3361 | return [new TreeNode(snapshot, children_1)];
|
3362 | }
|
3363 | if (childConfig.length === 0 && slicedSegments.length === 0) {
|
3364 | return [new TreeNode(snapshot, [])];
|
3365 | }
|
3366 | var children = this.processSegment(childConfig, segmentGroup, slicedSegments, PRIMARY_OUTLET);
|
3367 | return [new TreeNode(snapshot, children)];
|
3368 | };
|
3369 | return Recognizer;
|
3370 | }());
|
3371 | function sortActivatedRouteSnapshots(nodes) {
|
3372 | nodes.sort(function (a, b) {
|
3373 | if (a.value.outlet === PRIMARY_OUTLET)
|
3374 | return -1;
|
3375 | if (b.value.outlet === PRIMARY_OUTLET)
|
3376 | return 1;
|
3377 | return a.value.outlet.localeCompare(b.value.outlet);
|
3378 | });
|
3379 | }
|
3380 | function getChildConfig(route) {
|
3381 | if (route.children) {
|
3382 | return route.children;
|
3383 | }
|
3384 | if (route.loadChildren) {
|
3385 | return route._loadedConfig.routes;
|
3386 | }
|
3387 | return [];
|
3388 | }
|
3389 | function match$1(segmentGroup, route, segments) {
|
3390 | if (route.path === '') {
|
3391 | if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) {
|
3392 | throw new NoMatch$1();
|
3393 | }
|
3394 | return { consumedSegments: [], lastChild: 0, parameters: {} };
|
3395 | }
|
3396 | var matcher = route.matcher || defaultUrlMatcher;
|
3397 | var res = matcher(segments, segmentGroup, route);
|
3398 | if (!res)
|
3399 | throw new NoMatch$1();
|
3400 | var posParams = {};
|
3401 | forEach(res.posParams, function (v, k) { posParams[k] = v.path; });
|
3402 | var parameters = res.consumed.length > 0 ? __assign({}, posParams, res.consumed[res.consumed.length - 1].parameters) :
|
3403 | posParams;
|
3404 | return { consumedSegments: res.consumed, lastChild: res.consumed.length, parameters: parameters };
|
3405 | }
|
3406 | function checkOutletNameUniqueness(nodes) {
|
3407 | var names = {};
|
3408 | nodes.forEach(function (n) {
|
3409 | var routeWithSameOutletName = names[n.value.outlet];
|
3410 | if (routeWithSameOutletName) {
|
3411 | var p = routeWithSameOutletName.url.map(function (s) { return s.toString(); }).join('/');
|
3412 | var c = n.value.url.map(function (s) { return s.toString(); }).join('/');
|
3413 | throw new Error("Two segments cannot have the same outlet name: '" + p + "' and '" + c + "'.");
|
3414 | }
|
3415 | names[n.value.outlet] = n.value;
|
3416 | });
|
3417 | }
|
3418 | function getSourceSegmentGroup(segmentGroup) {
|
3419 | var s = segmentGroup;
|
3420 | while (s._sourceSegment) {
|
3421 | s = s._sourceSegment;
|
3422 | }
|
3423 | return s;
|
3424 | }
|
3425 | function getPathIndexShift(segmentGroup) {
|
3426 | var s = segmentGroup;
|
3427 | var res = (s._segmentIndexShift ? s._segmentIndexShift : 0);
|
3428 | while (s._sourceSegment) {
|
3429 | s = s._sourceSegment;
|
3430 | res += (s._segmentIndexShift ? s._segmentIndexShift : 0);
|
3431 | }
|
3432 | return res - 1;
|
3433 | }
|
3434 | function split$1(segmentGroup, consumedSegments, slicedSegments, config, relativeLinkResolution) {
|
3435 | if (slicedSegments.length > 0 &&
|
3436 | containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) {
|
3437 | var s_1 = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(segmentGroup, consumedSegments, config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));
|
3438 | s_1._sourceSegment = segmentGroup;
|
3439 | s_1._segmentIndexShift = consumedSegments.length;
|
3440 | return { segmentGroup: s_1, slicedSegments: [] };
|
3441 | }
|
3442 | if (slicedSegments.length === 0 &&
|
3443 | containsEmptyPathMatches(segmentGroup, slicedSegments, config)) {
|
3444 | var s_2 = new UrlSegmentGroup(segmentGroup.segments, addEmptyPathsToChildrenIfNeeded(segmentGroup, consumedSegments, slicedSegments, config, segmentGroup.children, relativeLinkResolution));
|
3445 | s_2._sourceSegment = segmentGroup;
|
3446 | s_2._segmentIndexShift = consumedSegments.length;
|
3447 | return { segmentGroup: s_2, slicedSegments: slicedSegments };
|
3448 | }
|
3449 | var s = new UrlSegmentGroup(segmentGroup.segments, segmentGroup.children);
|
3450 | s._sourceSegment = segmentGroup;
|
3451 | s._segmentIndexShift = consumedSegments.length;
|
3452 | return { segmentGroup: s, slicedSegments: slicedSegments };
|
3453 | }
|
3454 | function addEmptyPathsToChildrenIfNeeded(segmentGroup, consumedSegments, slicedSegments, routes, children, relativeLinkResolution) {
|
3455 | var e_2, _a;
|
3456 | var res = {};
|
3457 | try {
|
3458 | for (var routes_1 = __values(routes), routes_1_1 = routes_1.next(); !routes_1_1.done; routes_1_1 = routes_1.next()) {
|
3459 | var r = routes_1_1.value;
|
3460 | if (emptyPathMatch(segmentGroup, slicedSegments, r) && !children[getOutlet$1(r)]) {
|
3461 | var s = new UrlSegmentGroup([], {});
|
3462 | s._sourceSegment = segmentGroup;
|
3463 | if (relativeLinkResolution === 'legacy') {
|
3464 | s._segmentIndexShift = segmentGroup.segments.length;
|
3465 | }
|
3466 | else {
|
3467 | s._segmentIndexShift = consumedSegments.length;
|
3468 | }
|
3469 | res[getOutlet$1(r)] = s;
|
3470 | }
|
3471 | }
|
3472 | }
|
3473 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
3474 | finally {
|
3475 | try {
|
3476 | if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
|
3477 | }
|
3478 | finally { if (e_2) throw e_2.error; }
|
3479 | }
|
3480 | return __assign({}, children, res);
|
3481 | }
|
3482 | function createChildrenForEmptyPaths(segmentGroup, consumedSegments, routes, primarySegment) {
|
3483 | var e_3, _a;
|
3484 | var res = {};
|
3485 | res[PRIMARY_OUTLET] = primarySegment;
|
3486 | primarySegment._sourceSegment = segmentGroup;
|
3487 | primarySegment._segmentIndexShift = consumedSegments.length;
|
3488 | try {
|
3489 | for (var routes_2 = __values(routes), routes_2_1 = routes_2.next(); !routes_2_1.done; routes_2_1 = routes_2.next()) {
|
3490 | var r = routes_2_1.value;
|
3491 | if (r.path === '' && getOutlet$1(r) !== PRIMARY_OUTLET) {
|
3492 | var s = new UrlSegmentGroup([], {});
|
3493 | s._sourceSegment = segmentGroup;
|
3494 | s._segmentIndexShift = consumedSegments.length;
|
3495 | res[getOutlet$1(r)] = s;
|
3496 | }
|
3497 | }
|
3498 | }
|
3499 | catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
3500 | finally {
|
3501 | try {
|
3502 | if (routes_2_1 && !routes_2_1.done && (_a = routes_2.return)) _a.call(routes_2);
|
3503 | }
|
3504 | finally { if (e_3) throw e_3.error; }
|
3505 | }
|
3506 | return res;
|
3507 | }
|
3508 | function containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, routes) {
|
3509 | return routes.some(function (r) { return emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet$1(r) !== PRIMARY_OUTLET; });
|
3510 | }
|
3511 | function containsEmptyPathMatches(segmentGroup, slicedSegments, routes) {
|
3512 | return routes.some(function (r) { return emptyPathMatch(segmentGroup, slicedSegments, r); });
|
3513 | }
|
3514 | function emptyPathMatch(segmentGroup, slicedSegments, r) {
|
3515 | if ((segmentGroup.hasChildren() || slicedSegments.length > 0) && r.pathMatch === 'full') {
|
3516 | return false;
|
3517 | }
|
3518 | return r.path === '' && r.redirectTo === undefined;
|
3519 | }
|
3520 | function getOutlet$1(route) {
|
3521 | return route.outlet || PRIMARY_OUTLET;
|
3522 | }
|
3523 | function getData(route) {
|
3524 | return route.data || {};
|
3525 | }
|
3526 | function getResolve(route) {
|
3527 | return route.resolve || {};
|
3528 | }
|
3529 |
|
3530 | |
3531 |
|
3532 |
|
3533 |
|
3534 |
|
3535 |
|
3536 |
|
3537 | function recognize$1(rootComponentType, config, serializer, paramsInheritanceStrategy, relativeLinkResolution) {
|
3538 | return function (source) {
|
3539 | return source.pipe(operators.mergeMap(function (t) { return recognize(rootComponentType, config, t.urlAfterRedirects, serializer(t.urlAfterRedirects), paramsInheritanceStrategy, relativeLinkResolution)
|
3540 | .pipe(operators.map(function (targetSnapshot) { return (__assign({}, t, { targetSnapshot: targetSnapshot })); })); }));
|
3541 | };
|
3542 | }
|
3543 |
|
3544 | |
3545 |
|
3546 |
|
3547 |
|
3548 |
|
3549 |
|
3550 |
|
3551 | function resolveData(paramsInheritanceStrategy, moduleInjector) {
|
3552 | return function (source) {
|
3553 | return source.pipe(operators.mergeMap(function (t) {
|
3554 | var targetSnapshot = t.targetSnapshot, canActivateChecks = t.guards.canActivateChecks;
|
3555 | if (!canActivateChecks.length) {
|
3556 | return rxjs.of(t);
|
3557 | }
|
3558 | return rxjs.from(canActivateChecks)
|
3559 | .pipe(operators.concatMap(function (check) { return runResolve(check.route, targetSnapshot, paramsInheritanceStrategy, moduleInjector); }), operators.reduce(function (_, __) { return _; }), operators.map(function (_) { return t; }));
|
3560 | }));
|
3561 | };
|
3562 | }
|
3563 | function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjector) {
|
3564 | var resolve = futureARS._resolve;
|
3565 | return resolveNode(resolve, futureARS, futureRSS, moduleInjector)
|
3566 | .pipe(operators.map(function (resolvedData) {
|
3567 | futureARS._resolvedData = resolvedData;
|
3568 | futureARS.data = __assign({}, futureARS.data, inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve);
|
3569 | return null;
|
3570 | }));
|
3571 | }
|
3572 | function resolveNode(resolve, futureARS, futureRSS, moduleInjector) {
|
3573 | var keys = Object.keys(resolve);
|
3574 | if (keys.length === 0) {
|
3575 | return rxjs.of({});
|
3576 | }
|
3577 | if (keys.length === 1) {
|
3578 | var key_1 = keys[0];
|
3579 | return getResolver(resolve[key_1], futureARS, futureRSS, moduleInjector)
|
3580 | .pipe(operators.map(function (value) {
|
3581 | var _a;
|
3582 | return _a = {}, _a[key_1] = value, _a;
|
3583 | }));
|
3584 | }
|
3585 | var data = {};
|
3586 | var runningResolvers$ = rxjs.from(keys).pipe(operators.mergeMap(function (key) {
|
3587 | return getResolver(resolve[key], futureARS, futureRSS, moduleInjector)
|
3588 | .pipe(operators.map(function (value) {
|
3589 | data[key] = value;
|
3590 | return value;
|
3591 | }));
|
3592 | }));
|
3593 | return runningResolvers$.pipe(operators.last(), operators.map(function () { return data; }));
|
3594 | }
|
3595 | function getResolver(injectionToken, futureARS, futureRSS, moduleInjector) {
|
3596 | var resolver = getToken(injectionToken, futureARS, moduleInjector);
|
3597 | return resolver.resolve ? wrapIntoObservable(resolver.resolve(futureARS, futureRSS)) :
|
3598 | wrapIntoObservable(resolver(futureARS, futureRSS));
|
3599 | }
|
3600 |
|
3601 | |
3602 |
|
3603 |
|
3604 |
|
3605 |
|
3606 |
|
3607 |
|
3608 | |
3609 |
|
3610 |
|
3611 |
|
3612 |
|
3613 |
|
3614 | function switchTap(next) {
|
3615 | return function (source) {
|
3616 | return source.pipe(operators.switchMap(function (v) {
|
3617 | var nextResult = next(v);
|
3618 | if (nextResult) {
|
3619 | return rxjs.from(nextResult).pipe(operators.map(function () { return v; }));
|
3620 | }
|
3621 | return rxjs.from([v]);
|
3622 | }));
|
3623 | };
|
3624 | }
|
3625 |
|
3626 | |
3627 |
|
3628 |
|
3629 |
|
3630 |
|
3631 |
|
3632 |
|
3633 | |
3634 |
|
3635 |
|
3636 |
|
3637 |
|
3638 |
|
3639 |
|
3640 | var RouteReuseStrategy = (function () {
|
3641 | function RouteReuseStrategy() {
|
3642 | }
|
3643 | return RouteReuseStrategy;
|
3644 | }());
|
3645 | |
3646 |
|
3647 |
|
3648 | var DefaultRouteReuseStrategy = (function () {
|
3649 | function DefaultRouteReuseStrategy() {
|
3650 | }
|
3651 | DefaultRouteReuseStrategy.prototype.shouldDetach = function (route) { return false; };
|
3652 | DefaultRouteReuseStrategy.prototype.store = function (route, detachedTree) { };
|
3653 | DefaultRouteReuseStrategy.prototype.shouldAttach = function (route) { return false; };
|
3654 | DefaultRouteReuseStrategy.prototype.retrieve = function (route) { return null; };
|
3655 | DefaultRouteReuseStrategy.prototype.shouldReuseRoute = function (future, curr) {
|
3656 | return future.routeConfig === curr.routeConfig;
|
3657 | };
|
3658 | return DefaultRouteReuseStrategy;
|
3659 | }());
|
3660 |
|
3661 | |
3662 |
|
3663 |
|
3664 |
|
3665 |
|
3666 |
|
3667 |
|
3668 | |
3669 |
|
3670 |
|
3671 |
|
3672 | var ROUTES = new core.InjectionToken('ROUTES');
|
3673 | var RouterConfigLoader = (function () {
|
3674 | function RouterConfigLoader(loader, compiler, onLoadStartListener, onLoadEndListener) {
|
3675 | this.loader = loader;
|
3676 | this.compiler = compiler;
|
3677 | this.onLoadStartListener = onLoadStartListener;
|
3678 | this.onLoadEndListener = onLoadEndListener;
|
3679 | }
|
3680 | RouterConfigLoader.prototype.load = function (parentInjector, route) {
|
3681 | var _this = this;
|
3682 | if (this.onLoadStartListener) {
|
3683 | this.onLoadStartListener(route);
|
3684 | }
|
3685 | var moduleFactory$ = this.loadModuleFactory(route.loadChildren);
|
3686 | return moduleFactory$.pipe(operators.map(function (factory) {
|
3687 | if (_this.onLoadEndListener) {
|
3688 | _this.onLoadEndListener(route);
|
3689 | }
|
3690 | var module = factory.create(parentInjector);
|
3691 | return new LoadedRouterConfig(flatten(module.injector.get(ROUTES)).map(standardizeConfig), module);
|
3692 | }));
|
3693 | };
|
3694 | RouterConfigLoader.prototype.loadModuleFactory = function (loadChildren) {
|
3695 | var _this = this;
|
3696 | if (typeof loadChildren === 'string') {
|
3697 | return rxjs.from(this.loader.load(loadChildren));
|
3698 | }
|
3699 | else {
|
3700 | return wrapIntoObservable(loadChildren()).pipe(operators.mergeMap(function (t) {
|
3701 | if (t instanceof core.NgModuleFactory) {
|
3702 | return rxjs.of(t);
|
3703 | }
|
3704 | else {
|
3705 | return rxjs.from(_this.compiler.compileModuleAsync(t));
|
3706 | }
|
3707 | }));
|
3708 | }
|
3709 | };
|
3710 | return RouterConfigLoader;
|
3711 | }());
|
3712 |
|
3713 | |
3714 |
|
3715 |
|
3716 |
|
3717 |
|
3718 |
|
3719 |
|
3720 | |
3721 |
|
3722 |
|
3723 |
|
3724 |
|
3725 |
|
3726 |
|
3727 | var UrlHandlingStrategy = (function () {
|
3728 | function UrlHandlingStrategy() {
|
3729 | }
|
3730 | return UrlHandlingStrategy;
|
3731 | }());
|
3732 | |
3733 |
|
3734 |
|
3735 | var DefaultUrlHandlingStrategy = (function () {
|
3736 | function DefaultUrlHandlingStrategy() {
|
3737 | }
|
3738 | DefaultUrlHandlingStrategy.prototype.shouldProcessUrl = function (url) { return true; };
|
3739 | DefaultUrlHandlingStrategy.prototype.extract = function (url) { return url; };
|
3740 | DefaultUrlHandlingStrategy.prototype.merge = function (newUrlPart, wholeUrl) { return newUrlPart; };
|
3741 | return DefaultUrlHandlingStrategy;
|
3742 | }());
|
3743 |
|
3744 | |
3745 |
|
3746 |
|
3747 |
|
3748 |
|
3749 |
|
3750 |
|
3751 | function defaultErrorHandler(error) {
|
3752 | throw error;
|
3753 | }
|
3754 | function defaultMalformedUriErrorHandler(error, urlSerializer, url) {
|
3755 | return urlSerializer.parse('/');
|
3756 | }
|
3757 | |
3758 |
|
3759 |
|
3760 | function defaultRouterHook(snapshot, runExtras) {
|
3761 | return rxjs.of(null);
|
3762 | }
|
3763 | |
3764 |
|
3765 |
|
3766 |
|
3767 |
|
3768 |
|
3769 |
|
3770 |
|
3771 |
|
3772 |
|
3773 |
|
3774 |
|
3775 | var Router = (function () {
|
3776 | |
3777 |
|
3778 |
|
3779 |
|
3780 | function Router(rootComponentType, urlSerializer, rootContexts, location, injector, loader, compiler, config) {
|
3781 | var _this = this;
|
3782 | this.rootComponentType = rootComponentType;
|
3783 | this.urlSerializer = urlSerializer;
|
3784 | this.rootContexts = rootContexts;
|
3785 | this.location = location;
|
3786 | this.config = config;
|
3787 | this.lastSuccessfulNavigation = null;
|
3788 | this.currentNavigation = null;
|
3789 | this.navigationId = 0;
|
3790 | this.isNgZoneEnabled = false;
|
3791 | |
3792 |
|
3793 |
|
3794 | this.events = new rxjs.Subject();
|
3795 | |
3796 |
|
3797 |
|
3798 | this.errorHandler = defaultErrorHandler;
|
3799 | |
3800 |
|
3801 |
|
3802 |
|
3803 |
|
3804 | this.malformedUriErrorHandler = defaultMalformedUriErrorHandler;
|
3805 | |
3806 |
|
3807 |
|
3808 |
|
3809 | this.navigated = false;
|
3810 | this.lastSuccessfulId = -1;
|
3811 | |
3812 |
|
3813 |
|
3814 |
|
3815 |
|
3816 |
|
3817 |
|
3818 | this.hooks = {
|
3819 | beforePreactivation: defaultRouterHook,
|
3820 | afterPreactivation: defaultRouterHook
|
3821 | };
|
3822 | |
3823 |
|
3824 |
|
3825 | this.urlHandlingStrategy = new DefaultUrlHandlingStrategy();
|
3826 | |
3827 |
|
3828 |
|
3829 | this.routeReuseStrategy = new DefaultRouteReuseStrategy();
|
3830 | |
3831 |
|
3832 |
|
3833 |
|
3834 |
|
3835 | this.onSameUrlNavigation = 'ignore';
|
3836 | |
3837 |
|
3838 |
|
3839 |
|
3840 |
|
3841 |
|
3842 |
|
3843 |
|
3844 |
|
3845 | this.paramsInheritanceStrategy = 'emptyOnly';
|
3846 | |
3847 |
|
3848 |
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 | this.urlUpdateStrategy = 'deferred';
|
3857 | |
3858 |
|
3859 |
|
3860 | this.relativeLinkResolution = 'legacy';
|
3861 | var onLoadStart = function (r) { return _this.triggerEvent(new RouteConfigLoadStart(r)); };
|
3862 | var onLoadEnd = function (r) { return _this.triggerEvent(new RouteConfigLoadEnd(r)); };
|
3863 | this.ngModule = injector.get(core.NgModuleRef);
|
3864 | this.console = injector.get(core.ɵConsole);
|
3865 | var ngZone = injector.get(core.NgZone);
|
3866 | this.isNgZoneEnabled = ngZone instanceof core.NgZone;
|
3867 | this.resetConfig(config);
|
3868 | this.currentUrlTree = createEmptyUrlTree();
|
3869 | this.rawUrlTree = this.currentUrlTree;
|
3870 | this.browserUrlTree = this.currentUrlTree;
|
3871 | this.configLoader = new RouterConfigLoader(loader, compiler, onLoadStart, onLoadEnd);
|
3872 | this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType);
|
3873 | this.transitions = new rxjs.BehaviorSubject({
|
3874 | id: 0,
|
3875 | currentUrlTree: this.currentUrlTree,
|
3876 | currentRawUrl: this.currentUrlTree,
|
3877 | extractedUrl: this.urlHandlingStrategy.extract(this.currentUrlTree),
|
3878 | urlAfterRedirects: this.urlHandlingStrategy.extract(this.currentUrlTree),
|
3879 | rawUrl: this.currentUrlTree,
|
3880 | extras: {},
|
3881 | resolve: null,
|
3882 | reject: null,
|
3883 | promise: Promise.resolve(true),
|
3884 | source: 'imperative',
|
3885 | restoredState: null,
|
3886 | currentSnapshot: this.routerState.snapshot,
|
3887 | targetSnapshot: null,
|
3888 | currentRouterState: this.routerState,
|
3889 | targetRouterState: null,
|
3890 | guards: { canActivateChecks: [], canDeactivateChecks: [] },
|
3891 | guardsResult: null,
|
3892 | });
|
3893 | this.navigations = this.setupNavigations(this.transitions);
|
3894 | this.processNavigations();
|
3895 | }
|
3896 | Router.prototype.setupNavigations = function (transitions) {
|
3897 | var _this = this;
|
3898 | var eventsSubject = this.events;
|
3899 | return transitions.pipe(operators.filter(function (t) { return t.id !== 0; }),
|
3900 |
|
3901 | operators.map(function (t) { return (__assign({}, t, { extractedUrl: _this.urlHandlingStrategy.extract(t.rawUrl) })); }),
|
3902 |
|
3903 | operators.switchMap(function (t) {
|
3904 | var completed = false;
|
3905 | var errored = false;
|
3906 | return rxjs.of(t).pipe(
|
3907 |
|
3908 | operators.tap(function (t) {
|
3909 | _this.currentNavigation = {
|
3910 | id: t.id,
|
3911 | initialUrl: t.currentRawUrl,
|
3912 | extractedUrl: t.extractedUrl,
|
3913 | trigger: t.source,
|
3914 | extras: t.extras,
|
3915 | previousNavigation: _this.lastSuccessfulNavigation ? __assign({}, _this.lastSuccessfulNavigation, { previousNavigation: null }) :
|
3916 | null
|
3917 | };
|
3918 | }), operators.switchMap(function (t) {
|
3919 | var urlTransition = !_this.navigated || t.extractedUrl.toString() !== _this.browserUrlTree.toString();
|
3920 | var processCurrentUrl = (_this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
|
3921 | _this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
|
3922 | if (processCurrentUrl) {
|
3923 | return rxjs.of(t).pipe(
|
3924 |
|
3925 | operators.switchMap(function (t) {
|
3926 | var transition = _this.transitions.getValue();
|
3927 | eventsSubject.next(new NavigationStart(t.id, _this.serializeUrl(t.extractedUrl), t.source, t.restoredState));
|
3928 | if (transition !== _this.transitions.getValue()) {
|
3929 | return rxjs.EMPTY;
|
3930 | }
|
3931 | return [t];
|
3932 | }),
|
3933 |
|
3934 |
|
3935 | operators.switchMap(function (t) { return Promise.resolve(t); }),
|
3936 |
|
3937 | applyRedirects$1(_this.ngModule.injector, _this.configLoader, _this.urlSerializer, _this.config),
|
3938 |
|
3939 | operators.tap(function (t) {
|
3940 | _this.currentNavigation = __assign({}, _this.currentNavigation, { finalUrl: t.urlAfterRedirects });
|
3941 | }),
|
3942 |
|
3943 | recognize$1(_this.rootComponentType, _this.config, function (url) { return _this.serializeUrl(url); }, _this.paramsInheritanceStrategy, _this.relativeLinkResolution),
|
3944 |
|
3945 | operators.tap(function (t) {
|
3946 | if (_this.urlUpdateStrategy === 'eager') {
|
3947 | if (!t.extras.skipLocationChange) {
|
3948 | _this.setBrowserUrl(t.urlAfterRedirects, !!t.extras.replaceUrl, t.id, t.extras.state);
|
3949 | }
|
3950 | _this.browserUrlTree = t.urlAfterRedirects;
|
3951 | }
|
3952 | }),
|
3953 |
|
3954 | operators.tap(function (t) {
|
3955 | var routesRecognized = new RoutesRecognized(t.id, _this.serializeUrl(t.extractedUrl), _this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
|
3956 | eventsSubject.next(routesRecognized);
|
3957 | }));
|
3958 | }
|
3959 | else {
|
3960 | var processPreviousUrl = urlTransition && _this.rawUrlTree &&
|
3961 | _this.urlHandlingStrategy.shouldProcessUrl(_this.rawUrlTree);
|
3962 | |
3963 |
|
3964 |
|
3965 | if (processPreviousUrl) {
|
3966 | var id = t.id, extractedUrl = t.extractedUrl, source = t.source, restoredState = t.restoredState, extras = t.extras;
|
3967 | var navStart = new NavigationStart(id, _this.serializeUrl(extractedUrl), source, restoredState);
|
3968 | eventsSubject.next(navStart);
|
3969 | var targetSnapshot = createEmptyState(extractedUrl, _this.rootComponentType).snapshot;
|
3970 | return rxjs.of(__assign({}, t, { targetSnapshot: targetSnapshot, urlAfterRedirects: extractedUrl, extras: __assign({}, extras, { skipLocationChange: false, replaceUrl: false }) }));
|
3971 | }
|
3972 | else {
|
3973 | |
3974 |
|
3975 |
|
3976 |
|
3977 | _this.rawUrlTree = t.rawUrl;
|
3978 | _this.browserUrlTree = t.urlAfterRedirects;
|
3979 | t.resolve(null);
|
3980 | return rxjs.EMPTY;
|
3981 | }
|
3982 | }
|
3983 | }),
|
3984 |
|
3985 | switchTap(function (t) {
|
3986 | var targetSnapshot = t.targetSnapshot, navigationId = t.id, appliedUrlTree = t.extractedUrl, rawUrlTree = t.rawUrl, _a = t.extras, skipLocationChange = _a.skipLocationChange, replaceUrl = _a.replaceUrl;
|
3987 | return _this.hooks.beforePreactivation(targetSnapshot, {
|
3988 | navigationId: navigationId,
|
3989 | appliedUrlTree: appliedUrlTree,
|
3990 | rawUrlTree: rawUrlTree,
|
3991 | skipLocationChange: !!skipLocationChange,
|
3992 | replaceUrl: !!replaceUrl,
|
3993 | });
|
3994 | }),
|
3995 |
|
3996 | operators.tap(function (t) {
|
3997 | var guardsStart = new GuardsCheckStart(t.id, _this.serializeUrl(t.extractedUrl), _this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
|
3998 | _this.triggerEvent(guardsStart);
|
3999 | }), operators.map(function (t) { return (__assign({}, t, { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, _this.rootContexts) })); }), checkGuards(_this.ngModule.injector, function (evt) { return _this.triggerEvent(evt); }), operators.tap(function (t) {
|
4000 | if (isUrlTree(t.guardsResult)) {
|
4001 | var error = navigationCancelingError("Redirecting to \"" + _this.serializeUrl(t.guardsResult) + "\"");
|
4002 | error.url = t.guardsResult;
|
4003 | throw error;
|
4004 | }
|
4005 | }), operators.tap(function (t) {
|
4006 | var guardsEnd = new GuardsCheckEnd(t.id, _this.serializeUrl(t.extractedUrl), _this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
|
4007 | _this.triggerEvent(guardsEnd);
|
4008 | }), operators.filter(function (t) {
|
4009 | if (!t.guardsResult) {
|
4010 | _this.resetUrlToCurrentUrlTree();
|
4011 | var navCancel = new NavigationCancel(t.id, _this.serializeUrl(t.extractedUrl), '');
|
4012 | eventsSubject.next(navCancel);
|
4013 | t.resolve(false);
|
4014 | return false;
|
4015 | }
|
4016 | return true;
|
4017 | }),
|
4018 |
|
4019 | switchTap(function (t) {
|
4020 | if (t.guards.canActivateChecks.length) {
|
4021 | return rxjs.of(t).pipe(operators.tap(function (t) {
|
4022 | var resolveStart = new ResolveStart(t.id, _this.serializeUrl(t.extractedUrl), _this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
|
4023 | _this.triggerEvent(resolveStart);
|
4024 | }), resolveData(_this.paramsInheritanceStrategy, _this.ngModule.injector),
|
4025 | operators.tap(function (t) {
|
4026 | var resolveEnd = new ResolveEnd(t.id, _this.serializeUrl(t.extractedUrl), _this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
|
4027 | _this.triggerEvent(resolveEnd);
|
4028 | }));
|
4029 | }
|
4030 | return undefined;
|
4031 | }),
|
4032 |
|
4033 | switchTap(function (t) {
|
4034 | var targetSnapshot = t.targetSnapshot, navigationId = t.id, appliedUrlTree = t.extractedUrl, rawUrlTree = t.rawUrl, _a = t.extras, skipLocationChange = _a.skipLocationChange, replaceUrl = _a.replaceUrl;
|
4035 | return _this.hooks.afterPreactivation(targetSnapshot, {
|
4036 | navigationId: navigationId,
|
4037 | appliedUrlTree: appliedUrlTree,
|
4038 | rawUrlTree: rawUrlTree,
|
4039 | skipLocationChange: !!skipLocationChange,
|
4040 | replaceUrl: !!replaceUrl,
|
4041 | });
|
4042 | }), operators.map(function (t) {
|
4043 | var targetRouterState = createRouterState(_this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
|
4044 | return (__assign({}, t, { targetRouterState: targetRouterState }));
|
4045 | }),
|
4046 | |
4047 |
|
4048 |
|
4049 |
|
4050 |
|
4051 | operators.tap(function (t) {
|
4052 | _this.currentUrlTree = t.urlAfterRedirects;
|
4053 | _this.rawUrlTree = _this.urlHandlingStrategy.merge(_this.currentUrlTree, t.rawUrl);
|
4054 | _this.routerState = t.targetRouterState;
|
4055 | if (_this.urlUpdateStrategy === 'deferred') {
|
4056 | if (!t.extras.skipLocationChange) {
|
4057 | _this.setBrowserUrl(_this.rawUrlTree, !!t.extras.replaceUrl, t.id, t.extras.state);
|
4058 | }
|
4059 | _this.browserUrlTree = t.urlAfterRedirects;
|
4060 | }
|
4061 | }), activateRoutes(_this.rootContexts, _this.routeReuseStrategy, function (evt) { return _this.triggerEvent(evt); }), operators.tap({ next: function () { completed = true; }, complete: function () { completed = true; } }), operators.finalize(function () {
|
4062 | |
4063 |
|
4064 |
|
4065 |
|
4066 |
|
4067 | if (!completed && !errored) {
|
4068 |
|
4069 |
|
4070 |
|
4071 |
|
4072 |
|
4073 |
|
4074 | _this.resetUrlToCurrentUrlTree();
|
4075 | var navCancel = new NavigationCancel(t.id, _this.serializeUrl(t.extractedUrl), "Navigation ID " + t.id + " is not equal to the current navigation id " + _this.navigationId);
|
4076 | eventsSubject.next(navCancel);
|
4077 | t.resolve(false);
|
4078 | }
|
4079 |
|
4080 |
|
4081 |
|
4082 | _this.currentNavigation = null;
|
4083 | }), operators.catchError(function (e) {
|
4084 | errored = true;
|
4085 | |
4086 |
|
4087 | if (isNavigationCancelingError(e)) {
|
4088 | var redirecting = isUrlTree(e.url);
|
4089 | if (!redirecting) {
|
4090 |
|
4091 |
|
4092 |
|
4093 |
|
4094 |
|
4095 | _this.navigated = true;
|
4096 | _this.resetStateAndUrl(t.currentRouterState, t.currentUrlTree, t.rawUrl);
|
4097 | }
|
4098 | var navCancel = new NavigationCancel(t.id, _this.serializeUrl(t.extractedUrl), e.message);
|
4099 | eventsSubject.next(navCancel);
|
4100 | t.resolve(false);
|
4101 | if (redirecting) {
|
4102 | _this.navigateByUrl(e.url);
|
4103 | }
|
4104 | |
4105 |
|
4106 | }
|
4107 | else {
|
4108 | _this.resetStateAndUrl(t.currentRouterState, t.currentUrlTree, t.rawUrl);
|
4109 | var navError = new NavigationError(t.id, _this.serializeUrl(t.extractedUrl), e);
|
4110 | eventsSubject.next(navError);
|
4111 | try {
|
4112 | t.resolve(_this.errorHandler(e));
|
4113 | }
|
4114 | catch (ee) {
|
4115 | t.reject(ee);
|
4116 | }
|
4117 | }
|
4118 | return rxjs.EMPTY;
|
4119 | }));
|
4120 |
|
4121 | }));
|
4122 | };
|
4123 | |
4124 |
|
4125 |
|
4126 |
|
4127 | Router.prototype.resetRootComponentType = function (rootComponentType) {
|
4128 | this.rootComponentType = rootComponentType;
|
4129 |
|
4130 |
|
4131 | this.routerState.root.component = this.rootComponentType;
|
4132 | };
|
4133 | Router.prototype.getTransition = function () {
|
4134 | var transition = this.transitions.value;
|
4135 |
|
4136 |
|
4137 |
|
4138 | transition.urlAfterRedirects = this.browserUrlTree;
|
4139 | return transition;
|
4140 | };
|
4141 | Router.prototype.setTransition = function (t) {
|
4142 | this.transitions.next(__assign({}, this.getTransition(), t));
|
4143 | };
|
4144 | |
4145 |
|
4146 |
|
4147 | Router.prototype.initialNavigation = function () {
|
4148 | this.setUpLocationChangeListener();
|
4149 | if (this.navigationId === 0) {
|
4150 | this.navigateByUrl(this.location.path(true), { replaceUrl: true });
|
4151 | }
|
4152 | };
|
4153 | |
4154 |
|
4155 |
|
4156 | Router.prototype.setUpLocationChangeListener = function () {
|
4157 | var _this = this;
|
4158 |
|
4159 |
|
4160 |
|
4161 | if (!this.locationSubscription) {
|
4162 | this.locationSubscription = this.location.subscribe(function (change) {
|
4163 | var rawUrlTree = _this.parseUrl(change['url']);
|
4164 | var source = change['type'] === 'popstate' ? 'popstate' : 'hashchange';
|
4165 |
|
4166 |
|
4167 | var state = change.state && change.state.navigationId ? change.state : null;
|
4168 | setTimeout(function () { _this.scheduleNavigation(rawUrlTree, source, state, { replaceUrl: true }); }, 0);
|
4169 | });
|
4170 | }
|
4171 | };
|
4172 | Object.defineProperty(Router.prototype, "url", {
|
4173 |
|
4174 | get: function () { return this.serializeUrl(this.currentUrlTree); },
|
4175 | enumerable: true,
|
4176 | configurable: true
|
4177 | });
|
4178 |
|
4179 | Router.prototype.getCurrentNavigation = function () { return this.currentNavigation; };
|
4180 |
|
4181 | Router.prototype.triggerEvent = function (event) { this.events.next(event); };
|
4182 | |
4183 |
|
4184 |
|
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 |
|
4193 |
|
4194 |
|
4195 |
|
4196 |
|
4197 |
|
4198 | Router.prototype.resetConfig = function (config) {
|
4199 | validateConfig(config);
|
4200 | this.config = config.map(standardizeConfig);
|
4201 | this.navigated = false;
|
4202 | this.lastSuccessfulId = -1;
|
4203 | };
|
4204 |
|
4205 | Router.prototype.ngOnDestroy = function () { this.dispose(); };
|
4206 |
|
4207 | Router.prototype.dispose = function () {
|
4208 | if (this.locationSubscription) {
|
4209 | this.locationSubscription.unsubscribe();
|
4210 | this.locationSubscription = null;
|
4211 | }
|
4212 | };
|
4213 | |
4214 |
|
4215 |
|
4216 |
|
4217 |
|
4218 |
|
4219 |
|
4220 |
|
4221 |
|
4222 |
|
4223 |
|
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 |
|
4230 |
|
4231 |
|
4232 |
|
4233 |
|
4234 |
|
4235 |
|
4236 |
|
4237 |
|
4238 |
|
4239 |
|
4240 |
|
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 |
|
4257 |
|
4258 | Router.prototype.createUrlTree = function (commands, navigationExtras) {
|
4259 | if (navigationExtras === void 0) { navigationExtras = {}; }
|
4260 | var relativeTo = navigationExtras.relativeTo, queryParams = navigationExtras.queryParams, fragment = navigationExtras.fragment, preserveQueryParams = navigationExtras.preserveQueryParams, queryParamsHandling = navigationExtras.queryParamsHandling, preserveFragment = navigationExtras.preserveFragment;
|
4261 | if (core.isDevMode() && preserveQueryParams && console && console.warn) {
|
4262 | console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.');
|
4263 | }
|
4264 | var a = relativeTo || this.routerState.root;
|
4265 | var f = preserveFragment ? this.currentUrlTree.fragment : fragment;
|
4266 | var q = null;
|
4267 | if (queryParamsHandling) {
|
4268 | switch (queryParamsHandling) {
|
4269 | case 'merge':
|
4270 | q = __assign({}, this.currentUrlTree.queryParams, queryParams);
|
4271 | break;
|
4272 | case 'preserve':
|
4273 | q = this.currentUrlTree.queryParams;
|
4274 | break;
|
4275 | default:
|
4276 | q = queryParams || null;
|
4277 | }
|
4278 | }
|
4279 | else {
|
4280 | q = preserveQueryParams ? this.currentUrlTree.queryParams : queryParams || null;
|
4281 | }
|
4282 | if (q !== null) {
|
4283 | q = this.removeEmptyProps(q);
|
4284 | }
|
4285 | return createUrlTree(a, this.currentUrlTree, commands, q, f);
|
4286 | };
|
4287 | |
4288 |
|
4289 |
|
4290 |
|
4291 |
|
4292 |
|
4293 |
|
4294 |
|
4295 |
|
4296 |
|
4297 |
|
4298 |
|
4299 |
|
4300 |
|
4301 |
|
4302 |
|
4303 |
|
4304 |
|
4305 |
|
4306 |
|
4307 |
|
4308 |
|
4309 |
|
4310 | Router.prototype.navigateByUrl = function (url, extras) {
|
4311 | if (extras === void 0) { extras = { skipLocationChange: false }; }
|
4312 | if (core.isDevMode() && this.isNgZoneEnabled && !core.NgZone.isInAngularZone()) {
|
4313 | this.console.warn("Navigation triggered outside Angular zone, did you forget to call 'ngZone.run()'?");
|
4314 | }
|
4315 | var urlTree = isUrlTree(url) ? url : this.parseUrl(url);
|
4316 | var mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree);
|
4317 | return this.scheduleNavigation(mergedTree, 'imperative', null, extras);
|
4318 | };
|
4319 | |
4320 |
|
4321 |
|
4322 |
|
4323 |
|
4324 |
|
4325 |
|
4326 |
|
4327 |
|
4328 |
|
4329 |
|
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 |
|
4337 |
|
4338 |
|
4339 |
|
4340 |
|
4341 |
|
4342 |
|
4343 |
|
4344 |
|
4345 |
|
4346 |
|
4347 |
|
4348 | Router.prototype.navigate = function (commands, extras) {
|
4349 | if (extras === void 0) { extras = { skipLocationChange: false }; }
|
4350 | validateCommands(commands);
|
4351 | return this.navigateByUrl(this.createUrlTree(commands, extras), extras);
|
4352 | };
|
4353 |
|
4354 | Router.prototype.serializeUrl = function (url) { return this.urlSerializer.serialize(url); };
|
4355 |
|
4356 | Router.prototype.parseUrl = function (url) {
|
4357 | var urlTree;
|
4358 | try {
|
4359 | urlTree = this.urlSerializer.parse(url);
|
4360 | }
|
4361 | catch (e) {
|
4362 | urlTree = this.malformedUriErrorHandler(e, this.urlSerializer, url);
|
4363 | }
|
4364 | return urlTree;
|
4365 | };
|
4366 |
|
4367 | Router.prototype.isActive = function (url, exact) {
|
4368 | if (isUrlTree(url)) {
|
4369 | return containsTree(this.currentUrlTree, url, exact);
|
4370 | }
|
4371 | var urlTree = this.parseUrl(url);
|
4372 | return containsTree(this.currentUrlTree, urlTree, exact);
|
4373 | };
|
4374 | Router.prototype.removeEmptyProps = function (params) {
|
4375 | return Object.keys(params).reduce(function (result, key) {
|
4376 | var value = params[key];
|
4377 | if (value !== null && value !== undefined) {
|
4378 | result[key] = value;
|
4379 | }
|
4380 | return result;
|
4381 | }, {});
|
4382 | };
|
4383 | Router.prototype.processNavigations = function () {
|
4384 | var _this = this;
|
4385 | this.navigations.subscribe(function (t) {
|
4386 | _this.navigated = true;
|
4387 | _this.lastSuccessfulId = t.id;
|
4388 | _this.events
|
4389 | .next(new NavigationEnd(t.id, _this.serializeUrl(t.extractedUrl), _this.serializeUrl(_this.currentUrlTree)));
|
4390 | _this.lastSuccessfulNavigation = _this.currentNavigation;
|
4391 | _this.currentNavigation = null;
|
4392 | t.resolve(true);
|
4393 | }, function (e) { _this.console.warn("Unhandled Navigation Error: "); });
|
4394 | };
|
4395 | Router.prototype.scheduleNavigation = function (rawUrl, source, restoredState, extras) {
|
4396 | var lastNavigation = this.getTransition();
|
4397 |
|
4398 |
|
4399 |
|
4400 | if (lastNavigation && source !== 'imperative' && lastNavigation.source === 'imperative' &&
|
4401 | lastNavigation.rawUrl.toString() === rawUrl.toString()) {
|
4402 | return Promise.resolve(true);
|
4403 | }
|
4404 |
|
4405 |
|
4406 |
|
4407 | if (lastNavigation && source == 'hashchange' && lastNavigation.source === 'popstate' &&
|
4408 | lastNavigation.rawUrl.toString() === rawUrl.toString()) {
|
4409 | return Promise.resolve(true);
|
4410 | }
|
4411 |
|
4412 |
|
4413 |
|
4414 | if (lastNavigation && source == 'popstate' && lastNavigation.source === 'hashchange' &&
|
4415 | lastNavigation.rawUrl.toString() === rawUrl.toString()) {
|
4416 | return Promise.resolve(true);
|
4417 | }
|
4418 | var resolve = null;
|
4419 | var reject = null;
|
4420 | var promise = new Promise(function (res, rej) {
|
4421 | resolve = res;
|
4422 | reject = rej;
|
4423 | });
|
4424 | var id = ++this.navigationId;
|
4425 | this.setTransition({
|
4426 | id: id,
|
4427 | source: source,
|
4428 | restoredState: restoredState,
|
4429 | currentUrlTree: this.currentUrlTree,
|
4430 | currentRawUrl: this.rawUrlTree, rawUrl: rawUrl, extras: extras, resolve: resolve, reject: reject, promise: promise,
|
4431 | currentSnapshot: this.routerState.snapshot,
|
4432 | currentRouterState: this.routerState
|
4433 | });
|
4434 |
|
4435 |
|
4436 | return promise.catch(function (e) { return Promise.reject(e); });
|
4437 | };
|
4438 | Router.prototype.setBrowserUrl = function (url, replaceUrl, id, state) {
|
4439 | var path = this.urlSerializer.serialize(url);
|
4440 | state = state || {};
|
4441 | if (this.location.isCurrentPathEqualTo(path) || replaceUrl) {
|
4442 |
|
4443 | this.location.replaceState(path, '', __assign({}, state, { navigationId: id }));
|
4444 | }
|
4445 | else {
|
4446 | this.location.go(path, '', __assign({}, state, { navigationId: id }));
|
4447 | }
|
4448 | };
|
4449 | Router.prototype.resetStateAndUrl = function (storedState, storedUrl, rawUrl) {
|
4450 | this.routerState = storedState;
|
4451 | this.currentUrlTree = storedUrl;
|
4452 | this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, rawUrl);
|
4453 | this.resetUrlToCurrentUrlTree();
|
4454 | };
|
4455 | Router.prototype.resetUrlToCurrentUrlTree = function () {
|
4456 | this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', { navigationId: this.lastSuccessfulId });
|
4457 | };
|
4458 | return Router;
|
4459 | }());
|
4460 | function validateCommands(commands) {
|
4461 | for (var i = 0; i < commands.length; i++) {
|
4462 | var cmd = commands[i];
|
4463 | if (cmd == null) {
|
4464 | throw new Error("The requested path contains " + cmd + " segment at index " + i);
|
4465 | }
|
4466 | }
|
4467 | }
|
4468 |
|
4469 | |
4470 |
|
4471 |
|
4472 |
|
4473 |
|
4474 |
|
4475 |
|
4476 | |
4477 |
|
4478 |
|
4479 |
|
4480 |
|
4481 |
|
4482 |
|
4483 |
|
4484 |
|
4485 |
|
4486 |
|
4487 |
|
4488 |
|
4489 |
|
4490 |
|
4491 |
|
4492 |
|
4493 |
|
4494 |
|
4495 |
|
4496 |
|
4497 |
|
4498 |
|
4499 |
|
4500 |
|
4501 |
|
4502 |
|
4503 |
|
4504 |
|
4505 |
|
4506 |
|
4507 |
|
4508 |
|
4509 |
|
4510 |
|
4511 |
|
4512 |
|
4513 |
|
4514 |
|
4515 |
|
4516 |
|
4517 |
|
4518 |
|
4519 |
|
4520 |
|
4521 |
|
4522 |
|
4523 |
|
4524 |
|
4525 |
|
4526 |
|
4527 |
|
4528 |
|
4529 |
|
4530 |
|
4531 |
|
4532 |
|
4533 |
|
4534 |
|
4535 |
|
4536 |
|
4537 |
|
4538 |
|
4539 |
|
4540 |
|
4541 |
|
4542 |
|
4543 |
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 |
|
4550 |
|
4551 |
|
4552 |
|
4553 |
|
4554 |
|
4555 |
|
4556 |
|
4557 |
|
4558 |
|
4559 |
|
4560 |
|
4561 |
|
4562 |
|
4563 |
|
4564 |
|
4565 |
|
4566 |
|
4567 |
|
4568 |
|
4569 |
|
4570 | var RouterLink = (function () {
|
4571 | function RouterLink(router, route, tabIndex, renderer, el) {
|
4572 | this.router = router;
|
4573 | this.route = route;
|
4574 | this.commands = [];
|
4575 | if (tabIndex == null) {
|
4576 | renderer.setAttribute(el.nativeElement, 'tabindex', '0');
|
4577 | }
|
4578 | }
|
4579 | Object.defineProperty(RouterLink.prototype, "routerLink", {
|
4580 | set: function (commands) {
|
4581 | if (commands != null) {
|
4582 | this.commands = Array.isArray(commands) ? commands : [commands];
|
4583 | }
|
4584 | else {
|
4585 | this.commands = [];
|
4586 | }
|
4587 | },
|
4588 | enumerable: true,
|
4589 | configurable: true
|
4590 | });
|
4591 | Object.defineProperty(RouterLink.prototype, "preserveQueryParams", {
|
4592 | |
4593 |
|
4594 |
|
4595 | set: function (value) {
|
4596 | if (core.isDevMode() && console && console.warn) {
|
4597 | console.warn('preserveQueryParams is deprecated!, use queryParamsHandling instead.');
|
4598 | }
|
4599 | this.preserve = value;
|
4600 | },
|
4601 | enumerable: true,
|
4602 | configurable: true
|
4603 | });
|
4604 | RouterLink.prototype.onClick = function () {
|
4605 | var extras = {
|
4606 | skipLocationChange: attrBoolValue(this.skipLocationChange),
|
4607 | replaceUrl: attrBoolValue(this.replaceUrl),
|
4608 | };
|
4609 | this.router.navigateByUrl(this.urlTree, extras);
|
4610 | return true;
|
4611 | };
|
4612 | Object.defineProperty(RouterLink.prototype, "urlTree", {
|
4613 | get: function () {
|
4614 | return this.router.createUrlTree(this.commands, {
|
4615 | relativeTo: this.route,
|
4616 | queryParams: this.queryParams,
|
4617 | fragment: this.fragment,
|
4618 | preserveQueryParams: attrBoolValue(this.preserve),
|
4619 | queryParamsHandling: this.queryParamsHandling,
|
4620 | preserveFragment: attrBoolValue(this.preserveFragment),
|
4621 | });
|
4622 | },
|
4623 | enumerable: true,
|
4624 | configurable: true
|
4625 | });
|
4626 | __decorate([
|
4627 | core.Input(),
|
4628 | __metadata("design:type", Object)
|
4629 | ], RouterLink.prototype, "queryParams", void 0);
|
4630 | __decorate([
|
4631 | core.Input(),
|
4632 | __metadata("design:type", String)
|
4633 | ], RouterLink.prototype, "fragment", void 0);
|
4634 | __decorate([
|
4635 | core.Input(),
|
4636 | __metadata("design:type", String)
|
4637 | ], RouterLink.prototype, "queryParamsHandling", void 0);
|
4638 | __decorate([
|
4639 | core.Input(),
|
4640 | __metadata("design:type", Boolean)
|
4641 | ], RouterLink.prototype, "preserveFragment", void 0);
|
4642 | __decorate([
|
4643 | core.Input(),
|
4644 | __metadata("design:type", Boolean)
|
4645 | ], RouterLink.prototype, "skipLocationChange", void 0);
|
4646 | __decorate([
|
4647 | core.Input(),
|
4648 | __metadata("design:type", Boolean)
|
4649 | ], RouterLink.prototype, "replaceUrl", void 0);
|
4650 | __decorate([
|
4651 | core.Input(),
|
4652 | __metadata("design:type", Object)
|
4653 | ], RouterLink.prototype, "state", void 0);
|
4654 | __decorate([
|
4655 | core.Input(),
|
4656 | __metadata("design:type", Object),
|
4657 | __metadata("design:paramtypes", [Object])
|
4658 | ], RouterLink.prototype, "routerLink", null);
|
4659 | __decorate([
|
4660 | core.Input(),
|
4661 | __metadata("design:type", Boolean),
|
4662 | __metadata("design:paramtypes", [Boolean])
|
4663 | ], RouterLink.prototype, "preserveQueryParams", null);
|
4664 | __decorate([
|
4665 | core.HostListener('click'),
|
4666 | __metadata("design:type", Function),
|
4667 | __metadata("design:paramtypes", []),
|
4668 | __metadata("design:returntype", Boolean)
|
4669 | ], RouterLink.prototype, "onClick", null);
|
4670 | RouterLink = __decorate([
|
4671 | core.Directive({ selector: ':not(a):not(area)[routerLink]' }),
|
4672 | __param(2, core.Attribute('tabindex')),
|
4673 | __metadata("design:paramtypes", [Router, ActivatedRoute, String, core.Renderer2, core.ElementRef])
|
4674 | ], RouterLink);
|
4675 | return RouterLink;
|
4676 | }());
|
4677 | |
4678 |
|
4679 |
|
4680 |
|
4681 |
|
4682 |
|
4683 |
|
4684 |
|
4685 |
|
4686 |
|
4687 |
|
4688 | var RouterLinkWithHref = (function () {
|
4689 | function RouterLinkWithHref(router, route, locationStrategy) {
|
4690 | var _this = this;
|
4691 | this.router = router;
|
4692 | this.route = route;
|
4693 | this.locationStrategy = locationStrategy;
|
4694 | this.commands = [];
|
4695 | this.subscription = router.events.subscribe(function (s) {
|
4696 | if (s instanceof NavigationEnd) {
|
4697 | _this.updateTargetUrlAndHref();
|
4698 | }
|
4699 | });
|
4700 | }
|
4701 | Object.defineProperty(RouterLinkWithHref.prototype, "routerLink", {
|
4702 | set: function (commands) {
|
4703 | if (commands != null) {
|
4704 | this.commands = Array.isArray(commands) ? commands : [commands];
|
4705 | }
|
4706 | else {
|
4707 | this.commands = [];
|
4708 | }
|
4709 | },
|
4710 | enumerable: true,
|
4711 | configurable: true
|
4712 | });
|
4713 | Object.defineProperty(RouterLinkWithHref.prototype, "preserveQueryParams", {
|
4714 | set: function (value) {
|
4715 | if (core.isDevMode() && console && console.warn) {
|
4716 | console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.');
|
4717 | }
|
4718 | this.preserve = value;
|
4719 | },
|
4720 | enumerable: true,
|
4721 | configurable: true
|
4722 | });
|
4723 | RouterLinkWithHref.prototype.ngOnChanges = function (changes) { this.updateTargetUrlAndHref(); };
|
4724 | RouterLinkWithHref.prototype.ngOnDestroy = function () { this.subscription.unsubscribe(); };
|
4725 | RouterLinkWithHref.prototype.onClick = function (button, ctrlKey, metaKey, shiftKey) {
|
4726 | if (button !== 0 || ctrlKey || metaKey || shiftKey) {
|
4727 | return true;
|
4728 | }
|
4729 | if (typeof this.target === 'string' && this.target != '_self') {
|
4730 | return true;
|
4731 | }
|
4732 | var extras = {
|
4733 | skipLocationChange: attrBoolValue(this.skipLocationChange),
|
4734 | replaceUrl: attrBoolValue(this.replaceUrl),
|
4735 | state: this.state
|
4736 | };
|
4737 | this.router.navigateByUrl(this.urlTree, extras);
|
4738 | return false;
|
4739 | };
|
4740 | RouterLinkWithHref.prototype.updateTargetUrlAndHref = function () {
|
4741 | this.href = this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.urlTree));
|
4742 | };
|
4743 | Object.defineProperty(RouterLinkWithHref.prototype, "urlTree", {
|
4744 | get: function () {
|
4745 | return this.router.createUrlTree(this.commands, {
|
4746 | relativeTo: this.route,
|
4747 | queryParams: this.queryParams,
|
4748 | fragment: this.fragment,
|
4749 | preserveQueryParams: attrBoolValue(this.preserve),
|
4750 | queryParamsHandling: this.queryParamsHandling,
|
4751 | preserveFragment: attrBoolValue(this.preserveFragment),
|
4752 | });
|
4753 | },
|
4754 | enumerable: true,
|
4755 | configurable: true
|
4756 | });
|
4757 | __decorate([
|
4758 | core.HostBinding('attr.target'), core.Input(),
|
4759 | __metadata("design:type", String)
|
4760 | ], RouterLinkWithHref.prototype, "target", void 0);
|
4761 | __decorate([
|
4762 | core.Input(),
|
4763 | __metadata("design:type", Object)
|
4764 | ], RouterLinkWithHref.prototype, "queryParams", void 0);
|
4765 | __decorate([
|
4766 | core.Input(),
|
4767 | __metadata("design:type", String)
|
4768 | ], RouterLinkWithHref.prototype, "fragment", void 0);
|
4769 | __decorate([
|
4770 | core.Input(),
|
4771 | __metadata("design:type", String)
|
4772 | ], RouterLinkWithHref.prototype, "queryParamsHandling", void 0);
|
4773 | __decorate([
|
4774 | core.Input(),
|
4775 | __metadata("design:type", Boolean)
|
4776 | ], RouterLinkWithHref.prototype, "preserveFragment", void 0);
|
4777 | __decorate([
|
4778 | core.Input(),
|
4779 | __metadata("design:type", Boolean)
|
4780 | ], RouterLinkWithHref.prototype, "skipLocationChange", void 0);
|
4781 | __decorate([
|
4782 | core.Input(),
|
4783 | __metadata("design:type", Boolean)
|
4784 | ], RouterLinkWithHref.prototype, "replaceUrl", void 0);
|
4785 | __decorate([
|
4786 | core.Input(),
|
4787 | __metadata("design:type", Object)
|
4788 | ], RouterLinkWithHref.prototype, "state", void 0);
|
4789 | __decorate([
|
4790 | core.HostBinding(),
|
4791 | __metadata("design:type", String)
|
4792 | ], RouterLinkWithHref.prototype, "href", void 0);
|
4793 | __decorate([
|
4794 | core.Input(),
|
4795 | __metadata("design:type", Object),
|
4796 | __metadata("design:paramtypes", [Object])
|
4797 | ], RouterLinkWithHref.prototype, "routerLink", null);
|
4798 | __decorate([
|
4799 | core.Input(),
|
4800 | __metadata("design:type", Boolean),
|
4801 | __metadata("design:paramtypes", [Boolean])
|
4802 | ], RouterLinkWithHref.prototype, "preserveQueryParams", null);
|
4803 | __decorate([
|
4804 | core.HostListener('click', ['$event.button', '$event.ctrlKey', '$event.metaKey', '$event.shiftKey']),
|
4805 | __metadata("design:type", Function),
|
4806 | __metadata("design:paramtypes", [Number, Boolean, Boolean, Boolean]),
|
4807 | __metadata("design:returntype", Boolean)
|
4808 | ], RouterLinkWithHref.prototype, "onClick", null);
|
4809 | RouterLinkWithHref = __decorate([
|
4810 | core.Directive({ selector: 'a[routerLink],area[routerLink]' }),
|
4811 | __metadata("design:paramtypes", [Router, ActivatedRoute,
|
4812 | common.LocationStrategy])
|
4813 | ], RouterLinkWithHref);
|
4814 | return RouterLinkWithHref;
|
4815 | }());
|
4816 | function attrBoolValue(s) {
|
4817 | return s === '' || !!s;
|
4818 | }
|
4819 |
|
4820 | |
4821 |
|
4822 |
|
4823 |
|
4824 |
|
4825 |
|
4826 |
|
4827 | |
4828 |
|
4829 |
|
4830 |
|
4831 |
|
4832 |
|
4833 |
|
4834 |
|
4835 |
|
4836 |
|
4837 |
|
4838 |
|
4839 |
|
4840 |
|
4841 |
|
4842 |
|
4843 |
|
4844 |
|
4845 |
|
4846 |
|
4847 |
|
4848 |
|
4849 |
|
4850 |
|
4851 |
|
4852 |
|
4853 |
|
4854 |
|
4855 |
|
4856 |
|
4857 |
|
4858 |
|
4859 |
|
4860 |
|
4861 |
|
4862 |
|
4863 |
|
4864 |
|
4865 |
|
4866 |
|
4867 |
|
4868 |
|
4869 |
|
4870 |
|
4871 |
|
4872 |
|
4873 |
|
4874 |
|
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 |
|
4884 | var RouterLinkActive = (function () {
|
4885 | function RouterLinkActive(router, element, renderer, link, linkWithHref) {
|
4886 | var _this = this;
|
4887 | this.router = router;
|
4888 | this.element = element;
|
4889 | this.renderer = renderer;
|
4890 | this.link = link;
|
4891 | this.linkWithHref = linkWithHref;
|
4892 | this.classes = [];
|
4893 | this.isActive = false;
|
4894 | this.routerLinkActiveOptions = { exact: false };
|
4895 | this.subscription = router.events.subscribe(function (s) {
|
4896 | if (s instanceof NavigationEnd) {
|
4897 | _this.update();
|
4898 | }
|
4899 | });
|
4900 | }
|
4901 | RouterLinkActive.prototype.ngAfterContentInit = function () {
|
4902 | var _this = this;
|
4903 | this.links.changes.subscribe(function (_) { return _this.update(); });
|
4904 | this.linksWithHrefs.changes.subscribe(function (_) { return _this.update(); });
|
4905 | this.update();
|
4906 | };
|
4907 | Object.defineProperty(RouterLinkActive.prototype, "routerLinkActive", {
|
4908 | set: function (data) {
|
4909 | var classes = Array.isArray(data) ? data : data.split(' ');
|
4910 | this.classes = classes.filter(function (c) { return !!c; });
|
4911 | },
|
4912 | enumerable: true,
|
4913 | configurable: true
|
4914 | });
|
4915 | RouterLinkActive.prototype.ngOnChanges = function (changes) { this.update(); };
|
4916 | RouterLinkActive.prototype.ngOnDestroy = function () { this.subscription.unsubscribe(); };
|
4917 | RouterLinkActive.prototype.update = function () {
|
4918 | var _this = this;
|
4919 | if (!this.links || !this.linksWithHrefs || !this.router.navigated)
|
4920 | return;
|
4921 | Promise.resolve().then(function () {
|
4922 | var hasActiveLinks = _this.hasActiveLinks();
|
4923 | if (_this.isActive !== hasActiveLinks) {
|
4924 | _this.isActive = hasActiveLinks;
|
4925 | _this.classes.forEach(function (c) {
|
4926 | if (hasActiveLinks) {
|
4927 | _this.renderer.addClass(_this.element.nativeElement, c);
|
4928 | }
|
4929 | else {
|
4930 | _this.renderer.removeClass(_this.element.nativeElement, c);
|
4931 | }
|
4932 | });
|
4933 | }
|
4934 | });
|
4935 | };
|
4936 | RouterLinkActive.prototype.isLinkActive = function (router) {
|
4937 | var _this = this;
|
4938 | return function (link) {
|
4939 | return router.isActive(link.urlTree, _this.routerLinkActiveOptions.exact);
|
4940 | };
|
4941 | };
|
4942 | RouterLinkActive.prototype.hasActiveLinks = function () {
|
4943 | var isActiveCheckFn = this.isLinkActive(this.router);
|
4944 | return this.link && isActiveCheckFn(this.link) ||
|
4945 | this.linkWithHref && isActiveCheckFn(this.linkWithHref) ||
|
4946 | this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
|
4947 | };
|
4948 | __decorate([
|
4949 | core.ContentChildren(RouterLink, { descendants: true }),
|
4950 | __metadata("design:type", core.QueryList)
|
4951 | ], RouterLinkActive.prototype, "links", void 0);
|
4952 | __decorate([
|
4953 | core.ContentChildren(RouterLinkWithHref, { descendants: true }),
|
4954 | __metadata("design:type", core.QueryList)
|
4955 | ], RouterLinkActive.prototype, "linksWithHrefs", void 0);
|
4956 | __decorate([
|
4957 | core.Input(),
|
4958 | __metadata("design:type", Object)
|
4959 | ], RouterLinkActive.prototype, "routerLinkActiveOptions", void 0);
|
4960 | __decorate([
|
4961 | core.Input(),
|
4962 | __metadata("design:type", Object),
|
4963 | __metadata("design:paramtypes", [Object])
|
4964 | ], RouterLinkActive.prototype, "routerLinkActive", null);
|
4965 | RouterLinkActive = __decorate([
|
4966 | core.Directive({
|
4967 | selector: '[routerLinkActive]',
|
4968 | exportAs: 'routerLinkActive',
|
4969 | }),
|
4970 | __param(3, core.Optional()),
|
4971 | __param(4, core.Optional()),
|
4972 | __metadata("design:paramtypes", [Router, core.ElementRef, core.Renderer2,
|
4973 | RouterLink,
|
4974 | RouterLinkWithHref])
|
4975 | ], RouterLinkActive);
|
4976 | return RouterLinkActive;
|
4977 | }());
|
4978 |
|
4979 | |
4980 |
|
4981 |
|
4982 |
|
4983 |
|
4984 |
|
4985 |
|
4986 | |
4987 |
|
4988 |
|
4989 |
|
4990 |
|
4991 | var OutletContext = (function () {
|
4992 | function OutletContext() {
|
4993 | this.outlet = null;
|
4994 | this.route = null;
|
4995 | this.resolver = null;
|
4996 | this.children = new ChildrenOutletContexts();
|
4997 | this.attachRef = null;
|
4998 | }
|
4999 | return OutletContext;
|
5000 | }());
|
5001 | |
5002 |
|
5003 |
|
5004 |
|
5005 |
|
5006 | var ChildrenOutletContexts = (function () {
|
5007 | function ChildrenOutletContexts() {
|
5008 |
|
5009 | this.contexts = new Map();
|
5010 | }
|
5011 |
|
5012 | ChildrenOutletContexts.prototype.onChildOutletCreated = function (childName, outlet) {
|
5013 | var context = this.getOrCreateContext(childName);
|
5014 | context.outlet = outlet;
|
5015 | this.contexts.set(childName, context);
|
5016 | };
|
5017 | |
5018 |
|
5019 |
|
5020 |
|
5021 |
|
5022 | ChildrenOutletContexts.prototype.onChildOutletDestroyed = function (childName) {
|
5023 | var context = this.getContext(childName);
|
5024 | if (context) {
|
5025 | context.outlet = null;
|
5026 | }
|
5027 | };
|
5028 | |
5029 |
|
5030 |
|
5031 |
|
5032 | ChildrenOutletContexts.prototype.onOutletDeactivated = function () {
|
5033 | var contexts = this.contexts;
|
5034 | this.contexts = new Map();
|
5035 | return contexts;
|
5036 | };
|
5037 | ChildrenOutletContexts.prototype.onOutletReAttached = function (contexts) { this.contexts = contexts; };
|
5038 | ChildrenOutletContexts.prototype.getOrCreateContext = function (childName) {
|
5039 | var context = this.getContext(childName);
|
5040 | if (!context) {
|
5041 | context = new OutletContext();
|
5042 | this.contexts.set(childName, context);
|
5043 | }
|
5044 | return context;
|
5045 | };
|
5046 | ChildrenOutletContexts.prototype.getContext = function (childName) { return this.contexts.get(childName) || null; };
|
5047 | return ChildrenOutletContexts;
|
5048 | }());
|
5049 |
|
5050 | |
5051 |
|
5052 |
|
5053 |
|
5054 |
|
5055 |
|
5056 |
|
5057 | |
5058 |
|
5059 |
|
5060 |
|
5061 |
|
5062 |
|
5063 |
|
5064 |
|
5065 |
|
5066 |
|
5067 |
|
5068 |
|
5069 |
|
5070 |
|
5071 |
|
5072 |
|
5073 |
|
5074 |
|
5075 |
|
5076 |
|
5077 |
|
5078 |
|
5079 |
|
5080 | var RouterOutlet = (function () {
|
5081 | function RouterOutlet(parentContexts, location, resolver, name, changeDetector) {
|
5082 | this.parentContexts = parentContexts;
|
5083 | this.location = location;
|
5084 | this.resolver = resolver;
|
5085 | this.changeDetector = changeDetector;
|
5086 | this.activated = null;
|
5087 | this._activatedRoute = null;
|
5088 | this.activateEvents = new core.EventEmitter();
|
5089 | this.deactivateEvents = new core.EventEmitter();
|
5090 | this.name = name || PRIMARY_OUTLET;
|
5091 | parentContexts.onChildOutletCreated(this.name, this);
|
5092 | }
|
5093 | RouterOutlet.prototype.ngOnDestroy = function () { this.parentContexts.onChildOutletDestroyed(this.name); };
|
5094 | RouterOutlet.prototype.ngOnInit = function () {
|
5095 | if (!this.activated) {
|
5096 |
|
5097 |
|
5098 | var context = this.parentContexts.getContext(this.name);
|
5099 | if (context && context.route) {
|
5100 | if (context.attachRef) {
|
5101 |
|
5102 | this.attach(context.attachRef, context.route);
|
5103 | }
|
5104 | else {
|
5105 |
|
5106 | this.activateWith(context.route, context.resolver || null);
|
5107 | }
|
5108 | }
|
5109 | }
|
5110 | };
|
5111 | Object.defineProperty(RouterOutlet.prototype, "isActivated", {
|
5112 | get: function () { return !!this.activated; },
|
5113 | enumerable: true,
|
5114 | configurable: true
|
5115 | });
|
5116 | Object.defineProperty(RouterOutlet.prototype, "component", {
|
5117 | get: function () {
|
5118 | if (!this.activated)
|
5119 | throw new Error('Outlet is not activated');
|
5120 | return this.activated.instance;
|
5121 | },
|
5122 | enumerable: true,
|
5123 | configurable: true
|
5124 | });
|
5125 | Object.defineProperty(RouterOutlet.prototype, "activatedRoute", {
|
5126 | get: function () {
|
5127 | if (!this.activated)
|
5128 | throw new Error('Outlet is not activated');
|
5129 | return this._activatedRoute;
|
5130 | },
|
5131 | enumerable: true,
|
5132 | configurable: true
|
5133 | });
|
5134 | Object.defineProperty(RouterOutlet.prototype, "activatedRouteData", {
|
5135 | get: function () {
|
5136 | if (this._activatedRoute) {
|
5137 | return this._activatedRoute.snapshot.data;
|
5138 | }
|
5139 | return {};
|
5140 | },
|
5141 | enumerable: true,
|
5142 | configurable: true
|
5143 | });
|
5144 | |
5145 |
|
5146 |
|
5147 | RouterOutlet.prototype.detach = function () {
|
5148 | if (!this.activated)
|
5149 | throw new Error('Outlet is not activated');
|
5150 | this.location.detach();
|
5151 | var cmp = this.activated;
|
5152 | this.activated = null;
|
5153 | this._activatedRoute = null;
|
5154 | return cmp;
|
5155 | };
|
5156 | |
5157 |
|
5158 |
|
5159 | RouterOutlet.prototype.attach = function (ref, activatedRoute) {
|
5160 | this.activated = ref;
|
5161 | this._activatedRoute = activatedRoute;
|
5162 | this.location.insert(ref.hostView);
|
5163 | };
|
5164 | RouterOutlet.prototype.deactivate = function () {
|
5165 | if (this.activated) {
|
5166 | var c = this.component;
|
5167 | this.activated.destroy();
|
5168 | this.activated = null;
|
5169 | this._activatedRoute = null;
|
5170 | this.deactivateEvents.emit(c);
|
5171 | }
|
5172 | };
|
5173 | RouterOutlet.prototype.activateWith = function (activatedRoute, resolver) {
|
5174 | if (this.isActivated) {
|
5175 | throw new Error('Cannot activate an already activated outlet');
|
5176 | }
|
5177 | this._activatedRoute = activatedRoute;
|
5178 | var snapshot = activatedRoute._futureSnapshot;
|
5179 | var component = snapshot.routeConfig.component;
|
5180 | resolver = resolver || this.resolver;
|
5181 | var factory = resolver.resolveComponentFactory(component);
|
5182 | var childContexts = this.parentContexts.getOrCreateContext(this.name).children;
|
5183 | var injector = new OutletInjector(activatedRoute, childContexts, this.location.injector);
|
5184 | this.activated = this.location.createComponent(factory, this.location.length, injector);
|
5185 |
|
5186 |
|
5187 | this.changeDetector.markForCheck();
|
5188 | this.activateEvents.emit(this.activated.instance);
|
5189 | };
|
5190 | __decorate([
|
5191 | core.Output('activate'),
|
5192 | __metadata("design:type", Object)
|
5193 | ], RouterOutlet.prototype, "activateEvents", void 0);
|
5194 | __decorate([
|
5195 | core.Output('deactivate'),
|
5196 | __metadata("design:type", Object)
|
5197 | ], RouterOutlet.prototype, "deactivateEvents", void 0);
|
5198 | RouterOutlet = __decorate([
|
5199 | core.Directive({ selector: 'router-outlet', exportAs: 'outlet' }),
|
5200 | __param(3, core.Attribute('name')),
|
5201 | __metadata("design:paramtypes", [ChildrenOutletContexts, core.ViewContainerRef,
|
5202 | core.ComponentFactoryResolver, String, core.ChangeDetectorRef])
|
5203 | ], RouterOutlet);
|
5204 | return RouterOutlet;
|
5205 | }());
|
5206 | var OutletInjector = (function () {
|
5207 | function OutletInjector(route, childContexts, parent) {
|
5208 | this.route = route;
|
5209 | this.childContexts = childContexts;
|
5210 | this.parent = parent;
|
5211 | }
|
5212 | OutletInjector.prototype.get = function (token, notFoundValue) {
|
5213 | if (token === ActivatedRoute) {
|
5214 | return this.route;
|
5215 | }
|
5216 | if (token === ChildrenOutletContexts) {
|
5217 | return this.childContexts;
|
5218 | }
|
5219 | return this.parent.get(token, notFoundValue);
|
5220 | };
|
5221 | return OutletInjector;
|
5222 | }());
|
5223 |
|
5224 | |
5225 |
|
5226 |
|
5227 |
|
5228 |
|
5229 |
|
5230 |
|
5231 | |
5232 |
|
5233 |
|
5234 |
|
5235 |
|
5236 |
|
5237 |
|
5238 | var PreloadingStrategy = (function () {
|
5239 | function PreloadingStrategy() {
|
5240 | }
|
5241 | return PreloadingStrategy;
|
5242 | }());
|
5243 | |
5244 |
|
5245 |
|
5246 |
|
5247 |
|
5248 |
|
5249 |
|
5250 |
|
5251 |
|
5252 |
|
5253 |
|
5254 | var PreloadAllModules = (function () {
|
5255 | function PreloadAllModules() {
|
5256 | }
|
5257 | PreloadAllModules.prototype.preload = function (route, fn) {
|
5258 | return fn().pipe(operators.catchError(function () { return rxjs.of(null); }));
|
5259 | };
|
5260 | return PreloadAllModules;
|
5261 | }());
|
5262 | |
5263 |
|
5264 |
|
5265 |
|
5266 |
|
5267 |
|
5268 |
|
5269 |
|
5270 |
|
5271 | var NoPreloading = (function () {
|
5272 | function NoPreloading() {
|
5273 | }
|
5274 | NoPreloading.prototype.preload = function (route, fn) { return rxjs.of(null); };
|
5275 | return NoPreloading;
|
5276 | }());
|
5277 | |
5278 |
|
5279 |
|
5280 |
|
5281 |
|
5282 |
|
5283 |
|
5284 |
|
5285 |
|
5286 |
|
5287 |
|
5288 |
|
5289 | var RouterPreloader = (function () {
|
5290 | function RouterPreloader(router, moduleLoader, compiler, injector, preloadingStrategy) {
|
5291 | this.router = router;
|
5292 | this.injector = injector;
|
5293 | this.preloadingStrategy = preloadingStrategy;
|
5294 | var onStartLoad = function (r) { return router.triggerEvent(new RouteConfigLoadStart(r)); };
|
5295 | var onEndLoad = function (r) { return router.triggerEvent(new RouteConfigLoadEnd(r)); };
|
5296 | this.loader = new RouterConfigLoader(moduleLoader, compiler, onStartLoad, onEndLoad);
|
5297 | }
|
5298 | RouterPreloader.prototype.setUpPreloading = function () {
|
5299 | var _this = this;
|
5300 | this.subscription =
|
5301 | this.router.events
|
5302 | .pipe(operators.filter(function (e) { return e instanceof NavigationEnd; }), operators.concatMap(function () { return _this.preload(); }))
|
5303 | .subscribe(function () { });
|
5304 | };
|
5305 | RouterPreloader.prototype.preload = function () {
|
5306 | var ngModule = this.injector.get(core.NgModuleRef);
|
5307 | return this.processRoutes(ngModule, this.router.config);
|
5308 | };
|
5309 |
|
5310 |
|
5311 |
|
5312 | RouterPreloader.prototype.ngOnDestroy = function () { this.subscription.unsubscribe(); };
|
5313 | RouterPreloader.prototype.processRoutes = function (ngModule, routes) {
|
5314 | var e_1, _a;
|
5315 | var res = [];
|
5316 | try {
|
5317 | for (var routes_1 = __values(routes), routes_1_1 = routes_1.next(); !routes_1_1.done; routes_1_1 = routes_1.next()) {
|
5318 | var route = routes_1_1.value;
|
5319 |
|
5320 | if (route.loadChildren && !route.canLoad && route._loadedConfig) {
|
5321 | var childConfig = route._loadedConfig;
|
5322 | res.push(this.processRoutes(childConfig.module, childConfig.routes));
|
5323 |
|
5324 | }
|
5325 | else if (route.loadChildren && !route.canLoad) {
|
5326 | res.push(this.preloadConfig(ngModule, route));
|
5327 |
|
5328 | }
|
5329 | else if (route.children) {
|
5330 | res.push(this.processRoutes(ngModule, route.children));
|
5331 | }
|
5332 | }
|
5333 | }
|
5334 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
5335 | finally {
|
5336 | try {
|
5337 | if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
|
5338 | }
|
5339 | finally { if (e_1) throw e_1.error; }
|
5340 | }
|
5341 | return rxjs.from(res).pipe(operators.mergeAll(), operators.map(function (_) { return void 0; }));
|
5342 | };
|
5343 | RouterPreloader.prototype.preloadConfig = function (ngModule, route) {
|
5344 | var _this = this;
|
5345 | return this.preloadingStrategy.preload(route, function () {
|
5346 | var loaded$ = _this.loader.load(ngModule.injector, route);
|
5347 | return loaded$.pipe(operators.mergeMap(function (config) {
|
5348 | route._loadedConfig = config;
|
5349 | return _this.processRoutes(config.module, config.routes);
|
5350 | }));
|
5351 | });
|
5352 | };
|
5353 | RouterPreloader = __decorate([
|
5354 | core.Injectable(),
|
5355 | __metadata("design:paramtypes", [Router, core.NgModuleFactoryLoader, core.Compiler,
|
5356 | core.Injector, PreloadingStrategy])
|
5357 | ], RouterPreloader);
|
5358 | return RouterPreloader;
|
5359 | }());
|
5360 |
|
5361 | |
5362 |
|
5363 |
|
5364 |
|
5365 |
|
5366 |
|
5367 |
|
5368 | var RouterScroller = (function () {
|
5369 | function RouterScroller(router,
|
5370 | /** @docsNotRequired */ viewportScroller, options) {
|
5371 | if (options === void 0) { options = {}; }
|
5372 | this.router = router;
|
5373 | this.viewportScroller = viewportScroller;
|
5374 | this.options = options;
|
5375 | this.lastId = 0;
|
5376 | this.lastSource = 'imperative';
|
5377 | this.restoredId = 0;
|
5378 | this.store = {};
|
5379 |
|
5380 | options.scrollPositionRestoration = options.scrollPositionRestoration || 'disabled';
|
5381 | options.anchorScrolling = options.anchorScrolling || 'disabled';
|
5382 | }
|
5383 | RouterScroller.prototype.init = function () {
|
5384 |
|
5385 |
|
5386 |
|
5387 | if (this.options.scrollPositionRestoration !== 'disabled') {
|
5388 | this.viewportScroller.setHistoryScrollRestoration('manual');
|
5389 | }
|
5390 | this.routerEventsSubscription = this.createScrollEvents();
|
5391 | this.scrollEventsSubscription = this.consumeScrollEvents();
|
5392 | };
|
5393 | RouterScroller.prototype.createScrollEvents = function () {
|
5394 | var _this = this;
|
5395 | return this.router.events.subscribe(function (e) {
|
5396 | if (e instanceof NavigationStart) {
|
5397 |
|
5398 | _this.store[_this.lastId] = _this.viewportScroller.getScrollPosition();
|
5399 | _this.lastSource = e.navigationTrigger;
|
5400 | _this.restoredId = e.restoredState ? e.restoredState.navigationId : 0;
|
5401 | }
|
5402 | else if (e instanceof NavigationEnd) {
|
5403 | _this.lastId = e.id;
|
5404 | _this.scheduleScrollEvent(e, _this.router.parseUrl(e.urlAfterRedirects).fragment);
|
5405 | }
|
5406 | });
|
5407 | };
|
5408 | RouterScroller.prototype.consumeScrollEvents = function () {
|
5409 | var _this = this;
|
5410 | return this.router.events.subscribe(function (e) {
|
5411 | if (!(e instanceof Scroll))
|
5412 | return;
|
5413 |
|
5414 | if (e.position) {
|
5415 | if (_this.options.scrollPositionRestoration === 'top') {
|
5416 | _this.viewportScroller.scrollToPosition([0, 0]);
|
5417 | }
|
5418 | else if (_this.options.scrollPositionRestoration === 'enabled') {
|
5419 | _this.viewportScroller.scrollToPosition(e.position);
|
5420 | }
|
5421 |
|
5422 | }
|
5423 | else {
|
5424 | if (e.anchor && _this.options.anchorScrolling === 'enabled') {
|
5425 | _this.viewportScroller.scrollToAnchor(e.anchor);
|
5426 | }
|
5427 | else if (_this.options.scrollPositionRestoration !== 'disabled') {
|
5428 | _this.viewportScroller.scrollToPosition([0, 0]);
|
5429 | }
|
5430 | }
|
5431 | });
|
5432 | };
|
5433 | RouterScroller.prototype.scheduleScrollEvent = function (routerEvent, anchor) {
|
5434 | this.router.triggerEvent(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));
|
5435 | };
|
5436 | RouterScroller.prototype.ngOnDestroy = function () {
|
5437 | if (this.routerEventsSubscription) {
|
5438 | this.routerEventsSubscription.unsubscribe();
|
5439 | }
|
5440 | if (this.scrollEventsSubscription) {
|
5441 | this.scrollEventsSubscription.unsubscribe();
|
5442 | }
|
5443 | };
|
5444 | return RouterScroller;
|
5445 | }());
|
5446 |
|
5447 | |
5448 |
|
5449 |
|
5450 |
|
5451 |
|
5452 |
|
5453 |
|
5454 | |
5455 |
|
5456 |
|
5457 |
|
5458 |
|
5459 |
|
5460 |
|
5461 | var ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent];
|
5462 | |
5463 |
|
5464 |
|
5465 |
|
5466 |
|
5467 |
|
5468 |
|
5469 | var ROUTER_CONFIGURATION = new core.InjectionToken('ROUTER_CONFIGURATION');
|
5470 | |
5471 |
|
5472 |
|
5473 | var ROUTER_FORROOT_GUARD = new core.InjectionToken('ROUTER_FORROOT_GUARD');
|
5474 | var ɵ0 = { enableTracing: false };
|
5475 | var ROUTER_PROVIDERS = [
|
5476 | common.Location,
|
5477 | { provide: UrlSerializer, useClass: DefaultUrlSerializer },
|
5478 | {
|
5479 | provide: Router,
|
5480 | useFactory: setupRouter,
|
5481 | deps: [
|
5482 | core.ApplicationRef, UrlSerializer, ChildrenOutletContexts, common.Location, core.Injector,
|
5483 | core.NgModuleFactoryLoader, core.Compiler, ROUTES, ROUTER_CONFIGURATION,
|
5484 | [UrlHandlingStrategy, new core.Optional()], [RouteReuseStrategy, new core.Optional()]
|
5485 | ]
|
5486 | },
|
5487 | ChildrenOutletContexts,
|
5488 | { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
|
5489 | { provide: core.NgModuleFactoryLoader, useClass: core.SystemJsNgModuleLoader },
|
5490 | RouterPreloader,
|
5491 | NoPreloading,
|
5492 | PreloadAllModules,
|
5493 | { provide: ROUTER_CONFIGURATION, useValue: ɵ0 },
|
5494 | ];
|
5495 | function routerNgProbeToken() {
|
5496 | return new core.NgProbeToken('Router', Router);
|
5497 | }
|
5498 | |
5499 |
|
5500 |
|
5501 |
|
5502 |
|
5503 |
|
5504 |
|
5505 |
|
5506 |
|
5507 |
|
5508 |
|
5509 |
|
5510 |
|
5511 |
|
5512 |
|
5513 |
|
5514 |
|
5515 |
|
5516 |
|
5517 |
|
5518 |
|
5519 |
|
5520 |
|
5521 |
|
5522 |
|
5523 |
|
5524 |
|
5525 |
|
5526 |
|
5527 |
|
5528 |
|
5529 |
|
5530 |
|
5531 |
|
5532 |
|
5533 |
|
5534 |
|
5535 |
|
5536 |
|
5537 |
|
5538 |
|
5539 |
|
5540 |
|
5541 |
|
5542 |
|
5543 |
|
5544 |
|
5545 |
|
5546 |
|
5547 |
|
5548 |
|
5549 | var RouterModule = (function () {
|
5550 |
|
5551 | function RouterModule(guard, router) {
|
5552 | }
|
5553 | RouterModule_1 = RouterModule;
|
5554 | |
5555 |
|
5556 |
|
5557 |
|
5558 |
|
5559 |
|
5560 |
|
5561 |
|
5562 |
|
5563 |
|
5564 |
|
5565 |
|
5566 |
|
5567 |
|
5568 |
|
5569 |
|
5570 |
|
5571 |
|
5572 |
|
5573 |
|
5574 |
|
5575 |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 | RouterModule.forRoot = function (routes, config) {
|
5585 | return {
|
5586 | ngModule: RouterModule_1,
|
5587 | providers: [
|
5588 | ROUTER_PROVIDERS,
|
5589 | provideRoutes(routes),
|
5590 | {
|
5591 | provide: ROUTER_FORROOT_GUARD,
|
5592 | useFactory: provideForRootGuard,
|
5593 | deps: [[Router, new core.Optional(), new core.SkipSelf()]]
|
5594 | },
|
5595 | { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
|
5596 | {
|
5597 | provide: common.LocationStrategy,
|
5598 | useFactory: provideLocationStrategy,
|
5599 | deps: [
|
5600 | common.PlatformLocation, [new core.Inject(common.APP_BASE_HREF), new core.Optional()], ROUTER_CONFIGURATION
|
5601 | ]
|
5602 | },
|
5603 | {
|
5604 | provide: RouterScroller,
|
5605 | useFactory: createRouterScroller,
|
5606 | deps: [Router, common.ViewportScroller, ROUTER_CONFIGURATION]
|
5607 | },
|
5608 | {
|
5609 | provide: PreloadingStrategy,
|
5610 | useExisting: config && config.preloadingStrategy ? config.preloadingStrategy :
|
5611 | NoPreloading
|
5612 | },
|
5613 | { provide: core.NgProbeToken, multi: true, useFactory: routerNgProbeToken },
|
5614 | provideRouterInitializer(),
|
5615 | ],
|
5616 | };
|
5617 | };
|
5618 | |
5619 |
|
5620 |
|
5621 | RouterModule.forChild = function (routes) {
|
5622 | return { ngModule: RouterModule_1, providers: [provideRoutes(routes)] };
|
5623 | };
|
5624 | var RouterModule_1;
|
5625 | RouterModule = RouterModule_1 = __decorate([
|
5626 | core.NgModule({
|
5627 | declarations: ROUTER_DIRECTIVES,
|
5628 | exports: ROUTER_DIRECTIVES,
|
5629 | entryComponents: [ɵEmptyOutletComponent]
|
5630 | }),
|
5631 | __param(0, core.Optional()), __param(0, core.Inject(ROUTER_FORROOT_GUARD)), __param(1, core.Optional()),
|
5632 | __metadata("design:paramtypes", [Object, Router])
|
5633 | ], RouterModule);
|
5634 | return RouterModule;
|
5635 | }());
|
5636 | function createRouterScroller(router, viewportScroller, config) {
|
5637 | if (config.scrollOffset) {
|
5638 | viewportScroller.setOffset(config.scrollOffset);
|
5639 | }
|
5640 | return new RouterScroller(router, viewportScroller, config);
|
5641 | }
|
5642 | function provideLocationStrategy(platformLocationStrategy, baseHref, options) {
|
5643 | if (options === void 0) { options = {}; }
|
5644 | return options.useHash ? new common.HashLocationStrategy(platformLocationStrategy, baseHref) :
|
5645 | new common.PathLocationStrategy(platformLocationStrategy, baseHref);
|
5646 | }
|
5647 | function provideForRootGuard(router) {
|
5648 | if (router) {
|
5649 | throw new Error("RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.");
|
5650 | }
|
5651 | return 'guarded';
|
5652 | }
|
5653 | |
5654 |
|
5655 |
|
5656 |
|
5657 |
|
5658 |
|
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 |
|
5669 |
|
5670 |
|
5671 | function provideRoutes(routes) {
|
5672 | return [
|
5673 | { provide: core.ANALYZE_FOR_ENTRY_COMPONENTS, multi: true, useValue: routes },
|
5674 | { provide: ROUTES, multi: true, useValue: routes },
|
5675 | ];
|
5676 | }
|
5677 | function setupRouter(ref, urlSerializer, contexts, location, injector, loader, compiler, config, opts, urlHandlingStrategy, routeReuseStrategy) {
|
5678 | if (opts === void 0) { opts = {}; }
|
5679 | var router = new Router(null, urlSerializer, contexts, location, injector, loader, compiler, flatten(config));
|
5680 | if (urlHandlingStrategy) {
|
5681 | router.urlHandlingStrategy = urlHandlingStrategy;
|
5682 | }
|
5683 | if (routeReuseStrategy) {
|
5684 | router.routeReuseStrategy = routeReuseStrategy;
|
5685 | }
|
5686 | if (opts.errorHandler) {
|
5687 | router.errorHandler = opts.errorHandler;
|
5688 | }
|
5689 | if (opts.malformedUriErrorHandler) {
|
5690 | router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
|
5691 | }
|
5692 | if (opts.enableTracing) {
|
5693 | var dom_1 = platformBrowser.ɵgetDOM();
|
5694 | router.events.subscribe(function (e) {
|
5695 | dom_1.logGroup("Router Event: " + e.constructor.name);
|
5696 | dom_1.log(e.toString());
|
5697 | dom_1.log(e);
|
5698 | dom_1.logGroupEnd();
|
5699 | });
|
5700 | }
|
5701 | if (opts.onSameUrlNavigation) {
|
5702 | router.onSameUrlNavigation = opts.onSameUrlNavigation;
|
5703 | }
|
5704 | if (opts.paramsInheritanceStrategy) {
|
5705 | router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
|
5706 | }
|
5707 | if (opts.urlUpdateStrategy) {
|
5708 | router.urlUpdateStrategy = opts.urlUpdateStrategy;
|
5709 | }
|
5710 | if (opts.relativeLinkResolution) {
|
5711 | router.relativeLinkResolution = opts.relativeLinkResolution;
|
5712 | }
|
5713 | return router;
|
5714 | }
|
5715 | function rootRoute(router) {
|
5716 | return router.routerState.root;
|
5717 | }
|
5718 | |
5719 |
|
5720 |
|
5721 |
|
5722 |
|
5723 |
|
5724 |
|
5725 |
|
5726 |
|
5727 |
|
5728 |
|
5729 | var RouterInitializer = (function () {
|
5730 | function RouterInitializer(injector) {
|
5731 | this.injector = injector;
|
5732 | this.initNavigation = false;
|
5733 | this.resultOfPreactivationDone = new rxjs.Subject();
|
5734 | }
|
5735 | RouterInitializer.prototype.appInitializer = function () {
|
5736 | var _this = this;
|
5737 | var p = this.injector.get(common.LOCATION_INITIALIZED, Promise.resolve(null));
|
5738 | return p.then(function () {
|
5739 | var resolve = null;
|
5740 | var res = new Promise(function (r) { return resolve = r; });
|
5741 | var router = _this.injector.get(Router);
|
5742 | var opts = _this.injector.get(ROUTER_CONFIGURATION);
|
5743 | if (_this.isLegacyDisabled(opts) || _this.isLegacyEnabled(opts)) {
|
5744 | resolve(true);
|
5745 | }
|
5746 | else if (opts.initialNavigation === 'disabled') {
|
5747 | router.setUpLocationChangeListener();
|
5748 | resolve(true);
|
5749 | }
|
5750 | else if (opts.initialNavigation === 'enabled') {
|
5751 | router.hooks.afterPreactivation = function () {
|
5752 |
|
5753 | if (!_this.initNavigation) {
|
5754 | _this.initNavigation = true;
|
5755 | resolve(true);
|
5756 | return _this.resultOfPreactivationDone;
|
5757 |
|
5758 | }
|
5759 | else {
|
5760 | return rxjs.of(null);
|
5761 | }
|
5762 | };
|
5763 | router.initialNavigation();
|
5764 | }
|
5765 | else {
|
5766 | throw new Error("Invalid initialNavigation options: '" + opts.initialNavigation + "'");
|
5767 | }
|
5768 | return res;
|
5769 | });
|
5770 | };
|
5771 | RouterInitializer.prototype.bootstrapListener = function (bootstrappedComponentRef) {
|
5772 | var opts = this.injector.get(ROUTER_CONFIGURATION);
|
5773 | var preloader = this.injector.get(RouterPreloader);
|
5774 | var routerScroller = this.injector.get(RouterScroller);
|
5775 | var router = this.injector.get(Router);
|
5776 | var ref = this.injector.get(core.ApplicationRef);
|
5777 | if (bootstrappedComponentRef !== ref.components[0]) {
|
5778 | return;
|
5779 | }
|
5780 | if (this.isLegacyEnabled(opts)) {
|
5781 | router.initialNavigation();
|
5782 | }
|
5783 | else if (this.isLegacyDisabled(opts)) {
|
5784 | router.setUpLocationChangeListener();
|
5785 | }
|
5786 | preloader.setUpPreloading();
|
5787 | routerScroller.init();
|
5788 | router.resetRootComponentType(ref.componentTypes[0]);
|
5789 | this.resultOfPreactivationDone.next(null);
|
5790 | this.resultOfPreactivationDone.complete();
|
5791 | };
|
5792 | RouterInitializer.prototype.isLegacyEnabled = function (opts) {
|
5793 | return opts.initialNavigation === 'legacy_enabled' || opts.initialNavigation === true ||
|
5794 | opts.initialNavigation === undefined;
|
5795 | };
|
5796 | RouterInitializer.prototype.isLegacyDisabled = function (opts) {
|
5797 | return opts.initialNavigation === 'legacy_disabled' || opts.initialNavigation === false;
|
5798 | };
|
5799 | RouterInitializer = __decorate([
|
5800 | core.Injectable(),
|
5801 | __metadata("design:paramtypes", [core.Injector])
|
5802 | ], RouterInitializer);
|
5803 | return RouterInitializer;
|
5804 | }());
|
5805 | function getAppInitializer(r) {
|
5806 | return r.appInitializer.bind(r);
|
5807 | }
|
5808 | function getBootstrapListener(r) {
|
5809 | return r.bootstrapListener.bind(r);
|
5810 | }
|
5811 | |
5812 |
|
5813 |
|
5814 |
|
5815 |
|
5816 | var ROUTER_INITIALIZER = new core.InjectionToken('Router Initializer');
|
5817 | function provideRouterInitializer() {
|
5818 | return [
|
5819 | RouterInitializer,
|
5820 | {
|
5821 | provide: core.APP_INITIALIZER,
|
5822 | multi: true,
|
5823 | useFactory: getAppInitializer,
|
5824 | deps: [RouterInitializer]
|
5825 | },
|
5826 | { provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener, deps: [RouterInitializer] },
|
5827 | { provide: core.APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
|
5828 | ];
|
5829 | }
|
5830 |
|
5831 | |
5832 |
|
5833 |
|
5834 |
|
5835 |
|
5836 |
|
5837 |
|
5838 | |
5839 |
|
5840 |
|
5841 | var VERSION = new core.Version('8.0.0');
|
5842 |
|
5843 | |
5844 |
|
5845 |
|
5846 |
|
5847 |
|
5848 |
|
5849 |
|
5850 |
|
5851 | |
5852 |
|
5853 |
|
5854 |
|
5855 |
|
5856 |
|
5857 |
|
5858 |
|
5859 | |
5860 |
|
5861 |
|
5862 |
|
5863 |
|
5864 |
|
5865 |
|
5866 |
|
5867 |
|
5868 | |
5869 |
|
5870 |
|
5871 |
|
5872 |
|
5873 |
|
5874 |
|
5875 |
|
5876 | |
5877 |
|
5878 |
|
5879 |
|
5880 | exports.ɵangular_packages_router_router_l = ɵEmptyOutletComponent;
|
5881 | exports.ɵEmptyOutletComponent = ɵEmptyOutletComponent;
|
5882 | exports.ɵangular_packages_router_router_a = ROUTER_FORROOT_GUARD;
|
5883 | exports.ɵangular_packages_router_router_h = RouterInitializer;
|
5884 | exports.ɵangular_packages_router_router_c = createRouterScroller;
|
5885 | exports.ɵangular_packages_router_router_i = getAppInitializer;
|
5886 | exports.ɵangular_packages_router_router_j = getBootstrapListener;
|
5887 | exports.ɵangular_packages_router_router_e = provideForRootGuard;
|
5888 | exports.ɵangular_packages_router_router_d = provideLocationStrategy;
|
5889 | exports.ɵangular_packages_router_router_k = provideRouterInitializer;
|
5890 | exports.ɵangular_packages_router_router_g = rootRoute;
|
5891 | exports.ɵangular_packages_router_router_b = routerNgProbeToken;
|
5892 | exports.ɵangular_packages_router_router_f = setupRouter;
|
5893 | exports.ɵangular_packages_router_router_o = RouterScroller;
|
5894 | exports.ɵangular_packages_router_router_m = Tree;
|
5895 | exports.ɵangular_packages_router_router_n = TreeNode;
|
5896 | exports.RouterLink = RouterLink;
|
5897 | exports.RouterLinkWithHref = RouterLinkWithHref;
|
5898 | exports.RouterLinkActive = RouterLinkActive;
|
5899 | exports.RouterOutlet = RouterOutlet;
|
5900 | exports.ActivationEnd = ActivationEnd;
|
5901 | exports.ActivationStart = ActivationStart;
|
5902 | exports.ChildActivationEnd = ChildActivationEnd;
|
5903 | exports.ChildActivationStart = ChildActivationStart;
|
5904 | exports.GuardsCheckEnd = GuardsCheckEnd;
|
5905 | exports.GuardsCheckStart = GuardsCheckStart;
|
5906 | exports.NavigationCancel = NavigationCancel;
|
5907 | exports.NavigationEnd = NavigationEnd;
|
5908 | exports.NavigationError = NavigationError;
|
5909 | exports.NavigationStart = NavigationStart;
|
5910 | exports.ResolveEnd = ResolveEnd;
|
5911 | exports.ResolveStart = ResolveStart;
|
5912 | exports.RouteConfigLoadEnd = RouteConfigLoadEnd;
|
5913 | exports.RouteConfigLoadStart = RouteConfigLoadStart;
|
5914 | exports.RouterEvent = RouterEvent;
|
5915 | exports.RoutesRecognized = RoutesRecognized;
|
5916 | exports.Scroll = Scroll;
|
5917 | exports.RouteReuseStrategy = RouteReuseStrategy;
|
5918 | exports.Router = Router;
|
5919 | exports.ROUTES = ROUTES;
|
5920 | exports.ROUTER_CONFIGURATION = ROUTER_CONFIGURATION;
|
5921 | exports.ROUTER_INITIALIZER = ROUTER_INITIALIZER;
|
5922 | exports.RouterModule = RouterModule;
|
5923 | exports.provideRoutes = provideRoutes;
|
5924 | exports.ChildrenOutletContexts = ChildrenOutletContexts;
|
5925 | exports.OutletContext = OutletContext;
|
5926 | exports.NoPreloading = NoPreloading;
|
5927 | exports.PreloadAllModules = PreloadAllModules;
|
5928 | exports.PreloadingStrategy = PreloadingStrategy;
|
5929 | exports.RouterPreloader = RouterPreloader;
|
5930 | exports.ActivatedRoute = ActivatedRoute;
|
5931 | exports.ActivatedRouteSnapshot = ActivatedRouteSnapshot;
|
5932 | exports.RouterState = RouterState;
|
5933 | exports.RouterStateSnapshot = RouterStateSnapshot;
|
5934 | exports.PRIMARY_OUTLET = PRIMARY_OUTLET;
|
5935 | exports.convertToParamMap = convertToParamMap;
|
5936 | exports.UrlHandlingStrategy = UrlHandlingStrategy;
|
5937 | exports.DefaultUrlSerializer = DefaultUrlSerializer;
|
5938 | exports.UrlSegment = UrlSegment;
|
5939 | exports.UrlSegmentGroup = UrlSegmentGroup;
|
5940 | exports.UrlSerializer = UrlSerializer;
|
5941 | exports.UrlTree = UrlTree;
|
5942 | exports.VERSION = VERSION;
|
5943 | exports.ɵROUTER_PROVIDERS = ROUTER_PROVIDERS;
|
5944 | exports.ɵflatten = flatten;
|
5945 |
|
5946 | Object.defineProperty(exports, '__esModule', { value: true });
|
5947 |
|
5948 | }));
|
5949 |
|