@coolon/angular-ui-powerups 0.0.98 → 0.0.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +2036 -1518
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  5. package/coolon-angular-ui-powerups.d.ts +19 -19
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +19 -19
  8. package/esm2015/index.js +2 -2
  9. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +20 -5
  10. package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +13 -3
  11. package/esm2015/lib/interaction/index.js +5 -4
  12. package/esm2015/lib/interaction/interaction-context-base.js +21 -8
  13. package/esm2015/lib/interaction/interaction-context.js +53 -46
  14. package/esm2015/lib/interaction/interaction.module.js +3 -3
  15. package/esm2015/lib/interaction/services/interaction.service.js +232 -0
  16. package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +62 -0
  17. package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +145 -0
  18. package/esm2015/lib/interaction/services/modal-interaction-context.factory.js +17 -0
  19. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +3 -3
  20. package/esm2015/lib/place/guards/navigation-state.js +406 -262
  21. package/esm2015/lib/place/guards/place-component-deactivation-handler.js +63 -28
  22. package/esm2015/lib/place/guards/place.guard.js +215 -0
  23. package/esm2015/lib/place/index.js +2 -3
  24. package/esm2015/lib/place/place-router.js +161 -118
  25. package/esm2015/lib/place/url-snapshot.js +124 -36
  26. package/esm2015/public_api.js +3 -3
  27. package/esm5/coolon-angular-ui-powerups.js +19 -19
  28. package/esm5/index.js +2 -2
  29. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +24 -14
  30. package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +10 -3
  31. package/esm5/lib/interaction/index.js +5 -4
  32. package/esm5/lib/interaction/interaction-context-base.js +25 -8
  33. package/esm5/lib/interaction/interaction-context.js +81 -56
  34. package/esm5/lib/interaction/interaction.module.js +3 -3
  35. package/esm5/lib/interaction/services/interaction.service.js +280 -0
  36. package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +65 -0
  37. package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +170 -0
  38. package/esm5/lib/interaction/services/modal-interaction-context.factory.js +27 -0
  39. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +3 -3
  40. package/esm5/lib/place/guards/navigation-state.js +552 -304
  41. package/esm5/lib/place/guards/place-component-deactivation-handler.js +73 -27
  42. package/esm5/lib/place/guards/place.guard.js +300 -0
  43. package/esm5/lib/place/index.js +2 -3
  44. package/esm5/lib/place/place-router.js +199 -137
  45. package/esm5/lib/place/url-snapshot.js +153 -42
  46. package/esm5/public_api.js +3 -3
  47. package/fesm2015/coolon-angular-ui-powerups.js +1636 -1300
  48. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  49. package/fesm5/coolon-angular-ui-powerups.js +1985 -1466
  50. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  51. package/lib/interaction/components/activity-container/activity-container.component.d.ts +1 -0
  52. package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +3 -1
  53. package/lib/interaction/index.d.ts +4 -3
  54. package/lib/interaction/interaction-context-base.d.ts +3 -1
  55. package/lib/interaction/interaction-context.d.ts +11 -13
  56. package/lib/interaction/services/interaction.service.d.ts +46 -0
  57. package/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.d.ts +15 -0
  58. package/lib/interaction/services/{dialog-interaction-context.d.ts → mat-dialog-interaction/dialog-interaction-context.d.ts} +2 -2
  59. package/lib/interaction/services/modal-interaction-context.factory.d.ts +4 -0
  60. package/lib/place/guards/navigation-state.d.ts +83 -49
  61. package/lib/place/guards/place-component-deactivation-handler.d.ts +7 -4
  62. package/lib/place/guards/{abstract-place.guard.d.ts → place.guard.d.ts} +9 -4
  63. package/lib/place/index.d.ts +1 -2
  64. package/lib/place/place-router.d.ts +17 -22
  65. package/lib/place/url-snapshot.d.ts +23 -6
  66. package/package.json +1 -1
  67. package/schematics/place-routes/place-def.js +1 -0
  68. package/schematics/place-routes/place-def.js.map +1 -1
  69. package/schematics/place-routes/templates/place-routes.ts.template +10 -11
  70. package/styles/styles.scss +1 -1
  71. package/esm2015/lib/interaction/services/dialog-interaction-context.js +0 -163
  72. package/esm2015/lib/interaction/services/dialog-interaction.service.js +0 -151
  73. package/esm2015/lib/interaction/services/modal-interaction.service.js +0 -109
  74. package/esm2015/lib/place/guards/abstract-place.guard.js +0 -165
  75. package/esm2015/lib/place/guards/interaction.guard.js +0 -113
  76. package/esm5/lib/interaction/services/dialog-interaction-context.js +0 -188
  77. package/esm5/lib/interaction/services/dialog-interaction.service.js +0 -179
  78. package/esm5/lib/interaction/services/modal-interaction.service.js +0 -153
  79. package/esm5/lib/place/guards/abstract-place.guard.js +0 -212
  80. package/esm5/lib/place/guards/interaction.guard.js +0 -125
  81. package/lib/interaction/services/dialog-interaction.service.d.ts +0 -24
  82. package/lib/interaction/services/modal-interaction.service.d.ts +0 -15
  83. package/lib/place/guards/interaction.guard.d.ts +0 -17
@@ -1,24 +1,24 @@
1
1
  import { DOCUMENT, CommonModule, Location } from '@angular/common';
2
- import { Directive, ElementRef, Inject, Input, HostListener, NgZone, NgModule, EventEmitter, Output, Component, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, ɵɵdefineInjectable, ɵɵinject, Optional, SkipSelf, HostBinding, INJECTOR } from '@angular/core';
2
+ import { Directive, ElementRef, Inject, Input, HostListener, NgZone, NgModule, EventEmitter, Output, Component, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, ɵɵdefineInjectable, ɵɵinject, Optional, SkipSelf, HostBinding } from '@angular/core';
3
3
  import { FormsModule } from '@angular/forms';
4
- import { MatInputModule, MatFormFieldModule, MatSelectModule, MatDialog, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule } from '@angular/material';
4
+ import { MatInputModule, MatFormFieldModule, MatSelectModule, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule, MatDialog } from '@angular/material';
5
5
  import { MatTabsModule } from '@angular/material/tabs';
6
6
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
7
  import { __extends, __decorate, __metadata, __awaiter, __generator, __assign, __spread } from 'tslib';
