@sbb-esta/lyne-elements-experimental 2.11.1 → 2.11.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 (52) hide show
  1. package/core/datetime/date-helper.js +142 -142
  2. package/core/timetable/access-leg-helper.js +49 -52
  3. package/core/timetable/timetable-helper.js +7 -8
  4. package/development/core/datetime/date-helper.js +10 -10
  5. package/development/core/timetable/access-leg-helper.js +12 -15
  6. package/development/core/timetable/timetable-helper.js +6 -7
  7. package/development/{differenceInMinutes-CHSyWiQs.js → differenceInMinutes-D5Nj8Stc.js} +3 -3
  8. package/development/{format-D0-yhzi4.js → format-BQfaa1ZT.js} +22 -26
  9. package/development/{isValid-Bo4R7iA7.js → isValid-DvieCZVi.js} +3 -3
  10. package/development/journey-summary/journey-summary.component.js +4 -5
  11. package/development/pearl-chain/pearl-chain.component.d.ts.map +1 -1
  12. package/development/pearl-chain/pearl-chain.component.js +28 -39
  13. package/development/pearl-chain-time/pearl-chain-time.component.js +5 -6
  14. package/development/pearl-chain-vertical/pearl-chain-vertical.component.js +1 -1
  15. package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.js +1 -1
  16. package/development/seat-reservation/common/mapper/icon-mapper.js +1 -1
  17. package/development/seat-reservation/common/mapper/mapper.js +14 -16
  18. package/development/seat-reservation/common/mapper/seat-reservation-sample-data.js +1 -1
  19. package/development/seat-reservation/common/svgs.js +1 -1
  20. package/development/seat-reservation/common/translations/i18n.js +2 -3
  21. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.js +22 -33
  22. package/development/seat-reservation/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +6 -7
  23. package/development/seat-reservation/seat-reservation/seat-reservation.component.js +16 -23
  24. package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +1 -1
  25. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +2 -3
  26. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +7 -8
  27. package/development/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +7 -11
  28. package/development/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +2 -3
  29. package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +4 -5
  30. package/development/timetable-duration/timetable-duration.component.js +1 -1
  31. package/development/timetable-row/timetable-row.component.js +58 -89
  32. package/differenceInMinutes-CP_C5onR.js +23 -0
  33. package/{format-Dg8rkk7h.js → format-lqeCzmzS.js} +438 -442
  34. package/isValid-Ceq2O0NQ.js +45 -0
  35. package/journey-summary/journey-summary.component.js +3 -4
  36. package/package.json +2 -2
  37. package/pearl-chain/pearl-chain.component.d.ts.map +1 -1
  38. package/pearl-chain/pearl-chain.component.js +78 -95
  39. package/pearl-chain-time/pearl-chain-time.component.js +44 -45
  40. package/seat-reservation/common/mapper/mapper.js +50 -54
  41. package/seat-reservation/common/translations/i18n.js +5 -6
  42. package/seat-reservation/seat-reservation/seat-reservation-base-element.js +104 -115
  43. package/seat-reservation/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +40 -41
  44. package/seat-reservation/seat-reservation/seat-reservation.component.js +78 -87
  45. package/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +15 -18
  46. package/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +58 -59
  47. package/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +71 -75
  48. package/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +12 -13
  49. package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +23 -24
  50. package/timetable-row/timetable-row.component.js +207 -247
  51. package/differenceInMinutes-BMqUZdhj.js +0 -23
  52. package/isValid-DJ69OMZJ.js +0 -45
