@sbb-esta/lyne-elements-experimental 3.1.0 → 3.3.0

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 (70) hide show
  1. package/custom-elements.json +1147 -590
  2. package/development/seat-reservation/common/mapper/icon-mapper.d.ts.map +1 -1
  3. package/development/seat-reservation/common/mapper/icon-mapper.js +4 -5
  4. package/development/seat-reservation/common/mapper/mapper.d.ts +6 -5
  5. package/development/seat-reservation/common/mapper/mapper.d.ts.map +1 -1
  6. package/development/seat-reservation/common/mapper/mapper.js +14 -11
  7. package/development/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts +113 -0
  8. package/development/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts.map +1 -1
  9. package/development/seat-reservation/common/mapper/seat-reservation-sample-data.js +25999 -649
  10. package/development/seat-reservation/common/svgs.d.ts +0 -1
  11. package/development/seat-reservation/common/svgs.d.ts.map +1 -1
  12. package/development/seat-reservation/common/svgs.js +1 -3
  13. package/development/seat-reservation/common/translations/i18n.d.ts.map +1 -1
  14. package/development/seat-reservation/common/translations/i18n.js +225 -194
  15. package/development/seat-reservation/common/types.d.ts +20 -3
  16. package/development/seat-reservation/common/types.d.ts.map +1 -1
  17. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +50 -18
  18. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts.map +1 -1
  19. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.js +352 -172
  20. package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts +29 -13
  21. package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
  22. package/development/seat-reservation/seat-reservation/seat-reservation.component.js +603 -308
  23. package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +17 -10
  24. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.d.ts.map +1 -1
  25. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +1 -6
  26. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +36 -18
  27. package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts +3 -1
  28. package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +1 -1
  29. package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +54 -32
  30. package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts +2 -0
  31. package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts.map +1 -1
  32. package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +107 -58
  33. package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts +1 -16
  34. package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +1 -1
  35. package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +10 -164
  36. package/package.json +2 -2
  37. package/seat-reservation/common/mapper/icon-mapper.d.ts.map +1 -1
  38. package/seat-reservation/common/mapper/icon-mapper.js +3 -4
  39. package/seat-reservation/common/mapper/mapper.d.ts +6 -5
  40. package/seat-reservation/common/mapper/mapper.d.ts.map +1 -1
  41. package/seat-reservation/common/mapper/mapper.js +35 -32
  42. package/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts +113 -0
  43. package/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts.map +1 -1
  44. package/seat-reservation/common/mapper/seat-reservation-sample-data.js +25997 -648
  45. package/seat-reservation/common/svgs.d.ts +0 -1
  46. package/seat-reservation/common/svgs.d.ts.map +1 -1
  47. package/seat-reservation/common/svgs.js +4 -11
  48. package/seat-reservation/common/translations/i18n.d.ts.map +1 -1
  49. package/seat-reservation/common/translations/i18n.js +228 -197
  50. package/seat-reservation/common/types.d.ts +20 -3
  51. package/seat-reservation/common/types.d.ts.map +1 -1
  52. package/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +50 -18
  53. package/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts.map +1 -1
  54. package/seat-reservation/seat-reservation/seat-reservation-base-element.js +294 -175
  55. package/seat-reservation/seat-reservation/seat-reservation.component.d.ts +29 -13
  56. package/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
  57. package/seat-reservation/seat-reservation/seat-reservation.component.js +318 -303
  58. package/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +22 -22
  59. package/seat-reservation/seat-reservation-graphic/seat-reservation-assets.d.ts.map +1 -1
  60. package/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +0 -5
  61. package/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +37 -37
  62. package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts +3 -1
  63. package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +1 -1
  64. package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +95 -84
  65. package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts +2 -0
  66. package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts.map +1 -1
  67. package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +75 -63
  68. package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts +1 -16
  69. package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +1 -1
  70. package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +14 -101