8
- import { DelegatingValueModel, assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, EventListenerList, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, Binding, Trace, Guard as Guard$1, StoreInValueModel, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
8
+ import { DelegatingValueModel, assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, Trace, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, Binding, Guard, StoreInValueModel, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
- import { RouterModule, NavigationStart, NavigationCancel, NavigationError, NavigationEnd, UrlSegment, Router, UrlSerializer, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
11
- import ___default, { last, isNil, isEqual } from 'lodash';
10
+ import { RouterModule, NavigationStart, NavigationCancel, UrlSegment, NavigationEnd, NavigationError, Router, UrlSerializer } from '@angular/router';
12
11
  import { assert as assert$1, Opts, Klass } from '@coolon/typescript-utilities';
13
- import { MatDialogConfig, MatDialog as MatDialog$1, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
14
12
  import { MatIconModule } from '@angular/material/icon';
15
13
  import { MatListModule } from '@angular/material/list';
16
14
  import { MatTooltipModule } from '@angular/material/tooltip';
17
15
  import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
18
16
  import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator';
19
17
  import 'reflect-metadata';
18
+ import ___default, { isNil, isEqual } from 'lodash';
20
19
  import { style, query, group, animate, trigger, transition } from '@angular/animations';
21
20
  import ResizeObserver from 'resize-observer-polyfill';
21
+ import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
22
22
  import { Observable } from 'rxjs';
23
23
 
24
24
  /**
@@ -1100,15 +1100,10 @@ if (false) {
1100
1100
  /**
1101
1101
  * @abstract
1102
1102
  */
1103
- var /**
1104
- * @abstract
1105
- */
1106
- InteractionContext = /** @class */ (function (_super) {
1103
+ var InteractionContext = /** @class */ (function (_super) {
1107
1104
  __extends(InteractionContext, _super);
1108
1105
  function InteractionContext() {
1109
- var _this = _super !== null && _super.apply(this, arguments) || this;
1110
- _this.activityListeners = new EventListenerList();
1111
- return _this;
1106
+ return _super !== null && _super.apply(this, arguments) || this;
1112
1107
  }
1113
1108
  /**
1114
1109
  * Returns true if an activity is currently running.
@@ -1125,62 +1120,112 @@ InteractionContext = /** @class */ (function (_super) {
1125
1120
  return this.active.value;
1126
1121
  };
1127
1122
  /**
1128
- * @param {?} listener
1129
1123
  * @return {?}
1130
1124
  */
1131
- InteractionContext.prototype.addActivityListener = /**
1132
- * @param {?} listener
1125
+ InteractionContext.prototype.dispose = /**
1133
1126
  * @return {?}
1134
1127
  */
1135
- function (listener) {
1136
- return this.activityListeners.add(listener);
1128
+ function () {
1129
+ // TODO: think about auto cancelling any outstanding activity on dispose.
1130
+ // See NavigationState.Navigating for a use-case.
1131
+ assert.isFalsey(this.isActive());
1132
+ _super.prototype.dispose.call(this);
1137
1133
  };
1138
1134
  /**
1139
- * @protected
1135
+ * Cancels the current activity and returns true the context is no longer active, false if
1136
+ * there is still another activity running.
1137
+ */
1138
+ /**
1139
+ * Cancels the current activity and returns true the context is no longer active, false if
1140
+ * there is still another activity running.
1140
1141
  * @return {?}
1141
1142
  */
1142
- InteractionContext.prototype.notifyActivityStarted = /**
1143
- * @protected
1143
+ InteractionContext.prototype.cancelCurrentActivity = /**
1144
+ * Cancels the current activity and returns true the context is no longer active, false if
1145
+ * there is still another activity running.
1144
1146
  * @return {?}
1145
1147
  */
1146
1148
  function () {
1147
- this.activityListeners.fire((/**
1148
- * @param {?} l
1149
- * @return {?}
1150
- */
1151
- function (l) { return l.onActivityStarted(); }));
1149
+ return __awaiter(this, void 0, void 0, function () {
1150
+ var when, activity;
1151
+ var _this = this;
1152
+ return __generator(this, function (_a) {
1153
+ switch (_a.label) {
1154
+ case 0:
1155
+ when = Dsl.disposeWith(this).when;
1156
+ return [4 /*yield*/, this.getCurrentActivity()];
1157
+ case 1:
1158
+ activity = _a.sent();
1159
+ return [2 /*return*/, new Promise((/**
1160
+ * @param {?} resolve
1161
+ * @return {?}
1162
+ */
1163
+ function (resolve) {
1164
+ when.valueOf(_this.activeActivity)
1165
+ .changes((/**
1166
+ * @param {?} nextActivity
1167
+ * @return {?}
1168
+ */
1169
+ function (nextActivity) {
1170
+ resolve(!nextActivity);
1171
+ }), { once: true });
1172
+ activity.cancel();
1173
+ }))];
1174
+ }
1175
+ });
1176
+ });
1152
1177
  };
1153
1178
  /**
1154
- * @protected
1155
1179
  * @return {?}
1156
1180
  */
1157
- InteractionContext.prototype.notifyActivityFinished = /**
1158
- * @protected
1181
+ InteractionContext.prototype.abort = /**
1159
1182
  * @return {?}
1160
1183
  */
1161
1184
  function () {
1162
- this.activityListeners.fire((/**
1163
- * @param {?} l
1164
- * @return {?}
1165
- */
1166
- function (l) { return l.onActivityFinished(); }));
1185
+ return __awaiter(this, void 0, void 0, function () {
1186
+ var count;
1187
+ return __generator(this, function (_a) {
1188
+ switch (_a.label) {
1189
+ case 0:
1190
+ assert.isTruthy(this.isActive());
1191
+ count = 1;
1192
+ return [4 /*yield*/, this.cancelCurrentActivity()];
1193
+ case 1:
1194
+ _a.sent();
1195
+ console.log("aborted -> " + count++);
1196
+ _a.label = 2;
1197
+ case 2:
1198
+ if (!this.isActive()) return [3 /*break*/, 4];
1199
+ return [4 /*yield*/, this.cancelCurrentActivity()];
1200
+ case 3:
1201
+ _a.sent();
1202
+ console.log("aborted -> " + count++);
1203
+ return [3 /*break*/, 2];
1204
+ case 4: return [2 /*return*/];
1205
+ }
1206
+ });
1207
+ });
1167
1208
  };
1209
+ __decorate([
1210
+ Trace(),
1211
+ __metadata("design:type", Function),
1212
+ __metadata("design:paramtypes", []),
1213
+ __metadata("design:returntype", Promise)
1214
+ ], InteractionContext.prototype, "abort", null);
1168
1215
  return InteractionContext;
1169
1216
  }(GarbageCollector));
1170
1217
  if (false) {
1171
- /**
1172
- * @type {?}
1173
- * @private
1174
- */
1175
- InteractionContext.prototype.activityListeners;
1218
+ /** @type {?} */
1219
+ InteractionContext.prototype.active;
1176
1220
  /** @type {?} */
1177
1221
  InteractionContext.prototype.activityList;
1178
1222
  /** @type {?} */
1179
- InteractionContext.prototype.active;
1223
+ InteractionContext.prototype.activeActivity;
1180
1224
  /**
1181
1225
  * Returns the activity that is currently active.
1182
1226
  * This model is only updated in the next tick after the view has been updated.
1183
1227
  * @abstract
1228
+ * @protected
1184
1229
  * @return {?}
1185
1230
  */
1186
1231
  InteractionContext.prototype.getCurrentActivity = function () { };
@@ -1221,23 +1266,6 @@ if (false) {
1221
1266
  */
1222
1267
  InteractionContext.prototype.confirmThen = function (confirm, activityType, data) { };
1223
1268
  }
1224
- (function (InteractionContext) {
1225
- /**
1226
- * @record
1227
- */
1228
- function Listener() { }
1229
- InteractionContext.Listener = Listener;
1230
- if (false) {
1231
- /**
1232
- * @return {?}
1233
- */
1234
- Listener.prototype.onActivityStarted = function () { };
1235
- /**
1236
- * @return {?}
1237
- */
1238
- Listener.prototype.onActivityFinished = function () { };
1239
- }
1240
- })(InteractionContext || (InteractionContext = {}));
1241
1269
 
1242
1270
  /**
1243
1271
  * @fileoverview added by tsickle
@@ -1406,13 +1434,14 @@ InteractionContextBase = /** @class */ (function (_super) {
1406
1434
  */
1407
1435
  _this._activityListDelegate = new DelegatingListModel();
1408
1436
  var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1409
- when.listOf(_this.activityList).becomesPopulated((/**
1410
- * @param {?} activities
1437
+ _this._currentActivity = chain(_this.activityList).last();
1438
+ when.valueOf(_this._currentActivity).becomesTruthy((/**
1439
+ * @param {?} activity
1411
1440
  * @return {?}
1412
1441
  */
1413
- function (activities) {
1442
+ function (activity) {
1414
1443
  if (_this.deferredGetCurrentActivity) {
1415
- _this.deferredGetCurrentActivity.resolve(last(activities));
1444
+ _this.deferredGetCurrentActivity.resolve(activity);
1416
1445
  _this.deferredGetCurrentActivity = null;
1417
1446
  }
1418
1447
  }));
@@ -1441,6 +1470,16 @@ InteractionContextBase = /** @class */ (function (_super) {
1441
1470
  enumerable: true,
1442
1471
  configurable: true
1443
1472
  });
1473
+ Object.defineProperty(InteractionContextBase.prototype, "activeActivity", {
1474
+ get: /**
1475
+ * @return {?}
1476
+ */
1477
+ function () {
1478
+ return this._currentActivity;
1479
+ },
1480
+ enumerable: true,
1481
+ configurable: true
1482
+ });
1444
1483
  /**
1445
1484
  * Returns the activity that is currently active.
1446
1485
  * This model is only updated in the next tick after the view has been updated.
@@ -1467,12 +1506,14 @@ InteractionContextBase = /** @class */ (function (_super) {
1467
1506
  return [2 /*return*/, this.deferredGetCurrentActivity.promise];
1468
1507
  }
1469
1508
  else {
1470
- if (this.activityList.length < 1) {
1509
+ if (!this._currentActivity.value) {
1510
+ // we'be been asked before we've got any activities, create a deferred promise
1511
+ // that we resolve when the list populates.
1471
1512
  this.deferredGetCurrentActivity = Deferred.defer();
1472
1513
  return [2 /*return*/, this.deferredGetCurrentActivity.promise];
1473
1514
  }
1474
1515
  else {
1475
- return [2 /*return*/, last(this.activityList.value)];
1516
+ return [2 /*return*/, this._currentActivity.value];
1476
1517
  }
1477
1518
  }
1478
1519
  }
@@ -1574,6 +1615,11 @@ if (false) {
1574
1615
  * @private
1575
1616
  */
1576
1617
  InteractionContextBase.prototype.deferredGetCurrentActivity;
1618
+ /**
1619
+ * @type {?}
1620
+ * @private
1621
+ */
1622
+ InteractionContextBase.prototype._currentActivity;
1577
1623
  /**
1578
1624
  * @abstract
1579
1625
  * @protected
@@ -1817,6 +1863,15 @@ TabContext = /** @class */ (function () {
1817
1863
  this._complete = true;
1818
1864
  this.activityCallbacks.onCancel(error);
1819
1865
  };
1866
+ /**
1867
+ * @return {?}
1868
+ */
1869
+ TabContext.prototype.dispose = /**
1870
+ * @return {?}
1871
+ */
1872
+ function () {
1873
+ this.component.dispose();
1874
+ };
1820
1875
  return TabContext;
1821
1876
  }());
1822
1877
  if (false) {
@@ -1906,20 +1961,10 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
1906
1961
  enumerable: true,
1907
1962
  configurable: true
1908
1963
  });
1909
- // get isFinished() {
1910
- // return !this._initialActivityOutletContext;
1911
- // }
1912
- // get isFinished() {
1913
- // return !this._initialActivityOutletContext;
1914
- // }
1915
1964
  /**
1916
1965
  * @return {?}
1917
1966
  */
1918
- ActivityContainerComponent.prototype.ngOnInit =
1919
- // get isFinished() {
1920
- // return !this._initialActivityOutletContext;
1921
- // }
1922
- /**
1967
+ ActivityContainerComponent.prototype.ngOnInit = /**
1923
1968
  * @return {?}
1924
1969
  */
1925
1970
  function () {
@@ -2001,6 +2046,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
2001
2046
  * @return {?}
2002
2047
  */
2003
2048
  function () {
2049
+ this.updateActivityList();
2004
2050
  this._initialActivityOutletContext.value = null;
2005
2051
  this.initialActivityOutletContextEvent.emit(null);
2006
2052
  };
@@ -2033,14 +2079,24 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
2033
2079
  * @return {?}
2034
2080
  */
2035
2081
  function () {
2036
- var _this = this;
2037
2082
  if (this.tabs.selectedIndex < this.activityTabs.length - 1) {
2083
+ /** @type {?} */
2084
+ var tabs = this.activityTabs.value;
2085
+ /** @type {?} */
2086
+ var remainingActivities_1 = tabs.slice(0, 1 + this.tabs.selectedIndex);
2087
+ /** @type {?} */
2088
+ var finishedActivityTabs = tabs.slice(1 + this.tabs.selectedIndex);
2089
+ finishedActivityTabs.forEach((/**
2090
+ * @param {?} a
2091
+ * @return {?}
2092
+ */
2093
+ function (a) { return a.dispose(); }));
2038
2094
  this.activityTabs.runInTransaction((/**
2039
2095
  * @param {?} draft
2040
2096
  * @return {?}
2041
2097
  */
2042
2098
  function (draft) {
2043
- draft.value = draft.value.slice(0, 1 + _this.tabs.selectedIndex);
2099
+ draft.value = remainingActivities_1;
2044
2100
  }));
2045
2101
  }
2046
2102
  };
@@ -2172,206 +2228,357 @@ if (false) {
2172
2228
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2173
2229
  */
2174
2230
  /**
2175
- * @template D, R, E
2231
+ * @abstract
2176
2232
  */
2177
- var InplaceInteractionContextComponent = /** @class */ (function (_super) {
2178
- __extends(InplaceInteractionContextComponent, _super);
2179
- function InplaceInteractionContextComponent() {
2180
- var _this = _super.call(this) || this;
2181
- _this._active = new MutableValueModel(false);
2182
- return _this;
2233
+ var /**
2234
+ * @abstract
2235
+ */
2236
+ ModalInteractionContextFactory = /** @class */ (function () {
2237
+ function ModalInteractionContextFactory() {
2183
2238
  }
2239
+ return ModalInteractionContextFactory;
2240
+ }());
2241
+ if (false) {
2184
2242
  /**
2243
+ * @abstract
2185
2244
  * @return {?}
2186
2245
  */
2187
- InplaceInteractionContextComponent.prototype.ngAfterViewInit = /**
2246
+ ModalInteractionContextFactory.prototype.createInteractionContext = function () { };
2247
+ }
2248
+
2249
+ /**
2250
+ * @fileoverview added by tsickle
2251
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2252
+ */
2253
+ /** @type {?} */
2254
+ var inplaceMonitorCount = 0;
2255
+ var InteractionService = /** @class */ (function () {
2256
+ function InteractionService(modelInteractionContextFactory) {
2257
+ this.modelInteractionContextFactory = modelInteractionContextFactory;
2258
+ this.garbage = new GarbageCollector();
2259
+ this.exclusiveContext = new MutableValueModel();
2260
+ this._activeModalInteractionContextModel = new MutableValueModel();
2261
+ this._activeInlineInteractionContextModel = new MutableValueModel();
2262
+ var _a = Dsl.disposeWith(this.garbage), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
2263
+ this._activeInteractionContext = chain(this._activeModalInteractionContextModel)
2264
+ .otherwise(this._activeInlineInteractionContextModel)
2265
+ .pluck('interactionContext');
2266
+ this.active = chain(this._activeInteractionContext).isNotNil();
2267
+ this.modelInteractionActive = chain(this._activeModalInteractionContextModel).isNotNil();
2268
+ this.inlineInteractionActive = chain(this._activeInlineInteractionContextModel).isNotNil();
2269
+ // TODO: chain.concat(listOrValueModels) would be nice.
2270
+ this.activeInteractionContextIds = chain(new MutableListModel())
2271
+ .append(this._activeInlineInteractionContextModel)
2272
+ .append(this._activeModalInteractionContextModel)
2273
+ .rejectNil()
2274
+ .pluck('id');
2275
+ }
2276
+ /**
2277
+ * @return {?}
2278
+ */
2279
+ InteractionService.prototype.isActive = /**
2188
2280
  * @return {?}
2189
2281
  */
2190
2282
  function () {
2191
- this.setActivityList(this.interactionContext.activityList);
2283
+ return this.active.value;
2192
2284
  };
2193
- Object.defineProperty(InplaceInteractionContextComponent.prototype, "active", {
2194
- get: /**
2195
- * @return {?}
2196
- */
2197
- function () {
2198
- return this._active.readonly;
2199
- },
2200
- enumerable: true,
2201
- configurable: true
2202
- });
2203
2285
  /**
2204
- * @protected
2205
- * @template D1, R1, E1
2206
- * @param {?} activityType
2207
- * @param {?=} data
2208
2286
  * @return {?}
2209
2287
  */
2210
- InplaceInteractionContextComponent.prototype._startActivity = /**
2211
- * @protected
2212
- * @template D1, R1, E1
2213
- * @param {?} activityType
2214
- * @param {?=} data
2288
+ InteractionService.prototype.isModalActive = /**
2215
2289
  * @return {?}
2216
2290
  */
2217
- function (activityType, data) {
2218
- var _this = this;
2219
- this._active.value = true;
2291
+ function () {
2292
+ return this.modelInteractionActive.value;
2293
+ };
2294
+ /**
2295
+ * @param {?} disposable
2296
+ * @return {?}
2297
+ */
2298
+ InteractionService.prototype.createModalInteractionContextFor = /**
2299
+ * @param {?} disposable
2300
+ * @return {?}
2301
+ */
2302
+ function (disposable) {
2303
+ /** @type {?} */
2304
+ var context = this.modelInteractionContextFactory.createInteractionContext();
2305
+ disposable.registerDisposable(new InteractionService.Monitor('modal', context, this._activeModalInteractionContextModel, this.exclusiveContext));
2306
+ return context;
2307
+ };
2308
+ /**
2309
+ * @param {?} interactionContext
2310
+ * @return {?}
2311
+ */
2312
+ InteractionService.prototype._registerInplaceInteractionContext = /**
2313
+ * @param {?} interactionContext
2314
+ * @return {?}
2315
+ */
2316
+ function (interactionContext) {
2317
+ interactionContext.registerDisposable(new InteractionService.Monitor("ip" + ++inplaceMonitorCount, interactionContext, this._activeInlineInteractionContextModel, this.exclusiveContext));
2318
+ };
2319
+ // @Trace()
2320
+ // @Trace()
2321
+ /**
2322
+ * @return {?}
2323
+ */
2324
+ InteractionService.prototype.getActiveContext =
2325
+ // @Trace()
2326
+ /**
2327
+ * @return {?}
2328
+ */
2329
+ function () {
2330
+ assert$1.isTruthy(this.isActive());
2331
+ return this._activeInteractionContext.value;
2332
+ };
2333
+ /**
2334
+ * Creates an interaction context that will prevent any other contexts from starting an
2335
+ * activity until it is disposed. This is intended for use by the router for passing
2336
+ * to PlaceComponent.canDeactivate(interactionContext). This ensures components don't
2337
+ * try and interact in a way that we can't track and synchronise with the browser back
2338
+ * button.
2339
+ */
2340
+ /**
2341
+ * Creates an interaction context that will prevent any other contexts from starting an
2342
+ * activity until it is disposed. This is intended for use by the router for passing
2343
+ * to PlaceComponent.canDeactivate(interactionContext). This ensures components don't
2344
+ * try and interact in a way that we can't track and synchronise with the browser back
2345
+ * button.
2346
+ * @return {?}
2347
+ */
2348
+ InteractionService.prototype._createExclusiveModalInteractionContext = /**
2349
+ * Creates an interaction context that will prevent any other contexts from starting an
2350
+ * activity until it is disposed. This is intended for use by the router for passing
2351
+ * to PlaceComponent.canDeactivate(interactionContext). This ensures components don't
2352
+ * try and interact in a way that we can't track and synchronise with the browser back
2353
+ * button.
2354
+ * @return {?}
2355
+ */
2356
+ function () {
2357
+ this.exclusiveContext.value = this.modelInteractionContextFactory.createInteractionContext();
2220
2358
  /** @type {?} */
2221
2359
  var self = this;
2222
- return new Promise((/**
2223
- * @param {?} resolve
2224
- * @param {?} reject
2225
- * @return {?}
2226
- */
2227
- function (resolve, reject) {
2228
- _this.interactionContext.initialActivityOutletContext = {
2229
- activityClass: activityType,
2230
- activityData: data,
2231
- onDone: /**
2232
- * @param {?} result
2233
- * @return {?}
2234
- */
2235
- function (result) {
2236
- self._active.value = false;
2237
- resolve(result);
2238
- },
2239
- onCancel: /**
2240
- * @param {?} error
2241
- * @return {?}
2242
- */
2243
- function (error) {
2244
- self._active.value = false;
2245
- reject(error);
2246
- }
2247
- };
2248
- }));
2360
+ this.exclusiveContext.value.registerDisposable({
2361
+ dispose: /**
2362
+ * @return {?}
2363
+ */
2364
+ function () {
2365
+ self.exclusiveContext.value = null;
2366
+ }
2367
+ });
2368
+ return this.exclusiveContext.value;
2249
2369
  };
2250
- InplaceInteractionContextComponent.decorators = [
2251
- { type: Component, args: [{
2252
- selector: 'aup-inplace-interaction-context',
2253
- template: "<mat-tab-group no-tab-header [selectedIndex]=\"isActive() ? 1 : 0\" full-height-tabs [dynamicHeight]=\"false\">\n <mat-tab>\n <ng-content></ng-content>\n </mat-tab>\n <mat-tab>\n <aup-activity-container #activityContainer\n [(initialActivityOutletContext)]=\"initialActivityContext\"\n [dynamicHeight]=\"false\"></aup-activity-container>\n </mat-tab>\n</mat-tab-group>\n\n",
2254
- styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
2255
- }] }
2370
+ InteractionService.decorators = [
2371
+ { type: Injectable, args: [{
2372
+ providedIn: 'root'
2373
+ },] }
2256
2374
  ];
2257
2375
  /** @nocollapse */
2258
- InplaceInteractionContextComponent.ctorParameters = function () { return []; };
2259
- InplaceInteractionContextComponent.propDecorators = {
2260
- interactionContext: [{ type: ViewChild, args: ['activityContainer', { static: true },] }]
2261
- };
2262
- return InplaceInteractionContextComponent;
2263
- }(InteractionContextBase));
2376
+ InteractionService.ctorParameters = function () { return [
2377
+ { type: ModalInteractionContextFactory }
2378
+ ]; };
2379
+ /** @nocollapse */ InteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionService_Factory() { return new InteractionService(ɵɵinject(ModalInteractionContextFactory)); }, token: InteractionService, providedIn: "root" });
2380
+ return InteractionService;
2381
+ }());
2264
2382
  if (false) {
2383
+ /**
2384
+ * @type {?}
2385
+ * @private
2386
+ */
2387
+ InteractionService.prototype.garbage;
2265
2388
  /** @type {?} */
2266
- InplaceInteractionContextComponent.prototype.interactionContext;
2267
- /** @type {?} */
2268
- InplaceInteractionContextComponent.prototype.initialActivityContext;
2389
+ InteractionService.prototype.active;
2269
2390
  /**
2270
2391
  * @type {?}
2271
2392
  * @private
2272
2393
  */
2273
- InplaceInteractionContextComponent.prototype._active;
2394
+ InteractionService.prototype.exclusiveContext;
2395
+ /**
2396
+ * @type {?}
2397
+ * @private
2398
+ */
2399
+ InteractionService.prototype._activeModalInteractionContextModel;
2400
+ /**
2401
+ * @type {?}
2402
+ * @private
2403
+ */
2404
+ InteractionService.prototype._activeInlineInteractionContextModel;
2405
+ /**
2406
+ * @type {?}
2407
+ * @private
2408
+ */
2409
+ InteractionService.prototype._activeInteractionContext;
2410
+ /** @type {?} */
2411
+ InteractionService.prototype.activeInteractionContextIds;
2412
+ /** @type {?} */
2413
+ InteractionService.prototype.modelInteractionActive;
2414
+ /** @type {?} */
2415
+ InteractionService.prototype.inlineInteractionActive;
2416
+ /** @type {?} */
2417
+ InteractionService.prototype.modelInteractionContextFactory;
2274
2418
  }
2275
-
2276
- /**
2277
- * @fileoverview added by tsickle
2278
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2279
- */
2280
- var InteractionOutletComponent = /** @class */ (function () {
2281
- function InteractionOutletComponent() {
2419
+ (function (InteractionService) {
2420
+ /**
2421
+ * @record
2422
+ */
2423
+ function Callback() { }
2424
+ InteractionService.Callback = Callback;
2425
+ if (false) {
2426
+ /**
2427
+ * @param {?} monitor
2428
+ * @return {?}
2429
+ */
2430
+ Callback.prototype.onStarted = function (monitor) { };
2431
+ /**
2432
+ * @param {?} monitor
2433
+ * @return {?}
2434
+ */
2435
+ Callback.prototype.onFinished = function (monitor) { };
2282
2436
  }
2283
- InteractionOutletComponent.decorators = [
2284
- { type: Component, args: [{
2285
- selector: 'aup-interaction-outlet',
2286
- template: "<router-outlet name=\"interaction-context\"></router-outlet>\n",
2287
- styles: [":host{display:block}"]
2288
- }] }
2289
- ];
2290
- /** @nocollapse */
2291
- InteractionOutletComponent.ctorParameters = function () { return []; };
2292
- return InteractionOutletComponent;
2293
- }());
2437
+ var Monitor = /** @class */ (function (_super) {
2438
+ __extends(Monitor, _super);
2439
+ function Monitor(id, interactionContext, currentActiveMonitor, exclusiveContext) {
2440
+ var _this = _super.call(this) || this;
2441
+ _this.id = id;
2442
+ _this.interactionContext = interactionContext;
2443
+ _this.currentActiveMonitor = currentActiveMonitor;
2444
+ _this.exclusiveContext = exclusiveContext;
2445
+ var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
2446
+ when.valueOf(interactionContext.active).becomesTruthy((/**
2447
+ * @return {?}
2448
+ */
2449
+ function () { return _this.onStarted(); }));
2450
+ when.valueOf(interactionContext.active).becomesFalsey((/**
2451
+ * @return {?}
2452
+ */
2453
+ function () { return _this.onFinished(); }));
2454
+ interactionContext.registerDisposable(_this);
2455
+ return _this;
2456
+ }
2457
+ /**
2458
+ * @protected
2459
+ * @return {?}
2460
+ */
2461
+ Monitor.prototype.onStarted = /**
2462
+ * @protected
2463
+ * @return {?}
2464
+ */
2465
+ function () {
2466
+ this.assertCanStart();
2467
+ this.currentActiveMonitor.value = this;
2468
+ };
2469
+ /**
2470
+ * @private
2471
+ * @return {?}
2472
+ */
2473
+ Monitor.prototype.assertCanStart = /**
2474
+ * @private
2475
+ * @return {?}
2476
+ */
2477
+ function () {
2478
+ assert$1.isFalsey(this.currentActiveMonitor.value);
2479
+ if (this.exclusiveContext.value && this.interactionContext !== this.exclusiveContext.value) {
2480
+ lang.illegalState('Interaction started while exclusive lock active. This is usually because you using a different context during place.canDeactivate(interactionContext)');
2481
+ }
2482
+ };
2483
+ /**
2484
+ * @protected
2485
+ * @return {?}
2486
+ */
2487
+ Monitor.prototype.onFinished = /**
2488
+ * @protected
2489
+ * @return {?}
2490
+ */
2491
+ function () {
2492
+ this.assertCurrentlyActive();
2493
+ this.currentActiveMonitor.value = null;
2494
+ };
2495
+ /**
2496
+ * @private
2497
+ * @return {?}
2498
+ */
2499
+ Monitor.prototype.assertCurrentlyActive = /**
2500
+ * @private
2501
+ * @return {?}
2502
+ */
2503
+ function () {
2504
+ assert$1.isTruthy(this.currentActiveMonitor.value === this);
2505
+ };
2506
+ return Monitor;
2507
+ }(GarbageCollector));
2508
+ InteractionService.Monitor = Monitor;
2509
+ if (false) {
2510
+ /** @type {?} */
2511
+ Monitor.prototype.id;
2512
+ /** @type {?} */
2513
+ Monitor.prototype.interactionContext;
2514
+ /** @type {?} */
2515
+ Monitor.prototype.currentActiveMonitor;
2516
+ /** @type {?} */
2517
+ Monitor.prototype.exclusiveContext;
2518
+ }
2519
+ })(InteractionService || (InteractionService = {}));
2294
2520
 
2295
2521
  /**
2296
2522
  * @fileoverview added by tsickle
2297
2523
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2298
2524
  */
2299
- var DialogInteractionContext = /** @class */ (function (_super) {
2300
- __extends(DialogInteractionContext, _super);
2301
- function DialogInteractionContext(dialogService, config) {
2525
+ /**
2526
+ * @template D, R, E
2527
+ */
2528
+ var InplaceInteractionContextComponent = /** @class */ (function (_super) {
2529
+ __extends(InplaceInteractionContextComponent, _super);
2530
+ function InplaceInteractionContextComponent(interactionService) {
2302
2531
  var _this = _super.call(this) || this;
2303
- _this.dialogService = dialogService;
2304
- _this.config = config;
2305
- _this._activeModel = new MutableValueModel(false);
2306
- assert$1.notNil(dialogService);
2307
- _this.onDispose((/**
2308
- * @return {?}
2309
- */
2310
- function () {
2311
- if (_this.isActive()) {
2312
- lang.illegalState('Dispose called while active.');
2313
- }
2314
- }));
2532
+ _this.interactionService = interactionService;
2533
+ _this._active = new MutableValueModel(false);
2534
+ _this.interactionService._registerInplaceInteractionContext(_this);
2315
2535
  return _this;
2316
2536
  }
2317
- Object.defineProperty(DialogInteractionContext.prototype, "active", {
2537
+ /**
2538
+ * @return {?}
2539
+ */
2540
+ InplaceInteractionContextComponent.prototype.ngAfterViewInit = /**
2541
+ * @return {?}
2542
+ */
2543
+ function () {
2544
+ this.setActivityList(this.interactionContext.activityList);
2545
+ };
2546
+ Object.defineProperty(InplaceInteractionContextComponent.prototype, "active", {
2318
2547
  get: /**
2319
2548
  * @return {?}
2320
2549
  */
2321
2550
  function () {
2322
- return this._activeModel.readonly;
2551
+ return this._active.readonly;
2323
2552
  },
2324
2553
  enumerable: true,
2325
2554
  configurable: true
2326
2555
  });
2327
2556
  /**
2328
2557
  * @protected
2329
- * @template D, R, E
2558
+ * @template D1, R1, E1
2330
2559
  * @param {?} activityType
2331
- * @param {?} data
2332
- * @param {?=} disableClose
2560
+ * @param {?=} data
2333
2561
  * @return {?}
2334
2562
  */
2335
- DialogInteractionContext.prototype._startActivity = /**
2563
+ InplaceInteractionContextComponent.prototype._startActivity = /**
2336
2564
  * @protected
2337
- * @template D, R, E
2565
+ * @template D1, R1, E1
2338
2566
  * @param {?} activityType
2339
- * @param {?} data
2340
- * @param {?=} disableClose
2567
+ * @param {?=} data
2341
2568
  * @return {?}
2342
2569
  */
2343
- function (activityType, data, disableClose) {
2570
+ function (activityType, data) {
2344
2571
  var _this = this;
2345
- if (disableClose === void 0) { disableClose = true; }
2346
- if (this.isActive()) {
2347
- lang.illegalState("Activity already in progress: " + this.activityList.value.map((/**
2348
- * @param {?} a
2349
- * @return {?}
2350
- */
2351
- function (a) { return a.constructor.name; })).join(', '));
2352
- }
2353
- this._activeModel.value = true;
2354
- this.notifyActivityStarted();
2355
- /** @type {?} */
2356
- var config = __assign({}, this.config, {
2357
- data: data,
2358
- disableClose: disableClose,
2359
- panelClass: 'dialog-interaction-service'
2360
- });
2572
+ this._active.value = true;
2361
2573
  /** @type {?} */
2362
2574
  var self = this;
2363
- /** @type {?} */
2364
- var matDialogRef = (/** @type {?} */ (this.dialogService.open(ActivityContainerComponent, config)));
2365
2575
  return new Promise((/**
2366
2576
  * @param {?} resolve
2367
2577
  * @param {?} reject
2368
2578
  * @return {?}
2369
2579
  */
2370
2580
  function (resolve, reject) {
2371
- /** @type {?} */
2372
- var activityContainer = matDialogRef.componentInstance;
2373
- self.safelyUpdateActivityListDelegate(activityContainer.activityList);
2374
- activityContainer.initialActivityOutletContext = {
2581
+ _this.interactionContext.initialActivityOutletContext = {
2375
2582
  activityClass: activityType,
2376
2583
  activityData: data,
2377
2584
  onDone: /**
@@ -2379,411 +2586,69 @@ var DialogInteractionContext = /** @class */ (function (_super) {
2379
2586
  * @return {?}
2380
2587
  */
2381
2588
  function (result) {
2589
+ self._active.value = false;
2382
2590
  resolve(result);
2383
- matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
2384
2591
  },
2385
2592
  onCancel: /**
2386
2593
  * @param {?} error
2387
2594
  * @return {?}
2388
2595
  */
2389
2596
  function (error) {
2597
+ self._active.value = false;
2390
2598
  reject(error);
2391
- matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
2392
2599
  }
2393
2600
  };
2394
- // we need to check if our onDone/onCancel methods above we called or if we were
2395
- // closed by the user clicking the backdrop. If the later then we need to reject
2396
- // our promise.
2397
- matDialogRef.afterClosed().subscribe((/**
2398
- * @param {?} promiseAlreadyFinished
2399
- * @return {?}
2400
- */
2401
- function (promiseAlreadyFinished) {
2402
- if (!promiseAlreadyFinished) {
2403
- reject('auto-closed');
2404
- }
2405
- }));
2406
- matDialogRef.updateSize();
2407
- matDialogRef.afterOpened().subscribe((/**
2408
- * @param {?} promiseAlreadyFinished
2409
- * @return {?}
2410
- */
2411
- function (promiseAlreadyFinished) {
2412
- matDialogRef.updateSize();
2413
- }));
2414
- })).finally((/**
2415
- * @return {?}
2416
- */
2417
- function () {
2418
- _this._activeModel.value = false;
2419
- _this.notifyActivityFinished();
2420
- self.safelyUpdateActivityListDelegate(null);
2421
- }));
2422
- };
2423
- /**
2424
- * Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
2425
- * @param delegate
2426
- */
2427
- /**
2428
- * Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
2429
- * @param {?} delegate
2430
- * @return {?}
2431
- */
2432
- DialogInteractionContext.prototype.safelyUpdateActivityListDelegate = /**
2433
- * Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
2434
- * @param {?} delegate
2435
- * @return {?}
2436
- */
2437
- function (delegate) {
2438
- var _this = this;
2439
- setTimeout((/**
2440
- * @return {?}
2441
- */
2442
- function () { return _this.setActivityList(delegate); }));
2443
- };
2444
- DialogInteractionContext.decorators = [
2445
- { type: Injectable, args: [{
2446
- providedIn: 'root'
2447
- },] }
2448
- ];
2449
- /** @nocollapse */
2450
- DialogInteractionContext.ctorParameters = function () { return [
2451
- { type: MatDialog },
2452
- { type: MatDialogConfig }
2453
- ]; };
2454
- /** @nocollapse */ DialogInteractionContext.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionContext_Factory() { return new DialogInteractionContext(ɵɵinject(MatDialog$1), ɵɵinject(MatDialogConfig)); }, token: DialogInteractionContext, providedIn: "root" });
2455
- return DialogInteractionContext;
2456
- }(InteractionContextBase));
2457
- if (false) {
2458
- /**
2459
- * @type {?}
2460
- * @private
2461
- */
2462
- DialogInteractionContext.prototype._activeModel;
2463
- /**
2464
- * @type {?}
2465
- * @private
2466
- */
2467
- DialogInteractionContext.prototype.dialogService;
2468
- /** @type {?} */
2469
- DialogInteractionContext.prototype.config;
2470
- }
2471
-
2472
- /**
2473
- * @fileoverview added by tsickle
2474
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2475
- */
2476
- var Guard = /** @class */ (function (_super) {
2477
- __extends(Guard, _super);
2478
- function Guard() {
2479
- return _super.call(this, { initialValue: false }) || this;
2480
- }
2481
- Object.defineProperty(Guard.prototype, "value", {
2482
- get: /**
2483
- * @return {?}
2484
- */
2485
- function () {
2486
- return this.store.read();
2487
- },
2488
- enumerable: true,
2489
- configurable: true
2490
- });
2491
- /**
2492
- * @template R
2493
- * @param {?} fun
2494
- * @return {?}
2495
- */
2496
- Guard.prototype.whileTrue = /**
2497
- * @template R
2498
- * @param {?} fun
2499
- * @return {?}
2500
- */
2501
- function (fun) {
2502
- this.startTransaction().commit(true);
2503
- try {
2504
- return fun();
2505
- }
2506
- finally {
2507
- this.startTransaction().commit(false);
2508
- }
2509
- };
2510
- /**
2511
- * @template R
2512
- * @param {?} fun
2513
- * @param {?=} defaultValue
2514
- * @return {?}
2515
- */
2516
- Guard.prototype.runIfFalse = /**
2517
- * @template R
2518
- * @param {?} fun
2519
- * @param {?=} defaultValue
2520
- * @return {?}
2521
- */
2522
- function (fun, defaultValue) {
2523
- if (defaultValue === void 0) { defaultValue = null; }
2524
- return !this.value ? fun() : defaultValue;
2525
- };
2526
- return Guard;
2527
- }(ValueModel));
2528
- /**
2529
- * @abstract
2530
- */
2531
- var /**
2532
- * @abstract
2533
- */
2534
- ModalInteractionService = /** @class */ (function (_super) {
2535
- __extends(ModalInteractionService, _super);
2536
- function ModalInteractionService() {
2537
- var _this = _super.call(this) || this;
2538
- _this._activityListeners = new EventListenerList();
2539
- return _this;
2540
- }
2541
- /**
2542
- * @return {?}
2543
- */
2544
- ModalInteractionService.prototype.isActive = /**
2545
- * @return {?}
2546
- */
2547
- function () {
2548
- return this.active.value;
2549
- };
2550
- /**
2551
- * @param {?} listener
2552
- * @return {?}
2553
- */
2554
- ModalInteractionService.prototype.addActivityListener = /**
2555
- * @param {?} listener
2556
- * @return {?}
2557
- */
2558
- function (listener) {
2559
- return this._activityListeners.add(listener);
2560
- };
2561
- /**
2562
- * @protected
2563
- * @return {?}
2564
- */
2565
- ModalInteractionService.prototype.notifyActivityStarted = /**
2566
- * @protected
2567
- * @return {?}
2568
- */
2569
- function () {
2570
- this._activityListeners.fire((/**
2571
- * @param {?} l
2572
- * @return {?}
2573
- */
2574
- function (l) { return l.onActivityStarted(); }));
2575
- };
2576
- /**
2577
- * @protected
2578
- * @return {?}
2579
- */
2580
- ModalInteractionService.prototype.notifyActivityFinished = /**
2581
- * @protected
2582
- * @return {?}
2583
- */
2584
- function () {
2585
- this._activityListeners.fire((/**
2586
- * @param {?} l
2587
- * @return {?}
2588
- */
2589
- function (l) { return l.onActivityFinished(); }));
2590
- };
2591
- return ModalInteractionService;
2592
- }(GarbageCollector));
2593
- if (false) {
2594
- /**
2595
- * @type {?}
2596
- * @private
2597
- */
2598
- ModalInteractionService.prototype._activityListeners;
2599
- /** @type {?} */
2600
- ModalInteractionService.prototype.active;
2601
- /**
2602
- * @abstract
2603
- * @param {?} disposable
2604
- * @return {?}
2605
- */
2606
- ModalInteractionService.prototype.createInteractionContextFor = function (disposable) { };
2607
- /**
2608
- * @abstract
2609
- * @return {?}
2610
- */
2611
- ModalInteractionService.prototype.createExclusiveInteractionContext = function () { };
2612
- /**
2613
- * @abstract
2614
- * @return {?}
2615
- */
2616
- ModalInteractionService.prototype.getCurrentActivity = function () { };
2617
- }
2618
-
2619
- /**
2620
- * @fileoverview added by tsickle
2621
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2622
- */
2623
- /** @type {?} */
2624
- var DIALOG_INTERACTION_SERVICE_DEFAULTS = new InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
2625
- var DialogInteractionService = /** @class */ (function (_super) {
2626
- __extends(DialogInteractionService, _super);
2627
- function DialogInteractionService(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
2628
- var _this = _super.call(this) || this;
2629
- _this.dialogService = dialogService;
2630
- _this.dialogServiceDefaults = dialogServiceDefaults;
2631
- _this.matDialogDefaultConfig = matDialogDefaultConfig;
2632
- _this._activeInteractionContextModel = new MutableValueModel();
2633
- assert$1.notNil(dialogService);
2634
- var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
2635
- _this.active = chain(_this._activeInteractionContextModel).isNotNil();
2636
- return _this;
2637
- }
2638
- /**
2639
- * @param {?} disposable
2640
- * @return {?}
2641
- */
2642
- DialogInteractionService.prototype.createInteractionContextFor = /**
2643
- * @param {?} disposable
2644
- * @return {?}
2645
- */
2646
- function (disposable) {
2647
- return disposable.registerDisposable(this._createInteractionContext());
2648
- };
2649
- /**
2650
- * @return {?}
2651
- */
2652
- DialogInteractionService.prototype._createInteractionContext = /**
2653
- * @return {?}
2654
- */
2655
- function () {
2656
- /** @type {?} */
2657
- var config = __assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig, this.dialogServiceDefaults);
2658
- /** @type {?} */
2659
- var self = this;
2660
- /** @type {?} */
2661
- var dialogInteractionContext = new DialogInteractionContext(this.dialogService, config);
2662
- dialogInteractionContext.registerDisposable(dialogInteractionContext.addActivityListener({
2663
- onActivityStarted: /**
2664
- * @return {?}
2665
- */
2666
- function () {
2667
- self.onActivityStarted(dialogInteractionContext);
2668
- },
2669
- onActivityFinished: /**
2670
- * @return {?}
2671
- */
2672
- function () {
2673
- self.onActivityFinished(dialogInteractionContext);
2674
- }
2675
2601
  }));
2676
- return dialogInteractionContext;
2677
2602
  };
2678
- /**
2679
- * @return {?}
2680
- */
2681
- DialogInteractionService.prototype.createExclusiveInteractionContext = /**
2682
- * @return {?}
2683
- */
2684
- function () {
2685
- this.exclusiveContext = this._createInteractionContext();
2686
- /** @type {?} */
2687
- var self = this;
2688
- this.exclusiveContext.registerDisposable({
2689
- dispose: /**
2690
- * @return {?}
2691
- */
2692
- function () {
2693
- self.exclusiveContext = null;
2694
- }
2695
- });
2696
- return this.exclusiveContext;
2697
- };
2698
- // @Trace()
2699
- // @Trace()
2700
- /**
2701
- * @param {?} dialogInteractionContext
2702
- * @return {?}
2703
- */
2704
- DialogInteractionService.prototype.onActivityStarted =
2705
- // @Trace()
2706
- /**
2707
- * @param {?} dialogInteractionContext
2708
- * @return {?}
2709
- */
2710
- function (dialogInteractionContext) {
2711
- assert$1.isFalsey(this.isActive());
2712
- if (this.exclusiveContext && dialogInteractionContext !== this.exclusiveContext) {
2713
- lang.illegalState("Interaction started while exclusive lock active. This is usually because you using a different context during place.canDeactivate(interactionContext)");
2714
- }
2715
- this._activeInteractionContextModel.value = dialogInteractionContext;
2716
- this.notifyActivityStarted();
2717
- };
2718
- // @Trace()
2719
- // @Trace()
2720
- /**
2721
- * @param {?} dialogInteractionContext
2722
- * @return {?}
2723
- */
2724
- DialogInteractionService.prototype.onActivityFinished =
2725
- // @Trace()
2726
- /**
2727
- * @param {?} dialogInteractionContext
2728
- * @return {?}
2729
- */
2730
- function (dialogInteractionContext) {
2731
- assert$1.isTruthy(this._activeInteractionContextModel.value === dialogInteractionContext);
2732
- this._activeInteractionContextModel.value = null;
2733
- this.notifyActivityFinished();
2734
- };
2735
- /**
2736
- * @return {?}
2737
- */
2738
- DialogInteractionService.prototype.getCurrentActivity = /**
2739
- * @return {?}
2740
- */
2741
- function () {
2742
- return __awaiter(this, void 0, void 0, function () {
2743
- return __generator(this, function (_a) {
2744
- assert$1.isTruthy(this.isActive());
2745
- return [2 /*return*/, this._activeInteractionContextModel.value.getCurrentActivity()];
2746
- });
2747
- });
2748
- };
2749
- DialogInteractionService.decorators = [
2750
- { type: Injectable, args: [{
2751
- providedIn: 'root'
2752
- },] }
2603
+ InplaceInteractionContextComponent.decorators = [
2604
+ { type: Component, args: [{
2605
+ selector: 'aup-inplace-interaction-context',
2606
+ template: "<mat-tab-group no-tab-header [selectedIndex]=\"isActive() ? 1 : 0\" full-height-tabs [dynamicHeight]=\"false\">\n <mat-tab>\n <ng-content></ng-content>\n </mat-tab>\n <mat-tab>\n <aup-activity-container #activityContainer\n [(initialActivityOutletContext)]=\"initialActivityContext\"\n [dynamicHeight]=\"false\"></aup-activity-container>\n </mat-tab>\n</mat-tab-group>\n\n",
2607
+ styles: [":host{display:flex;flex-direction:column}mat-tab-group{flex:1}"]
2608
+ }] }
2753
2609
  ];
2754
2610
  /** @nocollapse */
2755
- DialogInteractionService.ctorParameters = function () { return [
2756
- { type: MatDialog },
2757
- { type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
2758
- { type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
2611
+ InplaceInteractionContextComponent.ctorParameters = function () { return [
2612
+ { type: InteractionService }
2759
2613
  ]; };
2760
- /** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1), ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), ɵɵinject(MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
2761
- return DialogInteractionService;
2762
- }(ModalInteractionService));
2614
+ InplaceInteractionContextComponent.propDecorators = {
2615
+ interactionContext: [{ type: ViewChild, args: ['activityContainer', { static: true },] }]
2616
+ };
2617
+ return InplaceInteractionContextComponent;
2618
+ }(InteractionContextBase));
2763
2619
  if (false) {
2764
- /**
2765
- * @type {?}
2766
- * @private
2767
- */
2768
- DialogInteractionService.prototype._activeInteractionContextModel;
2769
2620
  /** @type {?} */
2770
- DialogInteractionService.prototype.active;
2771
- /**
2772
- * @type {?}
2773
- * @private
2774
- */
2775
- DialogInteractionService.prototype.exclusiveContext;
2621
+ InplaceInteractionContextComponent.prototype.interactionContext;
2622
+ /** @type {?} */
2623
+ InplaceInteractionContextComponent.prototype.initialActivityContext;
2776
2624
  /**
2777
2625
  * @type {?}
2778
2626
  * @private
2779
2627
  */
2780
- DialogInteractionService.prototype.dialogService;
2781
- /** @type {?} */
2782
- DialogInteractionService.prototype.dialogServiceDefaults;
2628
+ InplaceInteractionContextComponent.prototype._active;
2783
2629
  /** @type {?} */
2784
- DialogInteractionService.prototype.matDialogDefaultConfig;
2630
+ InplaceInteractionContextComponent.prototype.interactionService;
2785
2631
  }
2786
2632
 
2633
+ /**
2634
+ * @fileoverview added by tsickle
2635
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2636
+ */
2637
+ var InteractionOutletComponent = /** @class */ (function () {
2638
+ function InteractionOutletComponent() {
2639
+ }
2640
+ InteractionOutletComponent.decorators = [
2641
+ { type: Component, args: [{
2642
+ selector: 'aup-interaction-outlet',
2643
+ template: "<router-outlet name=\"interaction-context\"></router-outlet>\n",
2644
+ styles: [":host{display:block}"]
2645
+ }] }
2646
+ ];
2647
+ /** @nocollapse */
2648
+ InteractionOutletComponent.ctorParameters = function () { return []; };
2649
+ return InteractionOutletComponent;
2650
+ }());
2651
+
2787
2652
  /**
2788
2653
  * @fileoverview added by tsickle
2789
2654
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -2823,7 +2688,7 @@ var InteractionModule = /** @class */ (function () {
2823
2688
  AlertDialogComponent
2824
2689
  ],
2825
2690
  providers: [
2826
- DialogInteractionService,
2691
+ InteractionService,
2827
2692
  ]
2828
2693
  },] }
2829
2694
  ];
@@ -3796,67 +3661,110 @@ if (false) {
3796
3661
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3797
3662
  */
3798
3663
  var PlaceComponentDeactivationHandler = /** @class */ (function () {
3799
- function PlaceComponentDeactivationHandler(component, navigationSession) {
3664
+ function PlaceComponentDeactivationHandler(component, navigationState, isPrimaryComponent) {
3800
3665
  this.component = component;
3801
- this.navigationSession = navigationSession;
3666
+ this.navigationState = navigationState;
3667
+ this.isPrimaryComponent = isPrimaryComponent;
3802
3668
  }
3669
+ Object.defineProperty(PlaceComponentDeactivationHandler.prototype, "interactionService", {
3670
+ get: /**
3671
+ * @return {?}
3672
+ */
3673
+ function () {
3674
+ return this.navigationState.interactionService;
3675
+ },
3676
+ enumerable: true,
3677
+ configurable: true
3678
+ });
3679
+ Object.defineProperty(PlaceComponentDeactivationHandler.prototype, "placeRouter", {
3680
+ get: /**
3681
+ * @return {?}
3682
+ */
3683
+ function () {
3684
+ return this.navigationState.placeRouter;
3685
+ },
3686
+ enumerable: true,
3687
+ configurable: true
3688
+ });
3803
3689
  /**
3690
+ * @param {?} currentUrl
3804
3691
  * @param {?} nextState
3805
3692
  * @return {?}
3806
3693
  */
3807
3694
  PlaceComponentDeactivationHandler.prototype.canDeactivate = /**
3695
+ * @param {?} currentUrl
3808
3696
  * @param {?} nextState
3809
3697
  * @return {?}
3810
3698
  */
3811
- function (nextState) {
3699
+ function (currentUrl, nextState) {
3812
3700
  return __awaiter(this, void 0, void 0, function () {
3813
3701
  return __generator(this, function (_a) {
3814
3702
  // We'll get called multiple times if there's any parameter sanitisation so
3815
3703
  // we always return true if we accepted promise from a previous cycle of the current
3816
3704
  // navigation session.
3817
3705
  if (!this.canDeactivatePromise) {
3818
- this.canDeactivatePromise = this.canDeactivateComponent(nextState);
3706
+ console.log("creating deactivate promise for -> " + this.component.constructor.name);
3707
+ this.canDeactivatePromise = this.canDeactivateComponent(currentUrl, nextState);
3819
3708
  }
3820
3709
  return [2 /*return*/, this.canDeactivatePromise];
3821
3710
  });
3822
3711
  });
3823
3712
  };
3713
+ // @Trace()
3714
+ // @Trace()
3824
3715
  /**
3825
3716
  * @protected
3717
+ * @param {?} currentUrl
3826
3718
  * @param {?} nextState
3827
3719
  * @return {?}
3828
3720
  */
3829
- PlaceComponentDeactivationHandler.prototype.canDeactivateComponent = /**
3721
+ PlaceComponentDeactivationHandler.prototype.canDeactivateComponent =
3722
+ // @Trace()
3723
+ /**
3830
3724
  * @protected
3725
+ * @param {?} currentUrl
3831
3726
  * @param {?} nextState
3832
3727
  * @return {?}
3833
3728
  */
3834
- function (nextState) {
3729
+ function (currentUrl, nextState) {
3835
3730
  return __awaiter(this, void 0, void 0, function () {
3836
- var activity;
3731
+ var routeIds, currentIds;
3837
3732
  return __generator(this, function (_a) {
3838
3733
  switch (_a.label) {
3839
3734
  case 0:
3840
- if (!(this.navigationSession.isPopState && this.component.interactionContext && this.component.interactionContext.isActive())) return [3 /*break*/, 2];
3841
- // Note: Modal interactions are run in a different router outlet so we never get place deactivating while
3842
- // a model interaction is active. This is because:
3843
- // 1. the user can't click anything to navigate away
3844
- // 2. clicking the back button will only change the outlet route portion of the URL. This
3845
- // is all handled by the InteractionGuard and so the component guards will never run.
3846
- //
3847
- // Now we just cancel the current activity...
3848
- return [4 /*yield*/, this.component.interactionContext.getCurrentActivity()];
3735
+ console.log(this.navigationState.toString());
3736
+ if (!this.navigationState.isPopState) return [3 /*break*/, 5];
3737
+ if (!(this.isPrimaryComponent && this.interactionService.isModalActive())) return [3 /*break*/, 3];
3738
+ routeIds = this.placeRouter.getActiveInteractionIdsFromUrl(nextState.url);
3739
+ currentIds = this.interactionService.activeInteractionContextIds.value;
3740
+ if (!!isEqual(currentIds, routeIds)) return [3 /*break*/, 2];
3741
+ return [4 /*yield*/, this.interactionService.getActiveContext().cancelCurrentActivity()];
3849
3742
  case 1:
3850
- activity = _a.sent();
3851
- activity.cancel(null);
3852
- return [2 /*return*/, false]; // ..and stay where we are.
3853
- case 2:
3743
+ _a.sent();
3744
+ return [2 /*return*/, currentUrl.updateInteractionIds(this.interactionService.activeInteractionContextIds.value)];
3745
+ case 2: return [3 /*break*/, 5];
3746
+ case 3:
3747
+ if (!(this.component.interactionContext && this.component.interactionContext.isActive())) return [3 /*break*/, 5];
3748
+ return [4 /*yield*/, this.component.interactionContext.cancelCurrentActivity()];
3749
+ case 4:
3750
+ _a.sent();
3751
+ return [2 /*return*/, currentUrl
3752
+ .updateInteractionIds(this.interactionService.activeInteractionContextIds.value)];
3753
+ case 5:
3854
3754
  // Ok, so now we're really leaving, so we ask the component if we should.;
3855
- if (this.isNotJustAChangeInRouteId(nextState) && this.component.canDeactivate) {
3856
- // No interaction in progress, so ask the component .
3857
- // This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
3858
- // the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
3859
- return [2 /*return*/, this.component.canDeactivate(this.navigationSession.interactionContext)];
3755
+ if (this.isNotJustAChangeInRouteId(nextState)) {
3756
+ if (this.component.canDeactivate) {
3757
+ // No interaction in progress, so ask the component .
3758
+ // This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
3759
+ // the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
3760
+ return [2 /*return*/, this.component.canDeactivate(this.navigationState.interactionContext)];
3761
+ }
3762
+ // The component has an active interaction but no deactivation hook. Rather than guessing what to do
3763
+ // we'll just cancel the navigation and print a warning.
3764
+ if (this.component.interactionContext && this.component.interactionContext.isActive()) {
3765
+ console.warn('Route changed while component has active interaction, cancelling navigation');
3766
+ return [2 /*return*/, false];
3767
+ }
3860
3768
  }
3861
3769
  return [2 /*return*/, true];
3862
3770
  }
@@ -3890,7 +3798,9 @@ if (false) {
3890
3798
  /** @type {?} */
3891
3799
  PlaceComponentDeactivationHandler.prototype.component;
3892
3800
  /** @type {?} */
3893
- PlaceComponentDeactivationHandler.prototype.navigationSession;
3801
+ PlaceComponentDeactivationHandler.prototype.navigationState;
3802
+ /** @type {?} */
3803
+ PlaceComponentDeactivationHandler.prototype.isPrimaryComponent;
3894
3804
  }
3895
3805
 
3896
3806
  /**
@@ -3900,7 +3810,10 @@ if (false) {
3900
3810
  /**
3901
3811
  * @abstract
3902
3812
  */
3903
- var NavigationState = /** @class */ (function (_super) {
3813
+ var /**
3814
+ * @abstract
3815
+ */
3816
+ NavigationState = /** @class */ (function (_super) {
3904
3817
  __extends(NavigationState, _super);
3905
3818
  function NavigationState(context) {
3906
3819
  var _this = _super.call(this) || this;
@@ -3908,6 +3821,46 @@ var NavigationState = /** @class */ (function (_super) {
3908
3821
  _this._visits = new Map();
3909
3822
  return _this;
3910
3823
  }
3824
+ Object.defineProperty(NavigationState.prototype, "name", {
3825
+ get: /**
3826
+ * @return {?}
3827
+ */
3828
+ function () {
3829
+ return this.constructor.name;
3830
+ },
3831
+ enumerable: true,
3832
+ configurable: true
3833
+ });
3834
+ Object.defineProperty(NavigationState.prototype, "idle", {
3835
+ get: /**
3836
+ * @return {?}
3837
+ */
3838
+ function () {
3839
+ return !this.isTransitional;
3840
+ },
3841
+ enumerable: true,
3842
+ configurable: true
3843
+ });
3844
+ Object.defineProperty(NavigationState.prototype, "placeRouter", {
3845
+ get: /**
3846
+ * @return {?}
3847
+ */
3848
+ function () {
3849
+ return this.context.placeRouter;
3850
+ },
3851
+ enumerable: true,
3852
+ configurable: true
3853
+ });
3854
+ Object.defineProperty(NavigationState.prototype, "interactionService", {
3855
+ get: /**
3856
+ * @return {?}
3857
+ */
3858
+ function () {
3859
+ return this.context.interactionService;
3860
+ },
3861
+ enumerable: true,
3862
+ configurable: true
3863
+ });
3911
3864
  Object.defineProperty(NavigationState.prototype, "interactionContext", {
3912
3865
  get: /**
3913
3866
  * @return {?}
@@ -3940,6 +3893,74 @@ var NavigationState = /** @class */ (function (_super) {
3940
3893
  function (placeDef) {
3941
3894
  return this._visits.get(placeDef);
3942
3895
  };
3896
+ /**
3897
+ * @param {?} visit
3898
+ * @param {?} initialUrl
3899
+ * @return {?}
3900
+ */
3901
+ NavigationState.prototype.onPlaceNavigationStart = /**
3902
+ * @param {?} visit
3903
+ * @param {?} initialUrl
3904
+ * @return {?}
3905
+ */
3906
+ function (visit, initialUrl) {
3907
+ return this.illegalTransition('onPlaceNavigationStart');
3908
+ };
3909
+ /**
3910
+ * @param {?} event
3911
+ * @return {?}
3912
+ */
3913
+ NavigationState.prototype.onPopState = /**
3914
+ * @param {?} event
3915
+ * @return {?}
3916
+ */
3917
+ function (event) {
3918
+ return this.illegalTransition(event);
3919
+ };
3920
+ /**
3921
+ * @param {?} event
3922
+ * @return {?}
3923
+ */
3924
+ NavigationState.prototype.onRouterStarted = /**
3925
+ * @param {?} event
3926
+ * @return {?}
3927
+ */
3928
+ function (event) {
3929
+ return this.illegalTransition(event);
3930
+ };
3931
+ /**
3932
+ * @param {?} event
3933
+ * @return {?}
3934
+ */
3935
+ NavigationState.prototype.onRouterCancelled = /**
3936
+ * @param {?} event
3937
+ * @return {?}
3938
+ */
3939
+ function (event) {
3940
+ return this.illegalTransition(event);
3941
+ };
3942
+ /**
3943
+ * @param {?} event
3944
+ * @return {?}
3945
+ */
3946
+ NavigationState.prototype.onRouterError = /**
3947
+ * @param {?} event
3948
+ * @return {?}
3949
+ */
3950
+ function (event) {
3951
+ return this.illegalTransition(event);
3952
+ };
3953
+ /**
3954
+ * @param {?} event
3955
+ * @return {?}
3956
+ */
3957
+ NavigationState.prototype.onRouterEnd = /**
3958
+ * @param {?} event
3959
+ * @return {?}
3960
+ */
3961
+ function (event) {
3962
+ return this.illegalTransition(event);
3963
+ };
3943
3964
  /**
3944
3965
  * @param {?} newUrl
3945
3966
  * @return {?}
@@ -3951,6 +3972,25 @@ var NavigationState = /** @class */ (function (_super) {
3951
3972
  function (newUrl) {
3952
3973
  return this.illegalTransition('onBackClickedDuringNavigationInteraction');
3953
3974
  };
3975
+ /**
3976
+ * @param {?} component
3977
+ * @param {?} currentUrl
3978
+ * @param {?} nextUrl
3979
+ * @return {?}
3980
+ */
3981
+ NavigationState.prototype.canDeactivatePlace = /**
3982
+ * @param {?} component
3983
+ * @param {?} currentUrl
3984
+ * @param {?} nextUrl
3985
+ * @return {?}
3986
+ */
3987
+ function (component, currentUrl, nextUrl) {
3988
+ return __awaiter(this, void 0, void 0, function () {
3989
+ return __generator(this, function (_a) {
3990
+ return [2 /*return*/, this.illegalTransition('canDeactivatePlace')];
3991
+ });
3992
+ });
3993
+ };
3954
3994
  /**
3955
3995
  * @return {?}
3956
3996
  */
@@ -3984,34 +4024,53 @@ var NavigationState = /** @class */ (function (_super) {
3984
4024
  * @return {?}
3985
4025
  */
3986
4026
  function () {
3987
- return this.context.router.routerState ? this.context.router.routerState.snapshot.url : null;
4027
+ return this.placeRouter.getCurrentRouterUrl();
3988
4028
  };
3989
4029
  /**
3990
4030
  * @protected
3991
4031
  * @param {?} event
3992
4032
  * @return {?}
3993
4033
  */
3994
- NavigationState.prototype.createActiveSession = /**
4034
+ NavigationState.prototype.createTransitionStateFor = /**
3995
4035
  * @protected
3996
4036
  * @param {?} event
3997
4037
  * @return {?}
3998
4038
  */
3999
4039
  function (event) {
4000
- // TODO: check if the event is purely for interaction context changes.
4001
- return new NavigationState.Active(this.context, event.navigationTrigger === 'popstate', this.currentRouterUrl());
4040
+ /** @type {?} */
4041
+ var popstate = event.navigationTrigger === 'popstate';
4042
+ return popstate ?
4043
+ this.interactionService.isActive() ?
4044
+ new NavigationState.InteractionPopStateTransition(this.context, this.currentRouterUrl()) :
4045
+ new NavigationState.PopStateTransition(this.context, this.currentRouterUrl())
4046
+ :
4047
+ this.interactionService.isActive() ?
4048
+ new NavigationState.InteractionTransition(this.context, this.currentRouterUrl()) :
4049
+ new NavigationState.NavigationTransition(this.context, this.currentRouterUrl());
4002
4050
  };
4003
4051
  /**
4004
4052
  * @protected
4005
- * @param {?} url
4006
4053
  * @return {?}
4007
4054
  */
4008
- NavigationState.prototype.updateLocation = /**
4055
+ NavigationState.prototype.createIdleState = /**
4009
4056
  * @protected
4057
+ * @return {?}
4058
+ */
4059
+ function () {
4060
+ return this.interactionService.isActive() ?
4061
+ new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :
4062
+ new NavigationState.Idle(this.context);
4063
+ };
4064
+ /**
4065
+ * @param {?} url
4066
+ * @return {?}
4067
+ */
4068
+ NavigationState.prototype.resetBrowserLocation = /**
4010
4069
  * @param {?} url
4011
4070
  * @return {?}
4012
4071
  */
4013
4072
  function (url) {
4014
- this.context.angularLocation.go(url);
4073
+ this.placeRouter.resetBrowserLocation(url);
4015
4074
  };
4016
4075
  /**
4017
4076
  * @return {?}
@@ -4022,12 +4081,6 @@ var NavigationState = /** @class */ (function (_super) {
4022
4081
  function () {
4023
4082
  return this.constructor.name;
4024
4083
  };
4025
- __decorate([
4026
- Trace(),
4027
- __metadata("design:type", Function),
4028
- __metadata("design:paramtypes", [Object]),
4029
- __metadata("design:returntype", void 0)
4030
- ], NavigationState.prototype, "updateLocation", null);
4031
4084
  return NavigationState;
4032
4085
  }(GarbageCollector));
4033
4086
  if (false) {
@@ -4037,54 +4090,22 @@ if (false) {
4037
4090
  */
4038
4091
  NavigationState.prototype._visits;
4039
4092
  /** @type {?} */
4040
- NavigationState.prototype.isPopState;
4041
- /** @type {?} */
4042
- NavigationState.prototype.active;
4093
+ NavigationState.prototype.isTransitional;
4043
4094
  /** @type {?} */
4044
4095
  NavigationState.prototype.startingUrl;
4096
+ /** @type {?} */
4097
+ NavigationState.prototype.isPopState;
4045
4098
  /**
4046
4099
  * @type {?}
4047
4100
  * @protected
4048
4101
  */
4049
4102
  NavigationState.prototype.context;
4050
- /**
4051
- * @abstract
4052
- * @param {?} event
4053
- * @return {?}
4054
- */
4055
- NavigationState.prototype.onStart = function (event) { };
4056
- /**
4057
- * @abstract
4058
- * @param {?} event
4059
- * @return {?}
4060
- */
4061
- NavigationState.prototype.onCancel = function (event) { };
4062
- /**
4063
- * @abstract
4064
- * @param {?} event
4065
- * @return {?}
4066
- */
4067
- NavigationState.prototype.onError = function (event) { };
4068
- /**
4069
- * @abstract
4070
- * @param {?} event
4071
- * @return {?}
4072
- */
4073
- NavigationState.prototype.onEnd = function (event) { };
4074
- /**
4075
- * @abstract
4076
- * @param {?} component
4077
- * @param {?} nextState
4078
- * @return {?}
4079
- */
4080
- NavigationState.prototype.canDeactivatePlace = function (component, nextState) { };
4081
4103
  }
4082
4104
  (function (NavigationState) {
4083
4105
  var Context = /** @class */ (function () {
4084
- function Context(router, modalInteractionService, angularLocation, notifySuccess) {
4085
- this.router = router;
4086
- this.modalInteractionService = modalInteractionService;
4087
- this.angularLocation = angularLocation;
4106
+ function Context(placeRouter, interactionService, notifySuccess) {
4107
+ this.placeRouter = placeRouter;
4108
+ this.interactionService = interactionService;
4088
4109
  this.notifySuccess = notifySuccess;
4089
4110
  }
4090
4111
  return Context;
@@ -4092,11 +4113,9 @@ if (false) {
4092
4113
  NavigationState.Context = Context;
4093
4114
  if (false) {
4094
4115
  /** @type {?} */
4095
- Context.prototype.router;
4116
+ Context.prototype.placeRouter;
4096
4117
  /** @type {?} */
4097
- Context.prototype.modalInteractionService;
4098
- /** @type {?} */
4099
- Context.prototype.angularLocation;
4118
+ Context.prototype.interactionService;
4100
4119
  /** @type {?} */
4101
4120
  Context.prototype.notifySuccess;
4102
4121
  }
@@ -4104,100 +4123,85 @@ if (false) {
4104
4123
  __extends(Idle, _super);
4105
4124
  function Idle(context) {
4106
4125
  var _this = _super.call(this, context) || this;
4107
- _this.active = false;
4126
+ _this.isTransitional = false;
4108
4127
  _this.startingUrl = null;
4128
+ _this.isPopState = false;
4109
4129
  return _this;
4110
4130
  }
4111
4131
  /**
4112
- * @param {?} component
4113
- * @param {?} nextState
4114
- * @return {?}
4115
- */
4116
- Idle.prototype.canDeactivatePlace = /**
4117
- * @param {?} component
4118
- * @param {?} nextState
4119
- * @return {?}
4120
- */
4121
- function (component, nextState) {
4122
- return __awaiter(this, void 0, void 0, function () {
4123
- return __generator(this, function (_a) {
4124
- return [2 /*return*/, this.illegalTransition('canDeactivatePlace')];
4125
- });
4126
- });
4127
- };
4128
- /**
4129
- * @param {?} event
4130
- * @return {?}
4131
- */
4132
- Idle.prototype.onStart = /**
4133
- * @param {?} event
4132
+ * @param {?} visit
4133
+ * @param {?} initialUrl
4134
4134
  * @return {?}
4135
4135
  */
4136
- function (event) {
4137
- // calling angularLocation.go() to clear back state can trigger router cycles to the current url if we don't ignore them
4138
- if (event.url === this.currentRouterUrl()) {
4139
- Logger.get(this).info("navigation started to same url -> " + event.url);
4140
- return this;
4141
- }
4142
- if (event.url === (this.currentRouterUrl() + "(aup-interaction:modal)")) {
4143
- Logger.get(this).info("navigation started with interaction outlet -> " + event.url);
4144
- return new ModalInteractionSession(this.context, event.url);
4145
- }
4146
- return this.createActiveSession(event);
4147
- };
4148
- /**
4149
- * @param {?} event
4150
- * @return {?}
4151
- */
4152
- Idle.prototype.onCancel = /**
4153
- * @param {?} event
4136
+ Idle.prototype.onPlaceNavigationStart = /**
4137
+ * @param {?} visit
4138
+ * @param {?} initialUrl
4154
4139
  * @return {?}
4155
4140
  */
4156
- function (event) {
4157
- return this.illegalTransition(event);
4141
+ function (visit, initialUrl) {
4142
+ /** @type {?} */
4143
+ var navigationTransition = new NavigationTransition(this.context, initialUrl);
4144
+ navigationTransition.storeVisit(visit);
4145
+ return navigationTransition;
4158
4146
  };
4159
4147
  /**
4160
4148
  * @param {?} event
4161
4149
  * @return {?}
4162
4150
  */
4163
- Idle.prototype.onEnd = /**
4151
+ Idle.prototype.onRouterStarted = /**
4164
4152
  * @param {?} event
4165
4153
  * @return {?}
4166
4154
  */
4167
4155
  function (event) {
4168
- return this.illegalTransition(event);
4156
+ // calling angularLocation.go() to clear back state can trigger router cycles to the current url if we don't ignore them
4157
+ if (event.url === this.currentRouterUrl()) {
4158
+ Logger.get(this).info("navigation started to same url -> " + event.url);
4159
+ return this;
4160
+ }
4161
+ if (this.placeRouter.hasActiveInteractionIds(event.url)) {
4162
+ Logger.get(this).info("navigation started with interaction outlet -> " + event.url);
4163
+ return new InteractionTransition(this.context, event.url);
4164
+ }
4165
+ else {
4166
+ return this.createTransitionStateFor(event);
4167
+ }
4169
4168
  };
4170
4169
  /**
4171
4170
  * @param {?} event
4172
4171
  * @return {?}
4173
4172
  */
4174
- Idle.prototype.onError = /**
4173
+ Idle.prototype.onPopState = /**
4175
4174
  * @param {?} event
4176
4175
  * @return {?}
4177
4176
  */
4178
4177
  function (event) {
4179
- return this.illegalTransition(event);
4178
+ return this.createTransitionStateFor(event);
4180
4179
  };
4181
4180
  return Idle;
4182
4181
  }(NavigationState));
4183
4182
  NavigationState.Idle = Idle;
4184
4183
  if (false) {
4185
4184
  /** @type {?} */
4186
- Idle.prototype.isPopState;
4187
- /** @type {?} */
4188
- Idle.prototype.active;
4185
+ Idle.prototype.isTransitional;
4189
4186
  /** @type {?} */
4190
4187
  Idle.prototype.startingUrl;
4188
+ /** @type {?} */
4189
+ Idle.prototype.isPopState;
4191
4190
  }
4192
- var Active = /** @class */ (function (_super) {
4193
- __extends(Active, _super);
4194
- function Active(context, isPopState, startingUrl) {
4191
+ /**
4192
+ * @abstract
4193
+ */
4194
+ var /**
4195
+ * @abstract
4196
+ */
4197
+ AbstractNavigationTransition = /** @class */ (function (_super) {
4198
+ __extends(AbstractNavigationTransition, _super);
4199
+ function AbstractNavigationTransition(context, startingUrl) {
4195
4200
  var _this = _super.call(this, context) || this;
4196
- _this.isPopState = isPopState;
4197
4201
  _this.startingUrl = startingUrl;
4198
- _this.active = true;
4202
+ _this.isTransitional = true;
4199
4203
  _this.componentDeactivationHandlers = new Map();
4200
- _this._interactionContext = _this.context.modalInteractionService.createExclusiveInteractionContext();
4204
+ _this._interactionContext = _this.interactionService._createExclusiveModalInteractionContext();
4201
4205
  _this.onDispose((/**
4202
4206
  * @return {?}
4203
4207
  */
@@ -4205,14 +4209,14 @@ if (false) {
4205
4209
  // the interaction context can be detached during the back button cancellation state transition
4206
4210
  // as the transition is synchronous and activityCancellation isn't. Otherwise dispose will be
4207
4211
  // called before the context has been cancelled. It might be work having the interaction context
4208
- // automatically cancel if the context is disposed.
4212
+ // automatically cancel if the context is disposed so we don't have worry about detaching etc.
4209
4213
  if (_this._interactionContext) {
4210
- _this._interactionContext.dispose();
4214
+ _this._interactionContext.dispose(); // or do something like cancelAndDispose?
4211
4215
  }
4212
4216
  }));
4213
4217
  return _this;
4214
4218
  }
4215
- Object.defineProperty(Active.prototype, "interactionContext", {
4219
+ Object.defineProperty(AbstractNavigationTransition.prototype, "interactionContext", {
4216
4220
  get: /**
4217
4221
  * @return {?}
4218
4222
  */
@@ -4226,19 +4230,20 @@ if (false) {
4226
4230
  * @param {?} event
4227
4231
  * @return {?}
4228
4232
  */
4229
- Active.prototype.onStart = /**
4233
+ AbstractNavigationTransition.prototype.onRouterStarted = /**
4230
4234
  * @param {?} event
4231
4235
  * @return {?}
4232
4236
  */
4233
4237
  function (event) {
4234
- // active sessions can have many cancel start cycles.
4238
+ // active sessions can have many cancel start cycles due
4239
+ // to place guard redirects
4235
4240
  return this;
4236
4241
  };
4237
4242
  /**
4238
4243
  * @param {?} event
4239
4244
  * @return {?}
4240
4245
  */
4241
- Active.prototype.onEnd = /**
4246
+ AbstractNavigationTransition.prototype.onRouterEnd = /**
4242
4247
  * @param {?} event
4243
4248
  * @return {?}
4244
4249
  */
@@ -4247,85 +4252,47 @@ if (false) {
4247
4252
  this.context.notifySuccess(this);
4248
4253
  return new Idle(this.context);
4249
4254
  };
4250
- /**
4251
- * @param {?} event
4252
- * @return {?}
4253
- */
4254
- Active.prototype.onCancel = /**
4255
- * @param {?} event
4256
- * @return {?}
4257
- */
4258
- function (event) {
4259
- if (this.isPopState) { // back button clicked and a guard cancelled
4260
- // Angular doesn't preserve the url when a guard cancels the back button.
4261
- // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4262
- Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4263
- this.updateLocation(this.startingUrl);
4264
- }
4265
- return this.isPopState ? new Idle(this.context) : this;
4266
- };
4267
- /**
4268
- * @param {?} event
4269
- * @return {?}
4270
- */
4271
- Active.prototype.onError = /**
4272
- * @param {?} event
4273
- * @return {?}
4274
- */
4275
- function (event) {
4276
- // navigation was aborted.
4277
- if (this.isPopState && this.currentRouterUrl() !== this.startingUrl) {
4278
- // Angular doesn't preserve the url when a guard cancels the back button.
4279
- // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4280
- Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4281
- this.updateLocation(this.startingUrl);
4282
- }
4283
- return new Idle(this.context);
4284
- };
4285
4255
  /**
4286
4256
  * @param {?} locationTriggerUrl
4287
4257
  * @return {?}
4288
4258
  */
4289
- Active.prototype.onBackClickedDuringNavigationInteraction = /**
4259
+ AbstractNavigationTransition.prototype.onBackClickedDuringNavigationInteraction = /**
4290
4260
  * @param {?} locationTriggerUrl
4291
4261
  * @return {?}
4292
4262
  */
4293
4263
  function (locationTriggerUrl) {
4264
+ Logger.get(this).info("back button pressed during navigation session interaction promise");
4265
+ // detach the interaction from the session so it doesn't get disposed until the activity has completed.
4294
4266
  /** @type {?} */
4295
- var context = this.detachInteractionContext();
4296
- context.getCurrentActivity().then((/**
4297
- * @param {?} activity
4267
+ var navigationInteraction = this.detachInteractionContext();
4268
+ var when = Dsl.disposeWith(navigationInteraction).when;
4269
+ // TODO: I need to make the exclusive interaction context disallow nested activities or
4270
+ // that would mess things up entirely. Or, can I do a context.abortAll().then(..)
4271
+ navigationInteraction.cancelCurrentActivity().then((/**
4298
4272
  * @return {?}
4299
4273
  */
4300
- function (activity) {
4301
- context.addActivityListener({
4302
- onActivityFinished: /**
4303
- * @return {?}
4304
- */
4305
- function () {
4306
- context.dispose();
4307
- },
4308
- onActivityStarted: /**
4309
- * @return {?}
4310
- */
4311
- function () {
4312
- }
4313
- });
4314
- activity.cancel(null);
4274
+ function () {
4275
+ navigationInteraction.dispose();
4315
4276
  }));
4316
- return new CancelledDuringNavigationInteraction(this.context, this.startingUrl, locationTriggerUrl);
4277
+ return new CancelledDuringNavigationInteraction(this.context, this.startingUrl, this.isPopState, locationTriggerUrl);
4317
4278
  };
4279
+ // @Trace()
4280
+ // @Trace()
4318
4281
  /**
4319
4282
  * @param {?} component
4320
- * @param {?} nextState
4283
+ * @param {?} currentUrl
4284
+ * @param {?} nextUrl
4321
4285
  * @return {?}
4322
4286
  */
4323
- Active.prototype.canDeactivatePlace = /**
4287
+ AbstractNavigationTransition.prototype.canDeactivatePlace =
4288
+ // @Trace()
4289
+ /**
4324
4290
  * @param {?} component
4325
- * @param {?} nextState
4291
+ * @param {?} currentUrl
4292
+ * @param {?} nextUrl
4326
4293
  * @return {?}
4327
4294
  */
4328
- function (component, nextState) {
4295
+ function (component, currentUrl, nextUrl) {
4329
4296
  return __awaiter(this, void 0, void 0, function () {
4330
4297
  var handler, isPrimaryHandler;
4331
4298
  return __generator(this, function (_a) {
@@ -4333,10 +4300,10 @@ if (false) {
4333
4300
  handler = this.componentDeactivationHandlers.get(component);
4334
4301
  if (!handler) {
4335
4302
  isPrimaryHandler = this.componentDeactivationHandlers.size === 0;
4336
- handler = new PlaceComponentDeactivationHandler(component, this);
4303
+ handler = new PlaceComponentDeactivationHandler(component, this, isPrimaryHandler);
4337
4304
  this.componentDeactivationHandlers.set(component, handler);
4338
4305
  }
4339
- return [2 /*return*/, handler.canDeactivate(nextState)];
4306
+ return [2 /*return*/, handler.canDeactivate(currentUrl, nextUrl)];
4340
4307
  });
4341
4308
  });
4342
4309
  };
@@ -4344,7 +4311,7 @@ if (false) {
4344
4311
  * @private
4345
4312
  * @return {?}
4346
4313
  */
4347
- Active.prototype.detachInteractionContext = /**
4314
+ AbstractNavigationTransition.prototype.detachInteractionContext = /**
4348
4315
  * @private
4349
4316
  * @return {?}
4350
4317
  */
@@ -4354,226 +4321,390 @@ if (false) {
4354
4321
  this._interactionContext = null;
4355
4322
  return context;
4356
4323
  };
4357
- /**
4358
- * @return {?}
4359
- */
4360
- Active.prototype.toString = /**
4361
- * @return {?}
4362
- */
4363
- function () {
4364
- return this.constructor.name + "(startingUrl: " + this.startingUrl + ", isPopState:" + this.isPopState + ")";
4365
- };
4366
- __decorate([
4367
- Trace(),
4368
- __metadata("design:type", Function),
4369
- __metadata("design:paramtypes", [NavigationStart]),
4370
- __metadata("design:returntype", NavigationState)
4371
- ], Active.prototype, "onStart", null);
4372
- __decorate([
4373
- Trace(),
4374
- __metadata("design:type", Function),
4375
- __metadata("design:paramtypes", [NavigationCancel]),
4376
- __metadata("design:returntype", NavigationState)
4377
- ], Active.prototype, "onCancel", null);
4378
- __decorate([
4379
- Trace(),
4380
- __metadata("design:type", Function),
4381
- __metadata("design:paramtypes", [NavigationError]),
4382
- __metadata("design:returntype", NavigationState)
4383
- ], Active.prototype, "onError", null);
4384
- return Active;
4324
+ return AbstractNavigationTransition;
4385
4325
  }(NavigationState));
4386
- NavigationState.Active = Active;
4326
+ NavigationState.AbstractNavigationTransition = AbstractNavigationTransition;
4387
4327
  if (false) {
4388
4328
  /** @type {?} */
4389
- Active.prototype.active;
4329
+ AbstractNavigationTransition.prototype.isTransitional;
4390
4330
  /**
4391
4331
  * @type {?}
4392
4332
  * @private
4393
4333
  */
4394
- Active.prototype.componentDeactivationHandlers;
4334
+ AbstractNavigationTransition.prototype.componentDeactivationHandlers;
4395
4335
  /**
4396
4336
  * @type {?}
4397
4337
  * @private
4398
4338
  */
4399
- Active.prototype._interactionContext;
4400
- /** @type {?} */
4401
- Active.prototype.isPopState;
4339
+ AbstractNavigationTransition.prototype._interactionContext;
4402
4340
  /** @type {?} */
4403
- Active.prototype.startingUrl;
4341
+ AbstractNavigationTransition.prototype.startingUrl;
4404
4342
  }
4405
- var ModalInteractionSession = /** @class */ (function (_super) {
4406
- __extends(ModalInteractionSession, _super);
4407
- function ModalInteractionSession(context, startingUrl) {
4408
- var _this = _super.call(this, context) || this;
4409
- _this.startingUrl = startingUrl;
4410
- _this.active = false;
4343
+ var NavigationTransition = /** @class */ (function (_super) {
4344
+ __extends(NavigationTransition, _super);
4345
+ function NavigationTransition() {
4346
+ var _this = _super !== null && _super.apply(this, arguments) || this;
4411
4347
  _this.isPopState = false;
4412
4348
  return _this;
4413
4349
  }
4414
4350
  /**
4415
- * @param {?} url
4351
+ * @param {?} event
4416
4352
  * @return {?}
4417
4353
  */
4418
- ModalInteractionSession.hasInteraction = /**
4419
- * @param {?} url
4354
+ NavigationTransition.prototype.onRouterCancelled = /**
4355
+ * @param {?} event
4420
4356
  * @return {?}
4421
4357
  */
4422
- function (url) {
4423
- return url.endsWith('(aup-interaction:modal)');
4358
+ function (event) {
4359
+ return this;
4424
4360
  };
4425
4361
  /**
4426
4362
  * @param {?} event
4427
4363
  * @return {?}
4428
4364
  */
4429
- ModalInteractionSession.prototype.onStart = /**
4365
+ NavigationTransition.prototype.onRouterError = /**
4430
4366
  * @param {?} event
4431
4367
  * @return {?}
4432
4368
  */
4433
4369
  function (event) {
4434
- // VERY VERY IMPORTANT BACK BUTTON NOTE:
4435
- // When the back button is clicked we'll enter here first, and push the url
4436
- // back to the browser. Angular seems to ignore it from a routing perspective
4437
- // and then the InteractionGuard will cancel the navigation. This process seems
4438
- // to keep the brower history in a sane state.
4439
- if (this.context.modalInteractionService.isActive()) {
4440
- if (!ModalInteractionSession.hasInteraction(event.url)) {
4441
- // this capture the case where
4442
- this.updateLocation(this.startingUrl);
4443
- }
4444
- }
4445
- return this;
4370
+ // navigation was aborted.
4371
+ return new Idle(this.context);
4372
+ };
4373
+ /**
4374
+ * @return {?}
4375
+ */
4376
+ NavigationTransition.prototype.toString = /**
4377
+ * @return {?}
4378
+ */
4379
+ function () {
4380
+ return this.constructor.name + "(startingUrl: " + this.startingUrl + ")";
4446
4381
  };
4382
+ return NavigationTransition;
4383
+ }(AbstractNavigationTransition));
4384
+ NavigationState.NavigationTransition = NavigationTransition;
4385
+ if (false) {
4386
+ /** @type {?} */
4387
+ NavigationTransition.prototype.isPopState;
4388
+ }
4389
+ var PopStateTransition = /** @class */ (function (_super) {
4390
+ __extends(PopStateTransition, _super);
4391
+ function PopStateTransition() {
4392
+ var _this = _super !== null && _super.apply(this, arguments) || this;
4393
+ _this.isPopState = true;
4394
+ return _this;
4395
+ }
4447
4396
  /**
4448
4397
  * @param {?} event
4449
4398
  * @return {?}
4450
4399
  */
4451
- ModalInteractionSession.prototype.onCancel = /**
4400
+ PopStateTransition.prototype.onRouterCancelled = /**
4452
4401
  * @param {?} event
4453
4402
  * @return {?}
4454
4403
  */
4455
4404
  function (event) {
4456
- // this.updateLocation(this.startingUrl);
4457
- return this;
4405
+ // Angular doesn't preserve the url when a guard cancels the back button.
4406
+ // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4407
+ Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4408
+ this.resetBrowserLocation(this.startingUrl);
4409
+ return new Idle(this.context);
4458
4410
  };
4459
4411
  /**
4460
4412
  * @param {?} event
4461
4413
  * @return {?}
4462
4414
  */
4463
- ModalInteractionSession.prototype.onEnd = /**
4415
+ PopStateTransition.prototype.onRouterError = /**
4464
4416
  * @param {?} event
4465
4417
  * @return {?}
4466
4418
  */
4467
4419
  function (event) {
4468
- if (this.context.modalInteractionService.isActive()) {
4469
- return this;
4470
- }
4471
- else {
4472
- return new Idle(this.context);
4420
+ // navigation was aborted.
4421
+ if (this.currentRouterUrl() !== this.startingUrl) {
4422
+ // Angular doesn't preserve the url when a guard cancels the back button.
4423
+ // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4424
+ Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4425
+ this.resetBrowserLocation(this.startingUrl);
4473
4426
  }
4427
+ return new Idle(this.context);
4428
+ };
4429
+ return PopStateTransition;
4430
+ }(AbstractNavigationTransition));
4431
+ NavigationState.PopStateTransition = PopStateTransition;
4432
+ if (false) {
4433
+ /** @type {?} */
4434
+ PopStateTransition.prototype.isPopState;
4435
+ }
4436
+ var IdleDuringInteraction = /** @class */ (function (_super) {
4437
+ __extends(IdleDuringInteraction, _super);
4438
+ function IdleDuringInteraction(context, startingUrl) {
4439
+ var _this = _super.call(this, context) || this;
4440
+ _this.startingUrl = startingUrl;
4441
+ _this.isTransitional = false;
4442
+ _this.isPopState = false;
4443
+ return _this;
4444
+ }
4445
+ /**
4446
+ * @param {?} visit
4447
+ * @param {?} initialUrl
4448
+ * @return {?}
4449
+ */
4450
+ IdleDuringInteraction.prototype.onPlaceNavigationStart = /**
4451
+ * @param {?} visit
4452
+ * @param {?} initialUrl
4453
+ * @return {?}
4454
+ */
4455
+ function (visit, initialUrl) {
4456
+ /** @type {?} */
4457
+ var navigationTransition = new InteractionTransition(this.context, initialUrl);
4458
+ navigationTransition.storeVisit(visit);
4459
+ return navigationTransition;
4474
4460
  };
4475
4461
  /**
4476
4462
  * @param {?} event
4477
4463
  * @return {?}
4478
4464
  */
4479
- ModalInteractionSession.prototype.onError = /**
4465
+ IdleDuringInteraction.prototype.onRouterStarted = /**
4480
4466
  * @param {?} event
4481
4467
  * @return {?}
4482
4468
  */
4483
4469
  function (event) {
4484
- return this.illegalTransition(event);
4470
+ return new InteractionTransition(this.context, event.url);
4485
4471
  };
4486
4472
  /**
4487
- * @param {?} component
4488
- * @param {?} nextState
4473
+ * @param {?} event
4489
4474
  * @return {?}
4490
4475
  */
4491
- ModalInteractionSession.prototype.canDeactivatePlace = /**
4492
- * @param {?} component
4493
- * @param {?} nextState
4476
+ IdleDuringInteraction.prototype.onPopState = /**
4477
+ * @param {?} event
4494
4478
  * @return {?}
4495
4479
  */
4496
- function (component, nextState) {
4497
- return __awaiter(this, void 0, void 0, function () {
4498
- return __generator(this, function (_a) {
4499
- return [2 /*return*/, true];
4500
- });
4501
- });
4480
+ function (event) {
4481
+ return new InteractionPopStateTransition(this.context, event.url);
4502
4482
  };
4503
4483
  __decorate([
4504
4484
  Trace(),
4505
4485
  __metadata("design:type", Function),
4506
4486
  __metadata("design:paramtypes", [NavigationStart]),
4507
4487
  __metadata("design:returntype", NavigationState)
4508
- ], ModalInteractionSession.prototype, "onStart", null);
4509
- __decorate([
4510
- Trace(),
4511
- __metadata("design:type", Function),
4512
- __metadata("design:paramtypes", [NavigationCancel]),
4513
- __metadata("design:returntype", NavigationState)
4514
- ], ModalInteractionSession.prototype, "onCancel", null);
4488
+ ], IdleDuringInteraction.prototype, "onRouterStarted", null);
4515
4489
  __decorate([
4516
4490
  Trace(),
4517
4491
  __metadata("design:type", Function),
4518
- __metadata("design:paramtypes", [NavigationEnd]),
4492
+ __metadata("design:paramtypes", [NavigationStart]),
4519
4493
  __metadata("design:returntype", NavigationState)
4520
- ], ModalInteractionSession.prototype, "onEnd", null);
4521
- return ModalInteractionSession;
4494
+ ], IdleDuringInteraction.prototype, "onPopState", null);
4495
+ return IdleDuringInteraction;
4522
4496
  }(NavigationState));
4523
- NavigationState.ModalInteractionSession = ModalInteractionSession;
4497
+ NavigationState.IdleDuringInteraction = IdleDuringInteraction;
4498
+ if (false) {
4499
+ /** @type {?} */
4500
+ IdleDuringInteraction.prototype.isTransitional;
4501
+ /** @type {?} */
4502
+ IdleDuringInteraction.prototype.isPopState;
4503
+ /** @type {?} */
4504
+ IdleDuringInteraction.prototype.startingUrl;
4505
+ }
4506
+ /**
4507
+ * @abstract
4508
+ */
4509
+ var /**
4510
+ * @abstract
4511
+ */
4512
+ AbstractInteractionTransition = /** @class */ (function (_super) {
4513
+ __extends(AbstractInteractionTransition, _super);
4514
+ function AbstractInteractionTransition(context, startingUrl) {
4515
+ var _this = _super.call(this, context, startingUrl) || this;
4516
+ _this.startingUrl = startingUrl;
4517
+ _this.isTransitional = true;
4518
+ return _this;
4519
+ }
4520
+ return AbstractInteractionTransition;
4521
+ }(AbstractNavigationTransition));
4522
+ NavigationState.AbstractInteractionTransition = AbstractInteractionTransition;
4524
4523
  if (false) {
4525
4524
  /** @type {?} */
4526
- ModalInteractionSession.prototype.active;
4525
+ AbstractInteractionTransition.prototype.isTransitional;
4526
+ /** @type {?} */
4527
+ AbstractInteractionTransition.prototype.startingUrl;
4528
+ }
4529
+ /**
4530
+ * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
4531
+ * happily ignore interaction contexts.
4532
+ */
4533
+ var /**
4534
+ * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
4535
+ * happily ignore interaction contexts.
4536
+ */
4537
+ InteractionTransition = /** @class */ (function (_super) {
4538
+ __extends(InteractionTransition, _super);
4539
+ function InteractionTransition() {
4540
+ var _this = _super !== null && _super.apply(this, arguments) || this;
4541
+ _this.isPopState = false;
4542
+ return _this;
4543
+ }
4544
+ /**
4545
+ * @param {?} event
4546
+ * @return {?}
4547
+ */
4548
+ InteractionTransition.prototype.onRouterCancelled = /**
4549
+ * @param {?} event
4550
+ * @return {?}
4551
+ */
4552
+ function (event) {
4553
+ if (this.context.interactionService.isActive()) {
4554
+ /** @type {?} */
4555
+ var interactionIds = this.interactionService.activeInteractionContextIds.value;
4556
+ this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
4557
+ return new IdleDuringInteraction(this.context, this.startingUrl);
4558
+ }
4559
+ else {
4560
+ return new Idle(this.context);
4561
+ }
4562
+ };
4563
+ /**
4564
+ * @param {?} event
4565
+ * @return {?}
4566
+ */
4567
+ InteractionTransition.prototype.onRouterError = /**
4568
+ * @param {?} event
4569
+ * @return {?}
4570
+ */
4571
+ function (event) {
4572
+ // navigation was aborted.
4573
+ return new IdleDuringInteraction(this.context, this.startingUrl);
4574
+ };
4575
+ /**
4576
+ * @param {?} event
4577
+ * @return {?}
4578
+ */
4579
+ InteractionTransition.prototype.onRouterEnd = /**
4580
+ * @param {?} event
4581
+ * @return {?}
4582
+ */
4583
+ function (event) {
4584
+ if (this.context.interactionService.isActive()) {
4585
+ return new IdleDuringInteraction(this.context, this.startingUrl);
4586
+ }
4587
+ else {
4588
+ return new Idle(this.context);
4589
+ }
4590
+ };
4591
+ return InteractionTransition;
4592
+ }(AbstractInteractionTransition));
4593
+ NavigationState.InteractionTransition = InteractionTransition;
4594
+ if (false) {
4527
4595
  /** @type {?} */
4528
- ModalInteractionSession.prototype.isPopState;
4596
+ InteractionTransition.prototype.isPopState;
4597
+ }
4598
+ /**
4599
+ * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
4600
+ * happily ignore interaction contexts.
4601
+ */
4602
+ var /**
4603
+ * This state exists to handle all events while any kind of navigation is in progress. That way all other states can
4604
+ * happily ignore interaction contexts.
4605
+ */
4606
+ InteractionPopStateTransition = /** @class */ (function (_super) {
4607
+ __extends(InteractionPopStateTransition, _super);
4608
+ function InteractionPopStateTransition() {
4609
+ var _this = _super !== null && _super.apply(this, arguments) || this;
4610
+ _this.isPopState = true;
4611
+ return _this;
4612
+ }
4613
+ /**
4614
+ * @param {?} event
4615
+ * @return {?}
4616
+ */
4617
+ InteractionPopStateTransition.prototype.onRouterCancelled = /**
4618
+ * @param {?} event
4619
+ * @return {?}
4620
+ */
4621
+ function (event) {
4622
+ if (this.interactionService.isActive()) {
4623
+ /** @type {?} */
4624
+ var interactionIds = this.interactionService.activeInteractionContextIds.value;
4625
+ this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
4626
+ return new IdleDuringInteraction(this.context, this.startingUrl);
4627
+ }
4628
+ else {
4629
+ return new Idle(this.context);
4630
+ }
4631
+ };
4632
+ /**
4633
+ * @param {?} event
4634
+ * @return {?}
4635
+ */
4636
+ InteractionPopStateTransition.prototype.onRouterEnd = /**
4637
+ * @param {?} event
4638
+ * @return {?}
4639
+ */
4640
+ function (event) {
4641
+ if (this.context.interactionService.isActive()) {
4642
+ return new IdleDuringInteraction(this.context, this.startingUrl);
4643
+ }
4644
+ else {
4645
+ return new Idle(this.context);
4646
+ }
4647
+ };
4648
+ return InteractionPopStateTransition;
4649
+ }(AbstractInteractionTransition));
4650
+ NavigationState.InteractionPopStateTransition = InteractionPopStateTransition;
4651
+ if (false) {
4529
4652
  /** @type {?} */
4530
- ModalInteractionSession.prototype.startingUrl;
4653
+ InteractionPopStateTransition.prototype.isPopState;
4531
4654
  }
4532
4655
  var CancelledDuringNavigationInteraction = /** @class */ (function (_super) {
4533
4656
  __extends(CancelledDuringNavigationInteraction, _super);
4534
- function CancelledDuringNavigationInteraction(context, startingUrl, locationChangeTriggerUrl) {
4657
+ function CancelledDuringNavigationInteraction(context, startingUrl, startingEventWasAPopState, locationChangeTriggerUrl) {
4535
4658
  var _this = _super.call(this, context) || this;
4536
4659
  _this.startingUrl = startingUrl;
4660
+ _this.startingEventWasAPopState = startingEventWasAPopState;
4537
4661
  _this.locationChangeTriggerUrl = locationChangeTriggerUrl;
4538
- _this.active = false;
4539
- _this.capturedFauxRouterStart = false;
4662
+ _this.isPopState = false;
4663
+ _this.gotPopStateWithLeavingUrl = false;
4540
4664
  return _this;
4541
- // This will trigger a return to the route we originally started with.
4542
- // this.angularLocation.go(this.startingUrl);
4543
4665
  }
4666
+ Object.defineProperty(CancelledDuringNavigationInteraction.prototype, "isTransitional", {
4667
+ get: /**
4668
+ * @return {?}
4669
+ */
4670
+ function () {
4671
+ return true;
4672
+ },
4673
+ enumerable: true,
4674
+ configurable: true
4675
+ });
4544
4676
  /**
4545
- * @param {?} component
4546
- * @param {?} nextState
4677
+ * @param {?} event
4547
4678
  * @return {?}
4548
4679
  */
4549
- CancelledDuringNavigationInteraction.prototype.canDeactivatePlace = /**
4550
- * @param {?} component
4551
- * @param {?} nextState
4680
+ CancelledDuringNavigationInteraction.prototype.onRouterStarted = /**
4681
+ * @param {?} event
4552
4682
  * @return {?}
4553
4683
  */
4554
- function (component, nextState) {
4555
- return __awaiter(this, void 0, void 0, function () {
4556
- return __generator(this, function (_a) {
4557
- return [2 /*return*/, false];
4558
- });
4559
- });
4684
+ function (event) {
4685
+ return this.ignore(event);
4560
4686
  };
4561
4687
  /**
4562
4688
  * @param {?} event
4563
4689
  * @return {?}
4564
4690
  */
4565
- CancelledDuringNavigationInteraction.prototype.onCancel = /**
4691
+ CancelledDuringNavigationInteraction.prototype.onRouterCancelled = /**
4566
4692
  * @param {?} event
4567
4693
  * @return {?}
4568
4694
  */
4569
4695
  function (event) {
4570
- return this.ignore(event);
4696
+ // Depending on the state of the router and what was done we get a different
4697
+ // sequence of events. I.e. If they just clicked a link we'll get a cancel
4698
+ // with the locationChangeTriggerUrl as the final event. However the user
4699
+ // started the initial navigation with a pop state then we'll get one of
4700
+ // those with the locationChangeTriggerUrl but no cancel event with it.
4701
+ return this.gotPopStateWithLeavingUrl || this.locationChangeTriggerUrl === event.url ? this.createIdleState() : this.ignore(event);
4571
4702
  };
4572
4703
  /**
4573
4704
  * @param {?} event
4574
4705
  * @return {?}
4575
4706
  */
4576
- CancelledDuringNavigationInteraction.prototype.onEnd = /**
4707
+ CancelledDuringNavigationInteraction.prototype.onRouterEnd = /**
4577
4708
  * @param {?} event
4578
4709
  * @return {?}
4579
4710
  */
@@ -4584,7 +4715,7 @@ if (false) {
4584
4715
  * @param {?} event
4585
4716
  * @return {?}
4586
4717
  */
4587
- CancelledDuringNavigationInteraction.prototype.onError = /**
4718
+ CancelledDuringNavigationInteraction.prototype.onRouterError = /**
4588
4719
  * @param {?} event
4589
4720
  * @return {?}
4590
4721
  */
@@ -4595,18 +4726,36 @@ if (false) {
4595
4726
  * @param {?} event
4596
4727
  * @return {?}
4597
4728
  */
4598
- CancelledDuringNavigationInteraction.prototype.onStart = /**
4729
+ CancelledDuringNavigationInteraction.prototype.onPopState = /**
4599
4730
  * @param {?} event
4600
4731
  * @return {?}
4601
4732
  */
4602
4733
  function (event) {
4603
- if (event.url === this.locationChangeTriggerUrl && !this.capturedFauxRouterStart) {
4604
- this.capturedFauxRouterStart = true;
4605
- return this.ignore(event, 'url matched back button location change');
4606
- }
4607
- else {
4608
- return this.createActiveSession(event);
4609
- }
4734
+ this.gotPopStateWithLeavingUrl = this.gotPopStateWithLeavingUrl || event.url === this.locationChangeTriggerUrl;
4735
+ return this.ignore(event);
4736
+ };
4737
+ // @Trace()
4738
+ // @Trace()
4739
+ /**
4740
+ * @param {?} component
4741
+ * @param {?} currentUrl
4742
+ * @param {?} nextUrl
4743
+ * @return {?}
4744
+ */
4745
+ CancelledDuringNavigationInteraction.prototype.canDeactivatePlace =
4746
+ // @Trace()
4747
+ /**
4748
+ * @param {?} component
4749
+ * @param {?} currentUrl
4750
+ * @param {?} nextUrl
4751
+ * @return {?}
4752
+ */
4753
+ function (component, currentUrl, nextUrl) {
4754
+ return __awaiter(this, void 0, void 0, function () {
4755
+ return __generator(this, function (_a) {
4756
+ return [2 /*return*/, false];
4757
+ });
4758
+ });
4610
4759
  };
4611
4760
  /**
4612
4761
  * @param {?} event
@@ -4619,7 +4768,7 @@ if (false) {
4619
4768
  * @return {?}
4620
4769
  */
4621
4770
  function (event, reason) {
4622
- reason = reason ? " (" + reason + ")" : '';
4771
+ reason = reason ? " -> " + reason : '';
4623
4772
  Logger.get(this).info("ignoring router event" + reason + ": " + event.constructor.name + " -> " + event.url);
4624
4773
  return this;
4625
4774
  };
@@ -4630,24 +4779,30 @@ if (false) {
4630
4779
  * @return {?}
4631
4780
  */
4632
4781
  function () {
4633
- return this.constructor.name + "(startingUrl: " + this.startingUrl + ", locationChangeTriggerUrl:" + this.locationChangeTriggerUrl + ")";
4782
+ return this.constructor.name + "(isIdl: " + this.idle + ", startingUrl: " + this.startingUrl + ", locationChangeTriggerUrl:" + this.locationChangeTriggerUrl + ")";
4634
4783
  };
4784
+ __decorate([
4785
+ Trace(),
4786
+ __metadata("design:type", Function),
4787
+ __metadata("design:paramtypes", [NavigationCancel]),
4788
+ __metadata("design:returntype", NavigationState)
4789
+ ], CancelledDuringNavigationInteraction.prototype, "onRouterCancelled", null);
4635
4790
  return CancelledDuringNavigationInteraction;
4636
4791
  }(NavigationState));
4637
4792
  NavigationState.CancelledDuringNavigationInteraction = CancelledDuringNavigationInteraction;
4638
4793
  if (false) {
4639
- /** @type {?} */
4640
- CancelledDuringNavigationInteraction.prototype.active;
4641
4794
  /** @type {?} */
4642
4795
  CancelledDuringNavigationInteraction.prototype.isPopState;
4643
4796
  /**
4644
4797
  * @type {?}
4645
4798
  * @private
4646
4799
  */
4647
- CancelledDuringNavigationInteraction.prototype.capturedFauxRouterStart;
4800
+ CancelledDuringNavigationInteraction.prototype.gotPopStateWithLeavingUrl;
4648
4801
  /** @type {?} */
4649
4802
  CancelledDuringNavigationInteraction.prototype.startingUrl;
4650
4803
  /** @type {?} */
4804
+ CancelledDuringNavigationInteraction.prototype.startingEventWasAPopState;
4805
+ /** @type {?} */
4651
4806
  CancelledDuringNavigationInteraction.prototype.locationChangeTriggerUrl;
4652
4807
  }
4653
4808
  })(NavigationState || (NavigationState = {}));
@@ -4737,19 +4892,13 @@ if (false) {
4737
4892
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4738
4893
  */
4739
4894
  var UrlSnapshot = /** @class */ (function () {
4740
- function UrlSnapshot(urlTree) {
4741
- this.urlTree = urlTree;
4742
- // console.log({ segments: this.urlTree.root.children.primary.segments });
4895
+ // TODO: Update this accept a url Parser so it can be immutable and generate new trees on mutation using toString() are parseUrl.
4896
+ function UrlSnapshot(urlSerializer, url, options) {
4897
+ this.urlSerializer = urlSerializer;
4898
+ this.url = url;
4899
+ this.options = options;
4900
+ this.urlTree = urlSerializer.parse(url);
4743
4901
  }
4744
- /**
4745
- * @return {?}
4746
- */
4747
- UrlSnapshot.prototype.cloneUrlSegmentList = /**
4748
- * @return {?}
4749
- */
4750
- function () {
4751
- return __spread(this.urlTree.root.children.primary.segments);
4752
- };
4753
4902
  /**
4754
4903
  * @param {?} visit
4755
4904
  * @return {?}
@@ -4759,11 +4908,13 @@ var UrlSnapshot = /** @class */ (function () {
4759
4908
  * @return {?}
4760
4909
  */
4761
4910
  function (visit) {
4911
+ /** @type {?} */
4912
+ var urlTree = this.urlSerializer.parse(this.url);
4762
4913
  // Ugly, but it works for now.
4763
4914
  /** @type {?} */
4764
- var segments = this.cloneUrlSegmentList();
4915
+ var segments = __spread(this.getPrimarySegments(urlTree));
4765
4916
  /** @type {?} */
4766
- var visitSegments = this.convertToUrlSegments(visit);
4917
+ var visitSegments = this.getSegmentsFor(visit);
4767
4918
  /** @type {?} */
4768
4919
  var replaceAt = segments.findIndex((/**
4769
4920
  * @param {?} segment
@@ -4772,7 +4923,21 @@ var UrlSnapshot = /** @class */ (function () {
4772
4923
  function (segment) { return segment.path === visitSegments[0].path; }));
4773
4924
  // do not use the return value, it's the items that were removed!
4774
4925
  segments.splice.apply(segments, __spread([replaceAt, visitSegments.length], visitSegments));
4775
- return segments;
4926
+ urlTree.root.children.primary.segments = segments;
4927
+ return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
4928
+ };
4929
+ /**
4930
+ * @private
4931
+ * @param {?} urlTree
4932
+ * @return {?}
4933
+ */
4934
+ UrlSnapshot.prototype.getPrimarySegments = /**
4935
+ * @private
4936
+ * @param {?} urlTree
4937
+ * @return {?}
4938
+ */
4939
+ function (urlTree) {
4940
+ return this.urlTree.root.children.primary.segments;
4776
4941
  };
4777
4942
  /**
4778
4943
  * Converts the visit into segments. Please not that these segments are not e
@@ -4780,11 +4945,13 @@ var UrlSnapshot = /** @class */ (function () {
4780
4945
  */
4781
4946
  /**
4782
4947
  * Converts the visit into segments. Please not that these segments are not e
4948
+ * @protected
4783
4949
  * @param {?} visit
4784
4950
  * @return {?}
4785
4951
  */
4786
- UrlSnapshot.prototype.convertToUrlSegments = /**
4952
+ UrlSnapshot.prototype.getSegmentsFor = /**
4787
4953
  * Converts the visit into segments. Please not that these segments are not e
4954
+ * @protected
4788
4955
  * @param {?} visit
4789
4956
  * @return {?}
4790
4957
  */
@@ -4803,51 +4970,150 @@ var UrlSnapshot = /** @class */ (function () {
4803
4970
  ];
4804
4971
  };
4805
4972
  /**
4806
- * @param {?} visit
4973
+ * @param {?} placeDef
4807
4974
  * @return {?}
4808
4975
  */
4809
- UrlSnapshot.prototype.createRedirectCommandsFor = /**
4810
- * @param {?} visit
4976
+ UrlSnapshot.prototype.includesPathOf = /**
4977
+ * @param {?} placeDef
4811
4978
  * @return {?}
4812
4979
  */
4813
- function (visit) {
4814
- /** @type {?} */
4815
- var segments = this.updateVisitSegments(visit);
4816
- /** @type {?} */
4817
- var commands = [];
4818
- segments.forEach((/**
4980
+ function (placeDef) {
4981
+ return this.getPrimarySegments(this.urlTree).find((/**
4819
4982
  * @param {?} s
4820
4983
  * @return {?}
4821
4984
  */
4822
- function (s) {
4823
- commands.push(s.path);
4824
- if (s.parameterMap.keys.length > 0) {
4825
- commands.push(s.parameters);
4826
- }
4827
- }));
4828
- return commands;
4985
+ function (s) { return s.path === placeDef.path; }));
4829
4986
  };
4830
4987
  /**
4831
- * @param {?} placeDef
4832
4988
  * @return {?}
4833
4989
  */
4834
- UrlSnapshot.prototype.includesPathOf = /**
4835
- * @param {?} placeDef
4990
+ UrlSnapshot.prototype.getInteractionIds = /**
4836
4991
  * @return {?}
4837
4992
  */
4838
- function (placeDef) {
4839
- return this.cloneUrlSegmentList().find((/**
4840
- * @param {?} s
4841
- * @return {?}
4842
- */
4843
- function (s) { return s.path === placeDef.path; }));
4993
+ function () {
4994
+ /** @type {?} */
4995
+ var queryParam = this.urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM];
4996
+ if (queryParam) {
4997
+ return UrlSnapshot.parseInteractionIds(queryParam);
4998
+ }
4999
+ else {
5000
+ return [];
5001
+ }
5002
+ };
5003
+ /**
5004
+ * @return {?}
5005
+ */
5006
+ UrlSnapshot.prototype.hasInteractionIds = /**
5007
+ * @return {?}
5008
+ */
5009
+ function () {
5010
+ return this.getInteractionIds().length > 0;
5011
+ };
5012
+ // @Trace()
5013
+ // @Trace()
5014
+ /**
5015
+ * @param {?} ids
5016
+ * @return {?}
5017
+ */
5018
+ UrlSnapshot.prototype.updateInteractionIds =
5019
+ // @Trace()
5020
+ /**
5021
+ * @param {?} ids
5022
+ * @return {?}
5023
+ */
5024
+ function (ids) {
5025
+ if (ids.length === 0) {
5026
+ return this.removeInteractionIds();
5027
+ }
5028
+ else {
5029
+ /** @type {?} */
5030
+ var urlTree = this.urlSerializer.parse(this.url);
5031
+ urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM] = UrlSnapshot.createPathIdFor(ids);
5032
+ return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
5033
+ }
5034
+ };
5035
+ // @Trace()
5036
+ // @Trace()
5037
+ /**
5038
+ * @return {?}
5039
+ */
5040
+ UrlSnapshot.prototype.removeInteractionIds =
5041
+ // @Trace()
5042
+ /**
5043
+ * @return {?}
5044
+ */
5045
+ function () {
5046
+ /** @type {?} */
5047
+ var urlTree = this.urlSerializer.parse(this.url);
5048
+ if (urlTree.queryParams && urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM]) {
5049
+ urlTree.queryParams = {}; //[UrlSnapshot.INTERACTION_ROUTER_OUTLET]
5050
+ }
5051
+ return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
5052
+ };
5053
+ /**
5054
+ * @param {?} options
5055
+ * @return {?}
5056
+ */
5057
+ UrlSnapshot.prototype.withOptions = /**
5058
+ * @param {?} options
5059
+ * @return {?}
5060
+ */
5061
+ function (options) {
5062
+ return new UrlSnapshot(this.urlSerializer, this.url, options);
5063
+ };
5064
+ /**
5065
+ * @return {?}
5066
+ */
5067
+ UrlSnapshot.prototype.getNavigationExtras = /**
5068
+ * @return {?}
5069
+ */
5070
+ function () {
5071
+ return this.options;
4844
5072
  };
4845
5073
  return UrlSnapshot;
4846
5074
  }());
4847
5075
  if (false) {
4848
5076
  /** @type {?} */
4849
5077
  UrlSnapshot.prototype.urlTree;
5078
+ /** @type {?} */
5079
+ UrlSnapshot.prototype.urlSerializer;
5080
+ /** @type {?} */
5081
+ UrlSnapshot.prototype.url;
5082
+ /**
5083
+ * @type {?}
5084
+ * @private
5085
+ */
5086
+ UrlSnapshot.prototype.options;
4850
5087
  }
5088
+ (function (UrlSnapshot) {
5089
+ UrlSnapshot.INTERACTION_QUERY_PARAM = 'aup-interactions';
5090
+ UrlSnapshot.INTERACTION_ID_SEPARATOR = '--';
5091
+ /**
5092
+ * @param {?} path
5093
+ * @return {?}
5094
+ */
5095
+ function parseInteractionIds(path) {
5096
+ return path.split(UrlSnapshot.INTERACTION_ID_SEPARATOR);
5097
+ }
5098
+ UrlSnapshot.parseInteractionIds = parseInteractionIds;
5099
+ /**
5100
+ * @param {?} interactionIds
5101
+ * @return {?}
5102
+ */
5103
+ function createPathIdFor(interactionIds) {
5104
+ return interactionIds.join(UrlSnapshot.INTERACTION_ID_SEPARATOR);
5105
+ }
5106
+ UrlSnapshot.createPathIdFor = createPathIdFor;
5107
+ /**
5108
+ * @record
5109
+ */
5110
+ function NavigationOptions() { }
5111
+ UrlSnapshot.NavigationOptions = NavigationOptions;
5112
+ if (false) {
5113
+ /** @type {?|undefined} */
5114
+ NavigationOptions.prototype.replaceUrl;
5115
+ }
5116
+ })(UrlSnapshot || (UrlSnapshot = {}));
4851
5117
 
4852
5118
  /**
4853
5119
  * @fileoverview added by tsickle
@@ -4855,27 +5121,31 @@ if (false) {
4855
5121
  */
4856
5122
  var PlaceRouter = /** @class */ (function (_super) {
4857
5123
  __extends(PlaceRouter, _super);
4858
- function PlaceRouter(router, urlSerializer, angularLocation, placeHistory, modalInteractionService) {
5124
+ function PlaceRouter(router, urlSerializer, angularLocation, placeHistory, interactionService) {
4859
5125
  var _this = _super.call(this) || this;
4860
5126
  _this.router = router;
4861
5127
  _this.urlSerializer = urlSerializer;
4862
5128
  _this.angularLocation = angularLocation;
4863
5129
  _this.placeHistory = placeHistory;
4864
- _this.modalInteractionService = modalInteractionService;
4865
- _this.firstRoute = true;
4866
- _this._navigationSessionModel = new MutableValueModel();
5130
+ _this.interactionService = interactionService;
5131
+ _this._navigationStateModel = new MutableValueModel();
4867
5132
  _this._activeVisits = new MutableListModel();
4868
5133
  var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
4869
5134
  _this.activeVisitIndex = chain(_this._activeVisits).indexBy('placeDefinition');
4870
- _this.navigationSessionActive = chain(_this.navigationSessionModel).pluck('active');
4871
- _this._navigationSessionContext = new NavigationState.Context(_this.router, _this.modalInteractionService, _this.angularLocation, (/**
5135
+ _this.navigationInProgress = chain(_this.navigationStateModel).pluck('isTransitional');
5136
+ _this._navigationSessionContext = new NavigationState.Context(_this, _this.interactionService, (/**
4872
5137
  * @param {?} session
4873
5138
  * @return {?}
4874
5139
  */
4875
5140
  function (session) {
4876
5141
  _this.processNavigationSuccess(session);
4877
5142
  }));
4878
- _this._navigationSessionModel.value = new NavigationState.Idle(_this._navigationSessionContext);
5143
+ _this._navigationStateModel.value = new NavigationState.Idle(_this._navigationSessionContext);
5144
+ _this._navigationStateTypeModel = chain(_this._navigationStateModel).map((/**
5145
+ * @param {?} state
5146
+ * @return {?}
5147
+ */
5148
+ function (state) { return (/** @type {?} */ (state.constructor)); }));
4879
5149
  // TODO: make setup the callbacks in during module initiation to make this testable.
4880
5150
  _this.router.events.subscribe((/**
4881
5151
  * @param {?} event
@@ -4889,53 +5159,83 @@ var PlaceRouter = /** @class */ (function (_super) {
4889
5159
  // NavigationStart -> .... -> NavigationError --> navigation aborted, end session.
4890
5160
  // =======================
4891
5161
  if (event instanceof NavigationStart) {
4892
- _this.runStateTransition((/**
4893
- * @param {?} session
4894
- * @return {?}
4895
- */
4896
- function (session) { return session.onStart(event); }));
5162
+ if (event.navigationTrigger === 'popstate') {
5163
+ _this.runStateTransition((/**
5164
+ * @param {?} state
5165
+ * @return {?}
5166
+ */
5167
+ function (state) { return state.onPopState(event); }));
5168
+ }
5169
+ else {
5170
+ _this.runStateTransition((/**
5171
+ * @param {?} state
5172
+ * @return {?}
5173
+ */
5174
+ function (state) { return state.onRouterStarted(event); }));
5175
+ }
4897
5176
  }
4898
5177
  if (event instanceof NavigationEnd) {
5178
+ console.log(event);
4899
5179
  _this.runStateTransition((/**
4900
- * @param {?} session
5180
+ * @param {?} state
4901
5181
  * @return {?}
4902
5182
  */
4903
- function (session) { return session.onEnd(event); }));
5183
+ function (state) { return state.onRouterEnd(event); }));
4904
5184
  }
4905
5185
  if (event instanceof NavigationError) {
5186
+ console.log(event);
4906
5187
  _this.runStateTransition((/**
4907
- * @param {?} session
5188
+ * @param {?} state
4908
5189
  * @return {?}
4909
5190
  */
4910
- function (session) { return session.onError(event); }));
5191
+ function (state) { return state.onRouterError(event); }));
4911
5192
  }
4912
5193
  if (event instanceof NavigationCancel) {
5194
+ console.log(event);
4913
5195
  _this.runStateTransition((/**
4914
- * @param {?} session
5196
+ * @param {?} state
4915
5197
  * @return {?}
4916
5198
  */
4917
- function (session) { return session.onCancel(event); }));
5199
+ function (state) { return state.onRouterCancelled(event); }));
4918
5200
  }
4919
5201
  }));
4920
5202
  // Push dialog state to the url so we can capture the back button.
4921
- _this.modalInteractionService.addActivityListener(new PlaceRouter.InteractionRouteMediator(_this.navigationSessionActive, _this.router));
5203
+ when.listOf(_this.interactionService.activeInteractionContextIds).changes((/**
5204
+ * @param {?} ids
5205
+ * @param {?} previous
5206
+ * @return {?}
5207
+ */
5208
+ function (ids, previous) {
5209
+ _this.syncInteractionIdsWithRouter();
5210
+ }), { unless: _this.navigationInProgress }); // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
5211
+ // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.
5212
+ /** @type {?} */
5213
+ var urlChanges = new MutableStream();
4922
5214
  // The angular router doesn't always fire router events when the back button is pushed while a navigation
4923
5215
  // session is in progress. Sometimes we only know about it from the url change.
5216
+ // IMPORTANT ORDER DEPENDENCY
5217
+ // This only works because we're notified of the change after the router has started reacting to it. This
5218
+ // we can can use our navigationState to determine things.
4924
5219
  angularLocation.onUrlChange((/**
4925
5220
  * @param {?} url
4926
5221
  * @return {?}
4927
5222
  */
4928
5223
  function (url) {
4929
- console.log("#### url changed ->", { url: url, navIsActive: _this.navigationSessionActive.value });
4930
5224
  /** @type {?} */
4931
- var interactionContext = _this.navigationSessionActive.value && _this.navigationSession.interactionContext;
4932
- if (interactionContext && interactionContext.isActive()) {
4933
- Logger.get(_this).info("back button pressed during navigation session interaction");
4934
- _this.runStateTransition((/**
4935
- * @param {?} navigationSession
4936
- * @return {?}
4937
- */
4938
- function (navigationSession) { return navigationSession.onBackClickedDuringNavigationInteraction(url); }));
5225
+ var navigationState = _this._navigationStateModel.value;
5226
+ console.log("URLChange -> " + url, { state: navigationState });
5227
+ urlChanges.publish({ url: url, state: navigationState });
5228
+ // The url has changed while we're in a transitional state
5229
+ if (navigationState.isTransitional) {
5230
+ /** @type {?} */
5231
+ var navigationInteraction = _this.navigationState.interactionContext;
5232
+ if (navigationInteraction && navigationInteraction.isActive()) {
5233
+ _this.runStateTransition((/**
5234
+ * @param {?} state
5235
+ * @return {?}
5236
+ */
5237
+ function (state) { return state.onBackClickedDuringNavigationInteraction(url); }));
5238
+ }
4939
5239
  }
4940
5240
  }));
4941
5241
  return _this;
@@ -4954,7 +5254,7 @@ var PlaceRouter = /** @class */ (function (_super) {
4954
5254
  var _this = this;
4955
5255
  // We need to update the visits before the session finishes. This allows the placeOutets to ignore visit
4956
5256
  // changes that occur while routerNavigationActive is true.
4957
- assert.isTruthy(this.navigationSessionActive.value);
5257
+ assert.isTruthy(this.navigationInProgress.value);
4958
5258
  /** @type {?} */
4959
5259
  var visits = session.getVisits();
4960
5260
  visits.forEach((/**
@@ -4964,22 +5264,22 @@ var PlaceRouter = /** @class */ (function (_super) {
4964
5264
  function (v) { return _this.placeHistory.add(v); }));
4965
5265
  this._activeVisits.value = visits;
4966
5266
  };
4967
- Object.defineProperty(PlaceRouter.prototype, "navigationSession", {
5267
+ Object.defineProperty(PlaceRouter.prototype, "navigationState", {
4968
5268
  get: /**
4969
5269
  * @return {?}
4970
5270
  */
4971
5271
  function () {
4972
- return this._navigationSessionModel.value;
5272
+ return this._navigationStateModel.value;
4973
5273
  },
4974
5274
  enumerable: true,
4975
5275
  configurable: true
4976
5276
  });
4977
- Object.defineProperty(PlaceRouter.prototype, "navigationSessionModel", {
5277
+ Object.defineProperty(PlaceRouter.prototype, "navigationStateModel", {
4978
5278
  get: /**
4979
5279
  * @return {?}
4980
5280
  */
4981
5281
  function () {
4982
- return this._navigationSessionModel.readonly;
5282
+ return this._navigationStateModel.readonly;
4983
5283
  },
4984
5284
  enumerable: true,
4985
5285
  configurable: true
@@ -5070,9 +5370,9 @@ var PlaceRouter = /** @class */ (function (_super) {
5070
5370
  */
5071
5371
  function (router) {
5072
5372
  /** @type {?} */
5073
- var commands = _this.parseUrl(_this.router.routerState.snapshot).createRedirectCommandsFor(next);
5074
- console.log('### Push Changes to route Redirect', { commands: commands });
5075
- return router.navigate(commands);
5373
+ var urlSnapshot = _this.parseUrl(_this.router.routerState.snapshot.url).updateVisitSegments(next);
5374
+ console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });
5375
+ return _this.navigateByUrl(urlSnapshot);
5076
5376
  }))];
5077
5377
  }
5078
5378
  return [2 /*return*/];
@@ -5095,7 +5395,7 @@ var PlaceRouter = /** @class */ (function (_super) {
5095
5395
  return __generator(this, function (_a) {
5096
5396
  switch (_a.label) {
5097
5397
  case 0:
5098
- if (this.navigationSessionActive.value) {
5398
+ if (this.navigationInProgress.value) {
5099
5399
  lang.illegalState('Navigation already in progress');
5100
5400
  }
5101
5401
  this.runStateTransition((/**
@@ -5104,7 +5404,7 @@ var PlaceRouter = /** @class */ (function (_super) {
5104
5404
  */
5105
5405
  function (current) {
5106
5406
  /** @type {?} */
5107
- var session = new NavigationState.Active(_this._navigationSessionContext, false, _this.router.routerState.snapshot.url);
5407
+ var session = _this.navigationState.onPlaceNavigationStart(visit, _this.getCurrentRouterUrl());
5108
5408
  session.storeVisit(visit);
5109
5409
  return session;
5110
5410
  }));
@@ -5118,12 +5418,12 @@ var PlaceRouter = /** @class */ (function (_super) {
5118
5418
  case 3:
5119
5419
  // Router has finished (since there was no router change required) so we
5120
5420
  // need to end the navigation session.
5121
- if (this.navigationSession.active && !this.router.getCurrentNavigation()) {
5421
+ if (this.navigationState.isTransitional && !this.router.getCurrentNavigation()) {
5122
5422
  this.runStateTransition((/**
5123
5423
  * @param {?} session
5124
5424
  * @return {?}
5125
5425
  */
5126
- function (session) { return session.onEnd(new NavigationEnd(-1, '', '')); }));
5426
+ function (session) { return session.onRouterEnd(new NavigationEnd(-1, '', '')); }));
5127
5427
  }
5128
5428
  return [7 /*endfinally*/];
5129
5429
  case 4: return [2 /*return*/];
@@ -5131,22 +5431,26 @@ var PlaceRouter = /** @class */ (function (_super) {
5131
5431
  });
5132
5432
  });
5133
5433
  };
5434
+ // @Trace()
5435
+ // @Trace()
5134
5436
  /**
5135
5437
  * @protected
5136
5438
  * @param {?} transition
5137
5439
  * @return {?}
5138
5440
  */
5139
- PlaceRouter.prototype.runStateTransition = /**
5441
+ PlaceRouter.prototype.runStateTransition =
5442
+ // @Trace()
5443
+ /**
5140
5444
  * @protected
5141
5445
  * @param {?} transition
5142
5446
  * @return {?}
5143
5447
  */
5144
5448
  function (transition) {
5145
5449
  /** @type {?} */
5146
- var previous = this._navigationSessionModel.value;
5450
+ var previous = this._navigationStateModel.value;
5147
5451
  /** @type {?} */
5148
- var next = transition(this.navigationSession);
5149
- this._navigationSessionModel.value = next;
5452
+ var next = transition(this.navigationState);
5453
+ this._navigationStateModel.value = next;
5150
5454
  if (next !== previous) {
5151
5455
  previous.dispose();
5152
5456
  Logger.get(this).info("Router State Transition: " + previous.toString() + " -> " + next.toString());
@@ -5185,15 +5489,114 @@ var PlaceRouter = /** @class */ (function (_super) {
5185
5489
  function (child) { return child.url; })));
5186
5490
  };
5187
5491
  /**
5188
- * @param {?} snapshot
5492
+ * @param {?} url
5189
5493
  * @return {?}
5190
5494
  */
5191
5495
  PlaceRouter.prototype.parseUrl = /**
5192
- * @param {?} snapshot
5496
+ * @param {?} url
5497
+ * @return {?}
5498
+ */
5499
+ function (url) {
5500
+ return new UrlSnapshot(this.urlSerializer, url, {});
5501
+ };
5502
+ /**
5503
+ * @param {?} url
5504
+ * @return {?}
5505
+ */
5506
+ PlaceRouter.prototype.resetBrowserLocation = /**
5507
+ * @param {?} url
5508
+ * @return {?}
5509
+ */
5510
+ function (url) {
5511
+ this.angularLocation.go(url);
5512
+ };
5513
+ /**
5514
+ * @return {?}
5515
+ */
5516
+ PlaceRouter.prototype.getCurrentRouterUrl = /**
5517
+ * @return {?}
5518
+ */
5519
+ function () {
5520
+ return this.router.routerState ? this.router.routerState.snapshot.url : null;
5521
+ };
5522
+ /**
5523
+ * @return {?}
5524
+ */
5525
+ PlaceRouter.prototype.getCurrentRouteSnapshot = /**
5526
+ * @return {?}
5527
+ */
5528
+ function () {
5529
+ return this.parseUrl(this.getCurrentRouterUrl());
5530
+ };
5531
+ /**
5532
+ * @param {?} url
5533
+ * @return {?}
5534
+ */
5535
+ PlaceRouter.prototype.getActiveInteractionIdsFromUrl = /**
5536
+ * @param {?} url
5537
+ * @return {?}
5538
+ */
5539
+ function (url) {
5540
+ return this.parseUrl(url).getInteractionIds();
5541
+ };
5542
+ // @Trace()
5543
+ // @Trace()
5544
+ /**
5545
+ * @param {?} url
5546
+ * @return {?}
5547
+ */
5548
+ PlaceRouter.prototype.hasActiveInteractionIds =
5549
+ // @Trace()
5550
+ /**
5551
+ * @param {?} url
5552
+ * @return {?}
5553
+ */
5554
+ function (url) {
5555
+ return this.getActiveInteractionIdsFromUrl(url).length > 0;
5556
+ };
5557
+ // @Trace()
5558
+ // @Trace()
5559
+ /**
5560
+ * @param {?} urlSnapshot
5561
+ * @return {?}
5562
+ */
5563
+ PlaceRouter.prototype.navigateByUrl =
5564
+ // @Trace()
5565
+ /**
5566
+ * @param {?} urlSnapshot
5567
+ * @return {?}
5568
+ */
5569
+ function (urlSnapshot) {
5570
+ this.router.navigateByUrl(urlSnapshot.urlTree, urlSnapshot.getNavigationExtras());
5571
+ };
5572
+ // @Trace()
5573
+ // @Trace()
5574
+ /**
5575
+ * @return {?}
5576
+ */
5577
+ PlaceRouter.prototype.syncInteractionIdsWithRouter =
5578
+ // @Trace()
5579
+ /**
5193
5580
  * @return {?}
5194
5581
  */
5195
- function (snapshot) {
5196
- return new UrlSnapshot(this.urlSerializer.parse(snapshot.url));
5582
+ function () {
5583
+ assert.isFalsey(this.navigationInProgress.value); // Updating interaction routes during an existing navigation breaks all the things.
5584
+ // Updating interaction routes during an existing navigation breaks all the things.
5585
+ /** @type {?} */
5586
+ var currentIds = this.interactionService.activeInteractionContextIds.value;
5587
+ if (___default.isEqual(currentIds, this.getActiveInteractionIdsFromUrl(this.getCurrentRouterUrl()))) {
5588
+ console.log('activity ids were the same, skipping');
5589
+ }
5590
+ else {
5591
+ if (currentIds.length < 1) {
5592
+ // no more interactions to remove from history.
5593
+ this.navigateByUrl(this.getCurrentRouteSnapshot().removeInteractionIds());
5594
+ }
5595
+ else {
5596
+ // todo was or is...
5597
+ this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds));
5598
+ }
5599
+ }
5197
5600
  };
5198
5601
  PlaceRouter.decorators = [
5199
5602
  { type: Injectable, args: [{
@@ -5206,9 +5609,9 @@ var PlaceRouter = /** @class */ (function (_super) {
5206
5609
  { type: UrlSerializer },
5207
5610
  { type: Location },
5208
5611
  { type: PlaceHistory },
5209
- { type: ModalInteractionService }
5612
+ { type: InteractionService }
5210
5613
  ]; };
5211
- /** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(Location), ɵɵinject(PlaceHistory), ɵɵinject(ModalInteractionService)); }, token: PlaceRouter, providedIn: "root" });
5614
+ /** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(Location), ɵɵinject(PlaceHistory), ɵɵinject(InteractionService)); }, token: PlaceRouter, providedIn: "root" });
5212
5615
  return PlaceRouter;
5213
5616
  }(GarbageCollector));
5214
5617
  if (false) {
@@ -5216,19 +5619,14 @@ if (false) {
5216
5619
  * @type {?}
5217
5620
  * @private
5218
5621
  */
5219
- PlaceRouter.prototype.firstRoute;
5220
- /**
5221
- * @type {?}
5222
- * @private
5223
- */
5224
- PlaceRouter.prototype._navigationSessionModel;
5622
+ PlaceRouter.prototype._navigationStateModel;
5225
5623
  /**
5226
5624
  * @type {?}
5227
5625
  * @private
5228
5626
  */
5229
5627
  PlaceRouter.prototype._activeVisits;
5230
5628
  /** @type {?} */
5231
- PlaceRouter.prototype.navigationSessionActive;
5629
+ PlaceRouter.prototype.navigationInProgress;
5232
5630
  /** @type {?} */
5233
5631
  PlaceRouter.prototype.activeVisitIndex;
5234
5632
  /**
@@ -5236,6 +5634,11 @@ if (false) {
5236
5634
  * @private
5237
5635
  */
5238
5636
  PlaceRouter.prototype._navigationSessionContext;
5637
+ /**
5638
+ * @type {?}
5639
+ * @private
5640
+ */
5641
+ PlaceRouter.prototype._navigationStateTypeModel;
5239
5642
  /**
5240
5643
  * @type {?}
5241
5644
  * @private
@@ -5260,83 +5663,8 @@ if (false) {
5260
5663
  * @type {?}
5261
5664
  * @private
5262
5665
  */
5263
- PlaceRouter.prototype.modalInteractionService;
5666
+ PlaceRouter.prototype.interactionService;
5264
5667
  }
5265
- (function (PlaceRouter) {
5266
- PlaceRouter.INTERACTION_ROUTER_OUTLET = 'aup-interaction';
5267
- var InteractionRouteMediator = /** @class */ (function () {
5268
- function InteractionRouteMediator(navigationSessionModelActive, router) {
5269
- this.navigationSessionModelActive = navigationSessionModelActive;
5270
- this.router = router;
5271
- }
5272
- Object.defineProperty(InteractionRouteMediator.prototype, "isNavigating", {
5273
- get: /**
5274
- * @return {?}
5275
- */
5276
- function () {
5277
- return this.navigationSessionModelActive.value;
5278
- },
5279
- enumerable: true,
5280
- configurable: true
5281
- });
5282
- // If we're not in a navigation we push
5283
- // @Trace()
5284
- // If we're not in a navigation we push
5285
- // @Trace()
5286
- /**
5287
- * @return {?}
5288
- */
5289
- InteractionRouteMediator.prototype.onActivityStarted =
5290
- // If we're not in a navigation we push
5291
- // @Trace()
5292
- /**
5293
- * @return {?}
5294
- */
5295
- function () {
5296
- var _a;
5297
- if (!this.isNavigating) {
5298
- this.router.navigate(['.', {
5299
- outlets: (_a = {},
5300
- _a[PlaceRouter.INTERACTION_ROUTER_OUTLET] = ['modal'] // "open" must be a valid route for this outlet.
5301
- ,
5302
- _a)
5303
- }], {
5304
- replaceUrl: false
5305
- });
5306
- }
5307
- };
5308
- // @Trace()
5309
- // @Trace()
5310
- /**
5311
- * @return {?}
5312
- */
5313
- InteractionRouteMediator.prototype.onActivityFinished =
5314
- // @Trace()
5315
- /**
5316
- * @return {?}
5317
- */
5318
- function () {
5319
- var _a;
5320
- if (!this.isNavigating) {
5321
- this.router.navigate(['.', {
5322
- outlets: (_a = {},
5323
- _a[PlaceRouter.INTERACTION_ROUTER_OUTLET] = null,
5324
- _a)
5325
- }], {
5326
- replaceUrl: true // remove the interaction from the history.
5327
- });
5328
- }
5329
- };
5330
- return InteractionRouteMediator;
5331
- }());
5332
- PlaceRouter.InteractionRouteMediator = InteractionRouteMediator;
5333
- if (false) {
5334
- /** @type {?} */
5335
- InteractionRouteMediator.prototype.navigationSessionModelActive;
5336
- /** @type {?} */
5337
- InteractionRouteMediator.prototype.router;
5338
- }
5339
- })(PlaceRouter || (PlaceRouter = {}));
5340
5668
 
5341
5669
  /**
5342
5670
  * @fileoverview added by tsickle
@@ -5425,9 +5753,9 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
5425
5753
  _this.placeChanged = new EventEmitter();
5426
5754
  _this._activePlace = new MutableValueModel();
5427
5755
  _this._activePlaceVisitModel = new DelegatingValueModel();
5428
- _this._inOutletActivation = new Guard$1();
5429
- _this._inOutletDeactivation = new Guard$1();
5430
- _this._inRouteVisitUpdate = new Guard$1();
5756
+ _this._inOutletActivation = new Guard();
5757
+ _this._inOutletDeactivation = new Guard();
5758
+ _this._inRouteVisitUpdate = new Guard();
5431
5759
  _this._activatedRouteModel = new MutableValueModel();
5432
5760
  _this._placeDefinition = new MutableValueModel();
5433
5761
  _this.initialPlaceIndex = null;
@@ -5487,10 +5815,10 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
5487
5815
  function (next, previous) {
5488
5816
  _this.pushVisitChangesToRoute(next, previous);
5489
5817
  }), {
5490
- unless: _this.placeRouter.navigationSessionActive
5818
+ unless: _this.placeRouter.navigationInProgress
5491
5819
  });
5492
5820
  chain(_this._activePlace)
5493
- .postponeWhile(placeRouter.navigationSessionActive)
5821
+ .postponeWhile(placeRouter.navigationInProgress)
5494
5822
  .subscribe((/**
5495
5823
  * @param {?} place
5496
5824
  * @return {?}
@@ -6511,45 +6839,264 @@ if (false) {
6511
6839
  * @fileoverview added by tsickle
6512
6840
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6513
6841
  */
6514
- /**
6515
- * @record
6516
- * @template R, E
6517
- */
6518
- function Result() { }
6519
- (function (Result) {
6842
+ /**
6843
+ * @record
6844
+ * @template R, E
6845
+ */
6846
+ function Result() { }
6847
+ (function (Result) {
6848
+ /**
6849
+ * @record
6850
+ * @template R, E
6851
+ */
6852
+ function Callback() { }
6853
+ Result.Callback = Callback;
6854
+ if (false) {
6855
+ /** @type {?} */
6856
+ Callback.prototype.then;
6857
+ /** @type {?} */
6858
+ Callback.prototype.catch;
6859
+ }
6860
+ })(Result || (Result = {}));
6861
+
6862
+ /**
6863
+ * @fileoverview added by tsickle
6864
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6865
+ */
6866
+ /**
6867
+ * @record
6868
+ * @template D, R, E
6869
+ */
6870
+ function ActivityOutletContext() { }
6871
+ if (false) {
6872
+ /** @type {?} */
6873
+ ActivityOutletContext.prototype.activityClass;
6874
+ /** @type {?} */
6875
+ ActivityOutletContext.prototype.activityData;
6876
+ /**
6877
+ * @param {?} component
6878
+ * @return {?}
6879
+ */
6880
+ ActivityOutletContext.prototype.componentReady = function (component) { };
6881
+ }
6882
+
6883
+ /**
6884
+ * @fileoverview added by tsickle
6885
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6886
+ */
6887
+ var DialogInteractionContext = /** @class */ (function (_super) {
6888
+ __extends(DialogInteractionContext, _super);
6889
+ function DialogInteractionContext(dialogService, config) {
6890
+ var _this = _super.call(this) || this;
6891
+ _this.dialogService = dialogService;
6892
+ _this.config = config;
6893
+ _this._activeModel = new MutableValueModel(false);
6894
+ assert$1.notNil(dialogService);
6895
+ _this.onDispose((/**
6896
+ * @return {?}
6897
+ */
6898
+ function () {
6899
+ if (_this.isActive()) {
6900
+ lang.illegalState('Dispose called while active.');
6901
+ }
6902
+ }));
6903
+ return _this;
6904
+ }
6905
+ Object.defineProperty(DialogInteractionContext.prototype, "active", {
6906
+ get: /**
6907
+ * @return {?}
6908
+ */
6909
+ function () {
6910
+ return this._activeModel.readonly;
6911
+ },
6912
+ enumerable: true,
6913
+ configurable: true
6914
+ });
6915
+ /**
6916
+ * @protected
6917
+ * @template D, R, E
6918
+ * @param {?} activityType
6919
+ * @param {?} data
6920
+ * @param {?=} disableClose
6921
+ * @return {?}
6922
+ */
6923
+ DialogInteractionContext.prototype._startActivity = /**
6924
+ * @protected
6925
+ * @template D, R, E
6926
+ * @param {?} activityType
6927
+ * @param {?} data
6928
+ * @param {?=} disableClose
6929
+ * @return {?}
6930
+ */
6931
+ function (activityType, data, disableClose) {
6932
+ var _this = this;
6933
+ if (disableClose === void 0) { disableClose = true; }
6934
+ if (this.isActive()) {
6935
+ lang.illegalState("Activity already in progress: " + this.activityList.value.map((/**
6936
+ * @param {?} a
6937
+ * @return {?}
6938
+ */
6939
+ function (a) { return a.constructor.name; })).join(', '));
6940
+ }
6941
+ this._activeModel.value = true;
6942
+ /** @type {?} */
6943
+ var config = __assign({}, this.config, {
6944
+ data: data,
6945
+ disableClose: disableClose,
6946
+ panelClass: 'dialog-interaction-context'
6947
+ });
6948
+ /** @type {?} */
6949
+ var self = this;
6950
+ /** @type {?} */
6951
+ var matDialogRef = (/** @type {?} */ (this.dialogService.open(ActivityContainerComponent, config)));
6952
+ return new Promise((/**
6953
+ * @param {?} resolve
6954
+ * @param {?} reject
6955
+ * @return {?}
6956
+ */
6957
+ function (resolve, reject) {
6958
+ /** @type {?} */
6959
+ var activityContainer = matDialogRef.componentInstance;
6960
+ self.safelyUpdateActivityListDelegate(activityContainer.activityList);
6961
+ activityContainer.initialActivityOutletContext = {
6962
+ activityClass: activityType,
6963
+ activityData: data,
6964
+ onDone: /**
6965
+ * @param {?} result
6966
+ * @return {?}
6967
+ */
6968
+ function (result) {
6969
+ resolve(result);
6970
+ matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
6971
+ },
6972
+ onCancel: /**
6973
+ * @param {?} error
6974
+ * @return {?}
6975
+ */
6976
+ function (error) {
6977
+ reject(error);
6978
+ matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
6979
+ }
6980
+ };
6981
+ // we need to check if our onDone/onCancel methods above we called or if we were
6982
+ // closed by the user clicking the backdrop. If the later then we need to reject
6983
+ // our promise.
6984
+ matDialogRef.afterClosed().subscribe((/**
6985
+ * @param {?} promiseAlreadyFinished
6986
+ * @return {?}
6987
+ */
6988
+ function (promiseAlreadyFinished) {
6989
+ if (!promiseAlreadyFinished) {
6990
+ reject('auto-closed');
6991
+ }
6992
+ }));
6993
+ matDialogRef.updateSize();
6994
+ matDialogRef.afterOpened().subscribe((/**
6995
+ * @param {?} promiseAlreadyFinished
6996
+ * @return {?}
6997
+ */
6998
+ function (promiseAlreadyFinished) {
6999
+ matDialogRef.updateSize();
7000
+ }));
7001
+ })).finally((/**
7002
+ * @return {?}
7003
+ */
7004
+ function () {
7005
+ self.safelyUpdateActivityListDelegate(null);
7006
+ _this._activeModel.value = false;
7007
+ }));
7008
+ };
7009
+ /**
7010
+ * Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
7011
+ * @param delegate
7012
+ */
7013
+ /**
7014
+ * Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
7015
+ * @param {?} delegate
7016
+ * @return {?}
7017
+ */
7018
+ DialogInteractionContext.prototype.safelyUpdateActivityListDelegate = /**
7019
+ * Updates teh delegate on the next tick to avoid modifying state during the current change detection cycle.
7020
+ * @param {?} delegate
7021
+ * @return {?}
7022
+ */
7023
+ function (delegate) {
7024
+ var _this = this;
7025
+ setTimeout((/**
7026
+ * @return {?}
7027
+ */
7028
+ function () { return _this.setActivityList(delegate); }));
7029
+ };
7030
+ return DialogInteractionContext;
7031
+ }(InteractionContextBase));
7032
+ if (false) {
7033
+ /**
7034
+ * @type {?}
7035
+ * @private
7036
+ */
7037
+ DialogInteractionContext.prototype._activeModel;
7038
+ /**
7039
+ * @type {?}
7040
+ * @private
7041
+ */
7042
+ DialogInteractionContext.prototype.dialogService;
7043
+ /** @type {?} */
7044
+ DialogInteractionContext.prototype.config;
7045
+ }
7046
+
7047
+ /**
7048
+ * @fileoverview added by tsickle
7049
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7050
+ */
7051
+ /** @type {?} */
7052
+ var DIALOG_INTERACTION_SERVICE_DEFAULTS = new InjectionToken('DIALOG_INTERACTION_SERVICE_DEFAULTS');
7053
+ var DialogInteractionContextFactory = /** @class */ (function (_super) {
7054
+ __extends(DialogInteractionContextFactory, _super);
7055
+ function DialogInteractionContextFactory(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
7056
+ var _this = _super.call(this) || this;
7057
+ _this.dialogService = dialogService;
7058
+ _this.dialogServiceDefaults = dialogServiceDefaults;
7059
+ _this.matDialogDefaultConfig = matDialogDefaultConfig;
7060
+ assert$1.notNil(dialogService);
7061
+ return _this;
7062
+ }
6520
7063
  /**
6521
- * @record
6522
- * @template R, E
7064
+ * @return {?}
6523
7065
  */
6524
- function Callback() { }
6525
- Result.Callback = Callback;
6526
- if (false) {
6527
- /** @type {?} */
6528
- Callback.prototype.then;
7066
+ DialogInteractionContextFactory.prototype.createInteractionContext = /**
7067
+ * @return {?}
7068
+ */
7069
+ function () {
6529
7070
  /** @type {?} */
6530
- Callback.prototype.catch;
6531
- }
6532
- })(Result || (Result = {}));
6533
-
6534
- /**
6535
- * @fileoverview added by tsickle
6536
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6537
- */
6538
- /**
6539
- * @record
6540
- * @template D, R, E
6541
- */
6542
- function ActivityOutletContext() { }
7071
+ var config = __assign({ autoFocus: false, hasBackdrop: true, closeOnNavigation: false }, this.matDialogDefaultConfig, this.dialogServiceDefaults);
7072
+ return new DialogInteractionContext(this.dialogService, config);
7073
+ };
7074
+ DialogInteractionContextFactory.decorators = [
7075
+ { type: Injectable, args: [{
7076
+ providedIn: 'root'
7077
+ },] }
7078
+ ];
7079
+ /** @nocollapse */
7080
+ DialogInteractionContextFactory.ctorParameters = function () { return [
7081
+ { type: MatDialog },
7082
+ { type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
7083
+ { type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
7084
+ ]; };
7085
+ /** @nocollapse */ DialogInteractionContextFactory.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionContextFactory_Factory() { return new DialogInteractionContextFactory(ɵɵinject(MatDialog$1), ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), ɵɵinject(MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionContextFactory, providedIn: "root" });
7086
+ return DialogInteractionContextFactory;
7087
+ }(ModalInteractionContextFactory));
6543
7088
  if (false) {
6544
7089
  /** @type {?} */
6545
- ActivityOutletContext.prototype.activityClass;
6546
- /** @type {?} */
6547
- ActivityOutletContext.prototype.activityData;
7090
+ DialogInteractionContextFactory.prototype.active;
6548
7091
  /**
6549
- * @param {?} component
6550
- * @return {?}
7092
+ * @type {?}
7093
+ * @private
6551
7094
  */
6552
- ActivityOutletContext.prototype.componentReady = function (component) { };
7095
+ DialogInteractionContextFactory.prototype.dialogService;
7096
+ /** @type {?} */
7097
+ DialogInteractionContextFactory.prototype.dialogServiceDefaults;
7098
+ /** @type {?} */
7099
+ DialogInteractionContextFactory.prototype.matDialogDefaultConfig;
6553
7100
  }
6554
7101
 
6555
7102
  /**
@@ -6626,103 +7173,6 @@ function Place(options) {
6626
7173
  }
6627
7174
  })(Place || (Place = {}));
6628
7175
 
6629
- /**
6630
- * @fileoverview added by tsickle
6631
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6632
- */
6633
- var VisitSanitiser = /** @class */ (function () {
6634
- function VisitSanitiser(activatedRoute, router, placeHistory, injector) {
6635
- this.activatedRoute = activatedRoute;
6636
- this.router = router;
6637
- this.placeHistory = placeHistory;
6638
- this.injector = injector;
6639
- }
6640
- // @Trace()
6641
- // @Trace()
6642
- /**
6643
- * @param {?} visit
6644
- * @return {?}
6645
- */
6646
- VisitSanitiser.prototype.sanitise =
6647
- // @Trace()
6648
- /**
6649
- * @param {?} visit
6650
- * @return {?}
6651
- */
6652
- function (visit) {
6653
- return __awaiter(this, void 0, void 0, function () {
6654
- var placeDef, routeIdDef, routeId, sanitisedValue, parameterDefs, sanitisedVisit, i, def, value, sanitisedValue;
6655
- return __generator(this, function (_a) {
6656
- switch (_a.label) {
6657
- case 0:
6658
- placeDef = visit.placeDefinition;
6659
- if (!placeDef.hasRouteId()) return [3 /*break*/, 2];
6660
- routeIdDef = placeDef.getRouteIdParameterDef();
6661
- routeId = visit.getRouteId();
6662
- return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector)];
6663
- case 1:
6664
- sanitisedValue = _a.sent();
6665
- // console.log({routeId, sanitisedValue});
6666
- // ###------- EARLY EXIT --------###
6667
- if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
6668
- // if the route id has changed we redirect immediately as other
6669
- // parameter sanitisers might use it.
6670
- return [2 /*return*/, visit.replace(routeIdDef, sanitisedValue)];
6671
- }
6672
- _a.label = 2;
6673
- case 2:
6674
- // if we didn't replace the routeId we continue the url present parameters.
6675
- parameterDefs = placeDef.getVisitParameterDefs({
6676
- includeRouteParameters: true,
6677
- includeNonRouteParameters: true
6678
- });
6679
- sanitisedVisit = visit;
6680
- i = 0;
6681
- _a.label = 3;
6682
- case 3:
6683
- if (!(i < parameterDefs.length)) return [3 /*break*/, 6];
6684
- def = parameterDefs[i];
6685
- value = visit.getParameter(def.name);
6686
- return [4 /*yield*/, def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector)];
6687
- case 4:
6688
- sanitisedValue = _a.sent();
6689
- if (def.hasChanged(value, sanitisedValue)) {
6690
- sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
6691
- }
6692
- _a.label = 5;
6693
- case 5:
6694
- i++;
6695
- return [3 /*break*/, 3];
6696
- case 6: return [2 /*return*/, sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit];
6697
- }
6698
- });
6699
- });
6700
- };
6701
- return VisitSanitiser;
6702
- }());
6703
- if (false) {
6704
- /**
6705
- * @type {?}
6706
- * @private
6707
- */
6708
- VisitSanitiser.prototype.activatedRoute;
6709
- /**
6710
- * @type {?}
6711
- * @private
6712
- */
6713
- VisitSanitiser.prototype.router;
6714
- /**
6715
- * @type {?}
6716
- * @private
6717
- */
6718
- VisitSanitiser.prototype.placeHistory;
6719
- /**
6720
- * @type {?}
6721
- * @private
6722
- */
6723
- VisitSanitiser.prototype.injector;
6724
- }
6725
-
6726
7176
  /**
6727
7177
  * @fileoverview added by tsickle
6728
7178
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -6827,58 +7277,190 @@ var ParamMapAdapter = /** @class */ (function () {
6827
7277
  this.params = params;
6828
7278
  }
6829
7279
  /**
6830
- * @param {?} name
7280
+ * @param {?} name
7281
+ * @return {?}
7282
+ */
7283
+ ParamMapAdapter.prototype.get = /**
7284
+ * @param {?} name
7285
+ * @return {?}
7286
+ */
7287
+ function (name) {
7288
+ return this.params[name];
7289
+ };
7290
+ /**
7291
+ * @param {?} name
7292
+ * @return {?}
7293
+ */
7294
+ ParamMapAdapter.prototype.getAll = /**
7295
+ * @param {?} name
7296
+ * @return {?}
7297
+ */
7298
+ function (name) {
7299
+ /** @type {?} */
7300
+ var value = this.get(name);
7301
+ return Array.isArray(value) ? value : [value];
7302
+ };
7303
+ /**
7304
+ * @param {?} name
7305
+ * @return {?}
7306
+ */
7307
+ ParamMapAdapter.prototype.has = /**
7308
+ * @param {?} name
7309
+ * @return {?}
7310
+ */
7311
+ function (name) {
7312
+ return this.keys.includes(name);
7313
+ };
7314
+ Object.defineProperty(ParamMapAdapter.prototype, "keys", {
7315
+ get: /**
7316
+ * @return {?}
7317
+ */
7318
+ function () {
7319
+ return Object.keys(this.params);
7320
+ },
7321
+ enumerable: true,
7322
+ configurable: true
7323
+ });
7324
+ return ParamMapAdapter;
7325
+ }());
7326
+ if (false) {
7327
+ /**
7328
+ * @type {?}
7329
+ * @private
7330
+ */
7331
+ ParamMapAdapter.prototype.params;
7332
+ }
7333
+
7334
+ /**
7335
+ * @fileoverview added by tsickle
7336
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7337
+ */
7338
+ var NoopAuthGuard = /** @class */ (function () {
7339
+ function NoopAuthGuard() {
7340
+ }
7341
+ /**
7342
+ * @param {?} activatedRoute
7343
+ * @param {?} state
7344
+ * @return {?}
7345
+ */
7346
+ NoopAuthGuard.prototype.canActivate = /**
7347
+ * @param {?} activatedRoute
7348
+ * @param {?} state
7349
+ * @return {?}
7350
+ */
7351
+ function (activatedRoute, state) {
7352
+ return __awaiter(this, void 0, void 0, function () {
7353
+ return __generator(this, function (_a) {
7354
+ return [2 /*return*/, true];
7355
+ });
7356
+ });
7357
+ };
7358
+ NoopAuthGuard.decorators = [
7359
+ { type: Injectable, args: [{
7360
+ providedIn: 'root'
7361
+ },] }
7362
+ ];
7363
+ /** @nocollapse */
7364
+ NoopAuthGuard.ctorParameters = function () { return []; };
7365
+ /** @nocollapse */ NoopAuthGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function NoopAuthGuard_Factory() { return new NoopAuthGuard(); }, token: NoopAuthGuard, providedIn: "root" });
7366
+ return NoopAuthGuard;
7367
+ }());
7368
+
7369
+ /**
7370
+ * @fileoverview added by tsickle
7371
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7372
+ */
7373
+ var VisitSanitiser = /** @class */ (function () {
7374
+ function VisitSanitiser(activatedRoute, router, placeHistory, injector) {
7375
+ this.activatedRoute = activatedRoute;
7376
+ this.router = router;
7377
+ this.placeHistory = placeHistory;
7378
+ this.injector = injector;
7379
+ }
7380
+ // @Trace()
7381
+ // @Trace()
7382
+ /**
7383
+ * @param {?} visit
6831
7384
  * @return {?}
6832
7385
  */
6833
- ParamMapAdapter.prototype.get = /**
6834
- * @param {?} name
7386
+ VisitSanitiser.prototype.sanitise =
7387
+ // @Trace()
7388
+ /**
7389
+ * @param {?} visit
6835
7390
  * @return {?}
6836
7391
  */
6837
- function (name) {
6838
- return this.params[name];
7392
+ function (visit) {
7393
+ return __awaiter(this, void 0, void 0, function () {
7394
+ var placeDef, routeIdDef, routeId, sanitisedValue, parameterDefs, sanitisedVisit, i, def, value, sanitisedValue;
7395
+ return __generator(this, function (_a) {
7396
+ switch (_a.label) {
7397
+ case 0:
7398
+ placeDef = visit.placeDefinition;
7399
+ if (!placeDef.hasRouteId()) return [3 /*break*/, 2];
7400
+ routeIdDef = placeDef.getRouteIdParameterDef();
7401
+ routeId = visit.getRouteId();
7402
+ return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector)];
7403
+ case 1:
7404
+ sanitisedValue = _a.sent();
7405
+ // console.log({routeId, sanitisedValue});
7406
+ // ###------- EARLY EXIT --------###
7407
+ if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
7408
+ // if the route id has changed we redirect immediately as other
7409
+ // parameter sanitisers might use it.
7410
+ return [2 /*return*/, visit.replace(routeIdDef, sanitisedValue)];
7411
+ }
7412
+ _a.label = 2;
7413
+ case 2:
7414
+ // if we didn't replace the routeId we continue the url present parameters.
7415
+ parameterDefs = placeDef.getVisitParameterDefs({
7416
+ includeRouteParameters: true,
7417
+ includeNonRouteParameters: true
7418
+ });
7419
+ sanitisedVisit = visit;
7420
+ i = 0;
7421
+ _a.label = 3;
7422
+ case 3:
7423
+ if (!(i < parameterDefs.length)) return [3 /*break*/, 6];
7424
+ def = parameterDefs[i];
7425
+ value = visit.getParameter(def.name);
7426
+ return [4 /*yield*/, def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector)];
7427
+ case 4:
7428
+ sanitisedValue = _a.sent();
7429
+ if (def.hasChanged(value, sanitisedValue)) {
7430
+ sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
7431
+ }
7432
+ _a.label = 5;
7433
+ case 5:
7434
+ i++;
7435
+ return [3 /*break*/, 3];
7436
+ case 6: return [2 /*return*/, sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit];
7437
+ }
7438
+ });
7439
+ });
6839
7440
  };
7441
+ return VisitSanitiser;
7442
+ }());
7443
+ if (false) {
6840
7444
  /**
6841
- * @param {?} name
6842
- * @return {?}
6843
- */
6844
- ParamMapAdapter.prototype.getAll = /**
6845
- * @param {?} name
6846
- * @return {?}
7445
+ * @type {?}
7446
+ * @private
6847
7447
  */
6848
- function (name) {
6849
- /** @type {?} */
6850
- var value = this.get(name);
6851
- return Array.isArray(value) ? value : [value];
6852
- };
7448
+ VisitSanitiser.prototype.activatedRoute;
6853
7449
  /**
6854
- * @param {?} name
6855
- * @return {?}
7450
+ * @type {?}
7451
+ * @private
6856
7452
  */
6857
- ParamMapAdapter.prototype.has = /**
6858
- * @param {?} name
6859
- * @return {?}
7453
+ VisitSanitiser.prototype.router;
7454
+ /**
7455
+ * @type {?}
7456
+ * @private
6860
7457
  */
6861
- function (name) {
6862
- return this.keys.includes(name);
6863
- };
6864
- Object.defineProperty(ParamMapAdapter.prototype, "keys", {
6865
- get: /**
6866
- * @return {?}
6867
- */
6868
- function () {
6869
- return Object.keys(this.params);
6870
- },
6871
- enumerable: true,
6872
- configurable: true
6873
- });
6874
- return ParamMapAdapter;
6875
- }());
6876
- if (false) {
7458
+ VisitSanitiser.prototype.placeHistory;
6877
7459
  /**
6878
7460
  * @type {?}
6879
7461
  * @private
6880
7462
  */
6881
- ParamMapAdapter.prototype.params;
7463
+ VisitSanitiser.prototype.injector;
6882
7464
  }
6883
7465
 
6884
7466
  /**
@@ -6888,12 +7470,16 @@ if (false) {
6888
7470
  /**
6889
7471
  * @abstract
6890
7472
  */
6891
- var AbstractPlaceGuard = /** @class */ (function () {
6892
- function AbstractPlaceGuard(router, urlSerializer, placeRouter, placeHistory, injector) {
7473
+ var /**
7474
+ * @abstract
7475
+ */
7476
+ PlaceGuard = /** @class */ (function () {
7477
+ function PlaceGuard(router, urlSerializer, placeRouter, placeHistory, interactionService, injector) {
6893
7478
  this.router = router;
6894
7479
  this.urlSerializer = urlSerializer;
6895
7480
  this.placeRouter = placeRouter;
6896
7481
  this.placeHistory = placeHistory;
7482
+ this.interactionService = interactionService;
6897
7483
  this.injector = injector;
6898
7484
  }
6899
7485
  // @Trace()
@@ -6903,7 +7489,7 @@ var AbstractPlaceGuard = /** @class */ (function () {
6903
7489
  * @param {?} state
6904
7490
  * @return {?}
6905
7491
  */
6906
- AbstractPlaceGuard.prototype.canActivate =
7492
+ PlaceGuard.prototype.canActivate =
6907
7493
  // @Trace()
6908
7494
  /**
6909
7495
  * @param {?} activatedRoute
@@ -6914,44 +7500,59 @@ var AbstractPlaceGuard = /** @class */ (function () {
6914
7500
  return __awaiter(this, void 0, void 0, function () {
6915
7501
  var _this = this;
6916
7502
  return __generator(this, function (_a) {
7503
+ // TODO: this is ugly now that I'm return UrlSnapshots and not UrlTrees. It'd be better if the functions
7504
+ // weren't nested or if I implemented a handler chain.
6917
7505
  return [2 /*return*/, this.authorisePlaceThen(activatedRoute, state, (/**
6918
7506
  * @param {?} placeDefinition
6919
7507
  * @return {?}
6920
7508
  */
6921
7509
  function (placeDefinition) { return __awaiter(_this, void 0, void 0, function () {
6922
- var params, parsedParams, initialVisit, sanitiser, sanitisedVisit, commands;
7510
+ var result;
7511
+ var _this = this;
6923
7512
  return __generator(this, function (_a) {
6924
7513
  switch (_a.label) {
6925
- case 0:
6926
- // Parse our route params.
6927
- params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
6928
- parsedParams = placeDefinition.parseRouteParams(params);
6929
- initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
6930
- sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
6931
- return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
7514
+ case 0: return [4 /*yield*/, this.cleanInteractionState(activatedRoute, state, (/**
7515
+ * @return {?}
7516
+ */
7517
+ function () { return __awaiter(_this, void 0, void 0, function () {
7518
+ var params, parsedParams, initialVisit, sanitiser, sanitisedVisit, urlSnapshot;
7519
+ return __generator(this, function (_a) {
7520
+ switch (_a.label) {
7521
+ case 0:
7522
+ // Parse our route params.
7523
+ params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
7524
+ parsedParams = placeDefinition.parseRouteParams(params);
7525
+ initialVisit = this.placeRouter.navigationState.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
7526
+ sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
7527
+ return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
7528
+ case 1:
7529
+ sanitisedVisit = _a.sent();
7530
+ // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
7531
+ this.placeRouter.navigationState.storeVisit(sanitisedVisit);
7532
+ if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
7533
+ // Regenerate the url
7534
+ urlSnapshot = this.placeRouter.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
7535
+ console.log('##### Place Guard Redirect', urlSnapshot);
7536
+ return [2 /*return*/, urlSnapshot];
7537
+ }
7538
+ else {
7539
+ return [2 /*return*/, true];
7540
+ }
7541
+ return [2 /*return*/];
7542
+ }
7543
+ });
7544
+ }); }))];
6932
7545
  case 1:
6933
- sanitisedVisit = _a.sent();
6934
- // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
6935
- this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
6936
- if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
6937
- // Regenerate the url
6938
- commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
6939
- console.log('##### Place Guard Redirect', commands);
6940
- return [2 /*return*/, this.router.createUrlTree(commands, {
6941
- replaceUrl: true,
6942
- skipLocationChange: false
6943
- })];
6944
- }
6945
- else {
6946
- return [2 /*return*/, true];
6947
- }
6948
- return [2 /*return*/];
7546
+ result = _a.sent();
7547
+ return [2 /*return*/, this.handleGuardResult(result)];
6949
7548
  }
6950
7549
  });
6951
7550
  }); }))];
6952
7551
  });
6953
7552
  });
6954
7553
  };
7554
+ // @Trace()
7555
+ // @Trace()
6955
7556
  /**
6956
7557
  * @param {?} component
6957
7558
  * @param {?} currentRoute
@@ -6959,7 +7560,9 @@ var AbstractPlaceGuard = /** @class */ (function () {
6959
7560
  * @param {?=} nextState
6960
7561
  * @return {?}
6961
7562
  */
6962
- AbstractPlaceGuard.prototype.canDeactivate = /**
7563
+ PlaceGuard.prototype.canDeactivate =
7564
+ // @Trace()
7565
+ /**
6963
7566
  * @param {?} component
6964
7567
  * @param {?} currentRoute
6965
7568
  * @param {?} currentState
@@ -6968,32 +7571,59 @@ var AbstractPlaceGuard = /** @class */ (function () {
6968
7571
  */
6969
7572
  function (component, currentRoute, currentState, nextState) {
6970
7573
  return __awaiter(this, void 0, void 0, function () {
7574
+ var currentUrl, nextUrl, result;
6971
7575
  return __generator(this, function (_a) {
6972
- return [2 /*return*/, this.placeRouter.navigationSession.canDeactivatePlace(component, this.placeRouter.parseUrl(nextState))];
7576
+ switch (_a.label) {
7577
+ case 0:
7578
+ currentUrl = this.placeRouter.parseUrl(currentState.url);
7579
+ nextUrl = this.placeRouter.parseUrl(nextState.url);
7580
+ return [4 /*yield*/, this.placeRouter.navigationState.canDeactivatePlace(component, currentUrl, nextUrl)];
7581
+ case 1:
7582
+ result = _a.sent();
7583
+ return [2 /*return*/, this.handleGuardResult(result)];
7584
+ }
6973
7585
  });
6974
7586
  });
6975
7587
  };
7588
+ /**
7589
+ * @private
7590
+ * @param {?} result
7591
+ * @return {?}
7592
+ */
7593
+ PlaceGuard.prototype.handleGuardResult = /**
7594
+ * @private
7595
+ * @param {?} result
7596
+ * @return {?}
7597
+ */
7598
+ function (result) {
7599
+ if (result instanceof UrlSnapshot) {
7600
+ return result.urlTree;
7601
+ }
7602
+ else {
7603
+ return result;
7604
+ }
7605
+ };
6976
7606
  // @Trace()
6977
7607
  // @Trace()
6978
7608
  /**
6979
7609
  * @protected
6980
7610
  * @param {?} activatedRoute
6981
7611
  * @param {?} state
6982
- * @param {?} canActivate
7612
+ * @param {?} runPlaceGuards
6983
7613
  * @return {?}
6984
7614
  */
6985
- AbstractPlaceGuard.prototype.authorisePlaceThen =
7615
+ PlaceGuard.prototype.authorisePlaceThen =
6986
7616
  // @Trace()
6987
7617
  /**
6988
7618
  * @protected
6989
7619
  * @param {?} activatedRoute
6990
7620
  * @param {?} state
6991
- * @param {?} canActivate
7621
+ * @param {?} runPlaceGuards
6992
7622
  * @return {?}
6993
7623
  */
6994
- function (activatedRoute, state, canActivate) {
7624
+ function (activatedRoute, state, runPlaceGuards) {
6995
7625
  return __awaiter(this, void 0, void 0, function () {
6996
- var placeDefinition, authorised, _a;
7626
+ var placeDefinition, authoriseResult, _a;
6997
7627
  return __generator(this, function (_b) {
6998
7628
  switch (_b.label) {
6999
7629
  case 0:
@@ -7008,13 +7638,14 @@ var AbstractPlaceGuard = /** @class */ (function () {
7008
7638
  _a = true;
7009
7639
  _b.label = 3;
7010
7640
  case 3:
7011
- authorised = _a;
7012
- if (authorised === true) {
7013
- return [2 /*return*/, canActivate(placeDefinition)];
7641
+ authoriseResult = _a;
7642
+ if (authoriseResult === true) {
7643
+ // we're authorised, now run the place guards.
7644
+ return [2 /*return*/, runPlaceGuards(placeDefinition)];
7014
7645
  }
7015
7646
  else {
7016
- console.log('not authorised result', authorised);
7017
- return [2 /*return*/, authorised];
7647
+ console.log('not authorised result', authoriseResult);
7648
+ return [2 /*return*/, authoriseResult];
7018
7649
  }
7019
7650
  return [3 /*break*/, 5];
7020
7651
  case 4: return [2 /*return*/, lang.illegalState("expected component to be an instance of PlaceComponent, got " + activatedRoute.component)];
@@ -7023,12 +7654,16 @@ var AbstractPlaceGuard = /** @class */ (function () {
7023
7654
  });
7024
7655
  });
7025
7656
  };
7657
+ // @Trace()
7658
+ // @Trace()
7026
7659
  /**
7027
7660
  * @param {?} activatedRoute
7028
7661
  * @param {?} state
7029
7662
  * @return {?}
7030
7663
  */
7031
- AbstractPlaceGuard.prototype.isAuthorised = /**
7664
+ PlaceGuard.prototype.isAuthorised =
7665
+ // @Trace()
7666
+ /**
7032
7667
  * @param {?} activatedRoute
7033
7668
  * @param {?} state
7034
7669
  * @return {?}
@@ -7042,195 +7677,79 @@ var AbstractPlaceGuard = /** @class */ (function () {
7042
7677
  });
7043
7678
  });
7044
7679
  };
7045
- __decorate([
7046
- Trace(),
7047
- __metadata("design:type", Function),
7048
- __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
7049
- __metadata("design:returntype", Promise)
7050
- ], AbstractPlaceGuard.prototype, "isAuthorised", null);
7051
- return AbstractPlaceGuard;
7052
- }());
7053
- if (false) {
7054
- /**
7055
- * @type {?}
7056
- * @private
7057
- */
7058
- AbstractPlaceGuard.prototype.router;
7059
- /**
7060
- * @type {?}
7061
- * @private
7062
- */
7063
- AbstractPlaceGuard.prototype.urlSerializer;
7064
- /**
7065
- * @type {?}
7066
- * @private
7067
- */
7068
- AbstractPlaceGuard.prototype.placeRouter;
7069
- /**
7070
- * @type {?}
7071
- * @private
7072
- */
7073
- AbstractPlaceGuard.prototype.placeHistory;
7074
- /**
7075
- * @type {?}
7076
- * @private
7077
- */
7078
- AbstractPlaceGuard.prototype.injector;
7079
- /**
7080
- * @abstract
7081
- * @param {?} injector
7082
- * @return {?}
7083
- */
7084
- AbstractPlaceGuard.prototype.getAuthGuard = function (injector) { };
7085
- }
7086
-
7087
- /**
7088
- * @fileoverview added by tsickle
7089
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7090
- */
7091
- var InteractionGuard = /** @class */ (function () {
7092
- function InteractionGuard(router, injector, placeRouter, angularLocation, modalInteractionService) {
7093
- this.router = router;
7094
- this.injector = injector;
7095
- this.placeRouter = placeRouter;
7096
- this.angularLocation = angularLocation;
7097
- this.modalInteractionService = modalInteractionService;
7098
- }
7680
+ // @Trace()
7681
+ // @Trace()
7099
7682
  /**
7100
7683
  * @param {?} route
7101
7684
  * @param {?} state
7685
+ * @param {?} then
7102
7686
  * @return {?}
7103
7687
  */
7104
- InteractionGuard.prototype.canActivate = /**
7688
+ PlaceGuard.prototype.cleanInteractionState =
7689
+ // @Trace()
7690
+ /**
7105
7691
  * @param {?} route
7106
7692
  * @param {?} state
7693
+ * @param {?} then
7107
7694
  * @return {?}
7108
7695
  */
7109
- function (route, state) {
7110
- /** @type {?} */
7111
- var url = this.router.parseUrl(state.url);
7112
- if (!this.modalInteractionService.isActive() && url.root.children[PlaceRouter.INTERACTION_ROUTER_OUTLET]) {
7113
- // This happens if we reload the page or the url was pasted as the route should only be activated
7114
- // after the interaction context has become active.
7115
- delete url.root.children[PlaceRouter.INTERACTION_ROUTER_OUTLET];
7116
- return url;
7117
- }
7118
- else {
7119
- return true;
7120
- }
7121
- };
7122
- /**
7123
- * @param {?} component
7124
- * @param {?} currentRoute
7125
- * @param {?} currentState
7126
- * @param {?=} nextState
7127
- * @return {?}
7128
- */
7129
- InteractionGuard.prototype.canDeactivate = /**
7130
- * @param {?} component
7131
- * @param {?} currentRoute
7132
- * @param {?} currentState
7133
- * @param {?=} nextState
7134
- * @return {?}
7135
- */
7136
- function (component, currentRoute, currentState, nextState) {
7696
+ function (route, state, then) {
7137
7697
  return __awaiter(this, void 0, void 0, function () {
7138
- var popstateReturnUrl, activity;
7698
+ var url;
7139
7699
  return __generator(this, function (_a) {
7140
- switch (_a.label) {
7141
- case 0:
7142
- popstateReturnUrl = this.placeRouter.navigationSession.startingUrl;
7143
- if (!this.modalInteractionService.isActive()) return [3 /*break*/, 2];
7144
- // The activity is still active so the route change was triggered by the back button.
7145
- return [4 /*yield*/, this.modalInteractionService.getCurrentActivity()];
7146
- case 1:
7147
- activity = _a.sent();
7148
- activity.cancel();
7149
- // See ModalInteractionSession#onStart() for the url updating.
7150
- return [2 /*return*/, false];
7151
- case 2: return [2 /*return*/, true];
7700
+ url = this.placeRouter.parseUrl(state.url);
7701
+ if (!this.interactionService.isActive() && url.hasInteractionIds()) {
7702
+ // This happens if we reload the page or the url was pasted as the route should only be activated
7703
+ // after the interaction context has become active.
7704
+ return [2 /*return*/, url.removeInteractionIds()];
7705
+ }
7706
+ else {
7707
+ return [2 /*return*/, then()];
7152
7708
  }
7709
+ return [2 /*return*/];
7153
7710
  });
7154
7711
  });
7155
7712
  };
7156
- InteractionGuard.decorators = [
7157
- { type: Injectable, args: [{
7158
- providedIn: 'root'
7159
- },] }
7160
- ];
7161
- /** @nocollapse */
7162
- InteractionGuard.ctorParameters = function () { return [
7163
- { type: Router },
7164
- { type: Injector },
7165
- { type: PlaceRouter },
7166
- { type: Location },
7167
- { type: ModalInteractionService }
7168
- ]; };
7169
- /** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(PlaceRouter), ɵɵinject(Location), ɵɵinject(ModalInteractionService)); }, token: InteractionGuard, providedIn: "root" });
7170
- return InteractionGuard;
7713
+ return PlaceGuard;
7171
7714
  }());
7172
7715
  if (false) {
7173
7716
  /**
7174
7717
  * @type {?}
7175
7718
  * @private
7176
7719
  */
7177
- InteractionGuard.prototype.router;
7720
+ PlaceGuard.prototype.router;
7178
7721
  /**
7179
7722
  * @type {?}
7180
7723
  * @private
7181
7724
  */
7182
- InteractionGuard.prototype.injector;
7725
+ PlaceGuard.prototype.urlSerializer;
7183
7726
  /**
7184
7727
  * @type {?}
7185
7728
  * @private
7186
7729
  */
7187
- InteractionGuard.prototype.placeRouter;
7730
+ PlaceGuard.prototype.placeRouter;
7188
7731
  /**
7189
7732
  * @type {?}
7190
7733
  * @private
7191
7734
  */
7192
- InteractionGuard.prototype.angularLocation;
7735
+ PlaceGuard.prototype.placeHistory;
7193
7736
  /**
7194
7737
  * @type {?}
7195
7738
  * @private
7196
7739
  */
7197
- InteractionGuard.prototype.modalInteractionService;
7198
- }
7199
-
7200
- /**
7201
- * @fileoverview added by tsickle
7202
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7203
- */
7204
- var NoopAuthGuard = /** @class */ (function () {
7205
- function NoopAuthGuard() {
7206
- }
7740
+ PlaceGuard.prototype.interactionService;
7207
7741
  /**
7208
- * @param {?} activatedRoute
7209
- * @param {?} state
7210
- * @return {?}
7742
+ * @type {?}
7743
+ * @private
7211
7744
  */
7212
- NoopAuthGuard.prototype.canActivate = /**
7213
- * @param {?} activatedRoute
7214
- * @param {?} state
7745
+ PlaceGuard.prototype.injector;
7746
+ /**
7747
+ * @abstract
7748
+ * @param {?} injector
7215
7749
  * @return {?}
7216
7750
  */
7217
- function (activatedRoute, state) {
7218
- return __awaiter(this, void 0, void 0, function () {
7219
- return __generator(this, function (_a) {
7220
- return [2 /*return*/, true];
7221
- });
7222
- });
7223
- };
7224
- NoopAuthGuard.decorators = [
7225
- { type: Injectable, args: [{
7226
- providedIn: 'root'
7227
- },] }
7228
- ];
7229
- /** @nocollapse */
7230
- NoopAuthGuard.ctorParameters = function () { return []; };
7231
- /** @nocollapse */ NoopAuthGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function NoopAuthGuard_Factory() { return new NoopAuthGuard(); }, token: NoopAuthGuard, providedIn: "root" });
7232
- return NoopAuthGuard;
7233
- }());
7751
+ PlaceGuard.prototype.getAuthGuard = function (injector) { };
7752
+ }
7234
7753
 
7235
7754
  /**
7236
7755
  * @fileoverview added by tsickle
@@ -7512,5 +8031,5 @@ if (false) {
7512
8031
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7513
8032
  */
7514
8033
 
7515
- export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractInputComponent, AbstractPlaceGuard, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext, DialogInteractionService, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionContextBase, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ModalInteractionService, NavigationState, NoopAuthGuard, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, UrlSnapshot, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, ActivityContainerComponent as ɵba, InteractionContextBase as ɵbb, InteractionContext as ɵbc, ActivityOutletComponent as ɵbd, ConfirmationDialogComponent as ɵbe, AbstractActivity as ɵbf, ACTIVITY_DATA as ɵbg, Activity as ɵbh, ConfirmThenDialogComponent as ɵbj, AlertDialogComponent as ɵbk, InteractionOutletComponent as ɵbm, InplaceInteractionContextComponent as ɵbn, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbo, DialogInteractionService as ɵbp, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, PlaceHistory as ɵu, ModalInteractionService as ɵv, TabbedPlaceNavigationComponent as ɵw, AbstractPlaceNavigationComponent as ɵx, ListPlaceNavComponent as ɵy, InteractionModule as ɵz };
8034
+ export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionContextBase, InteractionModule, InteractionOutletComponent, InteractionService, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ModalInteractionContextFactory, NavigationState, NoopAuthGuard, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, UrlSnapshot, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, InteractionModule as ɵba, ActivityContainerComponent as ɵbb, InteractionContextBase as ɵbc, InteractionContext as ɵbd, ActivityOutletComponent as ɵbe, ConfirmationDialogComponent as ɵbf, AbstractActivity as ɵbg, ACTIVITY_DATA as ɵbh, Activity as ɵbi, ConfirmThenDialogComponent as ɵbk, AlertDialogComponent as ɵbl, InteractionOutletComponent as ɵbn, InplaceInteractionContextComponent as ɵbo, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, PlaceHistory as ɵu, InteractionService as ɵv, ModalInteractionContextFactory as ɵw, TabbedPlaceNavigationComponent as ɵx, AbstractPlaceNavigationComponent as ɵy, ListPlaceNavComponent as ɵz };
7516
8035
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map