@sbb-esta/lyne-elements-experimental 4.0.1 → 4.0.2

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 (22) hide show
  1. package/custom-elements.json +198 -50
  2. package/development/pearl-chain/pearl-chain.component.js +1 -3
  3. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +11 -5
  4. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts.map +1 -1
  5. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.js +116 -56
  6. package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
  7. package/development/seat-reservation/seat-reservation/seat-reservation.component.js +145 -259
  8. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.d.ts.map +1 -1
  9. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +11 -8
  10. package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +1 -1
  11. package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +153 -45
  12. package/package.json +2 -2
  13. package/pearl-chain/pearl-chain.component.js +1 -1
  14. package/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +11 -5
  15. package/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts.map +1 -1
  16. package/seat-reservation/seat-reservation/seat-reservation-base-element.js +201 -175
  17. package/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
  18. package/seat-reservation/seat-reservation/seat-reservation.component.js +188 -194
  19. package/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.d.ts.map +1 -1
  20. package/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +31 -28
  21. package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +1 -1
  22. package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +143 -142
@@ -1,19 +1,19 @@
1
1
  var fe = (n) => {
2
2
  throw TypeError(n);
3
3
  };
4
- var Se = (n, d, u) => d.has(n) || fe("Cannot " + u);
5
- var g = (n, d, u) => (Se(n, d, "read from private field"), u ? u.call(n) : d.get(n)), v = (n, d, u) => d.has(n) ? fe("Cannot add the same private member more than once") : d instanceof WeakSet ? d.add(n) : d.set(n, u), r = (n, d, u, D) => (Se(n, d, "write to private field"), D ? D.call(n, u) : d.set(n, u), u);
4
+ var Ce = (n, d, u) => d.has(n) || fe("Cannot " + u);
5
+ var g = (n, d, u) => (Ce(n, d, "read from private field"), u ? u.call(n) : d.get(n)), v = (n, d, u) => d.has(n) ? fe("Cannot add the same private member more than once") : d instanceof WeakSet ? d.add(n) : d.set(n, u), r = (n, d, u, D) => (Ce(n, d, "write to private field"), D ? D.call(n, u) : d.set(n, u), u);
6
6
  import { __runInitializers as l, __esDecorate as f } from "tslib";
7
- import { isArrowKeyOrPageKeysPressed as Ie } from "@sbb-esta/lyne-elements/core/a11y.js";
8
- import { forceType as C } from "@sbb-esta/lyne-elements/core/decorators.js";
7
+ import { isArrowKeyOrPageKeysPressed as Se } from "@sbb-esta/lyne-elements/core/a11y.js";
8
+ import { forceType as S } from "@sbb-esta/lyne-elements/core/decorators.js";
9
9
  import { LitElement as xe, isServer as pe } from "lit";
10
- import { property as S, state as T, eventOptions as me } from "lit/decorators.js";
11
- import { mapIconToSvg as Ce, mapPlaceInfosToPlaceSelection as _e, mapPlaceAndCoachToSeatReservationPlaceSelection as ye, mapCoachInfosToCoachSelection as be } from "../common/mapper.js";
10
+ import { property as C, state as T, eventOptions as _e } from "lit/decorators.js";
11
+ import { mapIconToSvg as Ie, mapPlaceInfosToPlaceSelection as me, mapPlaceAndCoachToSeatReservationPlaceSelection as ye, mapCoachInfosToCoachSelection as be } from "../common/mapper.js";
12
12
  var I;
13
13
  (function(n) {
14
14
  n.right = "right", n.left = "left";
15
15
  })(I || (I = {}));