@@ -1,34 +1,40 @@
1
- var Q = (a) => {
2
- throw TypeError(a);
1
+ var ue = (h) => {
2
+ throw TypeError(h);
3
3
  };
4
- var Y = (a, l, h) => l.has(a) || Q("Cannot " + h);
5
- var d = (a, l, h) => (Y(a, l, "read from private field"), h ? h.call(a) : l.get(a)), u = (a, l, h) => l.has(a) ? Q("Cannot add the same private member more than once") : l instanceof WeakSet ? l.add(a) : l.set(a, h), c = (a, l, h, R) => (Y(a, l, "write to private field"), R ? R.call(a, h) : l.set(a, h), h);
6
- import { __runInitializers as o, __esDecorate as f } from "tslib";
7
- import { isArrowKeyOrPageKeysPressed as ee } from "@sbb-esta/lyne-elements/core/a11y.js";
8
- import { forceType as y } from "@sbb-esta/lyne-elements/core/decorators.js";
9
- import { LitElement as te } from "lit";
10
- import { property as C, state as Z } from "lit/decorators.js";
11
- import { mapPlaceInfosToPlaceSelection as ie, mapPlaceAndCoachToSeatReservationPlaceSelection as se, mapCoachInfosToCoachSelection as ae } from "../common/mapper.js";
12
- var g;
13
- (function(a) {
14
- a.right = "right", a.left = "left";
15
- })(g || (g = {}));
16
- let fe = (() => {
17
- var v, S, p, x, b, I, P, _, m, r;
18
- let a = te, l, h = [], R = [], E, A = [], w = [], N, k = [], T = [], z, B = [], G = [], V, F = [], O = [], D, W = [], K = [], L, H = [], U = [], X, q = [], M = [], j, $ = [], J = [];
19
- return r = class extends a {
4
+ var ge = (h, d, u) => d.has(h) || ue("Cannot " + u);
5
+ var g = (h, d, u) => (ge(h, d, "read from private field"), u ? u.call(h) : d.get(h)), v = (h, d, u) => d.has(h) ? ue("Cannot add the same private member more than once") : d instanceof WeakSet ? d.add(h) : d.set(h, u), o = (h, d, u, w) => (ge(h, d, "write to private field"), w ? w.call(h, u) : d.set(h, u), u);
6
+ import { __runInitializers as r, __esDecorate as f } from "tslib";
7
+ import { isArrowKeyOrPageKeysPressed as ve } from "@sbb-esta/lyne-elements/core/a11y.js";
8
+ import { forceType as S } from "@sbb-esta/lyne-elements/core/decorators.js";
9
+ import { LitElement as fe } from "lit";
10
+ import { property as C, state as B } from "lit/decorators.js";
11
+ import { mapPlaceInfosToPlaceSelection as Ce, mapPlaceAndCoachToSeatReservationPlaceSelection as Se, mapCoachInfosToCoachSelection as xe } from "../common/mapper.js";
12
+ var x;
13
+ (function(h) {
14
+ h.right = "right", h.left = "left";
15
+ })(x || (x = {}));
16
+ let Re = (() => {
17
+ var I, p, b, m, y, _, P, A, R, k, E, N, n;
18
+ let h = fe, d, u = [], w = [], T, D = [], z = [], G, F = [], V = [], L, O = [], W = [], X, H = [], K = [], U, q = [], M = [], $, j = [], J = [], Q, Y = [], Z = [], ee, te = [], ie = [], se, ae = [], ce = [], oe, re = [], le = [], he, ne = [], de = [];
19
+ return n = class extends h {
20
20
  constructor() {
21
21
  super(...arguments);
22
- u(this, v);
23
- u(this, S);
24
- u(this, p);
25
- u(this, x);
26
- u(this, b);
27
- u(this, I);
28
- u(this, P);
29
- u(this, _);
30
- u(this, m);
31
- c(this, v, o(this, h, null)), c(this, S, (o(this, R), o(this, A, !0))), c(this, p, (o(this, w), o(this, k, !1))), c(this, x, (o(this, T), o(this, B, 16))), c(this, b, (o(this, G), o(this, F, null))), c(this, I, (o(this, O), o(this, W, null))), c(this, P, (o(this, K), o(this, H, !1))), c(this, _, (o(this, U), o(this, q, -1))), c(this, m, (o(this, M), o(this, $, -1))), this.coachBorderPadding = (o(this, J), 6), this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.currScrollDirection = g.right, this.maxCalcCoachsWidth = 0, this.scrollCoachsAreaWidth = 0, this.triggerCoachPositionsCollection = [], this.firstTabElement = null, this.lastTabElement = null, this.coachScrollArea = null, this.currSelectedPlace = null, this.currSelectedPlaceElementId = null, this.currSelectedCoachIndex = -1, this.preventCoachScrollByPlaceClick = !1, this.selectedSeatReservationPlaces = [], this.seatReservationWithoutNavigationHasFocus = !1, this.isCoachGridFocusable = !1, this.isAutoScrolling = !1, this.isKeyboardNavigation = !1, this.keyboardNavigationEvents = {
22
+ v(this, I);
23
+ v(this, p);
24
+ v(this, b);
25
+ v(this, m);
26
+ v(this, y);
27
+ v(this, _);
28
+ v(this, P);
29
+ v(this, A);
30
+ v(this, R);
31
+ v(this, k);
32
+ v(this, E);
33
+ v(this, N);
34
+ o(this, I, r(this, u, null)), o(this, p, (r(this, w), r(this, D, !0))), o(this, b, (r(this, z), r(this, F, !1))), o(this, m, (r(this, V), r(this, O, 16))), o(this, y, (r(this, W), r(this, H, null))), o(this, _, (r(this, K), r(this, q, -1))), o(this, P, (r(this, M), r(this, j, -1))), o(this, A, (r(this, J), r(this, Y, !1))), o(this, R, (r(this, Z), r(this, te, -1))), o(this, k, (r(this, ie), r(this, ae, -1))), o(this, E, (r(this, ce), r(this, re, -1))), o(this, N, (r(this, le), r(this, ne, -1))), this.coachBorderPadding = (r(this, de), 6), this.gapBetweenCoaches = 4, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.gapBetweenCoachDecks = 48, this.coachNavButtonDim = 0, this.currScrollDirection = x.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 = {
35
+ seats: [],
36
+ bicycles: []
37
+ }, this.seatReservationWithoutNavigationHasFocus = !1, this.isCoachGridFocusable = !1, this.isAutoScrolling = !1, this.isKeyboardNavigation = !1, this.hasMultipleDecks = !1, this.keyboardNavigationEvents = {
32
38
  ArrowLeft: "ArrowLeft",
33
39
  ArrowRight: "ArrowRight",
34
40
  ArrowUp: "ArrowUp",
@@ -37,85 +43,135 @@ let fe = (() => {
37
43
  Enter: "Enter"
38
44
  };
39
45
  }
40
- /** The seat reservation object which contains all coaches and places */
41
- get seatReservation() {
42
- return d(this, v);
46
+ /** The seat reservations array contains all coaches and places */
47
+ get seatReservations() {
48
+ return g(this, I);
43
49
  }
44
- set seatReservation(e) {
45
- c(this, v, e);
50
+ set seatReservations(e) {
51
+ o(this, I, e);
46
52
  }
47
53
  /** The seat reservation navigation can be toggled by this property */
48
54
  get hasNavigation() {
49
- return d(this, S);
55
+ return g(this, p);
50
56
  }
51
57
  set hasNavigation(e) {
52
- c(this, S, e);
58
+ o(this, p, e);
53
59
  }
54
60
  /** The seat reservation area is aligned vertically */
55
61
  get alignVertical() {
56
- return d(this, p);
62
+ return g(this, b);
57
63
  }
58
64
  set alignVertical(e) {
59
- c(this, p, e);
65
+ o(this, b, e);
60
66
  }
61
67
  /** The seat reservation area's base grid size */
62
68
  get baseGridSize() {
63
- return d(this, x);
69
+ return g(this, m);
64
70
  }
65
71
  set baseGridSize(e) {
66
- c(this, x, e);
72
+ o(this, m, e);
67
73
  }
68
74
  /** The seat reservation area's width */
69
75
  get height() {
70
- return d(this, b);
76
+ return g(this, y);
71
77
  }
72
78
  set height(e) {
73
- c(this, b, e);
79
+ o(this, y, e);
74
80
  }
75
81
  /** Maximal number of possible clickable seats */
76
- get maxReservations() {
77
- return d(this, I);
82
+ get maxSeatReservations() {
83
+ return g(this, _);
78
84
  }
79
- set maxReservations(e) {
80
- c(this, I, e);
85
+ set maxSeatReservations(e) {
86
+ o(this, _, e);
87
+ }
88
+ /** Maximal number of possible clickable bicycle places */
89
+ get maxBicycleReservations() {
90
+ return g(this, P);
91
+ }
92
+ set maxBicycleReservations(e) {
93
+ o(this, P, e);
81
94
  }
82
95
  /** Any click functionality is prevented */
83
96
  get preventPlaceClick() {
84
- return d(this, P);
97
+ return g(this, A);
85
98
  }
86
99
  set preventPlaceClick(e) {
87
- c(this, P, e);
100
+ o(this, A, e);
101
+ }
102
+ get preselectCoachIndex() {
103
+ return g(this, R);
104
+ }
105
+ set preselectCoachIndex(e) {
106
+ o(this, R, e);
88
107
  }
89
108
  get selectedCoachIndex() {
90
- return d(this, _);
109
+ return g(this, k);
91
110
  }
92
111
  set selectedCoachIndex(e) {
93
- c(this, _, e);
112
+ o(this, k, e);
94
113
  }
95
114
  get focusedCoachIndex() {
96
- return d(this, m);
115
+ return g(this, E);
97
116
  }
98
117
  set focusedCoachIndex(e) {
99
- c(this, m, e);
118
+ o(this, E, e);
119
+ }
120
+ //Sets the hover style when scrolling to a coach
121
+ get hoveredScrollCoachIndex() {
122
+ return g(this, N);
123
+ }
124
+ set hoveredScrollCoachIndex(e) {
125
+ o(this, N, e);
100
126
  }
101
127
  willUpdate(e) {
102
- super.willUpdate(e), e.has("seatReservation") && this._initSeatReservationPlaceSelection(), e.has("baseGridSize") && (this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.alignVertical && this._setVerticalAlignmentOffset()), e.has("height") && this.height && this.seatReservation.coachItems.length && (this.baseGridSize = this.height / this.seatReservation.coachItems[0].dimension.h, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.alignVertical && this._setVerticalAlignmentOffset()), e.has("alignVertical") && this.alignVertical && this._setVerticalAlignmentOffset();
128
+ if (super.willUpdate(e), e.has("seatReservations") && (this.hasMultipleDecks = this.seatReservations?.length > 1, this._initSeatReservationPlaceSelection()), e.has("baseGridSize") && (this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.initNavigationSelectionByScrollEvent()), e.has("height") && this.height) {
129
+ const t = this.seatReservations[this.currSelectedDeckIndex] || null;
130
+ 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());
131
+ }
132
+ e.has("alignVertical") && this.alignVertical && this.initNavigationSelectionByScrollEvent(), e.has("preselectCoachIndex") && this.preselectCoachIndex && setTimeout(() => this.scrollToSelectedNavCoach(this.preselectCoachIndex), 1);
133
+ }
134
+ navigateByDirectionBtn(e) {
135
+ this.unfocusPlaceElement();
136
+ let t = this.currSelectedCoachIndex;
137
+ e == "DIRECTION_LEFT" && t > 0 ? t = this.currSelectedCoachIndex != -1 ? this.currSelectedCoachIndex - 1 : 0 : e == "DIRECTION_RIGHT" && t < this.seatReservations[this.currSelectedDeckIndex].coachItems.length - 1 && (t = this.currSelectedCoachIndex != -1 ? this.currSelectedCoachIndex + 1 : 0), this.scrollToSelectedNavCoach(t);
138
+ }
139
+ /**
140
+ * Data can be prepared once for the entire component
141
+ * in order to avoid recurring iteration processes in rendering.
142
+ */
143
+ initPrepairSeatReservationData() {
144
+ this._prepairCoachDriverArea();
103
145
  }
104
146
  /* Init scroll event handling for coach navigation */
105
147
  initNavigationSelectionByScrollEvent() {
106
- if (this.firstTabElement = this.shadowRoot?.getElementById("first-tab-element"), this.lastTabElement = this.shadowRoot?.getElementById("last-tab-element"), this.coachScrollArea = this.shadowRoot?.getElementById("sbb-sr__parent-area"), this.coachScrollArea) {
107
- let e = 0;
108
- this.scrollCoachsAreaWidth = this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = this.seatReservation.coachItems.map((t) => {
109
- const i = e, s = this.getCalculatedDimension(t.dimension).w;
110
- return e += s, {
111
- start: i,
112
- end: e,
113
- width: s
148
+ 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");
149
+ const e = this.seatReservations ? this.seatReservations[this.currSelectedDeckIndex] : null;
150
+ if (e && e.coachItems.length > 0) {
151
+ const t = e.coachItems[0].dimension.h * this.baseGridSize + this.coachBorderPadding, i = (this.seatReservations.length - 1) * this.gapBetweenCoachDecks;
152
+ this.style?.setProperty("--sbb-seat-reservation-height", `${t * this.seatReservations.length + i}`), this.style?.setProperty("--sbb-seat-reservation-decks", `${this.seatReservations.length}`);
153
+ }
154
+ if (this.navigationScrollArea) {
155
+ this.scrollNavigationAreaDim = this.alignVertical ? this.navigationScrollArea.getBoundingClientRect().height : this.navigationScrollArea.getBoundingClientRect().width;
156
+ const t = this.navigationScrollArea.querySelector("ul > li");
157
+ if (t) {
158
+ const i = t?.getBoundingClientRect();
159
+ this.coachNavButtonDim = this.alignVertical ? i.height : i.width;
160
+ }
161
+ }
162
+ if (this.coachScrollArea && e) {
163
+ let t = 0;
164
+ this.scrollCoachsAreaWidth = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = e.coachItems.map((i) => {
165
+ const s = t, c = this.getCalculatedDimension(i.dimension).w;
166
+ return t += c + this.gapBetweenCoaches, {
167
+ start: s,
168
+ end: t,
169
+ width: c
114
170
  };
115
- }), this.maxCalcCoachsWidth = e, this.coachScrollArea.addEventListener("scrollend", () => {
116
- const t = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
117
- this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex = t : this.currSelectedCoachIndex = t < this.currSelectedCoachIndex ? this.currSelectedCoachIndex : t, this.preventCoachScrollByPlaceClick = !1, this.updateCurrentSelectedCoach(), this.hasNavigation || (this.preselectPlaceInCoach(), this.isAutoScrolling = !1);
118
- }), this.alignVertical && this._setVerticalAlignmentOffset();
171
+ }), this.maxCalcCoachsWidth = t, this.coachScrollArea.addEventListener("scrollend", () => {
172
+ const i = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
173
+ this.currSelectedCoachIndex === -1 && (this.currSelectedCoachIndex = i), this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex = i : this.currSelectedCoachIndex = i < this.currSelectedCoachIndex ? this.currSelectedCoachIndex : i, this.isAutoScrolling || this._scrollToSelectedNavigationButton(i), this.preventCoachScrollByPlaceClick = !1, this.updateCurrentSelectedCoach(), this.hasNavigation || (this.preselectPlaceInCoach(), this.isAutoScrolling = !1);
174
+ });
119
175
  }
120
176
  }
121
177
  /**
@@ -143,7 +199,7 @@ let fe = (() => {
143
199
  return;
144
200
  }
145
201
  }
146
- if (this.currSelectedCoachIndex !== -1 && ee(e))
202
+ if (this.currSelectedCoachIndex !== -1 && ve(e))
147
203
  switch (e.preventDefault(), t) {
148
204
  case this.keyboardNavigationEvents.ArrowLeft:
149
205
  {
@@ -184,27 +240,82 @@ let fe = (() => {
184
240
  this.isAutoScrolling = !0, this.isCoachGridFocusable = !0, this.currSelectedCoachIndex = e, this._setScrollDirectionByCoachIndex();
185
241
  const t = this._getCoachScrollPositionX();
186
242
  (this.selectedCoachIndex !== -1 || this.currSelectedCoachIndex > 0) && this._isScrollableToSelectedCoach() ? this.coachScrollArea.scrollTo({
187
- top: 0,
188
- left: t,
243
+ top: this.alignVertical ? t : 0,
244
+ left: this.alignVertical ? 0 : t,
189
245
  behavior: "smooth"
190
- }) : this.updateCurrentSelectedCoach();
246
+ }) : this.updateCurrentSelectedCoach(), this._scrollToSelectedNavigationButton(e);
191
247
  }
192
248
  }
249
+ focusPlaceElement(e) {
250
+ if (this.unfocusPlaceElement(), e) {
251
+ this.currSelectedPlace = e, this._setCurrSelectedPlaceElementId(e);
252
+ const t = this._getPlaceHtmlElement();
253
+ t && t.setAttribute("keyfocus", "focus");
254
+ }
255
+ }
256
+ unfocusPlaceElement() {
257
+ const e = this._getPlaceHtmlElement();
258
+ e && (e.setAttribute("keyfocus", "unfocus"), this._setCurrSelectedPlaceElementId(null), this.currSelectedPlace = null);
259
+ }
260
+ getCalculatedDimension(e, t, i, s) {
261
+ return t && !i && (e.h += this.coachBorderOffset * 2), s && (e.h += this.coachBorderOffset), {
262
+ w: this.baseGridSize * e.w,
263
+ h: this.baseGridSize * e.h
264
+ };
265
+ }
266
+ getCalculatedPosition(e, t, i, s) {
267
+ if (i && t) {
268
+ const c = s ? i.h : i.h + this.coachBorderOffset;
269
+ e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === c && (e.y += this.coachBorderOffset);
270
+ }
271
+ return {
272
+ x: this.baseGridSize * e.x,
273
+ y: this.baseGridSize * e.y,
274
+ z: e.z
275
+ };
276
+ }
277
+ /**
278
+ * Counts all available seats together depending on the seat type
279
+ *
280
+ * @param coachIndex
281
+ * @returns An Object with count of free seats and free bicycle places
282
+ */
283
+ getAvailableFreePlacesNumFromCoach(e) {
284
+ const t = { seats: 0, bicycles: 0 }, i = this.seatReservations[this.currSelectedDeckIndex].coachItems[e].places?.reduce((s, c) => (c.state !== "FREE" || (c.type === "SEAT" ? s.seats++ : s.bicycles++), s), t);
285
+ return i || t;
286
+ }
287
+ /**
288
+ * Performs an automatic main navigation scroll to the specified selectedNavCoachIndex.
289
+ * Calculates the central scroll offset of the nav coach to be selected.
290
+ * @param selectedNavCoachIndex
291
+ */
292
+ _scrollToSelectedNavigationButton(e) {
293
+ setTimeout(() => {
294
+ if (this.hoveredScrollCoachIndex = e, this.hasNavigation && this.navigationScrollArea) {
295
+ const t = this.scrollNavigationAreaDim / 2, s = e * this.coachNavButtonDim - t + this.coachNavButtonDim;
296
+ this.navigationScrollArea.scrollTo({
297
+ top: this.alignVertical ? s : 0,
298
+ left: this.alignVertical ? 0 : s,
299
+ behavior: "smooth"
300
+ });
301
+ }
302
+ }, 10);
303
+ }
193
304
  /**
194
305
  * Sets the new ScrollDirection by the new given target coach index.
195
306
  */
196
307
  _setScrollDirectionByCoachIndex() {
197
- this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ? g.right : g.left;
308
+ this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ? x.right : x.left;
198
309
  }
199
310
  /**
200
311
  * Returns the scroll start or end position X from the selected coach.
201
- * In case the user is curretnly navigate throught places by keyboard and goes to previous coach,
202
- * then we return the end position of the coach to get clostest next scroll position of the next focus place.
312
+ * In case the user is currently navigating through places by keyboard and goes to previous coach,
313
+ * then we return the end position of the coach to get the closest scroll position of the next focus place.
203
314
  * @returns number
204
315
  */
205
316
  _getCoachScrollPositionX() {
206
317
  const e = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];
207
- return this.isKeyboardNavigation && this.currScrollDirection === g.left && e.width > this.scrollCoachsAreaWidth ? e.end - this.scrollCoachsAreaWidth : e.start;
318
+ return this.isKeyboardNavigation && this.currScrollDirection === x.left && e.width > this.scrollCoachsAreaWidth ? e.end - this.scrollCoachsAreaWidth : e.start;
208
319
  }
209
320
  /**
210
321
  * Sets the focus on the HTML table (grid) caption element so that the heading is read out when using a ScreenReader.
@@ -221,16 +332,16 @@ let fe = (() => {
221
332
  * @returns boolean
222
333
  */
223
334
  _isScrollableToSelectedCoach() {
224
- const e = this.coachScrollArea.scrollLeft, t = this.coachScrollArea.getBoundingClientRect().width, i = this.maxCalcCoachsWidth - t, s = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex], n = e === this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;
225
- return (e < i || e > s.start) && !n;
335
+ 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], c = e === this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;
336
+ return (e < i || e > s.start) && !c;
226
337
  }
227
338
  /**
228
339
  * Returns the coach index which is currently visible in the scroll area
229
340
  * @returns number
230
341
  */
231
342
  _getCoachIndexByScrollTriggerPosition() {
232
- const e = this.coachScrollArea.scrollLeft + this.scrollCoachsAreaWidth / 2;
233
- return this.triggerCoachPositionsCollection.findIndex((t) => e >= t.start && e <= t.end);
343
+ const t = (this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft) + this.scrollCoachsAreaWidth / 2;
344
+ return this.triggerCoachPositionsCollection.findIndex((i) => t >= i.start && t <= i.end);
234
345
  }
235
346
  /**
236
347
  * Get the first place of current selected coach by table cell coordinate 0-0 id.
@@ -238,8 +349,11 @@ let fe = (() => {
238
349
  */
239
350
  _getFirstPlaceInSelecedCoach() {
240
351
  let e = null;
241
- const t = this.seatReservation?.coachItems[this.currSelectedCoachIndex], i = "cell-" + this.currSelectedCoachIndex + "-0-0", s = this.shadowRoot?.querySelector("[cell-id='" + i + "']")?.querySelector("sbb-seat-reservation-place-control")?.getAttribute("text") || null;
242
- return t && s && (e = t.places?.find((n) => n.number === s) || null), e;
352
+ 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;
353
+ return t && s && (e = t.places?.find((c) => c.number === s) || null), e;
354
+ }
355
+ _getSwitchedCoachDeckIndexByKeyNavigation(e, t) {
356
+ 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;
243
357
  }
244
358
  /**
245
359
  * To get the correct closest place of current pressed key and the current selected place,
@@ -248,56 +362,39 @@ let fe = (() => {
248
362
  * @returns Place or null
249
363
  */
250
364
  _getClosestPlaceByKeyDirection(e) {
251
- const t = this.seatReservation?.coachItems[this.currSelectedCoachIndex];
252
- let i = null;
253
- if (t.places)
365
+ const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex];
366
+ let i = null, s = t.places, c = null;
367
+ if (s)
254
368
  if (this.currSelectedPlaceElementId) {
255
- if (this.currSelectedPlace)
256
- for (const s of t.places)
257
- e ? s.number !== this.currSelectedPlace?.number && (e === this.keyboardNavigationEvents.ArrowRight && (s.position.y === this.currSelectedPlace.position.y || s.position.y === this.currSelectedPlace.position.y - 1) && s.position.x > this.currSelectedPlace.position.x && (!i || s.position.x < i.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (s.position.x === this.currSelectedPlace.position.x || s.position.x === this.currSelectedPlace.position.x + 1) && s.position.y > this.currSelectedPlace.position.y && (!i || s.position.y < i.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (s.position.y === this.currSelectedPlace.position.y || s.position.y === this.currSelectedPlace.position.y + 1) && s.position.x < this.currSelectedPlace.position.x && (!i || s.position.x > i.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (s.position.x === this.currSelectedPlace.position.x || s.position.x === this.currSelectedPlace.position.x - 1) && s.position.y < this.currSelectedPlace?.position.y && (!i || s.position.y > i.position.y)) && (i = s) : (this.currScrollDirection === g.right && s.position.y === this.currSelectedPlace?.position.y && (!i || s.position.x < i.position.x) || this.currScrollDirection === g.left && s.position.y === this.currSelectedPlace?.position.y && (!i || s.position.x > i.position.x)) && (i = s);
369
+ if (this.currSelectedPlace) {
370
+ const l = { ...this.currSelectedPlace.position };
371
+ e && (c = this._getSwitchedCoachDeckIndexByKeyNavigation(e, t), c !== null && (s = this.seatReservations[c].coachItems[this.currSelectedCoachIndex].places || [], l.y = c < this.currSelectedDeckIndex ? t.dimension.h : -1));
372
+ for (const a of s)
373
+ e ? a.number !== this.currSelectedPlace?.number && (e === this.keyboardNavigationEvents.ArrowRight && (a.position.y === l.y || a.position.y === l.y - 1) && a.position.x > l.x && (!i || a.position.x < i.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (a.position.x === l.x || a.position.x === l.x + 1) && a.position.y > l.y && (!i || a.position.y < i.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (a.position.y === l.y || a.position.y === l.y + 1) && a.position.x < l.x && (!i || a.position.x > i.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (a.position.x === l.x || a.position.x === l.x - 1) && a.position.y < l.y && (!i || a.position.y > i.position.y)) && (i = a) : (this.currScrollDirection === x.right && a.position.y === l.y && (!i || a.position.x < i.position.x) || this.currScrollDirection === x.left && a.position.y === l.y && (!i || a.position.x > i.position.x)) && (i = a);
374
+ c !== null && i && (this.currSelectedDeckIndex = c);
375
+ }
258
376
  } else
259
377
  return this._getFirstPlaceInSelecedCoach();
260
378
  return i;
261
379
  }
262
- focusPlaceElement(e, t) {
263
- if (this.unfocusPlaceElement(), e) {
264
- this.currSelectedPlace = e, t && (this.currSelectedCoachIndex = t), this._setCurrSelectedPlaceElementId(e);
265
- const i = this._getPlaceHtmlElement();
266
- i && i.setAttribute("keyfocus", "focus");
267
- }
268
- }
269
- unfocusPlaceElement() {
270
- const e = this._getPlaceHtmlElement();
271
- e && (e.setAttribute("keyfocus", "unfocus"), this._setCurrSelectedPlaceElementId(null), this.currSelectedPlace = null);
272
- }
273
- getCalculatedDimension(e, t, i, s) {
274
- return t && !i && (e.h += this.coachBorderOffset * 2), s && (e.h += this.coachBorderOffset), {
275
- w: this.baseGridSize * e.w,
276
- h: this.baseGridSize * e.h
277
- };
278
- }
279
- getCalculatedPosition(e, t, i, s) {
280
- if (i && t) {
281
- const n = s ? i.h : i.h + this.coachBorderOffset;
282
- e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === n && (e.y += this.coachBorderOffset);
283
- }
284
- return {
285
- x: this.baseGridSize * e.x,
286
- y: this.baseGridSize * e.y,
287
- z: e.z
288
- };
289
- }
290
380
  // Handling for Tab navigation if an place is selected inside the coach.
291
381
  // This controls the focused coach from the current selected coach.
292
382
  _navigateCoachNavigationByKeyboard(e) {
293
383
  const t = this.focusedCoachIndex === -1 ? this.currSelectedCoachIndex === -1 ? 0 : this.currSelectedCoachIndex : this.focusedCoachIndex, i = e === "NEXT_TAB" ? this.getNextAvailableCoachIndex(t) : this.getPrevAvailableCoachIndex(t);
294
384
  if (t === i) {
295
- this.unfocusPlaceElement(), this.selectedCoachIndex = -1, this.currSelectedCoachIndex = -1, this.seatReservationWithoutNavigationHasFocus = !1, e === "NEXT_TAB" ? this.lastTabElement.focus() : this.firstTabElement.focus();
385
+ this.unfocusPlaceElement(), this.seatReservationWithoutNavigationHasFocus = !1, e === "NEXT_TAB" ? this.lastTabElement.focus() : this.firstTabElement.focus();
296
386
  return;
297
387
  }
298
388
  if (this.hasNavigation) {
299
- const s = this._getPlaceHtmlElement(), n = s ? s.getAttribute("keyfocus") === "focus" : !1;
300
- e === "PREV_TAB" && this.selectedCoachIndex === t ? n ? (this.focusedCoachIndex = t, this.unfocusPlaceElement()) : this.focusedCoachIndex = i : i !== this.currSelectedCoachIndex ? this.focusedCoachIndex = i : (this.focusedCoachIndex = -1, this.selectedCoachIndex = i, n ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid()));
389
+ const s = this._getPlaceHtmlElement(), c = s ? s.getAttribute("keyfocus") === "focus" : !1;
390
+ if (e === "PREV_TAB" && this.selectedCoachIndex === t)
391
+ if (c) {
392
+ this.focusedCoachIndex = t, this.unfocusPlaceElement();
393
+ return;
394
+ } else
395
+ this.focusedCoachIndex = i;
396
+ else i !== this.currSelectedCoachIndex ? this.focusedCoachIndex = i : (this.focusedCoachIndex = -1, this.selectedCoachIndex = i, c ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid()));
397
+ this._scrollToSelectedNavigationButton(i);
301
398
  } else
302
399
  this.scrollToSelectedNavCoach(i);
303
400
  }
@@ -314,31 +411,39 @@ let fe = (() => {
314
411
  }
315
412
  getNextAvailableCoachIndex(e) {
316
413
  const t = e ?? this.currSelectedCoachIndex;
317
- return t < this.seatReservation.coachItems.length - 1 ? t + 1 : t;
414
+ return t < this.seatReservations[this.currSelectedDeckIndex].coachItems.length - 1 ? t + 1 : t;
318
415
  }
319
416
  getPrevAvailableCoachIndex(e) {
320
417
  const t = e ?? this.currSelectedCoachIndex;
321
418
  return t > 0 ? t - 1 : t;
322
419
  }
323
420
  updateSelectedSeatReservationPlaces(e) {
324
- if (e.state === "SELECTED") {
325
- const t = this._getSeatReservationPlaceSelection(e);
326
- t && this.selectedSeatReservationPlaces.push(t);
327
- } else
328
- this.selectedSeatReservationPlaces = this.selectedSeatReservationPlaces.filter((t) => t.id !== e.id);
329
- this.maxReservations && this.selectedSeatReservationPlaces.length > this.maxReservations && this._resetAllPlaceSelections(e), this.dispatchEvent(new CustomEvent("selectedplaces", {
421
+ const t = e.placeType === "SEAT" ? "seats" : "bicycles", i = e.placeType === "SEAT" ? this.maxSeatReservations : this.maxBicycleReservations, s = this.selectedSeatReservationPlaces[t], c = this._updateSelectedSeatReservationPlaces(s, i, e);
422
+ this.selectedSeatReservationPlaces[t] = c, this.dispatchEvent(new CustomEvent("selectedplaces", {
330
423
  bubbles: !0,
331
424
  composed: !0,
332
425
  detail: this.selectedSeatReservationPlaces
333
426
  }));
334
427
  }
428
+ _updateSelectedSeatReservationPlaces(e, t, i) {
429
+ if (i.state === "SELECTED") {
430
+ const s = this._getSeatReservationPlaceSelection(i);
431
+ s && e.push(s);
432
+ } else
433
+ e = e.filter((s) => s.id !== i.id);
434
+ if (t > -1 && e.length > t) {
435
+ const s = t > 0 ? i : void 0;
436
+ e = this._resetAllPlaceSelections(e, s);
437
+ }
438
+ return e;
439
+ }
335
440
  updateCurrentSelectedPlaceInCoach(e) {
336
- const t = e.coachIndex, i = this.seatReservation.coachItems[t].places?.find((s) => s.number == e.number);
441
+ const t = e.coachIndex, i = this.seatReservations[this.currSelectedDeckIndex].coachItems[t].places?.find((s) => s.number == e.number);
337
442
  i && (this.currSelectedCoachIndex = t, this.currSelectedPlace = i, this.currSelectedCoachIndex !== this.selectedCoachIndex && this.updateCurrentSelectedCoach(), this._setCurrSelectedPlaceElementId(i));
338
443
  }
339
444
  updateCurrentSelectedCoach() {
340
445
  this.selectedCoachIndex = this.currSelectedCoachIndex, this.focusedCoachIndex = -1;
341
- const e = this._getSeatReservationCoachSelection(this.selectedCoachIndex);
446
+ const e = this._getSeatReservationSelectedCoach(this.selectedCoachIndex);
342
447
  e && this.dispatchEvent(new CustomEvent("selectedcoach", {
343
448
  bubbles: !0,
344
449
  composed: !0,
@@ -350,82 +455,96 @@ let fe = (() => {
350
455
  * that have the state SELECTED within the seatReservation object
351
456
  */
352
457
  _initSeatReservationPlaceSelection() {
353
- this.seatReservation.coachItems.map((e, t) => {
354
- e.places?.filter((i) => i.state === "SELECTED")?.forEach((i) => {
355
- const s = ie(i, t), n = this._getSeatReservationPlaceSelection(s);
356
- n && this.selectedSeatReservationPlaces.push(n);
458
+ this.seatReservations?.forEach((e) => e.coachItems.map((t, i) => {
459
+ t.places?.filter((s) => s.state === "SELECTED")?.forEach((s) => {
460
+ const c = Ce(s, e.deckCoachIndex, i), l = this._getSeatReservationPlaceSelection(c);
461
+ l && (l.placeType === "SEAT" ? this.selectedSeatReservationPlaces.seats.push(l) : this.selectedSeatReservationPlaces.bicycles.push(l));
357
462
  });
358
- });
463
+ }));
359
464
  }
360
465
  /**
361
466
  * All selected places will be reset or the currentSelectedPlace was given, then we reset all except currentSelectedPlace
467
+ * @param reservationPlaceSelections
362
468
  * @param currSelectedPlace
363
469
  */
364
- _resetAllPlaceSelections(e) {
365
- for (const t of this.selectedSeatReservationPlaces)
366
- (!e || e.id !== t.id) && (this.shadowRoot?.getElementById(t.id)).setAttribute("state", "FREE");
367
- e ? this.selectedSeatReservationPlaces = this.selectedSeatReservationPlaces.filter((t) => t.id === e.id) : this.selectedSeatReservationPlaces = [];
470
+ _resetAllPlaceSelections(e, t) {
471
+ for (const i of e)
472
+ if (!t || t.id !== i.id) {
473
+ const s = this.shadowRoot?.getElementById(i.id);
474
+ s && s.setAttribute("state", "FREE");
475
+ }
476
+ return t ? e = e.filter((i) => i.id === t.id) : e = [], e;
368
477
  }
369
478
  _getSeatReservationPlaceSelection(e) {
370
- const t = this.seatReservation.coachItems[e.coachIndex], i = t.places?.find((s) => s.number === e.number);
371
- return i ? se(i, t, e.coachIndex) : null;
479
+ const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[e.coachIndex], i = t.places?.find((s) => s.number === e.number);
480
+ return i ? Se(i, t, e.deckIndex, e.coachIndex) : null;
372
481
  }
373
- _getSeatReservationCoachSelection(e) {
374
- if (!this.seatReservation.coachItems[e])
482
+ _getSeatReservationSelectedCoach(e) {
483
+ if (!this.seatReservations[this.currSelectedDeckIndex].coachItems[e])
375
484
  return null;
376
- const t = this.seatReservation.coachItems[e];
377
- return ae(e, t);
485
+ const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[e], i = this.getAvailableFreePlacesNumFromCoach(e);
486
+ return xe(e, t, i);
378
487
  }
379
488
  _setCurrSelectedPlaceElementId(e) {
380
- e ? this.currSelectedPlaceElementId = "seat-reservation__place-button-" + this.currSelectedCoachIndex + "-" + e.number : this.currSelectedPlaceElementId = null;
489
+ e ? this.currSelectedPlaceElementId = "seat-reservation__place-button-" + this.currSelectedDeckIndex + "-" + this.currSelectedCoachIndex + "-" + e.number : this.currSelectedPlaceElementId = null;
381
490
  }
382
491
  /**
383
- * Returns the current selected place HTML element by given placeNumber and coachIndex.
384
- * If both doesnt exist, we try to return the place HTML element by the _currentSelectedPlaceElementId
385
- * @param placeNumber optional as string
386
- * @param coachIndex optional as string
387
- * @returns HTMLElement or null
388
- */
389
- _getPlaceHtmlElement(e, t) {
390
- const i = t || this.currSelectedCoachIndex, s = e ? "seat-reservation__place-button-" + i + "-" + e : this.currSelectedPlaceElementId;
391
- return s && this.shadowRoot?.getElementById(s) || null;
392
- }
393
- //Set the vertical offset
394
- _setVerticalAlignmentOffset() {
395
- setTimeout(() => {
396
- const e = this.shadowRoot?.querySelector(".sbb-sr__wrapper");
397
- if (e) {
398
- const t = e.getBoundingClientRect().width;
399
- this.style?.setProperty("--sbb-seat-reservation-vertical-offset", `${t}px`);
400
- }
492
+ * Prepares all coaches with the values for whether there is a driver area left or right
493
+ * */
494
+ _prepairCoachDriverArea() {
495
+ this.seatReservations.forEach((e, t) => {
496
+ this.seatReservations[t].coachItems = e.coachItems.map((i) => {
497
+ const s = i.graphicElements?.filter((c) => c.icon === "DRIVER_AREA");
498
+ if (s && s.length > 0) {
499
+ const c = s.find((a) => a.position.x === 0) || !1, l = s.find((a) => a.position.x > 0) || !1;
500
+ i.driverAreaSide = {
501
+ left: !!c,
502
+ right: !!l
503
+ };
504
+ }
505
+ return i;
506
+ });
401
507
  });
402
508
  }
403
- }, v = new WeakMap(), S = new WeakMap(), p = new WeakMap(), x = new WeakMap(), b = new WeakMap(), I = new WeakMap(), P = new WeakMap(), _ = new WeakMap(), m = new WeakMap(), (() => {
404
- const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(a[Symbol.metadata] ?? null) : void 0;
405
- l = [C({ attribute: "seat-reservation", type: Object })], E = [y(), C({ attribute: "has-navigation", type: Boolean })], N = [y(), C({ attribute: "align-vertical", type: Boolean })], z = [y(), C({ attribute: "base-grid-size", type: Number })], V = [y(), C({ attribute: "height", type: Number })], D = [y(), C({ attribute: "max-reservations", type: Number })], L = [y(), C({ attribute: "prevent-place-click", type: Boolean })], X = [Z()], j = [Z()], f(r, null, l, { kind: "accessor", name: "seatReservation", static: !1, private: !1, access: { has: (t) => "seatReservation" in t, get: (t) => t.seatReservation, set: (t, i) => {
406
- t.seatReservation = i;
407
- } }, metadata: e }, h, R), f(r, null, E, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, i) => {
509
+ /**
510
+ * Returns the current selected place HTML element by currSelectedPlaceElementId.
511
+ * @returns HTMLElement or null
512
+ */
513
+ _getPlaceHtmlElement() {
514
+ return this.currSelectedPlaceElementId && this.shadowRoot?.getElementById(this.currSelectedPlaceElementId) || null;
515
+ }
516
+ }, I = new WeakMap(), p = new WeakMap(), b = new WeakMap(), m = new WeakMap(), y = new WeakMap(), _ = new WeakMap(), P = new WeakMap(), A = new WeakMap(), R = new WeakMap(), k = new WeakMap(), E = new WeakMap(), N = new WeakMap(), (() => {
517
+ const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(h[Symbol.metadata] ?? null) : void 0;
518
+ d = [C({ attribute: "seat-reservations", type: Array })], T = [S(), C({ attribute: "has-navigation", type: Boolean })], G = [S(), C({ attribute: "align-vertical", type: Boolean })], L = [S(), C({ attribute: "base-grid-size", type: Number })], X = [S(), C({ attribute: "height", type: Number })], U = [S(), C({ attribute: "max-seat-reservations", type: Number })], $ = [S(), C({ attribute: "max-bicycle-reservations", type: Number })], Q = [S(), C({ attribute: "prevent-place-click", type: Boolean })], ee = [S(), C({ attribute: "preselect-coach-index", type: Number })], se = [B()], oe = [B()], he = [B()], f(n, null, d, { kind: "accessor", name: "seatReservations", static: !1, private: !1, access: { has: (t) => "seatReservations" in t, get: (t) => t.seatReservations, set: (t, i) => {
519
+ t.seatReservations = i;
520
+ } }, metadata: e }, u, w), f(n, null, T, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, i) => {
408
521
  t.hasNavigation = i;
409
- } }, metadata: e }, A, w), f(r, null, N, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, i) => {
522
+ } }, metadata: e }, D, z), f(n, null, G, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, i) => {
410
523
  t.alignVertical = i;
411
- } }, metadata: e }, k, T), f(r, null, z, { kind: "accessor", name: "baseGridSize", static: !1, private: !1, access: { has: (t) => "baseGridSize" in t, get: (t) => t.baseGridSize, set: (t, i) => {
524
+ } }, metadata: e }, F, V), f(n, null, L, { kind: "accessor", name: "baseGridSize", static: !1, private: !1, access: { has: (t) => "baseGridSize" in t, get: (t) => t.baseGridSize, set: (t, i) => {
412
525
  t.baseGridSize = i;
413
- } }, metadata: e }, B, G), f(r, null, V, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, i) => {
526
+ } }, metadata: e }, O, W), f(n, null, X, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, i) => {
414
527
  t.height = i;
415
- } }, metadata: e }, F, O), f(r, null, D, { kind: "accessor", name: "maxReservations", static: !1, private: !1, access: { has: (t) => "maxReservations" in t, get: (t) => t.maxReservations, set: (t, i) => {
416
- t.maxReservations = i;
417
- } }, metadata: e }, W, K), f(r, null, L, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, i) => {
528
+ } }, metadata: e }, H, K), f(n, null, U, { kind: "accessor", name: "maxSeatReservations", static: !1, private: !1, access: { has: (t) => "maxSeatReservations" in t, get: (t) => t.maxSeatReservations, set: (t, i) => {
529
+ t.maxSeatReservations = i;
530
+ } }, metadata: e }, q, M), f(n, null, $, { kind: "accessor", name: "maxBicycleReservations", static: !1, private: !1, access: { has: (t) => "maxBicycleReservations" in t, get: (t) => t.maxBicycleReservations, set: (t, i) => {
531
+ t.maxBicycleReservations = i;
532
+ } }, metadata: e }, j, J), f(n, null, Q, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, i) => {
418
533
  t.preventPlaceClick = i;
419
- } }, metadata: e }, H, U), f(r, null, X, { kind: "accessor", name: "selectedCoachIndex", static: !1, private: !1, access: { has: (t) => "selectedCoachIndex" in t, get: (t) => t.selectedCoachIndex, set: (t, i) => {
534
+ } }, metadata: e }, Y, Z), f(n, null, ee, { kind: "accessor", name: "preselectCoachIndex", static: !1, private: !1, access: { has: (t) => "preselectCoachIndex" in t, get: (t) => t.preselectCoachIndex, set: (t, i) => {
535
+ t.preselectCoachIndex = i;
536
+ } }, metadata: e }, te, ie), f(n, null, se, { kind: "accessor", name: "selectedCoachIndex", static: !1, private: !1, access: { has: (t) => "selectedCoachIndex" in t, get: (t) => t.selectedCoachIndex, set: (t, i) => {
420
537
  t.selectedCoachIndex = i;
421
- } }, metadata: e }, q, M), f(r, null, j, { kind: "accessor", name: "focusedCoachIndex", static: !1, private: !1, access: { has: (t) => "focusedCoachIndex" in t, get: (t) => t.focusedCoachIndex, set: (t, i) => {
538
+ } }, metadata: e }, ae, ce), f(n, null, oe, { kind: "accessor", name: "focusedCoachIndex", static: !1, private: !1, access: { has: (t) => "focusedCoachIndex" in t, get: (t) => t.focusedCoachIndex, set: (t, i) => {
422
539
  t.focusedCoachIndex = i;
423
- } }, metadata: e }, $, J), e && Object.defineProperty(r, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
424
- })(), r.events = {
540
+ } }, metadata: e }, re, le), f(n, null, he, { kind: "accessor", name: "hoveredScrollCoachIndex", static: !1, private: !1, access: { has: (t) => "hoveredScrollCoachIndex" in t, get: (t) => t.hoveredScrollCoachIndex, set: (t, i) => {
541
+ t.hoveredScrollCoachIndex = i;
542
+ } }, metadata: e }, ne, de), e && Object.defineProperty(n, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
543
+ })(), n.events = {
425
544
  selectedplaces: "selectedplaces",
426
545
  selectedcoach: "selectedcoach"
427
- }, r;
546
+ }, n;
428
547
  })();
429
548
  export {
430
- fe as SeatReservationBaseElement
549
+ Re as SeatReservationBaseElement
431
550
  };