@@ -1,26 +1,22 @@
1
- import { MOCK_COACHES_RAW_0 as y, MOCK_COACHES_RAW_1 as I } from "./seat-reservation-sample-data.js";
2
- const u = (i) => {
3
- const r = (i === "TRAIN" ? y : I).map((o) => {
4
- var m, C;
5
- const e = o == null ? void 0 : o.coachDeckLayout, d = [], a = [], b = e.placeGroups.map((t) => {
6
- var g;
7
- return d.indexOf(t.travelClass) === -1 && d.push(t.travelClass), a.indexOf(t.accommodationSubType) === -1 && a.push(t.accommodationSubType), (g = t.places) == null ? void 0 : g.map((s) => ({
8
- number: s == null ? void 0 : s.number,
9
- state: s == null ? void 0 : s.state,
10
- type: t.accommodationSubType.indexOf("BICYCLE") === -1 ? "SEAT" : "BICYCLE",
11
- dimension: { w: s.rectangle.dimension.width, h: s.rectangle.dimension.height },
12
- position: {
13
- x: s.rectangle.position.x,
14
- y: s.rectangle.position.y,
15
- z: s.rectangle.position.z
16
- },
17
- rotation: (s == null ? void 0 : s.orientation) || 0,
18
- travelClass: t == null ? void 0 : t.travelClass,
19
- remarkId: "",
20
- propertyIds: s.placeProperties || [],
21
- selected: !1
22
- }));
23
- }).flat(), p = e.serviceIcons.map((t) => ({
1
+ import { MOCK_COACHES_RAW_0 as l, MOCK_COACHES_RAW_1 as h } from "./seat-reservation-sample-data.js";
2
+ const u = (e) => {
3
+ const i = (e === "TRAIN" ? l : h).map((c) => {
4
+ const s = c?.coachDeckLayout, a = [], r = [], d = s.placeGroups.map((t) => (a.indexOf(t.travelClass) === -1 && a.push(t.travelClass), r.indexOf(t.accommodationSubType) === -1 && r.push(t.accommodationSubType), t.places?.map((o) => ({
5
+ number: o?.number,
6
+ state: o?.state,
7
+ type: t.accommodationSubType.indexOf("BICYCLE") === -1 ? "SEAT" : "BICYCLE",
8
+ dimension: { w: o.rectangle.dimension.width, h: o.rectangle.dimension.height },
9
+ position: {
10
+ x: o.rectangle.position.x,
11
+ y: o.rectangle.position.y,
12
+ z: o.rectangle.position.z
13
+ },
14
+ rotation: o?.orientation || 0,
15
+ travelClass: t?.travelClass,
16
+ remarkId: "",
17
+ propertyIds: o.placeProperties || [],
18
+ selected: !1
19
+ })))).flat(), m = s.serviceIcons.map((t) => ({
24
20
  icon: t.type,
25
21
  position: {
26
22
  x: t.rectangle.position.x,
@@ -31,8 +27,8 @@ const u = (i) => {
31
27
  w: t.rectangle.dimension.width,
32
28
  h: t.rectangle.dimension.height
33
29
  }
34
- })), l = e.graphicElements.map((t) => ({
35
- icon: t == null ? void 0 : t.type,
30
+ })), p = s.graphicElements.map((t) => ({
31
+ icon: t?.type,
36
32
  position: {
37
33
  x: t.rectangle.position.x,
38
34
  y: t.rectangle.position.y,
@@ -42,46 +38,46 @@ const u = (i) => {
42
38
  rotation: t.orientation
43
39
  }));
44
40
  return {
45
- id: e == null ? void 0 : e.id,
46
- number: e == null ? void 0 : e.name,
47
- dimension: { w: (m = e.dimension) == null ? void 0 : m.width, h: (C = e.dimension) == null ? void 0 : C.height },
48
- places: b,
49
- serviceElements: p,
50
- graphicElements: l,
51
- travelClass: d,
52
- propertyIds: a
41
+ id: s?.id,
42
+ number: s?.name,
43
+ dimension: { w: s.dimension?.width, h: s.dimension?.height },
44
+ places: d,
45
+ serviceElements: m,
46
+ graphicElements: p,
47
+ travelClass: a,
48
+ propertyIds: r
53
49
  };
54
50
  });
55
51
  return {
56
- vehicleType: i,
52
+ vehicleType: e,
57
53
  deckCoachIndex: 0,
58
- coachItems: r
54
+ coachItems: i
59
55
  };
60
- }, A = (i, n) => ({
61
- id: "seat-reservation__place-button-" + n + "-" + i.number,
62
- number: i.number,
56
+ }, y = (e, n) => ({
57
+ id: "seat-reservation__place-button-" + n + "-" + e.number,
58
+ number: e.number,
63
59
  coachIndex: n,
64
- state: i.state
65
- }), S = (i, n, r) => ({
66
- id: "seat-reservation__place-button-" + r + "-" + i.number,
60
+ state: e.state
61
+ }), g = (e, n, i) => ({
62
+ id: "seat-reservation__place-button-" + i + "-" + e.number,
67
63
  coachId: n.id,
68
64
  coachNumber: n.number,
69
- coachIndex: r,
70
- placeNumber: i.number,
71
- placeType: i.type,
72
- placeTravelClass: i.travelClass || "ANY_CLASS",
73
- propertyIds: i.propertyIds || []
74
- }), _ = (i, n) => ({
65
+ coachIndex: i,
66
+ placeNumber: e.number,
67
+ placeType: e.type,
68
+ placeTravelClass: e.travelClass || "ANY_CLASS",
69
+ propertyIds: e.propertyIds || []
70
+ }), b = (e, n) => ({
75
71
  coachId: n.id,
76
72
  coachNumber: n.number,
77
- coachIndex: i,
78
- coachType: n == null ? void 0 : n.type,
79
- coachTravelClass: n == null ? void 0 : n.travelClass,
80
- coachPropertyIds: n == null ? void 0 : n.propertyIds
73
+ coachIndex: e,
74
+ coachType: n?.type,
75
+ coachTravelClass: n?.travelClass,
76
+ coachPropertyIds: n?.propertyIds
81
77
  });
82
78
  export {
83
- _ as mapCoachInfosToCoachSelection,
84
- S as mapPlaceAndCoachToSeatReservationPlaceSelection,
85
- A as mapPlaceInfosToPlaceSelection,
79
+ b as mapCoachInfosToCoachSelection,
80
+ g as mapPlaceAndCoachToSeatReservationPlaceSelection,
81
+ y as mapPlaceInfosToPlaceSelection,
86
82
  u as mapRawDataToSeatReservation
87
83
  };
@@ -1,4 +1,4 @@
1
- const l = {
1
+ const o = {
2
2
  // BASICS
3
3
  // CAPTION FOR SCREENREADER INSIDE WAGON
4
4
  COACH_TABLE_CAPTION: {
@@ -450,11 +450,10 @@ const l = {
450
450
  fr: "Test avec paramètres: _param0_ et _param1_",
451
451
  it: "Test con parametri: _param0_ e _param1_"
452
452
  }
453
- }, _ = (i, t, e) => {
454
- var r;
455
- const a = ((r = l[i]) == null ? void 0 : r[t]) || "";
456
- return e ? e.reduce((n, s, o) => n.replace(`_param${o}_`, s), a) : a;
453
+ }, l = (r, i, e) => {
454
+ const a = o[r]?.[i] || "";
455
+ return e ? e.reduce((t, n, s) => t.replace(`_param${s}_`, n), a) : a;
457
456
  };
458
457
  export {
459
- _ as getI18nSeatReservation
458
+ l as getI18nSeatReservation
460
459
  };
@@ -1,35 +1,35 @@
1
- var te = (o) => {
2
- throw TypeError(o);
1
+ var Q = (a) => {
2
+ throw TypeError(a);
3
3
  };
4
- var ie = (o, n, d) => n.has(o) || te("Cannot " + d);
5
- var f = (o, n, d) => (ie(o, n, "read from private field"), d ? d.call(o) : n.get(o)), g = (o, n, d) => n.has(o) ? te("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(o) : n.set(o, d), r = (o, n, d, w) => (ie(o, n, "write to private field"), w ? w.call(o, d) : n.set(o, d), d);
6
- import { __runInitializers as h, __esDecorate as v } from "tslib";
7
- import { isArrowKeyOrPageKeysPressed as oe } from "@sbb-esta/lyne-elements/core/a11y.js";
8
- import { forceType as E } from "@sbb-esta/lyne-elements/core/decorators.js";
9
- import { EventEmitter as se } from "@sbb-esta/lyne-elements/core/eventing.js";
10
- import { LitElement as re } from "lit";
11
- import { property as x, state as ae } from "lit/decorators.js";
12
- import { mapPlaceInfosToPlaceSelection as le, mapPlaceAndCoachToSeatReservationPlaceSelection as he, mapCoachInfosToCoachSelection as ne } from "../common/mapper.js";
13
- var S;
14
- (function(o) {
15
- o.right = "right", o.left = "left";
16
- })(S || (S = {}));
17
- let be = (() => {
18
- var p, b, P, I, m, _, y, R, A, l;
19
- let o = re, n, d = [], w = [], k, T = [], z = [], B, G = [], V = [], F, O = [], D = [], W, K = [], L = [], H, U = [], X = [], q, M = [], j = [], $, J = [], Q = [], Y, Z = [], ee = [];
20
- return l = class extends o {
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 r, __esDecorate as f } from "tslib";
7
+ import { isArrowKeyOrPageKeysPressed as te } from "@sbb-esta/lyne-elements/core/a11y.js";
8
+ import { forceType as y } from "@sbb-esta/lyne-elements/core/decorators.js";
9
+ import { EventEmitter as Z } from "@sbb-esta/lyne-elements/core/eventing.js";
10
+ import { LitElement as ie } from "lit";
11
+ import { property as C, state as ee } from "lit/decorators.js";
12
+ import { mapPlaceInfosToPlaceSelection as se, mapPlaceAndCoachToSeatReservationPlaceSelection as ae, mapCoachInfosToCoachSelection as ce } from "../common/mapper.js";
13
+ var g;
14
+ (function(a) {
15
+ a.right = "right", a.left = "left";
16
+ })(g || (g = {}));
17
+ let Ce = (() => {
18
+ var v, S, x, p, b, P, I, m, _, o;
19
+ let a = ie, l, h = [], R = [], A, E = [], w = [], N, k = [], T = [], z, B = [], G = [], V, F = [], O = [], D, W = [], K = [], L, H = [], U = [], X, q = [], M = [], j, $ = [], J = [];
20
+ return o = class extends a {
21
21
  constructor() {
22
22
  super(...arguments);
23
- g(this, p);
24
- g(this, b);
25
- g(this, P);
26
- g(this, I);
27
- g(this, m);
28
- g(this, _);
29
- g(this, y);
30
- g(this, R);
31
- g(this, A);
32
- r(this, p, h(this, d, null)), r(this, b, (h(this, w), h(this, T, !0))), r(this, P, (h(this, z), h(this, G, !1))), r(this, I, (h(this, V), h(this, O, 16))), r(this, m, (h(this, D), h(this, K, null))), r(this, _, (h(this, L), h(this, U, null))), r(this, y, (h(this, X), h(this, M, !1))), r(this, R, (h(this, j), h(this, J, -1))), r(this, A, (h(this, Q), h(this, Z, -1))), this.selectedPlaces = (h(this, ee), new se(this, l.events.selectedPlaces)), this.selectedCoach = new se(this, l.events.selectedCoach), this.coachBorderPadding = 6, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.currScrollDirection = S.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 = {
23
+ u(this, v);
24
+ u(this, S);
25
+ u(this, x);
26
+ u(this, p);
27
+ u(this, b);
28
+ u(this, P);
29
+ u(this, I);
30
+ u(this, m);
31
+ u(this, _);
32
+ c(this, v, r(this, h, null)), c(this, S, (r(this, R), r(this, E, !0))), c(this, x, (r(this, w), r(this, k, !1))), c(this, p, (r(this, T), r(this, B, 16))), c(this, b, (r(this, G), r(this, F, null))), c(this, P, (r(this, O), r(this, W, null))), c(this, I, (r(this, K), r(this, H, !1))), c(this, m, (r(this, U), r(this, q, -1))), c(this, _, (r(this, M), r(this, $, -1))), this.selectedPlaces = (r(this, J), new Z(this, o.events.selectedPlaces)), this.selectedCoach = new Z(this, o.events.selectedCoach), this.coachBorderPadding = 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 = {
33
33
  ArrowLeft: "ArrowLeft",
34
34
  ArrowRight: "ArrowRight",
35
35
  ArrowUp: "ArrowUp",
@@ -40,84 +40,82 @@ let be = (() => {
40
40
  }
41
41
  /** The seat reservation object which contains all coaches and places */
42
42
  get seatReservation() {
43
- return f(this, p);
43
+ return d(this, v);
44
44
  }
45
45
  set seatReservation(e) {
46
- r(this, p, e);
46
+ c(this, v, e);
47
47
  }
48
48
  /** The seat resvervation navigation can be toggled by this property */
49
49
  get hasNavigation() {
50
- return f(this, b);
50
+ return d(this, S);
51
51
  }
52
52
  set hasNavigation(e) {
53
- r(this, b, e);
53
+ c(this, S, e);
54
54
  }
55
55
  /** The seat reservation area is aligned vertically */
56
56
  get alignVertical() {
57
- return f(this, P);
57
+ return d(this, x);
58
58
  }
59
59
  set alignVertical(e) {
60
- r(this, P, e);
60
+ c(this, x, e);
61
61
  }
62
62
  /** The seat reservation area's base grid size */
63
63
  get baseGridSize() {
64
- return f(this, I);
64
+ return d(this, p);
65
65
  }
66
66
  set baseGridSize(e) {
67
- r(this, I, e);
67
+ c(this, p, e);
68
68
  }
69
69
  /** The seat reservation area's width */
70
70
  get height() {
71
- return f(this, m);
71
+ return d(this, b);
72
72
  }
73
73
  set height(e) {
74
- r(this, m, e);
74
+ c(this, b, e);
75
75
  }
76
76
  /** Maximal number of possible clickable seats */
77
77
  get maxReservations() {
78
- return f(this, _);
78
+ return d(this, P);
79
79
  }
80
80
  set maxReservations(e) {
81
- r(this, _, e);
81
+ c(this, P, e);
82
82
  }
83
83
  /** Any click functionality is prevented */
84
84
  get preventPlaceClick() {
85
- return f(this, y);
85
+ return d(this, I);
86
86
  }
87
87
  set preventPlaceClick(e) {
88
- r(this, y, e);
88
+ c(this, I, e);
89
89
  }
90
90
  get selectedCoachIndex() {
91
- return f(this, R);
91
+ return d(this, m);
92
92
  }
93
93
  set selectedCoachIndex(e) {
94
- r(this, R, e);
94
+ c(this, m, e);
95
95
  }
96
96
  get focusedCoachIndex() {
97
- return f(this, A);
97
+ return d(this, _);
98
98
  }
99
99
  set focusedCoachIndex(e) {
100
- r(this, A, e);
100
+ c(this, _, e);
101
101
  }
102
102
  willUpdate(e) {
103
- var t, i;
104
- super.willUpdate(e), e.has("seatReservation") && this._initSeatReservationPlaceSelection(), e.has("baseGridSize") && (this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, (t = this.style) == null || t.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, (i = this.style) == null || i.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.alignVertical && this._setVerticalAlignmentOffset()), e.has("alignVertical") && this.alignVertical && this._setVerticalAlignmentOffset();
103
+ 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();
105
104
  }
106
105
  /* Init scroll event handling for coach navigation */
107
106
  initNavigationSelectionByScrollEvent() {
108
- var e, t, i;
109
- if (this.firstTabElement = (e = this.shadowRoot) == null ? void 0 : e.getElementById("first-tab-element"), this.lastTabElement = (t = this.shadowRoot) == null ? void 0 : t.getElementById("last-tab-element"), this.coachScrollArea = (i = this.shadowRoot) == null ? void 0 : i.getElementById("sbb-sr__parent-area"), this.coachScrollArea) {
110
- let s = 0;
111
- this.scrollCoachsAreaWidth = this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = this.seatReservation.coachItems.map((c) => {
112
- const C = s, u = this.getCalculatedDimension(c.dimension).w;
113
- return s += u, {
114
- start: C,
115
- end: s,
116
- width: u
107
+ 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) {
108
+ let e = 0;
109
+ this.scrollCoachsAreaWidth = this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = this.seatReservation.coachItems.map((t) => {
110
+ const i = e, s = this.getCalculatedDimension(t.dimension).w;
111
+ return e += s, {
112
+ start: i,
113
+ end: e,
114
+ width: s
117
115
  };
118
- }), this.maxCalcCoachsWidth = s, this.coachScrollArea.addEventListener("scrollend", () => {
119
- const c = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
120
- this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex = c : this.currSelectedCoachIndex = c < this.currSelectedCoachIndex ? this.currSelectedCoachIndex : c, this.preventCoachScrollByPlaceClick = !1, this.updateCurrentSelectedCoach(), this.hasNavigation || (this.preselectPlaceInCoach(), this.isAutoScrolling = !1);
116
+ }), this.maxCalcCoachsWidth = e, this.coachScrollArea.addEventListener("scrollend", () => {
117
+ const t = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
118
+ 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);
121
119
  }), this.alignVertical && this._setVerticalAlignmentOffset();
122
120
  }
123
121
  }
@@ -146,7 +144,7 @@ let be = (() => {
146
144
  return;
147
145
  }
148
146
  }
149
- if (this.currSelectedCoachIndex !== -1 && oe(e))
147
+ if (this.currSelectedCoachIndex !== -1 && te(e))
150
148
  switch (e.preventDefault(), t) {
151
149
  case this.keyboardNavigationEvents.ArrowLeft:
152
150
  {
@@ -197,7 +195,7 @@ let be = (() => {
197
195
  * Sets the new ScrollDirection by the new given target coach index.
198
196
  */
199
197
  _setScrollDirectionByCoachIndex() {
200
- this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ? S.right : S.left;
198
+ this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ? g.right : g.left;
201
199
  }
202
200
  /**
203
201
  * Returns the scroll start or end position X from the selected coach.
@@ -207,17 +205,16 @@ let be = (() => {
207
205
  */
208
206
  _getCoachScrollPositionX() {
209
207
  const e = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];
210
- return this.isKeyboardNavigation && this.currScrollDirection === S.left && e.width > this.scrollCoachsAreaWidth ? e.end - this.scrollCoachsAreaWidth : e.start;
208
+ return this.isKeyboardNavigation && this.currScrollDirection === g.left && e.width > this.scrollCoachsAreaWidth ? e.end - this.scrollCoachsAreaWidth : e.start;
211
209
  }
212
210
  /**
213
211
  * Sets the focus on the HTML table (grid) caption element so that the heading is read out when using a ScreenReader.
214
212
  */
215
213
  _setFocusToSelectedCoachGrid() {
216
- var e;
217
214
  if (this.isCoachGridFocusable) {
218
215
  this.isCoachGridFocusable = !1;
219
- const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("#sbb-sr-coach-caption-" + this.currSelectedCoachIndex);
220
- t && t.focus();
216
+ const e = this.shadowRoot?.querySelector("#sbb-sr-coach-caption-" + this.currSelectedCoachIndex);
217
+ e && e.focus();
221
218
  }
222
219
  }
223
220
  /**
@@ -225,8 +222,8 @@ let be = (() => {
225
222
  * @returns boolean
226
223
  */
227
224
  _isScrollableToSelectedCoach() {
228
- const e = this.coachScrollArea.scrollLeft, t = this.coachScrollArea.getBoundingClientRect().width, i = this.maxCalcCoachsWidth - t, s = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex], c = e === this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;
229
- return (e < i || e > s.start) && !c;
225
+ 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;
226
+ return (e < i || e > s.start) && !n;
230
227
  }
231
228
  /**
232
229
  * Returns the coach index which is currently visible in the scroll area
@@ -241,10 +238,9 @@ let be = (() => {
241
238
  * @returns Place or null
242
239
  */
243
240
  _getFirstPlaceInSelecedCoach() {
244
- var c, C, u, N, a;
245
241
  let e = null;
246
- const t = (c = this.seatReservation) == null ? void 0 : c.coachItems[this.currSelectedCoachIndex], i = "cell-" + this.currSelectedCoachIndex + "-0-0", s = ((N = (u = (C = this.shadowRoot) == null ? void 0 : C.querySelector("[cell-id='" + i + "']")) == null ? void 0 : u.querySelector("sbb-seat-reservation-place-control")) == null ? void 0 : N.getAttribute("text")) || null;
247
- return t && s && (e = ((a = t.places) == null ? void 0 : a.find((ce) => ce.number === s)) || null), e;
242
+ 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;
243
+ return t && s && (e = t.places?.find((n) => n.number === s) || null), e;
248
244
  }
249
245
  /**
250
246
  * To get the correct closest place of current pressed key and the current selected place,
@@ -253,14 +249,13 @@ let be = (() => {
253
249
  * @returns Place or null
254
250
  */
255
251
  _getClosestPlaceByKeyDirection(e) {
256
- var s, c, C, u, N;
257
- const t = (s = this.seatReservation) == null ? void 0 : s.coachItems[this.currSelectedCoachIndex];
252
+ const t = this.seatReservation?.coachItems[this.currSelectedCoachIndex];
258
253
  let i = null;
259
254
  if (t.places)
260
255
  if (this.currSelectedPlaceElementId) {
261
256
  if (this.currSelectedPlace)
262
- for (const a of t.places)
263
- e ? a.number !== ((u = this.currSelectedPlace) == null ? void 0 : u.number) && (e === this.keyboardNavigationEvents.ArrowRight && (a.position.y === this.currSelectedPlace.position.y || a.position.y === this.currSelectedPlace.position.y - 1) && a.position.x > this.currSelectedPlace.position.x && (!i || a.position.x < i.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (a.position.x === this.currSelectedPlace.position.x || a.position.x === this.currSelectedPlace.position.x + 1) && a.position.y > this.currSelectedPlace.position.y && (!i || a.position.y < i.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (a.position.y === this.currSelectedPlace.position.y || a.position.y === this.currSelectedPlace.position.y + 1) && a.position.x < this.currSelectedPlace.position.x && (!i || a.position.x > i.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (a.position.x === this.currSelectedPlace.position.x || a.position.x === this.currSelectedPlace.position.x - 1) && a.position.y < ((N = this.currSelectedPlace) == null ? void 0 : N.position.y) && (!i || a.position.y > i.position.y)) && (i = a) : (this.currScrollDirection === S.right && a.position.y === ((c = this.currSelectedPlace) == null ? void 0 : c.position.y) && (!i || a.position.x < i.position.x) || this.currScrollDirection === S.left && a.position.y === ((C = this.currSelectedPlace) == null ? void 0 : C.position.y) && (!i || a.position.x > i.position.x)) && (i = a);
257
+ for (const s of t.places)
258
+ 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);
264
259
  } else
265
260
  return this._getFirstPlaceInSelecedCoach();
266
261
  return i;
@@ -284,8 +279,8 @@ let be = (() => {
284
279
  }
285
280
  getCalculatedPosition(e, t, i, s) {
286
281
  if (i && t) {
287
- const c = s ? i.h : i.h + this.coachBorderOffset;
288
- e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === c && (e.y += this.coachBorderOffset);
282
+ const n = s ? i.h : i.h + this.coachBorderOffset;
283
+ e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === n && (e.y += this.coachBorderOffset);
289
284
  }
290
285
  return {
291
286
  x: this.baseGridSize * e.x,
@@ -302,8 +297,8 @@ let be = (() => {
302
297
  return;
303
298
  }
304
299
  if (this.hasNavigation) {
305
- const s = this._getPlaceHtmlElement(), c = s ? s.getAttribute("keyfocus") === "focus" : !1;
306
- e === "PREV_TAB" && this.selectedCoachIndex === t ? c ? (this.focusedCoachIndex = t, this.unfocusPlaceElement()) : this.focusedCoachIndex = i : i !== this.currSelectedCoachIndex ? this.focusedCoachIndex = i : (this.focusedCoachIndex = -1, this.selectedCoachIndex = i, c ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid()));
300
+ const s = this._getPlaceHtmlElement(), n = s ? s.getAttribute("keyfocus") === "focus" : !1;
301
+ 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()));
307
302
  } else
308
303
  this.scrollToSelectedNavCoach(i);
309
304
  }
@@ -335,8 +330,7 @@ let be = (() => {
335
330
  this.maxReservations && this.selectedSeatReservationPlaces.length > this.maxReservations && this._resetAllPlaceSelections(e), this.selectedPlaces.emit(this.selectedSeatReservationPlaces);
336
331
  }
337
332
  updateCurrentSelectedPlaceInCoach(e) {
338
- var s;
339
- const t = e.coachIndex, i = (s = this.seatReservation.coachItems[t].places) == null ? void 0 : s.find((c) => c.number == e.number);
333
+ const t = e.coachIndex, i = this.seatReservation.coachItems[t].places?.find((s) => s.number == e.number);
340
334
  i && (this.currSelectedCoachIndex = t, this.currSelectedPlace = i, this.currSelectedCoachIndex !== this.selectedCoachIndex && this.updateCurrentSelectedCoach(), this._setCurrSelectedPlaceElementId(i));
341
335
  }
342
336
  updateCurrentSelectedCoach() {
@@ -350,10 +344,9 @@ let be = (() => {
350
344
  */
351
345
  _initSeatReservationPlaceSelection() {
352
346
  this.seatReservation.coachItems.map((e, t) => {
353
- var i, s;
354
- (s = (i = e.places) == null ? void 0 : i.filter((c) => c.state === "SELECTED")) == null || s.forEach((c) => {
355
- const C = le(c, t), u = this._getSeatReservationPlaceSelection(C);
356
- u && this.selectedSeatReservationPlaces.push(u);
347
+ e.places?.filter((i) => i.state === "SELECTED")?.forEach((i) => {
348
+ const s = se(i, t), n = this._getSeatReservationPlaceSelection(s);
349
+ n && this.selectedSeatReservationPlaces.push(n);
357
350
  });
358
351
  });
359
352
  }
@@ -362,21 +355,19 @@ let be = (() => {
362
355
  * @param currSelectedPlace
363
356
  */
364
357
  _resetAllPlaceSelections(e) {
365
- var t;
366
- for (const i of this.selectedSeatReservationPlaces)
367
- (!e || e.id !== i.id) && ((t = this.shadowRoot) == null ? void 0 : t.getElementById(i.id)).setAttribute("state", "FREE");
368
- e ? this.selectedSeatReservationPlaces = this.selectedSeatReservationPlaces.filter((i) => i.id === e.id) : this.selectedSeatReservationPlaces = [];
358
+ for (const t of this.selectedSeatReservationPlaces)
359
+ (!e || e.id !== t.id) && (this.shadowRoot?.getElementById(t.id)).setAttribute("state", "FREE");
360
+ e ? this.selectedSeatReservationPlaces = this.selectedSeatReservationPlaces.filter((t) => t.id === e.id) : this.selectedSeatReservationPlaces = [];
369
361
  }
370
362
  _getSeatReservationPlaceSelection(e) {
371
- var s;
372
- const t = this.seatReservation.coachItems[e.coachIndex], i = (s = t.places) == null ? void 0 : s.find((c) => c.number === e.number);
373
- return i ? he(i, t, e.coachIndex) : null;
363
+ const t = this.seatReservation.coachItems[e.coachIndex], i = t.places?.find((s) => s.number === e.number);
364
+ return i ? ae(i, t, e.coachIndex) : null;
374
365
  }
375
366
  _getSeatReservationCoachSelection(e) {
376
367
  if (!this.seatReservation.coachItems[e])
377
368
  return null;
378
369
  const t = this.seatReservation.coachItems[e];
379
- return ne(e, t);
370
+ return ce(e, t);
380
371
  }
381
372
  _setCurrSelectedPlaceElementId(e) {
382
373
  e ? this.currSelectedPlaceElementId = "seat-reservation__place-button-" + this.currSelectedCoachIndex + "-" + e.number : this.currSelectedPlaceElementId = null;
@@ -389,47 +380,45 @@ let be = (() => {
389
380
  * @returns HTMLElement or null
390
381
  */
391
382
  _getPlaceHtmlElement(e, t) {
392
- var c;
393
383
  const i = t || this.currSelectedCoachIndex, s = e ? "seat-reservation__place-button-" + i + "-" + e : this.currSelectedPlaceElementId;
394
- return s && ((c = this.shadowRoot) == null ? void 0 : c.getElementById(s)) || null;
384
+ return s && this.shadowRoot?.getElementById(s) || null;
395
385
  }
396
386
  //Set the vertical offset
397
387
  _setVerticalAlignmentOffset() {
398
388
  setTimeout(() => {
399
- var t, i;
400
- const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".sbb-sr__wrapper");
389
+ const e = this.shadowRoot?.querySelector(".sbb-sr__wrapper");
401
390
  if (e) {
402
- const s = e.getBoundingClientRect().width;
403
- (i = this.style) == null || i.setProperty("--sbb-seat-reservation-vertical-offset", `${s}px`);
391
+ const t = e.getBoundingClientRect().width;
392
+ this.style?.setProperty("--sbb-seat-reservation-vertical-offset", `${t}px`);
404
393
  }
405
394
  });
406
395
  }
407
- }, p = new WeakMap(), b = new WeakMap(), P = new WeakMap(), I = new WeakMap(), m = new WeakMap(), _ = new WeakMap(), y = new WeakMap(), R = new WeakMap(), A = new WeakMap(), (() => {
408
- const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(o[Symbol.metadata] ?? null) : void 0;
409
- n = [x({ attribute: "seat-reservation", type: Object })], k = [E(), x({ attribute: "has-navigation", type: Boolean })], B = [E(), x({ attribute: "align-vertical", type: Boolean })], F = [E(), x({ attribute: "base-grid-size", type: Number })], W = [E(), x({ attribute: "height", type: Number })], H = [E(), x({ attribute: "max-reservations", type: Number })], q = [E(), x({ attribute: "prevent-place-click", type: Boolean })], $ = [ae()], Y = [ae()], v(l, null, n, { kind: "accessor", name: "seatReservation", static: !1, private: !1, access: { has: (t) => "seatReservation" in t, get: (t) => t.seatReservation, set: (t, i) => {
396
+ }, v = new WeakMap(), S = new WeakMap(), x = new WeakMap(), p = new WeakMap(), b = new WeakMap(), P = new WeakMap(), I = new WeakMap(), m = new WeakMap(), _ = new WeakMap(), (() => {
397
+ const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(a[Symbol.metadata] ?? null) : void 0;
398
+ l = [C({ attribute: "seat-reservation", type: Object })], A = [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 = [ee()], j = [ee()], f(o, null, l, { kind: "accessor", name: "seatReservation", static: !1, private: !1, access: { has: (t) => "seatReservation" in t, get: (t) => t.seatReservation, set: (t, i) => {
410
399
  t.seatReservation = i;
411
- } }, metadata: e }, d, w), v(l, null, k, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, i) => {
400
+ } }, metadata: e }, h, R), f(o, null, A, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, i) => {
412
401
  t.hasNavigation = i;
413
- } }, metadata: e }, T, z), v(l, null, B, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, i) => {
402
+ } }, metadata: e }, E, w), f(o, null, N, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, i) => {
414
403
  t.alignVertical = i;
415
- } }, metadata: e }, G, V), v(l, null, F, { kind: "accessor", name: "baseGridSize", static: !1, private: !1, access: { has: (t) => "baseGridSize" in t, get: (t) => t.baseGridSize, set: (t, i) => {
404
+ } }, metadata: e }, k, T), f(o, null, z, { kind: "accessor", name: "baseGridSize", static: !1, private: !1, access: { has: (t) => "baseGridSize" in t, get: (t) => t.baseGridSize, set: (t, i) => {
416
405
  t.baseGridSize = i;
417
- } }, metadata: e }, O, D), v(l, null, W, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, i) => {
406
+ } }, metadata: e }, B, G), f(o, null, V, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, i) => {
418
407
  t.height = i;
419
- } }, metadata: e }, K, L), v(l, null, H, { kind: "accessor", name: "maxReservations", static: !1, private: !1, access: { has: (t) => "maxReservations" in t, get: (t) => t.maxReservations, set: (t, i) => {
408
+ } }, metadata: e }, F, O), f(o, null, D, { kind: "accessor", name: "maxReservations", static: !1, private: !1, access: { has: (t) => "maxReservations" in t, get: (t) => t.maxReservations, set: (t, i) => {
420
409
  t.maxReservations = i;
421
- } }, metadata: e }, U, X), v(l, null, q, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, i) => {
410
+ } }, metadata: e }, W, K), f(o, null, L, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, i) => {
422
411
  t.preventPlaceClick = i;
423
- } }, metadata: e }, M, j), v(l, null, $, { kind: "accessor", name: "selectedCoachIndex", static: !1, private: !1, access: { has: (t) => "selectedCoachIndex" in t, get: (t) => t.selectedCoachIndex, set: (t, i) => {
412
+ } }, metadata: e }, H, U), f(o, null, X, { kind: "accessor", name: "selectedCoachIndex", static: !1, private: !1, access: { has: (t) => "selectedCoachIndex" in t, get: (t) => t.selectedCoachIndex, set: (t, i) => {
424
413
  t.selectedCoachIndex = i;
425
- } }, metadata: e }, J, Q), v(l, null, Y, { kind: "accessor", name: "focusedCoachIndex", static: !1, private: !1, access: { has: (t) => "focusedCoachIndex" in t, get: (t) => t.focusedCoachIndex, set: (t, i) => {
414
+ } }, metadata: e }, q, M), f(o, null, j, { kind: "accessor", name: "focusedCoachIndex", static: !1, private: !1, access: { has: (t) => "focusedCoachIndex" in t, get: (t) => t.focusedCoachIndex, set: (t, i) => {
426
415
  t.focusedCoachIndex = i;
427
- } }, metadata: e }, Z, ee), e && Object.defineProperty(l, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
428
- })(), l.events = {
416
+ } }, metadata: e }, $, J), e && Object.defineProperty(o, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
417
+ })(), o.events = {
429
418
  selectedPlaces: "selectedPlaces",
430
419
  selectedCoach: "selectedCoach"
431
- }, l;
420
+ }, o;
432
421
  })();
433
422
  export {
434
- be as SeatReservationBaseElement
423
+ Ce as SeatReservationBaseElement
435
424
  };