16
- const Pe = 3, Ae = [
16
+ const Pe = 3, Ne = [
17
17
  "sa-vo",
18
18
  "sa-rs",
19
19
  "sa-abteilkinderwagen",
@@ -23,24 +23,24 @@ const Pe = 3, Ae = [
23
23
  "sa-rz"
24
24
  ];
25
25
  let ze = (() => {
26
- var x, p, m, _, y, b, P, A, R, k, N, E, h;
27
- let n = xe, d = [], u, D = [], B = [], z, F = [], V = [], O, G = [], L = [], W, X = [], K = [], H, U = [], q = [], M, $ = [], j = [], Y, J = [], Q = [], Z, ee = [], te = [], se, ie = [], ae = [], ce, oe = [], re = [], le, ne = [], he = [], de, ue = [], ge = [], ve;
26
+ var x, p, _, m, y, b, P, N, A, R, k, E, h;
27
+ let n = xe, d = [], u, D = [], B = [], z, F = [], V = [], G, O = [], L = [], K, W = [], X = [], H, U = [], M = [], q, $ = [], j = [], Y, J = [], Q = [], Z, ee = [], te = [], ie, se = [], ae = [], ce, oe = [], re = [], le, ne = [], he = [], de, ue = [], ge = [], ve;
28
28
  return h = class extends n {
29
29
  constructor() {
30
30
  super(...arguments);
31
31
  v(this, x);
32
32
  v(this, p);
33
- v(this, m);
34
33
  v(this, _);
34
+ v(this, m);
35
35
  v(this, y);
36
36
  v(this, b);
37
37
  v(this, P);
38
+ v(this, N);
38
39
  v(this, A);
39
40
  v(this, R);
40
41
  v(this, k);
41
- v(this, N);
42
42
  v(this, E);
43
- r(this, x, (l(this, d), l(this, D, null))), r(this, p, (l(this, B), l(this, F, !0))), r(this, m, (l(this, V), l(this, G, !1))), r(this, _, (l(this, L), l(this, X, 16))), r(this, y, (l(this, K), l(this, U, null))), r(this, b, (l(this, q), l(this, $, -1))), r(this, P, (l(this, j), l(this, J, -1))), r(this, A, (l(this, Q), l(this, ee, !1))), r(this, R, (l(this, te), l(this, ie, -1))), r(this, k, (l(this, ae), l(this, oe, -1))), r(this, N, (l(this, re), l(this, ne, -1))), r(this, E, (l(this, he), l(this, ue, -1))), this.coachBorderPadding = (l(this, ge), 6), this.gapBetweenCoaches = 4, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.gapBetweenCoachDecks = 48, this.coachNavButtonDim = 0, this.coachNavData = [], this.currScrollDirection = I.right, this.maxCalcCoachsWidth = 0, this.scrollCoachsAreaWidth = 0, this.scrollNavigationAreaDim = 0, this.triggerCoachPositionsCollection = [], this.firstTabElement = null, this.lastTabElement = null, this.navigationScrollArea = null, this.coachScrollArea = null, this.currSelectedPlace = null, this.currSelectedPlaceElementId = null, this.currSelectedCoachIndex = -1, this.currSelectedDeckIndex = 0, this.preventCoachScrollByPlaceClick = !1, this.selectedSeatReservationPlaces = {
43
+ r(this, x, (l(this, d), l(this, D, null))), r(this, p, (l(this, B), l(this, F, !0))), r(this, _, (l(this, V), l(this, O, !1))), r(this, m, (l(this, L), l(this, W, 16))), r(this, y, (l(this, X), l(this, U, null))), r(this, b, (l(this, M), l(this, $, -1))), r(this, P, (l(this, j), l(this, J, -1))), r(this, N, (l(this, Q), l(this, ee, !1))), r(this, A, (l(this, te), l(this, se, -1))), r(this, R, (l(this, ae), l(this, oe, -1))), r(this, k, (l(this, re), l(this, ne, -1))), r(this, E, (l(this, he), l(this, ue, -1))), this.coachBorderPadding = (l(this, ge), 6), this.gapBetweenCoaches = 4, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.gapBetweenCoachDecks = 48, this.coachNavButtonDim = 0, this.coachNavData = [], this.currScrollDirection = I.right, this.maxCalcCoachsWidth = 0, this.scrollCoachsAreaWidth = 0, this.scrollNavigationAreaDim = 0, this.triggerCoachPositionsCollection = [], this.navigationScrollArea = null, this.coachScrollArea = null, this.currSelectedPlace = null, this.currSelectedPlaceElementId = null, this.currSelectedCoachIndex = -1, this.currSelectedDeckIndex = 0, this.preventCoachScrollByPlaceClick = !1, this.selectedSeatReservationPlaces = {
44
44
  seats: [],
45
45
  bicycles: []
46
46
  }, this.seatReservationWithoutNavigationHasFocus = !1, this.isCoachGridFocusable = !1, this.isAutoScrolling = !1, this.isKeyboardNavigation = !1, this.hasMultipleDecks = !1, this.hasSeatReservationNativeFocus = !1, this.keyboardNavigationEvents = {
@@ -50,15 +50,15 @@ let ze = (() => {
50
50
  ArrowDown: "ArrowDown",
51
51
  Tab: "Tab",
52
52
  Enter: "Enter"
53
- }, this._prepareServiceIconsNavigation = (e) => {
53
+ }, this._isRunningInitPreselectCoachIndex = !1, this._lastStartScrollPos = -1, this._prepareServiceIconsNavigation = (e) => {
54
54
  if (!e)
55
55
  return [];
56
- const t = e?.map(function(s) {
56
+ const t = e?.map(function(i) {
57
57
  return {
58
- pId: s,
59
- svgName: Ce[s]?.svgName ? Ce[s]?.svgName : ""
58
+ pId: i,
59
+ svgName: Ie[i]?.svgName ? Ie[i]?.svgName : ""
60
60
  };
61
- }).filter((s) => Ae.indexOf(s.svgName) !== -1).filter((s, i, a) => a.map((o) => o.svgName).indexOf(s.svgName) === i).map((s) => s.pId).slice(0, Pe);
61
+ }).filter((i) => Ne.indexOf(i.svgName) !== -1).filter((i, s, a) => a.map((o) => o.svgName).indexOf(i.svgName) === s).map((i) => i.pId).slice(0, Pe);
62
62
  return t || [];
63
63
  };
64
64
  }
@@ -78,17 +78,17 @@ let ze = (() => {
78
78
  }
79
79
  /** The seat reservation area is aligned vertically */
80
80
  get alignVertical() {
81
- return g(this, m);
81
+ return g(this, _);
82
82
  }
83
83
  set alignVertical(e) {
84
- r(this, m, e);
84
+ r(this, _, e);
85
85
  }
86
86
  /** The seat reservation area's base grid size */
87
87
  get baseGridSize() {
88
- return g(this, _);
88
+ return g(this, m);
89
89
  }
90
90
  set baseGridSize(e) {
91
- r(this, _, e);
91
+ r(this, m, e);
92
92
  }
93
93
  /** The seat reservation area's width */
94
94
  get height() {
@@ -113,34 +113,33 @@ let ze = (() => {
113
113
  }
114
114
  /** Any click functionality is prevented */
115
115
  get preventPlaceClick() {
116
- return g(this, A);
116
+ return g(this, N);
117
117
  }
118
118
  set preventPlaceClick(e) {
119
- r(this, A, e);
119
+ r(this, N, e);
120
120
  }
121
121
  get preselectCoachIndex() {
122
- return g(this, R);
122
+ return g(this, A);
123
123
  }
124
124
  set preselectCoachIndex(e) {
125
- r(this, R, e);
125
+ r(this, A, e);
126
126
  }
127
127
  get selectedCoachIndex() {
128
- return g(this, k);
128
+ return g(this, R);
129
129
  }
130
130
  set selectedCoachIndex(e) {
131
- r(this, k, e);
131
+ r(this, R, e);
132
132
  }
133
133
  get focusedCoachIndex() {
134
- return g(this, N);
134
+ return g(this, k);
135
135
  }
136
136
  set focusedCoachIndex(e) {
137
- r(this, N, e);
137
+ r(this, k, e);
138
138
  }
139
- //Sets the hover style when scrolling to a coach
140
- get hoveredScrollCoachIndex() {
139
+ get hoveredCoachIndex() {
141
140
  return g(this, E);
142
141
  }
143
- set hoveredScrollCoachIndex(e) {
142
+ set hoveredCoachIndex(e) {
144
143
  r(this, E, e);
145
144
  }
146
145
  willUpdate(e) {
@@ -148,7 +147,7 @@ let ze = (() => {
148
147
  const t = this.seatReservations[this.currSelectedDeckIndex] || null;
149
148
  t?.coachItems.length && (this.baseGridSize = this.height / t.coachItems[0].dimension.h, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.initNavigationSelectionByScrollEvent());
150
149
  }
151
- e.has("alignVertical") && this.alignVertical && this.initNavigationSelectionByScrollEvent(), e.has("preselectCoachIndex") && setTimeout(() => this.scrollToSelectedNavCoach(this.preselectCoachIndex), 1);
150
+ e.has("alignVertical") && this.alignVertical && this.initNavigationSelectionByScrollEvent(), e.has("preselectCoachIndex") && (this._isRunningInitPreselectCoachIndex = !0, setTimeout(() => this.scrollToSelectedNavCoach(this.preselectCoachIndex), 1));
152
151
  }
153
152
  navigateByDirectionBtn(e) {
154
153
  this.unfocusPlaceElement();
@@ -164,26 +163,26 @@ let ze = (() => {
164
163
  }
165
164
  /** Init scroll event handling for coach navigation */
166
165
  initNavigationSelectionByScrollEvent() {
167
- this.firstTabElement = this.shadowRoot?.querySelector("#first-tab-element"), this.lastTabElement = this.shadowRoot?.querySelector("#last-tab-element"), this.coachScrollArea = this.shadowRoot?.querySelector("#sbb-sr__wrapper-scrollarea"), this.navigationScrollArea = this.shadowRoot?.querySelector("#sbb-sr-navigation");
166
+ this.coachScrollArea = this.shadowRoot?.querySelector("#sbb-sr__wrapper-scrollarea"), this.navigationScrollArea = this.shadowRoot?.querySelector("#sbb-sr__navigation-list-coaches");
168
167
  const e = this.seatReservations ? this.seatReservations[this.currSelectedDeckIndex] : null;
169
168
  if (e && e.coachItems.length > 0) {
170
- const t = e.coachItems[0].dimension.h * this.baseGridSize + this.coachBorderPadding, s = (this.seatReservations.length - 1) * this.gapBetweenCoachDecks;
171
- this.style?.setProperty("--sbb-seat-reservation-height", `${t * this.seatReservations.length + s}`), this.style?.setProperty("--sbb-seat-reservation-decks", `${this.seatReservations.length}`);
169
+ const t = e.coachItems[0].dimension.h * this.baseGridSize + this.coachBorderPadding, i = (this.seatReservations.length - 1) * this.gapBetweenCoachDecks;
170
+ this.style?.setProperty("--sbb-seat-reservation-height", `${t * this.seatReservations.length + i}`), this.style?.setProperty("--sbb-seat-reservation-decks", `${this.seatReservations.length}`);
172
171
  }
173
172
  if (this.navigationScrollArea) {
174
173
  this.scrollNavigationAreaDim = this.alignVertical ? this.navigationScrollArea.getBoundingClientRect().height : this.navigationScrollArea.getBoundingClientRect().width;
175
174
  const t = this.navigationScrollArea.querySelector("ul > li");
176
175
  if (t) {
177
- const s = t?.getBoundingClientRect();
178
- this.coachNavButtonDim = this.alignVertical ? s.height : s.width;
176
+ const i = t?.getBoundingClientRect();
177
+ this.coachNavButtonDim = this.alignVertical ? i.height : i.width;
179
178
  }
180
179
  }
181
180
  if (this.coachScrollArea && e) {
182
181
  let t = 0;
183
- this.scrollCoachsAreaWidth = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = e.coachItems.map((s) => {
184
- const i = t, a = this.getCalculatedDimension(s.dimension).w;
182
+ this.scrollCoachsAreaWidth = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = e.coachItems.map((i) => {
183
+ const s = t, a = this.getCalculatedDimension(i.dimension).w;
185
184
  return t += a + this.gapBetweenCoaches, {
186
- start: i,
185
+ start: s,
187
186
  end: t,
188
187
  width: a
189
188
  };
@@ -208,46 +207,57 @@ let ze = (() => {
208
207
  onFocusTableCoachAndPreselectPlace(e) {
209
208
  !this.seatReservationWithoutNavigationHasFocus && !this.hasNavigation && (this.seatReservationWithoutNavigationHasFocus = !0, this.currSelectedCoachIndex = e === 0 ? this.getNextAvailableCoachIndex(-1) : this.getPrevAvailableCoachIndex(e), this.preselectPlaceInCoach());
210
209
  }
210
+ /** Will be triggerd by focus navigation direction */
211
+ onFocusNavDirectionButton() {
212
+ this.focusedCoachIndex = -1;
213
+ }
214
+ /** TAB Key Event handling for Coach Navigation */
215
+ onKeyNavigationNavCoachButton(e, t) {
216
+ if (e.key === this.keyboardNavigationEvents.Tab) {
217
+ this._handleTabKeyNavigation(e, "navigation", t);
218
+ return;
219
+ }
220
+ Se(e) && this.keyboardSeatmapEventHadling(e);
221
+ }
222
+ /** General TAB Key Event handling for tab navigation inside the coach navigation area and the seatmap area */
223
+ _handleTabKeyNavigation(e, t, i) {
224
+ const s = e.key, a = e.shiftKey;
225
+ s === this.keyboardNavigationEvents.Tab && (t == "navigation" ? (i == this.currSelectedCoachIndex ? !this.currSelectedPlace || !a || this.coachNavData[i].isDriverArea || this.focusedCoachIndex == -1 ? this.focusedCoachIndex = i : a && this.currSelectedPlace && (this.focusedCoachIndex = -1, this.focusPlaceElement(this.currSelectedPlace)) : this.focusedCoachIndex = i, this._scrollToSelectedNavigationButton(i)) : t == "seatmap" && (e.preventDefault(), a ? this._navigateCoachNavigationByKeyboard("PREV_TAB") : this._navigateCoachNavigationByKeyboard("NEXT_TAB")));
226
+ }
211
227
  /**
212
- * Initialisation of Keyboard event handling to navigation between each places inside a selected coach by using [arrow] keys.
228
+ * Initialisation of Keyboard Seatmap event handling to navigation between each places inside a selected coach by using [arrow] keys.
213
229
  * With the [TAB] key the user navigation goes to the next coach navigation element and the currently selected place is automatically reset.
214
230
  */
215
- handleKeyboardEvent(e) {
231
+ keyboardSeatmapEventHadling(e) {
216
232
  const t = e.key;
217
- if (this.preventCoachScrollByPlaceClick = !1, !this.hasSeatReservationNativeFocus && (e.shiftKey && e.keyCode === 9 || t === this.keyboardNavigationEvents.Tab) && (this.hasSeatReservationNativeFocus = !0), this.currSelectedPlace) {
218
- if (e.shiftKey && e.keyCode === 9) {
219
- this._navigateCoachNavigationByKeyboard("PREV_TAB"), e.preventDefault();
220
- return;
221
- }
222
- if (t === this.keyboardNavigationEvents.Tab) {
223
- this._navigateCoachNavigationByKeyboard("NEXT_TAB"), e.preventDefault();
224
- return;
225
- }
233
+ if (this.preventCoachScrollByPlaceClick = !1, !this.hasSeatReservationNativeFocus && (e.shiftKey && t === this.keyboardNavigationEvents.Tab || t === this.keyboardNavigationEvents.Tab) && (this.hasSeatReservationNativeFocus = !0), t == this.keyboardNavigationEvents.Tab) {
234
+ this._handleTabKeyNavigation(e, "seatmap");
235
+ return;
226
236
  }
227
- if (this.currSelectedCoachIndex !== -1 && Ie(e))
237
+ if (this.currSelectedCoachIndex !== -1 && Se(e))
228
238
  switch (e.preventDefault(), t) {
229
239
  case this.keyboardNavigationEvents.ArrowLeft:
230
240
  {
231
- const s = this.alignVertical ? this.keyboardNavigationEvents.ArrowDown : t;
232
- this._navigateToPlaceByKeyboard(s);
241
+ const i = this.alignVertical ? this.keyboardNavigationEvents.ArrowDown : t;
242
+ this._navigateToPlaceByKeyboard(i);
233
243
  }
234
244
  break;
235
245
  case this.keyboardNavigationEvents.ArrowRight:
236
246
  {
237
- const s = this.alignVertical ? this.keyboardNavigationEvents.ArrowUp : t;
238
- this._navigateToPlaceByKeyboard(s);
247
+ const i = this.alignVertical ? this.keyboardNavigationEvents.ArrowUp : t;
248
+ this._navigateToPlaceByKeyboard(i);
239
249
  }
240
250
  break;
241
251
  case this.keyboardNavigationEvents.ArrowUp:
242
252
  {
243
- const s = this.alignVertical ? this.keyboardNavigationEvents.ArrowLeft : t;
244
- this._navigateToPlaceByKeyboard(s);
253
+ const i = this.alignVertical ? this.keyboardNavigationEvents.ArrowLeft : t;
254
+ this._navigateToPlaceByKeyboard(i);
245
255
  }
246
256
  break;
247
257
  case this.keyboardNavigationEvents.ArrowDown:
248
258
  {
249
- const s = this.alignVertical ? this.keyboardNavigationEvents.ArrowRight : t;
250
- this._navigateToPlaceByKeyboard(s);
259
+ const i = this.alignVertical ? this.keyboardNavigationEvents.ArrowRight : t;
260
+ this._navigateToPlaceByKeyboard(i);
251
261
  }
252
262
  break;
253
263
  }
@@ -257,40 +267,59 @@ let ze = (() => {
257
267
  * otherwise the coach grid is selected (necessary for ScreenReader)
258
268
  */
259
269
  preselectPlaceInCoach() {
260
- const e = this._getClosestPlaceByKeyDirection();
261
- e && this.unfocusPlaceElement(), this.isKeyboardNavigation && this.isAutoScrolling ? e && this.focusPlaceElement(e) : (this.currSelectedPlace = e, this._setFocusToSelectedCoachGrid());
270
+ if (this.isAutoScrolling) {
271
+ if (this._isRunningInitPreselectCoachIndex) {
272
+ this._isRunningInitPreselectCoachIndex = !1;
273
+ return;
274
+ }
275
+ if (this.coachNavData[this.currSelectedCoachIndex] && this.coachNavData[this.currSelectedCoachIndex].isDriverArea) {
276
+ this._setFocusToSelectedCoachGrid();
277
+ return;
278
+ }
279
+ if (this.isKeyboardNavigation && this.isAutoScrolling) {
280
+ const e = this._getClosestPlaceByKeyDirection();
281
+ e ? (this.unfocusPlaceElement(), this.focusPlaceElement(e), this.focusedCoachIndex = -1) : this._setFocusToSelectedCoachGrid();
282
+ } else
283
+ this.unfocusPlaceElement(), this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid();
284
+ }
262
285
  }
263
286
  scrollToSelectedNavCoach(e) {
264
287
  if (this._isValidCoachIndex(e) && e !== this.currSelectedCoachIndex) {
265
- this.isAutoScrolling = !0, this.isCoachGridFocusable = !0, this.currSelectedCoachIndex = e, this.currSelectedDeckIndex = this._getExistingCoachDeckIndex(), this._setScrollDirectionByCoachIndex();
288
+ this.hoveredCoachIndex = e, this.isAutoScrolling = !0, this.isCoachGridFocusable = !0, this.currSelectedCoachIndex = e, this.currSelectedDeckIndex = this._getExistingCoachDeckIndex(), this._setScrollDirectionByCoachIndex();
266
289
  const t = this._getCoachScrollPositionX();
267
- (this.selectedCoachIndex !== -1 || this.currSelectedCoachIndex > 0) && this._isScrollableToSelectedCoach() ? this.coachScrollArea.scrollTo({
290
+ (this.selectedCoachIndex !== -1 || this.currSelectedCoachIndex > 0) && this._isScrollableToSelectedCoach() ? (this._lastStartScrollPos = this.coachScrollArea.scrollLeft, this.coachScrollArea.scrollTo({
268
291
  top: this.alignVertical ? t : 0,
269
292
  left: this.alignVertical ? 0 : t,
270
293
  behavior: "smooth"
271
- }) : this.updateCurrentSelectedCoach(), this._scrollToSelectedNavigationButton(e);
294
+ })) : this.updateCurrentSelectedCoach(), this._scrollToSelectedNavigationButton(e);
272
295
  }
273
296
  }
274
297
  focusPlaceElement(e) {
275
298
  if (this.unfocusPlaceElement(), e) {
276
299
  this.currSelectedPlace = e, this._setCurrSelectedPlaceElementId(e);
277
300
  const t = this._getPlaceHtmlElement();
278
- t && t.setAttribute("keyfocus", "focus");
301
+ if (t) {
302
+ t.setAttribute("keyfocus", "focus");
303
+ const i = setTimeout(() => {
304
+ const s = this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number);
305
+ this._scrollPlaceIntoNearestViewport(s), clearTimeout(i);
306
+ }, 0);
307
+ }
279
308
  }
280
309
  }
281
310
  unfocusPlaceElement() {
282
311
  const e = this._getPlaceHtmlElement();
283
312
  e && (e.setAttribute("keyfocus", "unfocus"), this._setCurrSelectedPlaceElementId(null), this.currSelectedPlace = null);
284
313
  }
285
- getCalculatedDimension(e, t, s, i) {
286
- return t && !s && (e.h += this.coachBorderOffset * 2), i && (e.h += this.coachBorderOffset), {
314
+ getCalculatedDimension(e, t, i, s) {
315
+ return t && !i && (e.h += this.coachBorderOffset * 2), s && (e.h += this.coachBorderOffset), {
287
316
  w: this.baseGridSize * e.w,
288
317
  h: this.baseGridSize * e.h
289
318
  };
290
319
  }
291
- getCalculatedPosition(e, t, s, i) {
292
- if (s && t) {
293
- const a = i ? s.h : s.h + this.coachBorderOffset;
320
+ getCalculatedPosition(e, t, i, s) {
321
+ if (i && t) {
322
+ const a = s ? i.h : i.h + this.coachBorderOffset;
294
323
  e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === a && (e.y += this.coachBorderOffset);
295
324
  }
296
325
  return {
@@ -315,20 +344,20 @@ let ze = (() => {
315
344
  * @returns An Object with count of free seats and free bicycle places
316
345
  */
317
346
  getAvailableFreePlacesNumFromCoach(e) {
318
- const t = { seats: 0, bicycles: 0 }, s = e?.reduce((i, a) => (a.state !== "FREE" || (a.type === "SEAT" ? i.seats++ : i.bicycles++), i), t);
319
- return s || t;
347
+ const t = { seats: 0, bicycles: 0 }, i = e?.reduce((s, a) => (a.state !== "FREE" || (a.type === "SEAT" ? s.seats++ : s.bicycles++), s), t);
348
+ return i || t;
320
349
  }
321
350
  /**
322
351
  * At the end of a scroll Event from the coach scrollable area,
323
352
  * the reached coach is marked as selected
324
353
  */
325
354
  _handleCoachAreaScrollendEvent() {
355
+ const e = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
326
356
  if (this.preventCoachScrollByPlaceClick) {
327
- this.preventCoachScrollByPlaceClick = !1;
357
+ Math.abs(this._lastStartScrollPos - this.coachScrollArea.scrollLeft) > this.baseGridSize * 2 && (this.selectedCoachIndex = e), this.preventCoachScrollByPlaceClick = !1;
328
358
  return;
329
359
  }
330
- const e = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
331
- this.hoveredScrollCoachIndex = -1, this.currSelectedCoachIndex === -1 && (this.currSelectedCoachIndex = e), this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex = e : this.currSelectedCoachIndex = e < this.currSelectedCoachIndex ? this.currSelectedCoachIndex : e, this.isAutoScrolling || this._scrollToSelectedNavigationButton(e), this.preventCoachScrollByPlaceClick = !1, this.updateCurrentSelectedCoach(), this.hasNavigation || (this.preselectPlaceInCoach(), this.isAutoScrolling = !1);
360
+ this._lastStartScrollPos = this.coachScrollArea.scrollLeft, this.hoveredCoachIndex = -1, this.currSelectedCoachIndex === -1 && (this.currSelectedCoachIndex = e), this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex = e : this.currSelectedCoachIndex = e < this.currSelectedCoachIndex ? this.currSelectedCoachIndex : e, this.isAutoScrolling || this._scrollToSelectedNavigationButton(e), this.preventCoachScrollByPlaceClick = !1, this.updateCurrentSelectedCoach(), this.hasNavigation || (this.preselectPlaceInCoach(), this.isAutoScrolling = !1);
332
361
  }
333
362
  /**
334
363
  * Performs an automatic main navigation scroll to the specified selectedNavCoachIndex.
@@ -337,11 +366,11 @@ let ze = (() => {
337
366
  */
338
367
  _scrollToSelectedNavigationButton(e) {
339
368
  setTimeout(() => {
340
- if (this.hoveredScrollCoachIndex = e, this.hasNavigation && this.navigationScrollArea) {
341
- const t = this.scrollNavigationAreaDim / 2, i = e * this.coachNavButtonDim - t + this.coachNavButtonDim;
369
+ if (this.hasNavigation && this.navigationScrollArea) {
370
+ const t = this.scrollNavigationAreaDim / 2, s = e * this.coachNavButtonDim - t + this.coachNavButtonDim;
342
371
  this.navigationScrollArea.scrollTo({
343
- top: this.alignVertical ? i : 0,
344
- left: this.alignVertical ? 0 : i,
372
+ top: this.alignVertical ? s : 0,
373
+ left: this.alignVertical ? 0 : s,
345
374
  behavior: "smooth"
346
375
  });
347
376
  }
@@ -378,8 +407,8 @@ let ze = (() => {
378
407
  * @returns boolean
379
408
  */
380
409
  _isScrollableToSelectedCoach() {
381
- const e = this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft, t = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, s = this.maxCalcCoachsWidth - t, i = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex], a = e === this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;
382
- return (e < s || e > i.start) && !a;
410
+ const e = this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft, t = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, i = this.maxCalcCoachsWidth - t, s = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex], a = e === this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;
411
+ return (e < i || e > s.start) && !a;
383
412
  }
384
413
  /**
385
414
  * Returns the coach index which is currently visible in the scroll area
@@ -387,7 +416,7 @@ let ze = (() => {
387
416
  */
388
417
  _getCoachIndexByScrollTriggerPosition() {
389
418
  const t = (this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft) + this.scrollCoachsAreaWidth / 2;
390
- return this.triggerCoachPositionsCollection.findIndex((s) => t >= s.start && t <= s.end);
419
+ return this.triggerCoachPositionsCollection.findIndex((i) => t >= i.start && t <= i.end);
391
420
  }
392
421
  /**
393
422
  * Get the first place of current selected coach by table cell coordinate 0-0 id.
@@ -395,8 +424,8 @@ let ze = (() => {
395
424
  */
396
425
  _getFirstPlaceInSelectedCoach() {
397
426
  let e = null;
398
- const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex], s = "cell-" + this.currSelectedDeckIndex + "-" + this.currSelectedCoachIndex + "-0-0", i = this.shadowRoot?.querySelector("#" + s)?.querySelector("sbb-seat-reservation-place-control")?.getAttribute("text") || null;
399
- return t && i && (e = t.places?.find((a) => a.number === i) || null), e;
427
+ const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex], i = "cell-" + this.currSelectedDeckIndex + "-" + this.currSelectedCoachIndex + "-0-0", s = this.shadowRoot?.querySelector("#" + i)?.querySelector("sbb-seat-reservation-place-control")?.getAttribute("text") || null;
428
+ return t && s && (e = t.places?.find((a) => a.number === s) || null), e;
400
429
  }
401
430
  _getSwitchedCoachDeckIndexByKeyNavigation(e, t) {
402
431
  return !this.currSelectedPlace || e === this.keyboardNavigationEvents.ArrowRight || e === this.keyboardNavigationEvents.ArrowLeft ? null : e === this.keyboardNavigationEvents.ArrowDown && this.currSelectedPlace.position.y + 2 === t.dimension.h && this.seatReservations[this.currSelectedDeckIndex + 1] ? this.currSelectedDeckIndex + 1 : e === this.keyboardNavigationEvents.ArrowUp && this.currSelectedPlace.position.y === 0 && this.seatReservations[this.currSelectedDeckIndex - 1] ? this.currSelectedDeckIndex - 1 : null;
@@ -409,40 +438,35 @@ let ze = (() => {
409
438
  */
410
439
  _getClosestPlaceByKeyDirection(e) {
411
440
  const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex];
412
- let s = null, i = t.places, a = null;
413
- if (i)
441
+ let i = null, s = t.places, a = null;
442
+ if (s)
414
443
  if (this.currSelectedPlaceElementId) {
415
444
  if (this.currSelectedPlace) {
416
445
  const o = { ...this.currSelectedPlace.position };
417
- e && (a = this._getSwitchedCoachDeckIndexByKeyNavigation(e, t), a !== null && (i = this.seatReservations[a].coachItems[this.currSelectedCoachIndex].places || [], o.y = a < this.currSelectedDeckIndex ? t.dimension.h : -1));
418
- for (const c of i)
419
- e ? c.number !== this.currSelectedPlace?.number && (e === this.keyboardNavigationEvents.ArrowRight && (c.position.y === o.y || c.position.y === o.y - 1) && c.position.x > o.x && (!s || c.position.x < s.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (c.position.x === o.x || c.position.x === o.x + 1) && c.position.y > o.y && (!s || c.position.y < s.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (c.position.y === o.y || c.position.y === o.y + 1) && c.position.x < o.x && (!s || c.position.x > s.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (c.position.x === o.x || c.position.x === o.x - 1) && c.position.y < o.y && (!s || c.position.y > s.position.y)) && (s = c) : (this.currScrollDirection === I.right && c.position.y === o.y && (!s || c.position.x < s.position.x) || this.currScrollDirection === I.left && c.position.y === o.y && (!s || c.position.x > s.position.x)) && (s = c);
420
- a !== null && s && (this.currSelectedDeckIndex = a);
446
+ e && (a = this._getSwitchedCoachDeckIndexByKeyNavigation(e, t), a !== null && (s = this.seatReservations[a].coachItems[this.currSelectedCoachIndex].places || [], o.y = a < this.currSelectedDeckIndex ? t.dimension.h : -1));
447
+ for (const c of s)
448
+ e ? c.number !== this.currSelectedPlace?.number && (e === this.keyboardNavigationEvents.ArrowRight && (c.position.y === o.y || c.position.y === o.y - 1) && c.position.x > o.x && (!i || c.position.x < i.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (c.position.x === o.x || c.position.x === o.x + 1) && c.position.y > o.y && (!i || c.position.y < i.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (c.position.y === o.y || c.position.y === o.y + 1) && c.position.x < o.x && (!i || c.position.x > i.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (c.position.x === o.x || c.position.x === o.x - 1) && c.position.y < o.y && (!i || c.position.y > i.position.y)) && (i = c) : (this.currScrollDirection === I.right && c.position.y === o.y && (!i || c.position.x < i.position.x) || this.currScrollDirection === I.left && c.position.y === o.y && (!i || c.position.x > i.position.x)) && (i = c);
449
+ a !== null && i && (this.currSelectedDeckIndex = a);
421
450
  }
422
451
  } else
423
452
  return this._getFirstPlaceInSelectedCoach();
424
- return s;
453
+ return i;
425
454
  }
426
455
  // Handling for Tab navigation if a place is selected inside the coach.
427
456
  // This controls the focused coach from the current selected coach.
428
457
  _navigateCoachNavigationByKeyboard(e) {
429
- const t = this.focusedCoachIndex === -1 ? this.currSelectedCoachIndex === -1 ? 0 : this.currSelectedCoachIndex : this.focusedCoachIndex, s = e === "NEXT_TAB" ? this.getNextAvailableCoachIndex(t) : this.getPrevAvailableCoachIndex(t);
430
- if (t === s) {
431
- this.unfocusPlaceElement(), this.seatReservationWithoutNavigationHasFocus = !1, e === "NEXT_TAB" ? this.lastTabElement.focus() : this.firstTabElement.focus();
432
- return;
433
- }
458
+ const t = this.focusedCoachIndex === -1 ? this.currSelectedCoachIndex === -1 ? 0 : this.currSelectedCoachIndex : this.focusedCoachIndex, i = e === "NEXT_TAB" ? this.getNextAvailableCoachIndex(t) : this.getPrevAvailableCoachIndex(t);
434
459
  if (this.hasNavigation) {
435
- const i = this._getPlaceHtmlElement(), a = i ? i.getAttribute("keyfocus") === "focus" : !1;
460
+ const s = this._getPlaceHtmlElement(), a = s ? s.getAttribute("keyfocus") === "focus" : !1;
436
461
  if (e === "PREV_TAB" && this.selectedCoachIndex === t)
437
- if (a) {
462
+ if (a || this.currSelectedPlace !== null) {
438
463
  this.focusedCoachIndex = t, this.unfocusPlaceElement();
439
464
  return;
440
- } else
441
- this.focusedCoachIndex = s;
442
- else s !== this.currSelectedCoachIndex ? this.focusedCoachIndex = s : (this.focusedCoachIndex = -1, this.selectedCoachIndex = s, a ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid()));
443
- this._scrollToSelectedNavigationButton(s);
465
+ } else t == 0 ? (this.unfocusPlaceElement(), this.currSelectedPlace = null, this.focusedCoachIndex = -1, (this.shadowRoot?.getElementById("sbb-sr-navigation__wrapper-button-direction--left")).focus()) : this.focusedCoachIndex = i;
466
+ else i !== this.currSelectedCoachIndex ? this.focusedCoachIndex = i : e === "NEXT_TAB" && i === this.coachNavData.length - 1 ? (this.unfocusPlaceElement(), this.focusedCoachIndex = -1, (this.shadowRoot?.getElementById("sbb-sr-navigation__wrapper-button-direction--right")).focus()) : (this.focusedCoachIndex = -1, this.selectedCoachIndex = i, a ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid()));
467
+ this._scrollToSelectedNavigationButton(i);
444
468
  } else
445
- this.scrollToSelectedNavCoach(s);
469
+ this.scrollToSelectedNavCoach(i);
446
470
  }
447
471
  _navigateToPlaceByKeyboard(e) {
448
472
  if (this.isKeyboardNavigation = !0, this.focusedCoachIndex !== -1 && (this.focusedCoachIndex = -1), !this.preventPlaceClick) {
@@ -450,8 +474,8 @@ let ze = (() => {
450
474
  if (t)
451
475
  this.focusPlaceElement(t);
452
476
  else if (e === this.keyboardNavigationEvents.ArrowRight || e === this.keyboardNavigationEvents.ArrowLeft || this.alignVertical && (e === this.keyboardNavigationEvents.ArrowUp || e === this.keyboardNavigationEvents.ArrowDown)) {
453
- const s = e === this.keyboardNavigationEvents.ArrowRight ? this.getNextAvailableCoachIndex() : this.getPrevAvailableCoachIndex();
454
- this.scrollToSelectedNavCoach(s);
477
+ const i = e === this.keyboardNavigationEvents.ArrowRight ? this.getNextAvailableCoachIndex() : this.getPrevAvailableCoachIndex();
478
+ this.scrollToSelectedNavCoach(i);
455
479
  }
456
480
  }
457
481
  }
@@ -464,39 +488,41 @@ let ze = (() => {
464
488
  return t > 0 ? t - 1 : t;
465
489
  }
466
490
  updateSelectedSeatReservationPlaces(e) {
467
- const t = e.placeType === "SEAT" ? "seats" : "bicycles", s = e.placeType === "SEAT" ? this.maxSeatReservations : this.maxBicycleReservations, i = this.selectedSeatReservationPlaces[t];
468
- this.selectedSeatReservationPlaces[t] = this._updateSelectedSeatReservationPlaces(i, s, e), this.dispatchEvent(new CustomEvent("selectedplaces", {
491
+ const t = e.placeType === "SEAT" ? "seats" : "bicycles", i = e.placeType === "SEAT" ? this.maxSeatReservations : this.maxBicycleReservations, s = this.selectedSeatReservationPlaces[t];
492
+ this.selectedSeatReservationPlaces[t] = this._updateSelectedSeatReservationPlaces(s, i, e), this.dispatchEvent(new CustomEvent("selectedplaces", {
469
493
  bubbles: !0,
470
494
  composed: !0,
471
495
  detail: this.selectedSeatReservationPlaces
472
496
  }));
473
497
  }
474
- _updateSelectedSeatReservationPlaces(e, t, s) {
475
- if (s.state === "SELECTED") {
476
- const i = this._getDeckIndexByPlaceId(s.id), a = this._getSeatReservationPlaceSelection(s, i);
498
+ _updateSelectedSeatReservationPlaces(e, t, i) {
499
+ if (i.state === "SELECTED") {
500
+ const s = this._getDeckIndexByPlaceId(i.id), a = this._getSeatReservationPlaceSelection(i, s);
477
501
  a && e.push(a);
478
502
  } else
479
- e = e.filter((i) => i.id !== s.id);
503
+ e = e.filter((s) => s.id !== i.id);
480
504
  if (t > -1 && e.length > t) {
481
- const i = t > 0 ? s : void 0;
482
- e = this._resetAllPlaceSelections(e, i);
505
+ const s = t > 0 ? i : void 0;
506
+ e = this._resetAllPlaceSelections(e, s);
483
507
  }
484
508
  return e;
485
509
  }
486
510
  updateCurrentSelectedPlaceInCoach(e) {
487
- const t = this._getDeckIndexByPlaceId(e.id), s = e.coachIndex;
511
+ const t = this._getDeckIndexByPlaceId(e.id), i = e.coachIndex;
488
512
  if (t === null)
489
513
  return;
490
- const i = this.seatReservations[t].coachItems[s].places?.find((o) => o.number == e.number);
491
- if (!i)
514
+ const s = this.seatReservations[t].coachItems[i].places?.find((o) => o.number == e.number);
515
+ if (!s)
492
516
  return;
493
- this.unfocusPlaceElement(), this.currSelectedDeckIndex = t, this.currSelectedCoachIndex = s, this.currSelectedPlace = i, this.currSelectedCoachIndex !== this.selectedCoachIndex && this.updateCurrentSelectedCoach(), this._setCurrSelectedPlaceElementId(i);
517
+ this.currSelectedDeckIndex = t, this.currSelectedCoachIndex = i, this.currSelectedPlace = s, this.currSelectedCoachIndex !== this.selectedCoachIndex && this.updateCurrentSelectedCoach(), this._setCurrSelectedPlaceElementId(s);
494
518
  const a = setTimeout(() => {
495
519
  this._scrollPlaceIntoNearestViewport(e.id), clearTimeout(a);
496
520
  }, 0);
497
521
  }
498
522
  updateCurrentSelectedCoach() {
499
- this.selectedCoachIndex = this.currSelectedCoachIndex, this.focusedCoachIndex = -1;
523
+ if (this.currSelectedCoachIndex == this.selectedCoachIndex)
524
+ return;
525
+ this.focusedCoachIndex != -1 && (this.focusedCoachIndex = this.currSelectedCoachIndex), this.selectedCoachIndex = this.currSelectedCoachIndex;
500
526
  const e = this._getSeatReservationSelectedCoach(this.selectedCoachIndex);
501
527
  e && this.dispatchEvent(new CustomEvent("selectedcoach", {
502
528
  bubbles: !0,
@@ -504,8 +530,8 @@ let ze = (() => {
504
530
  detail: e
505
531
  }));
506
532
  }
507
- getPlaceElementId(e, t, s) {
508
- return "seat-reservation__place-button-" + e + "-" + t + "-" + s;
533
+ getPlaceElementId(e, t, i) {
534
+ return "seat-reservation__place-button-" + e + "-" + t + "-" + i;
509
535
  }
510
536
  /**
511
537
  * In the case of coach layouts with different decks,
@@ -517,21 +543,21 @@ let ze = (() => {
517
543
  */
518
544
  _initEmptyCoachDeckOffsets() {
519
545
  const e = Array(this.seatReservations.length - 1).fill(0);
520
- this.seatReservations[this.seatReservations.length - 1].coachItems.forEach((s) => {
521
- for (let i = 0; i < this.seatReservations.length - 1; i++) {
522
- const a = this.seatReservations[i].coachItems[e[i]];
523
- if (s.id != a?.id) {
546
+ this.seatReservations[this.seatReservations.length - 1].coachItems.forEach((i) => {
547
+ for (let s = 0; s < this.seatReservations.length - 1; s++) {
548
+ const a = this.seatReservations[s].coachItems[e[s]];
549
+ if (i.id != a?.id) {
524
550
  const o = {
525
- ...s,
551
+ ...i,
526
552
  places: void 0,
527
553
  propertyIds: void 0,
528
554
  graphicElements: void 0,
529
555
  serviceElements: void 0,
530
556
  travelClass: []
531
557
  };
532
- this.seatReservations[i].coachItems.splice(e[i], 0, o);
558
+ this.seatReservations[s].coachItems.splice(e[s], 0, o);
533
559
  }
534
- e[i]++;
560
+ e[s]++;
535
561
  }
536
562
  });
537
563
  }
@@ -540,9 +566,9 @@ let ze = (() => {
540
566
  * that have the state SELECTED within the seatReservation object
541
567
  */
542
568
  _initSeatReservationPlaceSelection() {
543
- this.seatReservations?.forEach((e, t) => e.coachItems.map((s, i) => {
544
- s.places?.filter((a) => a.state === "SELECTED")?.forEach((a) => {
545
- const o = this.getPlaceElementId(t, i, a.number), c = _e(a, o, e.deckCoachIndex, i), w = this._getSeatReservationPlaceSelection(c, t);
569
+ this.seatReservations?.forEach((e, t) => e.coachItems.map((i, s) => {
570
+ i.places?.filter((a) => a.state === "SELECTED")?.forEach((a) => {
571
+ const o = this.getPlaceElementId(t, s, a.number), c = me(a, o, e.deckCoachIndex, s), w = this._getSeatReservationPlaceSelection(c, t);
546
572
  w && (w.placeType === "SEAT" ? this.selectedSeatReservationPlaces.seats.push(w) : this.selectedSeatReservationPlaces.bicycles.push(w));
547
573
  });
548
574
  }));
@@ -553,24 +579,24 @@ let ze = (() => {
553
579
  * @param currSelectedPlace
554
580
  */
555
581
  _resetAllPlaceSelections(e, t) {
556
- for (const s of e)
557
- if (!t || t.id !== s.id) {
558
- const i = this.shadowRoot?.getElementById(s.id);
559
- i && i.setAttribute("state", "FREE");
582
+ for (const i of e)
583
+ if (!t || t.id !== i.id) {
584
+ const s = this.shadowRoot?.getElementById(i.id);
585
+ s && s.setAttribute("state", "FREE");
560
586
  }
561
- return t ? e = e.filter((s) => s.id === t.id) : e = [], e;
587
+ return t ? e = e.filter((i) => i.id === t.id) : e = [], e;
562
588
  }
563
589
  _getSeatReservationPlaceSelection(e, t) {
564
590
  if (t === null)
565
591
  return null;
566
- const s = this.seatReservations[t].coachItems[e.coachIndex], i = s.places?.find((a) => a.number === e.number);
567
- return i ? ye(i, s, e.id, e.deckIndex, e.coachIndex) : null;
592
+ const i = this.seatReservations[t].coachItems[e.coachIndex], s = i.places?.find((a) => a.number === e.number);
593
+ return s ? ye(s, i, e.id, e.deckIndex, e.coachIndex) : null;
568
594
  }
569
595
  _getSeatReservationSelectedCoach(e) {
570
596
  if (!this.seatReservations[this.currSelectedDeckIndex].coachItems[e])
571
597
  return null;
572
- const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[e], s = this.getAvailableFreePlacesNumFromCoach(t.places);
573
- return be(e, t, s);
598
+ const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[e], i = this.getAvailableFreePlacesNumFromCoach(t.places);
599
+ return be(e, t, i);
574
600
  }
575
601
  _setCurrSelectedPlaceElementId(e) {
576
602
  this.currSelectedPlaceElementId = e ? this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number) : null;
@@ -595,13 +621,13 @@ let ze = (() => {
595
621
  * */
596
622
  _prepareNavigationCoachData() {
597
623
  const e = this.seatReservations[this.seatReservations.length - 1].coachItems;
598
- this.coachNavData = [], e.forEach((t, s) => {
599
- const i = [], a = [], o = [];
600
- this.seatReservations.map((c) => c.coachItems[s]).forEach((c) => {
601
- i.push(...c.travelClass), a.push(...c.propertyIds ? c.propertyIds : []), o.push(...c.places ? c.places : []);
624
+ this.coachNavData = [], e.forEach((t, i) => {
625
+ const s = [], a = [], o = [];
626
+ this.seatReservations.map((c) => c.coachItems[i]).forEach((c) => {
627
+ s.push(...c.travelClass), a.push(...c.propertyIds ? c.propertyIds : []), o.push(...c.places ? c.places : []);
602
628
  }), this.coachNavData.push({
603
629
  id: t.id,
604
- travelClass: this._prepareTravelClassNavigation(i),
630
+ travelClass: this._prepareTravelClassNavigation(s),
605
631
  propertyIds: this._prepareServiceIconsNavigation(a),
606
632
  isDriverArea: t.places ? t.places.length === 0 : !0,
607
633
  driverAreaSide: this._prepareDriverAreaSideNavigation(t),
@@ -613,12 +639,12 @@ let ze = (() => {
613
639
  return e.indexOf("FIRST") !== -1 ? "FIRST" : e.indexOf("SECOND") !== -1 ? "SECOND" : "ANY_CLASS";
614
640
  }
615
641
  _prepareDriverAreaSideNavigation(e) {
616
- const t = e.graphicElements?.filter((s) => s.icon === "DRIVER_AREA");
642
+ const t = e.graphicElements?.filter((i) => i.icon === "DRIVER_AREA");
617
643
  if (t && t.length > 0) {
618
- const s = t.find((a) => a.position.x === 0) || !1, i = t.find((a) => a.position.x > 0) || !1;
644
+ const i = t.find((a) => a.position.x === 0) || !1, s = t.find((a) => a.position.x > 0) || !1;
619
645
  return {
620
- left: !!s,
621
- right: !!i
646
+ left: !!i,
647
+ right: !!s
622
648
  };
623
649
  }
624
650
  }
@@ -665,32 +691,32 @@ let ze = (() => {
665
691
  _scrollPlaceIntoNearestViewport(e) {
666
692
  this.shadowRoot?.getElementById(e)?.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
667
693
  }
668
- }, x = new WeakMap(), p = new WeakMap(), m = new WeakMap(), _ = new WeakMap(), y = new WeakMap(), b = new WeakMap(), P = new WeakMap(), A = new WeakMap(), R = new WeakMap(), k = new WeakMap(), N = new WeakMap(), E = new WeakMap(), (() => {
694
+ }, x = new WeakMap(), p = new WeakMap(), _ = new WeakMap(), m = new WeakMap(), y = new WeakMap(), b = new WeakMap(), P = new WeakMap(), N = new WeakMap(), A = new WeakMap(), R = new WeakMap(), k = new WeakMap(), E = new WeakMap(), (() => {
669
695
  const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(n[Symbol.metadata] ?? null) : void 0;
670
- u = [S({ attribute: "seat-reservations", type: Array })], z = [C(), S({ attribute: "has-navigation", type: Boolean })], O = [C(), S({ attribute: "align-vertical", type: Boolean, reflect: !0, useDefault: !0 })], W = [C(), S({ attribute: "base-grid-size", type: Number })], H = [C(), S({ attribute: "height", type: Number })], M = [C(), S({ attribute: "max-seat-reservations", type: Number })], Y = [C(), S({ attribute: "max-bicycle-reservations", type: Number })], Z = [C(), S({ attribute: "prevent-place-click", type: Boolean })], se = [C(), S({ attribute: "preselect-coach-index", type: Number })], ce = [T()], le = [T()], de = [T()], ve = [me({ passive: !0 })], f(h, null, u, { kind: "accessor", name: "seatReservations", static: !1, private: !1, access: { has: (t) => "seatReservations" in t, get: (t) => t.seatReservations, set: (t, s) => {
671
- t.seatReservations = s;
672
- } }, metadata: e }, D, B), f(h, null, z, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, s) => {
673
- t.hasNavigation = s;
674
- } }, metadata: e }, F, V), f(h, null, O, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, s) => {
675
- t.alignVertical = s;
676
- } }, metadata: e }, G, L), f(h, null, W, { kind: "accessor", name: "baseGridSize", static: !1, private: !1, access: { has: (t) => "baseGridSize" in t, get: (t) => t.baseGridSize, set: (t, s) => {
677
- t.baseGridSize = s;
678
- } }, metadata: e }, X, K), f(h, null, H, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, s) => {
679
- t.height = s;
680
- } }, metadata: e }, U, q), f(h, null, M, { kind: "accessor", name: "maxSeatReservations", static: !1, private: !1, access: { has: (t) => "maxSeatReservations" in t, get: (t) => t.maxSeatReservations, set: (t, s) => {
681
- t.maxSeatReservations = s;
682
- } }, metadata: e }, $, j), f(h, null, Y, { kind: "accessor", name: "maxBicycleReservations", static: !1, private: !1, access: { has: (t) => "maxBicycleReservations" in t, get: (t) => t.maxBicycleReservations, set: (t, s) => {
683
- t.maxBicycleReservations = s;
684
- } }, metadata: e }, J, Q), f(h, null, Z, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, s) => {
685
- t.preventPlaceClick = s;
686
- } }, metadata: e }, ee, te), f(h, null, se, { kind: "accessor", name: "preselectCoachIndex", static: !1, private: !1, access: { has: (t) => "preselectCoachIndex" in t, get: (t) => t.preselectCoachIndex, set: (t, s) => {
687
- t.preselectCoachIndex = s;
688
- } }, metadata: e }, ie, ae), f(h, null, ce, { kind: "accessor", name: "selectedCoachIndex", static: !1, private: !1, access: { has: (t) => "selectedCoachIndex" in t, get: (t) => t.selectedCoachIndex, set: (t, s) => {
689
- t.selectedCoachIndex = s;
690
- } }, metadata: e }, oe, re), f(h, null, le, { kind: "accessor", name: "focusedCoachIndex", static: !1, private: !1, access: { has: (t) => "focusedCoachIndex" in t, get: (t) => t.focusedCoachIndex, set: (t, s) => {
691
- t.focusedCoachIndex = s;
692
- } }, metadata: e }, ne, he), f(h, null, de, { kind: "accessor", name: "hoveredScrollCoachIndex", static: !1, private: !1, access: { has: (t) => "hoveredScrollCoachIndex" in t, get: (t) => t.hoveredScrollCoachIndex, set: (t, s) => {
693
- t.hoveredScrollCoachIndex = s;
696
+ u = [C({ attribute: "seat-reservations", type: Array })], z = [S(), C({ attribute: "has-navigation", type: Boolean })], G = [S(), C({ attribute: "align-vertical", type: Boolean, reflect: !0, useDefault: !0 })], K = [S(), C({ attribute: "base-grid-size", type: Number })], H = [S(), C({ attribute: "height", type: Number })], q = [S(), C({ attribute: "max-seat-reservations", type: Number })], Y = [S(), C({ attribute: "max-bicycle-reservations", type: Number })], Z = [S(), C({ attribute: "prevent-place-click", type: Boolean })], ie = [S(), C({ attribute: "preselect-coach-index", type: Number })], ce = [T()], le = [T()], de = [T()], ve = [_e({ passive: !0 })], f(h, null, u, { kind: "accessor", name: "seatReservations", static: !1, private: !1, access: { has: (t) => "seatReservations" in t, get: (t) => t.seatReservations, set: (t, i) => {
697
+ t.seatReservations = i;
698
+ } }, metadata: e }, D, B), f(h, null, z, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, i) => {
699
+ t.hasNavigation = i;
700
+ } }, metadata: e }, F, V), f(h, null, G, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, i) => {
701
+ t.alignVertical = i;
702
+ } }, metadata: e }, O, L), f(h, null, K, { kind: "accessor", name: "baseGridSize", static: !1, private: !1, access: { has: (t) => "baseGridSize" in t, get: (t) => t.baseGridSize, set: (t, i) => {
703
+ t.baseGridSize = i;
704
+ } }, metadata: e }, W, X), f(h, null, H, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, i) => {
705
+ t.height = i;
706
+ } }, metadata: e }, U, M), f(h, null, q, { kind: "accessor", name: "maxSeatReservations", static: !1, private: !1, access: { has: (t) => "maxSeatReservations" in t, get: (t) => t.maxSeatReservations, set: (t, i) => {
707
+ t.maxSeatReservations = i;
708
+ } }, metadata: e }, $, j), f(h, null, Y, { kind: "accessor", name: "maxBicycleReservations", static: !1, private: !1, access: { has: (t) => "maxBicycleReservations" in t, get: (t) => t.maxBicycleReservations, set: (t, i) => {
709
+ t.maxBicycleReservations = i;
710
+ } }, metadata: e }, J, Q), f(h, null, Z, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, i) => {
711
+ t.preventPlaceClick = i;
712
+ } }, metadata: e }, ee, te), f(h, null, ie, { kind: "accessor", name: "preselectCoachIndex", static: !1, private: !1, access: { has: (t) => "preselectCoachIndex" in t, get: (t) => t.preselectCoachIndex, set: (t, i) => {
713
+ t.preselectCoachIndex = i;
714
+ } }, metadata: e }, se, ae), f(h, null, ce, { kind: "accessor", name: "selectedCoachIndex", static: !1, private: !1, access: { has: (t) => "selectedCoachIndex" in t, get: (t) => t.selectedCoachIndex, set: (t, i) => {
715
+ t.selectedCoachIndex = i;
716
+ } }, metadata: e }, oe, re), f(h, null, le, { kind: "accessor", name: "focusedCoachIndex", static: !1, private: !1, access: { has: (t) => "focusedCoachIndex" in t, get: (t) => t.focusedCoachIndex, set: (t, i) => {
717
+ t.focusedCoachIndex = i;
718
+ } }, metadata: e }, ne, he), f(h, null, de, { kind: "accessor", name: "hoveredCoachIndex", static: !1, private: !1, access: { has: (t) => "hoveredCoachIndex" in t, get: (t) => t.hoveredCoachIndex, set: (t, i) => {
719
+ t.hoveredCoachIndex = i;
694
720
  } }, metadata: e }, ue, ge), f(h, null, ve, { kind: "method", name: "coachAreaScrollend", static: !1, private: !1, access: { has: (t) => "coachAreaScrollend" in t, get: (t) => t.coachAreaScrollend }, metadata: e }, null, d), e && Object.defineProperty(h, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
695
721
  })(), h.events = {
696
722
  selectedplaces: "selectedplaces",