@sbb-esta/lyne-elements-experimental-dev 5.4.0-dev.1785499519 → 5.4.0-dev.1785499554

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.
@@ -5220,6 +5220,17 @@
5220
5220
  ],
5221
5221
  "description": "Counts all available seats together depending on the seat type"
5222
5222
  },
5223
+ {
5224
+ "kind": "method",
5225
+ "name": "hasTravelDirection",
5226
+ "privacy": "protected",
5227
+ "return": {
5228
+ "type": {
5229
+ "text": "boolean"
5230
+ }
5231
+ },
5232
+ "description": "Returns the status whether the seat component with the direction of travel is currently displayed"
5233
+ },
5223
5234
  {
5224
5235
  "kind": "method",
5225
5236
  "name": "_handleCoachAreaScrollendEvent",
@@ -7631,6 +7642,21 @@
7631
7642
  "module": "seat-reservation/seat-reservation/seat-reservation-base-element.js"
7632
7643
  }
7633
7644
  },
7645
+ {
7646
+ "kind": "method",
7647
+ "name": "hasTravelDirection",
7648
+ "privacy": "protected",
7649
+ "return": {
7650
+ "type": {
7651
+ "text": "boolean"
7652
+ }
7653
+ },
7654
+ "description": "Returns the status whether the seat component with the direction of travel is currently displayed",
7655
+ "inheritedFrom": {
7656
+ "name": "SeatReservationBaseElement",
7657
+ "module": "seat-reservation/seat-reservation/seat-reservation-base-element.js"
7658
+ }
7659
+ },
7634
7660
  {
7635
7661
  "kind": "method",
7636
7662
  "name": "_handleCoachAreaScrollendEvent",
@@ -166,6 +166,10 @@ export declare class SeatReservationBaseElement extends SbbElement {
166
166
  * @returns An Object with count of free seats and free bicycle places
167
167
  */
168
168
  protected getAvailableFreePlacesNumFromCoach(places: Place[] | undefined): CoachNumberOfFreePlaces;
169
+ /**
170
+ * Returns the status whether the seat component with the direction of travel is currently displayed
171
+ */
172
+ protected hasTravelDirection(): boolean;
169
173
  /**
170
174
  * At the end of a scroll Event from the coach scrollable area,
171
175
  * the reached coach is marked as selected
@@ -14954,6 +14954,12 @@ let SeatReservationBaseElement = (() => {
14954
14954
  return freePlaces ? freePlaces : accumulator;
14955
14955
  }
14956
14956
  /**
14957
+ * Returns the status whether the seat component with the direction of travel is currently displayed
14958
+ */
14959
+ hasTravelDirection() {
14960
+ return this.travelDirection && this.travelDirection !== "NONE";
14961
+ }
14962
+ /**
14957
14963
  * At the end of a scroll Event from the coach scrollable area,
14958
14964
  * the reached coach is marked as selected
14959
14965
  */
@@ -15559,7 +15565,7 @@ let SeatReservationBaseElement = (() => {
15559
15565
 
15560
15566
  //#endregion
15561
15567
  //#region src/elements-experimental/seat-reservation/seat-reservation/seat-reservation.scss?inline
15562
- var seat_reservation_default = ":host {\n --sbb-seat-reservation-grid-size: 16px;\n --sbb-seat-reservation-height: 0;\n --sbb-seat-reservation-decks: 1;\n display: block;\n height: inherit;\n}\n:host ::part(coach-floor) {\n fill: var(--sbb-background-color-2);\n}\n@media (forced-colors: active) {\n :host ::part(coach-floor) {\n fill: transparent;\n }\n}\n\n:host(:dir(rtl)) :not(.sbb-sr-place-ctrl--type-bicycle,\n.sbb-sr-place-ctrl--orientation-90,\n.sbb-sr-place-ctrl--orientation-270,\n.sbb-sr-place-ctrl--state-selected) ::part(coach-floor) {\n rotate: calc(180 * 1deg);\n}\n\n.sbb-sr-popover {\n margin-block: calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n:host([align-vertical]) .sbb-sr__component {\n flex-direction: row-reverse;\n justify-content: flex-end;\n gap: calc(22 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n height: inherit;\n}\n@media (min-width: calc(37.5rem)) {\n :host([align-vertical]) .sbb-sr__component {\n gap: calc(54 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n }\n}\n:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation,\n:host([align-vertical]) .sbb-sr__component ul.sbb-sr-navigation__list-coaches {\n flex-direction: column;\n}\n:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation {\n padding: calc(16 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem)) 0;\n}\n:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button {\n left: calc(1 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n top: 0;\n rotate: 90deg;\n}\n@media (min-width: calc(64rem)) {\n :host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button {\n left: calc(-1 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n }\n}\n:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches {\n max-width: initial;\n padding: calc(5 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n overflow: hidden scroll;\n}\n:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches li {\n display: flex;\n}\n:host([align-vertical]) .sbb-sr__wrapper-coach-decks {\n flex-direction: column;\n}\n:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels {\n flex-direction: column-reverse;\n width: calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n height: initial;\n}\n:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b {\n inline-size: calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n block-size: calc(20 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n margin-bottom: calc(16 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n rotate: initial;\n writing-mode: initial;\n}\n:host([align-vertical]) .sbb-sr__wrapper-scrollarea {\n width: calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n height: 100%;\n overflow: hidden scroll;\n}\n:host([align-vertical]) .sbb-sr__wrapper-scrollarea .sbb-sr__parent {\n rotate: 90deg;\n}\n:host([align-vertical]) .sbb-sr-travel-direction-wrapper {\n width: calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n margin-block-start: calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n.sbb-sr-navigation {\n gap: calc(3 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n.sbb-sr-navigation .sbb-sr__navigation-control-button {\n position: relative;\n top: calc(2 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n@media (min-width: calc(64rem)) {\n .sbb-sr-navigation .sbb-sr__navigation-control-button {\n top: 0;\n }\n}\n\n.sbb-sr__component {\n display: flex;\n flex-direction: column;\n gap: calc(64 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem) - 16px);\n}\n\n.sbb-sr-travel-direction-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n column-gap: calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n margin-block: calc(8 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem)) calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n font-size: var(--sbb-text-font-size-s);\n}\n.sbb-sr-travel-direction-wrapper .sbb-sr__travel-direction--arrow {\n display: flex;\n align-items: center;\n}\n\n.sbb-sr-navigation-wrapper {\n display: flex;\n}\n\n.sbb-sr-navigation {\n display: flex;\n justify-content: center;\n width: 100%;\n padding-inline: 16px;\n}\n\n.sbb-sr-navigation__list-coaches {\n display: flex;\n flex-wrap: nowrap;\n gap: calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n padding: calc(6 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem)) calc(5 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem)) 0;\n max-width: 856px;\n --sbb-scrollbar-color: transparent;\n overflow: scroll hidden;\n position: relative;\n}\n\n.sbb-sr__wrapper-coach-decks {\n display: flex;\n overflow: hidden;\n height: inherit;\n}\n.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels {\n display: flex;\n justify-content: space-between;\n height: calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n writing-mode: vertical-lr;\n}\n.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b {\n height: calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n width: calc(20 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n margin-block-end: 16px;\n rotate: 180deg;\n text-align: center;\n line-height: calc(20 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n.sbb-sr__wrapper-scrollarea {\n overflow: scroll hidden;\n padding-block: calc(8 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem)) calc(16 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n.sbb-sr__wrapper-scrollarea .sbb-sr__parent {\n display: flex;\n flex-direction: column;\n position: relative;\n}\n\n.sbb-sr__list-decks {\n display: flex;\n flex-direction: column;\n}\n\n.sbb-sr__list-decks--gap {\n gap: calc(48 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n.sbb-sr__list-item-deck {\n position: relative;\n}\n\n.sbb-sr__list-coaches {\n display: flex;\n gap: calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n.sbb-sr__list-decks:has(.sbb-sr-coach-has-overhanging-elements) .sbb-sr__list-coaches {\n gap: calc(8 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n.sbb-sr__item-coach {\n position: relative;\n}\n\n.sbb-sr-coach-wrapper__table {\n outline: 0;\n}\n";
15568
+ var seat_reservation_default = ":host {\n --sbb-seat-reservation-grid-size: 16px;\n --sbb-seat-reservation-height: 0;\n --sbb-seat-reservation-decks: 1;\n display: block;\n height: inherit;\n}\n:host ::part(coach-floor) {\n fill: var(--sbb-background-color-2);\n}\n@media (forced-colors: active) {\n :host ::part(coach-floor) {\n fill: transparent;\n }\n}\n\n:host(:dir(rtl)) :not(.sbb-sr-place-ctrl--type-bicycle,\n.sbb-sr-place-ctrl--orientation-90,\n.sbb-sr-place-ctrl--orientation-270,\n.sbb-sr-place-ctrl--state-selected) ::part(coach-floor) {\n rotate: calc(180 * 1deg);\n}\n\n.sbb-sr-popover {\n margin-block: calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n:host([align-vertical]) .sbb-sr__component {\n flex-direction: row-reverse;\n justify-content: flex-end;\n gap: calc(22 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n height: inherit;\n}\n@media (min-width: calc(37.5rem)) {\n :host([align-vertical]) .sbb-sr__component {\n gap: calc(54 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n }\n}\n:host([align-vertical]) .sbb-sr__component--has-travel-direction {\n padding-block-start: calc(36 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation,\n:host([align-vertical]) .sbb-sr__component ul.sbb-sr-navigation__list-coaches {\n flex-direction: column;\n}\n:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation {\n padding: calc(16 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem)) 0;\n}\n:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button {\n left: calc(1 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n top: 0;\n rotate: 90deg;\n}\n@media (min-width: calc(64rem)) {\n :host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button {\n left: calc(-1 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n }\n}\n:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches {\n max-width: initial;\n padding: calc(5 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n overflow: hidden scroll;\n}\n:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches li {\n display: flex;\n}\n:host([align-vertical]) .sbb-sr__wrapper-coach-decks {\n flex-direction: column;\n}\n:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels {\n flex-direction: column-reverse;\n width: calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n height: initial;\n}\n:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b {\n inline-size: calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n block-size: calc(20 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n margin-bottom: calc(16 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n rotate: initial;\n writing-mode: initial;\n}\n:host([align-vertical]) .sbb-sr__wrapper-scrollarea {\n width: calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n height: 100%;\n overflow: hidden scroll;\n}\n:host([align-vertical]) .sbb-sr__wrapper-scrollarea .sbb-sr__parent {\n rotate: 90deg;\n}\n:host([align-vertical]) .sbb-sr-travel-direction-wrapper {\n width: calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n margin-block-start: calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n position: absolute;\n}\n\n.sbb-sr-navigation {\n gap: calc(3 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n.sbb-sr-navigation .sbb-sr__navigation-control-button {\n position: relative;\n top: calc(2 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n@media (min-width: calc(64rem)) {\n .sbb-sr-navigation .sbb-sr__navigation-control-button {\n top: 0;\n }\n}\n\n.sbb-sr__component {\n display: flex;\n flex-direction: column;\n gap: calc(64 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem) - 16px);\n}\n\n.sbb-sr-travel-direction-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n column-gap: calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n margin-block: calc(8 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem)) calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n font-size: var(--sbb-text-font-size-s);\n}\n.sbb-sr-travel-direction-wrapper .sbb-sr__travel-direction--arrow {\n display: flex;\n align-items: center;\n}\n\n.sbb-sr-navigation-wrapper {\n display: flex;\n}\n\n.sbb-sr-navigation {\n display: flex;\n justify-content: center;\n width: 100%;\n padding-inline: 16px;\n}\n\n.sbb-sr-navigation__list-coaches {\n display: flex;\n flex-wrap: nowrap;\n gap: calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n padding: calc(6 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem)) calc(5 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem)) 0;\n max-width: 856px;\n --sbb-scrollbar-color: transparent;\n overflow: scroll hidden;\n position: relative;\n}\n\n.sbb-sr__wrapper-coach-decks {\n display: flex;\n overflow: hidden;\n height: inherit;\n}\n.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels {\n display: flex;\n justify-content: space-between;\n height: calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n writing-mode: vertical-lr;\n}\n.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b {\n height: calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n width: calc(20 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n margin-block-end: 16px;\n rotate: 180deg;\n text-align: center;\n line-height: calc(20 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n.sbb-sr__wrapper-scrollarea {\n overflow: scroll hidden;\n padding-block: calc(8 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem)) calc(16 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n.sbb-sr__wrapper-scrollarea .sbb-sr__parent {\n display: flex;\n flex-direction: column;\n position: relative;\n}\n\n.sbb-sr__list-decks {\n display: flex;\n flex-direction: column;\n}\n\n.sbb-sr__list-decks--gap {\n gap: calc(48 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n.sbb-sr__list-item-deck {\n position: relative;\n}\n\n.sbb-sr__list-coaches {\n display: flex;\n gap: calc(4 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n.sbb-sr__list-decks:has(.sbb-sr-coach-has-overhanging-elements) .sbb-sr__list-coaches {\n gap: calc(8 * var(--sbb-seat-reservation-one-px-rem, 0.0625rem));\n}\n\n.sbb-sr__item-coach {\n position: relative;\n}\n\n.sbb-sr-coach-wrapper__table {\n outline: 0;\n}\n";
15563
15569
 
15564
15570
  //#endregion
15565
15571
  //#region src/elements-experimental/seat-reservation/seat-reservation/seat-reservation.component.ts
@@ -15612,7 +15618,12 @@ var SbbSeatReservationElement = class extends SeatReservationBaseElement {
15612
15618
  _initVehicleSeatReservationConstruction() {
15613
15619
  this._coachesHtmlTemplate = html`
15614
15620
  ${this._renderTravelDirection()}
15615
- <div class="sbb-sr__component">
15621
+ <div
15622
+ class="${classMap({
15623
+ "sbb-sr__component": true,
15624
+ "sbb-sr__component--has-travel-direction": this.hasTravelDirection()
15625
+ })}"
15626
+ >
15616
15627
  ${this._renderNavigation()}
15617
15628
  <div
15618
15629
  class="sbb-sr__wrapper-coach-decks"
@@ -15677,7 +15688,7 @@ var SbbSeatReservationElement = class extends SeatReservationBaseElement {
15677
15688
  </div>`;
15678
15689
  }
15679
15690
  _renderTravelDirection() {
15680
- if (!this.travelDirection || this.travelDirection === "NONE") return null;
15691
+ if (!this.hasTravelDirection()) return null;
15681
15692
  const labelText = getI18nSeatReservation("SEAT_RESERVATION_TRAVEL_DIRECTION", this._language.current);
15682
15693
  return html`<div class="sbb-sr-travel-direction-wrapper">
15683
15694
  <div class="sbb-sr__travel-direction--arrow">
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@sbb-esta/lyne-elements-experimental-dev",
3
- "version": "5.4.0-dev.1785499519",
3
+ "version": "5.4.0-dev.1785499554",
4
4
  "description": "Lyne Design System",
5
5
  "keywords": [
6
6
  "design system",
7
7
  "web components",
8
8
  "lit",
9
- "https://github.com/sbb-design-systems/lyne-components/commit/889c058be80451f29d413bc8273dfbbe0e4a273c"
9
+ "https://github.com/sbb-design-systems/lyne-components/commit/30f36a765b8424ed4113b95c5befce618f729710"
10
10
  ],
11
11
  "type": "module",
12
12
  "exports": {
@@ -291,10 +291,12 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbButtonBase
291
291
  ></sbb-seat-reservation-graphic>
292
292
  <span ${this.text??p} class="sbb-sr-place-ctrl__text">${r} </span>
293
293
  </div>`}_getPlaceSvg(e,t){return`PLACE_${e}_${t}`}_getTitleDescriptionPlace(e){let t=I(`PLACE_CONTROL_`+this.type+`_`+this.state,this._language.current,[this.text]),n=this._getRelativeTravelDirection(e);return(this.propertyIds.length||n)&&(t+=`. `+I(`PLACE_PROPERTY`,this._language.current).concat(`: `),t+=[n,...this.propertyIds].map(e=>I(`PLACE_PROPERTIES.`+e,this._language.current)).filter(e=>e).join(`, `)),t}_getRelativeTravelDirection(e){if(!this.travelDirection||this.travelDirection===`NONE`||this.placeType!==`SEAT`||!e)return;let t=Number(e);if(t===90||t===270)return`TRAVEL_DIRECTION_TRANSVERSELY`;if(t===0&&this.travelDirection===`RIGHT`||t===180&&this.travelDirection===`LEFT`)return`TRAVEL_DIRECTION_IN_DIRECTION`;if(t===0||t===180)return`TRAVEL_DIRECTION_IN_OPPOSITE_DIRECTION`}_selectPlace(){if((this.state===`FREE`||this.state===`SELECTED`)&&!this.preventClick){this.state=this.state===`FREE`?`SELECTED`:`FREE`;let e={id:this.id,deckIndex:this.deckIndex,coachIndex:this.coachIndex,number:this.text,state:this.state,placeType:this.placeType};this.dispatchEvent(new q(e))}}}})();var Y=`:host{--sbb-seat-reservation-scoped-width:0;--sbb-seat-reservation-scoped-height:0;width:calc(var(--sbb-seat-reservation-scoped-width) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:calc(var(--sbb-seat-reservation-scoped-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));display:block}
294
- `,X=class extends r{static{this.elementName=`sbb-seat-reservation-scoped`}static{this.styles=[m(Y)]}render(){return d`<slot></slot>`}},Z;(function(e){e.right=`right`,e.left=`left`})(Z||={});const ee=[`sa-vo`,`sa-rs`,`sa-abteilkinderwagen`,`sa-wr`,`sa-fa`,`sa-bz`,`sa-rz`];var te=class extends Event{get detail(){return this._detail}constructor(e){super(`selectedplaces`,{bubbles:!0,composed:!0}),this._detail=e}},ne=class extends Event{get detail(){return this._detail}constructor(e){super(`selectedcoach`,{bubbles:!0,composed:!0}),this._detail=e}};let Q=(()=>{let n=r,i=[],a,c=[],l=[],u,d=[],p=[],m,v=[],y=[],b,x=[],S=[],C,w=[],T=[],E,D=[],O=[],k,N=[],F=[],I,L=[],R=[],z,B=[],V=[],H,U=[],W=[],G,K=[],q=[],J,Y=[],X=[],Q,$=[],re=[],ie,ae=[],oe=[],se;return class extends n{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;a=[g({attribute:`seat-reservations`,type:Array})],u=[g({attribute:`travel-direction`,type:String})],m=[o(),g({attribute:`has-navigation`,type:Boolean})],b=[o(),g({attribute:`align-vertical`,type:Boolean,reflect:!0,useDefault:!0})],C=[o(),g({attribute:`base-grid-size`,type:Number})],E=[o(),g({attribute:`height`,type:Number})],k=[o(),g({attribute:`max-seat-reservations`,type:Number})],I=[o(),g({attribute:`max-bicycle-reservations`,type:Number})],z=[o(),g({attribute:`prevent-place-click`,type:Boolean})],H=[o(),g({attribute:`preselect-coach-index`,type:Number})],G=[o(),g({attribute:`show-title-info`,type:Boolean})],J=[_()],Q=[_()],ie=[_()],se=[h({passive:!0})],e(this,null,a,{kind:`accessor`,name:`seatReservations`,static:!1,private:!1,access:{has:e=>`seatReservations`in e,get:e=>e.seatReservations,set:(e,t)=>{e.seatReservations=t}},metadata:t},c,l),e(this,null,u,{kind:`accessor`,name:`travelDirection`,static:!1,private:!1,access:{has:e=>`travelDirection`in e,get:e=>e.travelDirection,set:(e,t)=>{e.travelDirection=t}},metadata:t},d,p),e(this,null,m,{kind:`accessor`,name:`hasNavigation`,static:!1,private:!1,access:{has:e=>`hasNavigation`in e,get:e=>e.hasNavigation,set:(e,t)=>{e.hasNavigation=t}},metadata:t},v,y),e(this,null,b,{kind:`accessor`,name:`alignVertical`,static:!1,private:!1,access:{has:e=>`alignVertical`in e,get:e=>e.alignVertical,set:(e,t)=>{e.alignVertical=t}},metadata:t},x,S),e(this,null,C,{kind:`accessor`,name:`baseGridSize`,static:!1,private:!1,access:{has:e=>`baseGridSize`in e,get:e=>e.baseGridSize,set:(e,t)=>{e.baseGridSize=t}},metadata:t},w,T),e(this,null,E,{kind:`accessor`,name:`height`,static:!1,private:!1,access:{has:e=>`height`in e,get:e=>e.height,set:(e,t)=>{e.height=t}},metadata:t},D,O),e(this,null,k,{kind:`accessor`,name:`maxSeatReservations`,static:!1,private:!1,access:{has:e=>`maxSeatReservations`in e,get:e=>e.maxSeatReservations,set:(e,t)=>{e.maxSeatReservations=t}},metadata:t},N,F),e(this,null,I,{kind:`accessor`,name:`maxBicycleReservations`,static:!1,private:!1,access:{has:e=>`maxBicycleReservations`in e,get:e=>e.maxBicycleReservations,set:(e,t)=>{e.maxBicycleReservations=t}},metadata:t},L,R),e(this,null,z,{kind:`accessor`,name:`preventPlaceClick`,static:!1,private:!1,access:{has:e=>`preventPlaceClick`in e,get:e=>e.preventPlaceClick,set:(e,t)=>{e.preventPlaceClick=t}},metadata:t},B,V),e(this,null,H,{kind:`accessor`,name:`preselectCoachIndex`,static:!1,private:!1,access:{has:e=>`preselectCoachIndex`in e,get:e=>e.preselectCoachIndex,set:(e,t)=>{e.preselectCoachIndex=t}},metadata:t},U,W),e(this,null,G,{kind:`accessor`,name:`showTitleInfo`,static:!1,private:!1,access:{has:e=>`showTitleInfo`in e,get:e=>e.showTitleInfo,set:(e,t)=>{e.showTitleInfo=t}},metadata:t},K,q),e(this,null,J,{kind:`accessor`,name:`selectedCoachIndex`,static:!1,private:!1,access:{has:e=>`selectedCoachIndex`in e,get:e=>e.selectedCoachIndex,set:(e,t)=>{e.selectedCoachIndex=t}},metadata:t},Y,X),e(this,null,Q,{kind:`accessor`,name:`focusedCoachIndex`,static:!1,private:!1,access:{has:e=>`focusedCoachIndex`in e,get:e=>e.focusedCoachIndex,set:(e,t)=>{e.focusedCoachIndex=t}},metadata:t},$,re),e(this,null,ie,{kind:`accessor`,name:`hoveredCoachIndex`,static:!1,private:!1,access:{has:e=>`hoveredCoachIndex`in e,get:e=>e.hoveredCoachIndex,set:(e,t)=>{e.hoveredCoachIndex=t}},metadata:t},ae,oe),e(this,null,se,{kind:`method`,name:`coachAreaScrollend`,static:!1,private:!1,access:{has:e=>`coachAreaScrollend`in e,get:e=>e.coachAreaScrollend},metadata:t},null,i),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.events={selectedplaces:`selectedplaces`,selectedcoach:`selectedcoach`}}#e;get seatReservations(){return this.#e}set seatReservations(e){this.#e=e}#t;get travelDirection(){return this.#t}set travelDirection(e){this.#t=e}#n;get hasNavigation(){return this.#n}set hasNavigation(e){this.#n=e}#r;get alignVertical(){return this.#r}set alignVertical(e){this.#r=e}#i;get baseGridSize(){return this.#i}set baseGridSize(e){this.#i=e}#a;get height(){return this.#a}set height(e){this.#a=e}#o;get maxSeatReservations(){return this.#o}set maxSeatReservations(e){this.#o=e}#s;get maxBicycleReservations(){return this.#s}set maxBicycleReservations(e){this.#s=e}#c;get preventPlaceClick(){return this.#c}set preventPlaceClick(e){this.#c=e}#l;get preselectCoachIndex(){return this.#l}set preselectCoachIndex(e){this.#l=e}#u;get showTitleInfo(){return this.#u}set showTitleInfo(e){this.#u=e}#d;get selectedCoachIndex(){return this.#d}set selectedCoachIndex(e){this.#d=e}#f;get focusedCoachIndex(){return this.#f}set focusedCoachIndex(e){this.#f=e}#p;get hoveredCoachIndex(){return this.#p}set hoveredCoachIndex(e){this.#p=e}constructor(){super(),this.#e=(t(this,i),t(this,c,null)),this.#t=(t(this,l),t(this,d,`NONE`)),this.#n=(t(this,p),t(this,v,!0)),this.#r=(t(this,y),t(this,x,!1)),this.#i=(t(this,S),t(this,w,16)),this.#a=(t(this,T),t(this,D,null)),this.#o=(t(this,O),t(this,N,-1)),this.#s=(t(this,F),t(this,L,-1)),this.#c=(t(this,R),t(this,B,!1)),this.#l=(t(this,V),t(this,U,-1)),this.#u=(t(this,W),t(this,K,!1)),this.#d=(t(this,q),t(this,Y,-1)),this.#f=(t(this,X),t(this,$,-1)),this.#p=(t(this,re),t(this,ae,-1)),this.coachBorderPadding=(t(this,oe),6),this.gapBetweenCoaches=4,this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.gapBetweenCoachDecks=48,this.coachNavButtonDim=0,this.globalAreaIconDim={w:2,h:2},this.globalAreaIconPadding=.8,this.coachItemDetailsElements=[],this.currScrollDirection=Z.right,this.maxCalcCoachesWidth=0,this.scrollCoachesAreaWidth=0,this.scrollNavigationAreaDim=0,this.triggerCoachPositionsCollection=[],this.navigationScrollArea=null,this.coachScrollArea=null,this.currSelectedPlace=null,this.currSelectedPlaceElementId=null,this.currSelectedCoachIndex=-1,this.currSelectedDeckIndex=0,this.preventCoachScrollByPlaceClick=!1,this.selectedSeatReservationPlaces={seats:[],bicycles:[]},this.seatReservationWithoutNavigationHasFocus=!1,this.isCoachGridFocusable=!1,this.isAutoScrolling=!1,this.isKeyboardNavigation=!1,this.hasMultipleDecks=!1,this.hasSeatReservationNativeFocus=!1,this.keyboardNavigationEvents={ArrowLeft:`ArrowLeft`,ArrowRight:`ArrowRight`,ArrowUp:`ArrowUp`,ArrowDown:`ArrowDown`,Tab:`Tab`,Enter:`Enter`},this.seatReservationStructure={decks:[]},this.notFixedRotatableAreaIcons=[`ENTRY_EXIT`],this.notAreaElements=[`DRIVER_AREA`,`DRIVER_AREA_NO_VERTICAL_WALL`,`COACH_PASSAGE`,`COACH_WALL_NO_PASSAGE`,`COMPARTMENT_PASSAGE`,`COMPARTMENT_PASSAGE_HIGH`,`COMPARTMENT_PASSAGE_MIDDLE`,`COMPARTMENT_PASSAGE_LOW`,`COMPARTMENT_WALL`],this.middleBorderDockingElements=[`DRIVER_AREA`,`DRIVER_AREA_NO_VERTICAL_WALL`,`COACH_PASSAGE`,`COACH_WALL_NO_PASSAGE`],this._isRunningInitPreselectCoachIndex=!1,this._lastStartScrollPos=-1,this._prepareServiceIconsNavigation=e=>e&&e?.map(function(e){return{pId:e,svgName:P[e]?.svgName?P[e]?.svgName:``}}).filter(e=>ee.indexOf(e.svgName)!==-1).filter((e,t,n)=>n.map(e=>e.svgName).indexOf(e.svgName)===t).map(e=>e.pId).slice(0,3)||[],this.addEventListener(`blur`,()=>this._onLeaveSeatReservationComponent())}willUpdate(e){if(super.willUpdate(e),e.has(`seatReservations`)&&(this.hasMultipleDecks=this.seatReservations?.length>1,this._initPrepareSeatReservationData(),this._initSeatReservationPlaceSelection(),this.initNavigationSelectionByScrollEvent()),e.has(`baseGridSize`)&&(this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.style?.setProperty(`--sbb-seat-reservation-grid-size`,`${this.baseGridSize}px`),this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent()),e.has(`height`)&&this.height){let e=this.seatReservations[this.currSelectedDeckIndex]||null;e?.coachItems.length&&(this.baseGridSize=this.height/e.coachItems[0].dimension.h,this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.style?.setProperty(`--sbb-seat-reservation-grid-size`,`${this.baseGridSize}px`),this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent())}e.has(`alignVertical`)&&(this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent()),e.has(`preselectCoachIndex`)&&(this._isRunningInitPreselectCoachIndex=!0,setTimeout(()=>this.scrollToSelectedNavCoach(this.preselectCoachIndex),1))}navigateByDirectionBtn(e){this.unfocusPlaceElement();let t=this.currSelectedCoachIndex;e==`DIRECTION_LEFT`&&t>0?t=this.currSelectedCoachIndex==-1?0:this.currSelectedCoachIndex-1:e==`DIRECTION_RIGHT`&&t<this.seatReservations[this.currSelectedDeckIndex]?.coachItems.length-1&&(t=this.currSelectedCoachIndex==-1?0:this.currSelectedCoachIndex+1),this.scrollToSelectedNavCoach(t)}_initPrepareSeatReservationData(){this._determineBaseFontSize(),this.hasMultipleDecks&&this._initEmptyCoachDeckOffsets(),this._prepareCoachItemDetailsData(),this._prepareSeatReservationStructureInformation(),this._prepareOptimizeAreaIconDimensionByMedian()}initNavigationSelectionByScrollEvent(){this.coachScrollArea=this.shadowRoot?.querySelector(`#sbb-sr__wrapper-scrollarea`),this.navigationScrollArea=this.shadowRoot?.querySelector(`#sbb-sr__navigation-list-coaches`);let e=this.seatReservations?this.seatReservations[this.currSelectedDeckIndex]:null;if(e&&e.coachItems.length>0){let t=e.coachItems[0].dimension.h*this.baseGridSize+this.coachBorderPadding,n=(this.seatReservations.length-1)*this.gapBetweenCoachDecks;this.style?.setProperty(`--sbb-seat-reservation-height`,`${t*this.seatReservations.length+n}`),this.style?.setProperty(`--sbb-seat-reservation-decks`,`${this.seatReservations.length}`)}if(this.navigationScrollArea){this.scrollNavigationAreaDim=this.alignVertical?this.navigationScrollArea.getBoundingClientRect().height:this.navigationScrollArea.getBoundingClientRect().width;let e=this.navigationScrollArea.querySelector(`ul > li`);if(e){let t=e?.getBoundingClientRect();this.coachNavButtonDim=this.alignVertical?t.height:t.width}}if(this.coachScrollArea&&e){let t=0;this.scrollCoachesAreaWidth=this.alignVertical?this.coachScrollArea.getBoundingClientRect().height:this.coachScrollArea.getBoundingClientRect().width,this.triggerCoachPositionsCollection=e.coachItems.map((e,n)=>{let r=this.seatReservationStructure.decks[this.currSelectedDeckIndex].deckCoaches[n],i=t;return t+=r.width+(r.hasOverhangingElements?2*this.gapBetweenCoaches:this.gapBetweenCoaches),{start:i,end:t,width:r.width}}),this.maxCalcCoachesWidth=t-this.gapBetweenCoaches}}coachAreaScrollend(){this._scrollTimeout&&clearTimeout(this._scrollTimeout),this._scrollTimeout=setTimeout(()=>this._handleCoachAreaScrollendEvent(),150)}onFocusTableCoachAndPreselectPlace(e){!this.seatReservationWithoutNavigationHasFocus&&!this.hasNavigation&&(this.seatReservationWithoutNavigationHasFocus=!0,this.currSelectedCoachIndex=e===0?this.getNextAvailableCoachIndex(-1):this.getPrevAvailableCoachIndex(e),this.preselectPlaceInCoach())}onFocusNavDirectionButton(){this.focusedCoachIndex=-1}onKeyNavigationNavCoachButton(e,t){if(e.key===this.keyboardNavigationEvents.Tab){this._handleTabKeyNavigation(e,`navigation`,t);return}s(e)&&this.keyboardSeatmapEventHandling(e)}_handleTabKeyNavigation(e,t,n){let r=e.key,i=e.shiftKey;r===this.keyboardNavigationEvents.Tab&&(t==`navigation`?(n==this.currSelectedCoachIndex?!this.currSelectedPlace||!i||this.coachItemDetailsElements[n].isDriverArea||this.focusedCoachIndex==-1?this.focusedCoachIndex=n:i&&this.currSelectedPlace&&(this.focusedCoachIndex=-1,this.focusPlaceElement(this.currSelectedPlace)):this.focusedCoachIndex=n,this._scrollToSelectedNavigationButton(n)):t==`seatmap`&&(e.preventDefault(),i?this._navigateCoachNavigationByKeyboard(`PREV_TAB`):this._navigateCoachNavigationByKeyboard(`NEXT_TAB`)))}keyboardSeatmapEventHandling(e){let t=e.key===this.keyboardNavigationEvents.Tab,n=e.shiftKey&&t;if(!this.hasNavigation&&this.currSelectedCoachIndex===0&&n||this.currSelectedCoachIndex===this.coachItemDetailsElements.length-1&&t)return;let r=e.key;if(this.preventCoachScrollByPlaceClick=!1,!this.hasSeatReservationNativeFocus&&(t||n)&&(this.hasSeatReservationNativeFocus=!0),t){this._handleTabKeyNavigation(e,`seatmap`);return}if(this.currSelectedCoachIndex!==-1&&s(e))switch(e.preventDefault(),r){case this.keyboardNavigationEvents.ArrowLeft:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowDown:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowRight:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowUp:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowUp:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowLeft:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowDown:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowRight:r;this._navigateToPlaceByKeyboard(e)}break;default:break}}preselectPlaceInCoach(){if(this.isAutoScrolling){if(this._isRunningInitPreselectCoachIndex){this._isRunningInitPreselectCoachIndex=!1;return}if(this.coachItemDetailsElements[this.currSelectedCoachIndex]&&this.coachItemDetailsElements[this.currSelectedCoachIndex].isDriverArea){this._setFocusToSelectedCoachGrid();return}if(this.isKeyboardNavigation&&this.isAutoScrolling){let e=this._getClosestPlaceByKeyDirection();e?(this.unfocusPlaceElement(),this.focusPlaceElement(e),this.focusedCoachIndex=-1):this._setFocusToSelectedCoachGrid()}else this.unfocusPlaceElement(),this.isCoachGridFocusable=!0,this._setFocusToSelectedCoachGrid()}}scrollToSelectedNavCoach(e){if(this._isValidCoachIndex(e)&&e!==this.currSelectedCoachIndex){this.hoveredCoachIndex=e,this.isAutoScrolling=!0,this.isCoachGridFocusable=!0,this.currSelectedCoachIndex=e,this.currSelectedDeckIndex=this._getExistingCoachDeckIndex(),this._setScrollDirectionByCoachIndex();let t=this._getCoachScrollPositionX();(this.selectedCoachIndex!==-1||this.currSelectedCoachIndex>0)&&this._isScrollableToSelectedCoach()?(this._lastStartScrollPos=this.coachScrollArea.scrollLeft,this.coachScrollArea.scrollTo({top:this.alignVertical?t:0,left:this.alignVertical?0:t,behavior:`smooth`})):this.updateCurrentSelectedCoach(),this._scrollToSelectedNavigationButton(e)}}focusPlaceElement(e){if(this.unfocusPlaceElement(),e){this.currSelectedPlace=e,this._setCurrSelectedPlaceElementId(e);let t=this._getPlaceHtmlElement();if(t){t.setAttribute(`keyfocus`,`focus`);let n=setTimeout(()=>{let t=this.getPlaceElementId(this.currSelectedDeckIndex,this.currSelectedCoachIndex,e.number);this._scrollPlaceIntoNearestViewport(t),clearTimeout(n)},0)}}}unfocusPlaceElement(){let e=this._getPlaceHtmlElement();e&&(e.setAttribute(`keyfocus`,`unfocus`),this._setCurrSelectedPlaceElementId(null),this.currSelectedPlace=null)}getCalculatedDimension(e,t,n,r){return t&&!n&&(e.h+=this.coachBorderOffset*2),r&&(e.h+=this.coachBorderOffset),{w:Math.round(this.baseGridSize*e.w),h:Math.round(this.baseGridSize*e.h)}}getCalculatedPosition(e,t,n,r){if(n&&t){let i=r?n.h:n.h+this.coachBorderOffset;e.y===0?e.y-=this.coachBorderOffset:e.y+t.h===i&&(e.y+=this.coachBorderOffset)}return{x:Math.round(this.baseGridSize*e.x),y:Math.round(this.baseGridSize*e.y),z:e.z}}isElementDirectlyOnBorder(e,t){return e.position.y===0||e.position.y+e.dimension.h===t.h}getAvailableFreePlacesNumFromCoach(e){let t={seats:0,bicycles:0};return e?.reduce((e,t)=>(t.state===`FREE`&&(t.type===`SEAT`?e.seats++:e.bicycles++),e),t)||t}_handleCoachAreaScrollendEvent(){let e=this.isAutoScrolling?this.currSelectedCoachIndex:this._getCoachIndexByScrollTriggerPosition();if(this.preventCoachScrollByPlaceClick){Math.abs(this._lastStartScrollPos-this.coachScrollArea.scrollLeft)>this.baseGridSize*2&&(this.selectedCoachIndex=e),this.preventCoachScrollByPlaceClick=!1;return}this._lastStartScrollPos=this.coachScrollArea.scrollLeft,this.hoveredCoachIndex=-1,this.currSelectedCoachIndex===-1&&(this.currSelectedCoachIndex=e),this._isScrollableToSelectedCoach()?this.currSelectedCoachIndex=e:this.currSelectedCoachIndex=e<this.currSelectedCoachIndex?this.currSelectedCoachIndex:e,this.isAutoScrolling||this._scrollToSelectedNavigationButton(e),this.preventCoachScrollByPlaceClick=!1,this.updateCurrentSelectedCoach(),this.hasNavigation||(this.preselectPlaceInCoach(),this.isAutoScrolling=!1)}_scrollToSelectedNavigationButton(e){setTimeout(()=>{if(this.hasNavigation&&this.navigationScrollArea){let t=this.scrollNavigationAreaDim/2,n=e*this.coachNavButtonDim-t+this.coachNavButtonDim;this.navigationScrollArea.scrollTo({top:this.alignVertical?n:0,left:this.alignVertical?0:n,behavior:`smooth`})}},10)}_setScrollDirectionByCoachIndex(){this.currScrollDirection=this.currSelectedCoachIndex>this.selectedCoachIndex?Z.right:Z.left}_getCoachScrollPositionX(){let e=this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];return this.isKeyboardNavigation&&this.currScrollDirection===Z.left&&e.width>this.scrollCoachesAreaWidth?e.end-this.scrollCoachesAreaWidth:e.start}_setFocusToSelectedCoachGrid(){if(this.isCoachGridFocusable&&this.hasSeatReservationNativeFocus){this.isCoachGridFocusable=!1;let e=this.shadowRoot?.querySelector(`#sbb-sr-coach-caption-`+this.currSelectedCoachIndex);e&&e.focus()}}_isScrollableToSelectedCoach(){let e=this.alignVertical?this.coachScrollArea.scrollTop:this.coachScrollArea.scrollLeft,t=this.alignVertical?this.coachScrollArea.getBoundingClientRect().height:this.coachScrollArea.getBoundingClientRect().width,n=this.maxCalcCoachesWidth-t,r=this.triggerCoachPositionsCollection[this.currSelectedCoachIndex],i=e===this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;return(e<n||e>r.start)&&!i}_getCoachIndexByScrollTriggerPosition(){let e=(this.alignVertical?this.coachScrollArea.scrollTop:this.coachScrollArea.scrollLeft)+this.scrollCoachesAreaWidth/2;return this.triggerCoachPositionsCollection.findIndex(t=>e>=t.start&&e<=t.end)}_getFirstPlaceInSelectedCoach(){let e=null,t=this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex],n=`cell-`+this.currSelectedDeckIndex+`-`+this.currSelectedCoachIndex+`-0-0`,r=this.shadowRoot?.querySelector(`#`+n)?.querySelector(`sbb-seat-reservation-place-control`)?.getAttribute(`text`)||null;return t&&r&&(e=t.places?.find(e=>e.number===r)||null),e}_getSwitchedCoachDeckIndexByKeyNavigation(e,t){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}_getClosestPlaceByKeyDirection(e){let t=this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex],n=null,r=t.places,i=null;if(r){if(!this.currSelectedPlaceElementId)return this._getFirstPlaceInSelectedCoach();if(this.currSelectedPlace){let a={...this.currSelectedPlace.position};e&&(i=this._getSwitchedCoachDeckIndexByKeyNavigation(e,t),i!==null&&(r=this.seatReservations[i].coachItems[this.currSelectedCoachIndex].places||[],a.y=i<this.currSelectedDeckIndex?t.dimension.h:-1));for(let t of r)e?t.number!==this.currSelectedPlace?.number&&(e===this.keyboardNavigationEvents.ArrowRight&&(t.position.y===a.y||t.position.y===a.y-1)&&t.position.x>a.x&&(!n||t.position.x<n.position.x)||e===this.keyboardNavigationEvents.ArrowDown&&(t.position.x===a.x||t.position.x===a.x+1)&&t.position.y>a.y&&(!n||t.position.y<n.position.y)||e===this.keyboardNavigationEvents.ArrowLeft&&(t.position.y===a.y||t.position.y===a.y+1)&&t.position.x<a.x&&(!n||t.position.x>n.position.x)||e===this.keyboardNavigationEvents.ArrowUp&&(t.position.x===a.x||t.position.x===a.x-1)&&t.position.y<a.y&&(!n||t.position.y>n.position.y))&&(n=t):(this.currScrollDirection===Z.right&&t.position.y===a.y&&(!n||t.position.x<n.position.x)||this.currScrollDirection===Z.left&&t.position.y===a.y&&(!n||t.position.x>n.position.x))&&(n=t);i!==null&&n&&(this.currSelectedDeckIndex=i)}}return n}_navigateCoachNavigationByKeyboard(e){let t=this.focusedCoachIndex===-1?this.currSelectedCoachIndex===-1?0:this.currSelectedCoachIndex:this.focusedCoachIndex,n=e===`NEXT_TAB`?this.getNextAvailableCoachIndex(t):this.getPrevAvailableCoachIndex(t);if(this.hasNavigation){let r=this._getPlaceHtmlElement(),i=r?r.getAttribute(`keyfocus`)===`focus`:!1;if(e===`PREV_TAB`&&this.selectedCoachIndex===t)if(i||this.currSelectedPlace!==null){this.focusedCoachIndex=t,this.unfocusPlaceElement();return}else t===0?this._refocusCurrentFocusedNavCoach(t):this.focusedCoachIndex=n;else n===this.currSelectedCoachIndex?e===`NEXT_TAB`&&n===this.coachItemDetailsElements.length-1?this._refocusCurrentFocusedNavCoach(t):(this.focusedCoachIndex=-1,this.selectedCoachIndex=n,i?this.focusPlaceElement(this.currSelectedPlace):(this.isCoachGridFocusable=!0,this._setFocusToSelectedCoachGrid())):this.focusedCoachIndex=n;this._scrollToSelectedNavigationButton(n)}else this.scrollToSelectedNavCoach(n)}_refocusCurrentFocusedNavCoach(e){this.focusedCoachIndex=-1,setTimeout(()=>this.focusedCoachIndex=e,0)}_navigateToPlaceByKeyboard(e){if(this.isKeyboardNavigation=!0,this.focusedCoachIndex!==-1&&(this.focusedCoachIndex=-1),!this.preventPlaceClick){let t=this._getClosestPlaceByKeyDirection(e);if(t)this.focusPlaceElement(t);else if(e===this.keyboardNavigationEvents.ArrowRight||e===this.keyboardNavigationEvents.ArrowLeft||this.alignVertical&&(e===this.keyboardNavigationEvents.ArrowUp||e===this.keyboardNavigationEvents.ArrowDown)){let t=e===this.keyboardNavigationEvents.ArrowRight?this.getNextAvailableCoachIndex():this.getPrevAvailableCoachIndex();this.scrollToSelectedNavCoach(t)}}}getNextAvailableCoachIndex(e){let t=e??this.currSelectedCoachIndex;return t<this.seatReservations[this.currSelectedDeckIndex].coachItems.length-1?t+1:t}getPrevAvailableCoachIndex(e){let t=e??this.currSelectedCoachIndex;return t>0?t-1:t}updateSelectedSeatReservationPlaces(e){let t=e.placeType===`SEAT`?`seats`:`bicycles`,n=e.placeType===`SEAT`?this.maxSeatReservations:this.maxBicycleReservations,r=this.selectedSeatReservationPlaces[t];this.selectedSeatReservationPlaces[t]=this._updateSelectedSeatReservationPlaces(r,n,e);let i=this.selectedSeatReservationPlaces;this.dispatchEvent(new te(i))}_updateSelectedSeatReservationPlaces(e,t,n){if(n.state===`SELECTED`){let t=this._getDeckIndexByPlaceId(n.id),r=this._getSeatReservationPlaceSelection(n,t);r&&e.push(r)}else e=e.filter(e=>e.id!==n.id);if(t>-1&&e.length>t){let r=t>0?n:void 0;e=this._resetAllPlaceSelections(e,r)}return e}updateCurrentSelectedPlaceInCoach(e){let t=this._getDeckIndexByPlaceId(e.id),n=e.coachIndex;if(t===null)return;let r=this.seatReservations[t].coachItems[n].places?.find(t=>t.number==e.number);if(!r)return;this.currSelectedDeckIndex=t,this.currSelectedCoachIndex=n,this.currSelectedPlace=r,this.currSelectedCoachIndex!==this.selectedCoachIndex&&this.updateCurrentSelectedCoach(),this._setCurrSelectedPlaceElementId(r);let i=setTimeout(()=>{this._scrollPlaceIntoNearestViewport(e.id),clearTimeout(i)},0)}updateCurrentSelectedCoach(){if(this.currSelectedCoachIndex==this.selectedCoachIndex)return;this.focusedCoachIndex!=-1&&(this.focusedCoachIndex=this.currSelectedCoachIndex),this.selectedCoachIndex=this.currSelectedCoachIndex;let e=this._getSeatReservationSelectedCoach(this.selectedCoachIndex);e&&this.dispatchEvent(new ne(e))}getPlaceElementId(e,t,n){return`seat-reservation__place-button-`+e+`-`+t+`-`+n}_initEmptyCoachDeckOffsets(){let e=Array(this.seatReservations.length-1).fill(0);this.seatReservations[this.seatReservations.length-1].coachItems.forEach(t=>{for(let n=0;n<this.seatReservations.length-1;n++){let r=this.seatReservations[n].coachItems[e[n]];if(t.id!=r?.id){let r={...t,places:void 0,propertyIds:void 0,graphicElements:void 0,serviceElements:void 0,travelClass:[]};this.seatReservations[n].coachItems.splice(e[n],0,r)}e[n]++}})}_initSeatReservationPlaceSelection(){this.selectedSeatReservationPlaces.seats=[],this.selectedSeatReservationPlaces.bicycles=[],this.seatReservations?.forEach((e,t)=>e.coachItems.map((n,r)=>{n.places?.filter(e=>e.state===`SELECTED`)?.forEach(n=>{let i=A(n,this.getPlaceElementId(t,r,n.number),e.deckCoachIndex,r),a=this._getSeatReservationPlaceSelection(i,t);a&&(a.placeType===`SEAT`?this.selectedSeatReservationPlaces.seats.push(a):this.selectedSeatReservationPlaces.bicycles.push(a))})}))}_resetAllPlaceSelections(e,t){for(let n of e)if(!t||t.id!==n.id){let e=this.shadowRoot?.getElementById(n.id);e&&e.setAttribute(`state`,`FREE`)}return e=t?e.filter(e=>e.id===t.id):[],e}_getSeatReservationPlaceSelection(e,t){if(t===null)return null;let n=this.seatReservations[t].coachItems[e.coachIndex],r=n.places?.find(t=>t.number===e.number);return r?j(r,n,e.id,e.deckIndex,e.coachIndex):null}_getSeatReservationSelectedCoach(e){if(!this.seatReservations[this.currSelectedDeckIndex].coachItems[e])return null;let t=this.seatReservations[this.currSelectedDeckIndex].coachItems[e];return M(e,t,this.getAvailableFreePlacesNumFromCoach(t.places))}_setCurrSelectedPlaceElementId(e){this.currSelectedPlaceElementId=e?this.getPlaceElementId(this.currSelectedDeckIndex,this.currSelectedCoachIndex,e.number):null}_determineBaseFontSize(){if(!f){let e=1/parseInt(window.getComputedStyle(document.body).fontSize,10);this.style?.setProperty(`--sbb-seat-reservation-one-px-rem`,`${e+`rem`}`)}}_prepareCoachItemDetailsData(){if(this.seatReservations){let e=this.seatReservations[this.seatReservations.length-1].coachItems;this.coachItemDetailsElements=[],e.forEach((e,t)=>{let n=[],r=[],i=[];this.seatReservations.map(e=>e.coachItems[t]).forEach(e=>{n.push(...e.travelClass),r.push(...e.propertyIds?e.propertyIds:[]),i.push(...e.places?e.places:[])}),this.coachItemDetailsElements.push({id:e.id,travelClass:this._prepareTravelClassNavigation(n),propertyIds:this._prepareServiceIconsNavigation(r),isDriverArea:!e.places||e.places.length===0,isLocomotive:this._isLocomotive(e),driverAreaSide:this._prepareDriverAreaSideNavigation(e),freePlaces:this.getAvailableFreePlacesNumFromCoach(i)})})}}_prepareOptimizeAreaIconDimensionByMedian(){if(this.seatReservations){let e=[];if(this.seatReservations.forEach(t=>t.coachItems.forEach(t=>t.serviceElements?.forEach(t=>e.push(t.dimension)))),e.length){e.sort((e,t)=>{if(e&&t){let n=e.w+e.h,r=t.w+t.h;return n>r?1:n<r?-1:0}return 0});let t=e[Math.floor(e.length/2)];this.globalAreaIconDim=this.getCalculatedDimension(t)}else{let e=this.seatReservations.flatMap(e=>e.coachItems.map(e=>e.dimension.h)).reduce((e,t)=>Math.max(e,t),0),t=Math.floor(e*.2);this.globalAreaIconDim=this.getCalculatedDimension({w:t,h:t})}}}_prepareTravelClassNavigation(e){return e.indexOf(`FIRST`)===-1?e.indexOf(`SECOND`)===-1?`ANY_CLASS`:`SECOND`:`FIRST`}_prepareDriverAreaSideNavigation(e){let t=e.graphicElements?.filter(e=>e.icon===`DRIVER_AREA`);if(t&&t.length>0){let e=t.find(e=>e.position.x===0)||!1,n=t.find(e=>e.position.x>0)||!1;return{left:!!e,right:!!n}}}_prepareSeatReservationStructureInformation(){this.seatReservations&&(this.seatReservationStructure={decks:[]},this.seatReservations.forEach((e,t)=>{let n={deckIndex:t,deckCoaches:[]};e?.coachItems?.forEach(e=>{let t=(e.graphicElements?.filter(e=>e.icon&&!this.notAreaElements.includes(e.icon)))?.concat(e.serviceElements||[]).concat(e.places||[])||[],r=this._isOverhangingElementsPresent(e.dimension.w,t),i=e.graphicElements?.filter(e=>!this.notAreaElements.includes(e.icon)).map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`AREA`)),a=e.graphicElements?.filter(e=>this.notAreaElements.includes(e.icon)).map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`OTHER`)),o=e.serviceElements?.map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`SERVICE`)),s=this._getCalculatedMiddleBorderElement(e),c=this.getCalculatedDimension({...e.dimension}),l={width:c.w,height:c.h,otherElements:a||[],serviceElements:o||[],areaElements:i||[],borderMiddleElement:s,hasOverhangingElements:r};n.deckCoaches.push(l)}),this.seatReservationStructure.decks.push(n)}))}_getCalculatedMiddleBorderElement(e){let t=(e.dimension.h+this.coachBorderOffset*2)*this.baseGridSize,n=0,r=e.dimension.w;if(e.graphicElements){let t=this._getFirstLastDockingElements(e.graphicElements);if(t?.length==2){let i=t[0],a=t[1],o=i.position.x==0?a.dimension.w:i.dimension.w;n=i.position.x==0?i.dimension.w:a.dimension.w,r=e.dimension.w-o-n}else if(t?.length==1){let i=t[0];i.position.x===0?(n=i.dimension.w,r=e.dimension.w-i.dimension.w):i.position.x!==0&&(r=e.dimension.w-i.dimension.w)}}let i=this.coachBorderPadding*-1;return{position:{x:Math.floor(n*this.baseGridSize)-1,y:i,z:0},dimension:{w:Math.floor(r*this.baseGridSize)+2,h:t}}}_getFirstLastDockingElements(e){let t=(e.filter(e=>this.middleBorderDockingElements.includes(e.icon))||[]).sort((e,t)=>{let n=e.position.x,r=t.position.x;return n>r?1:n<r?-1:0});return t.filter((e,n)=>n==0||n==t.length-1)}_getCalculatedDimensionPositionElement(e,t,n){let r={...e.dimension},i={...e.position},a=e.rotation||0,o=this.notAreaElements.concat(this.notFixedRotatableAreaIcons).indexOf(e.icon)===-1,s=this.alignVertical&&o?a-90:a,c=null;if(n===`AREA`){let n=e.icon?.indexOf(`TABLE`)===-1,a=e.icon&&n?e.icon:null,o=this.isElementDirectlyOnBorder(e,t)&&a!==`ENTRY_EXIT`;e.position.y===0?(c=`upper-border`,i.y-=this.coachBorderOffset-this.coachBorderOffset/3):e.position.y+e.dimension.h===t.h&&(c=`lower-border`,o||(i.y+=this.coachBorderOffset-this.coachBorderOffset/3)),o&&(r.h+=this.coachBorderOffset-this.coachBorderOffset/3)}else n===`OTHER`&&(e.position.y===0&&(i.y-=this.coachBorderOffset),t.h===e.position.y+e.dimension.h&&(r.h+=this.coachBorderOffset*2));return r.w=Math.floor(r.w*this.baseGridSize),r.h=Math.floor(r.h*this.baseGridSize),i.x=Math.floor(i.x*this.baseGridSize),i.y=Math.floor(i.y*this.baseGridSize),{icon:e.icon&&e.icon.endsWith(`DRIVER_AREA`)?e.icon?.concat(`_`,this.seatReservations[this.currSelectedDeckIndex].vehicleType):e.icon,rotation:s,dimension:r,position:i,mounting:c}}_getPlaceHtmlElement(){return this.currSelectedPlaceElementId&&this.shadowRoot?.getElementById(this.currSelectedPlaceElementId)||null}_getDeckIndexByPlaceId(e){let t=this.shadowRoot?.querySelector(`#`+e)?.getAttribute(`data-deck-index`);return t&&!isNaN(+t)?+t:null}_isValidCoachIndex(e){return e>=0&&e<=this.seatReservations[this.seatReservations.length-1].coachItems.length}_getExistingCoachDeckIndex(){if(this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex].places!==void 0)return this.currSelectedDeckIndex;let e=this.seatReservations.findIndex(e=>e.coachItems[this.currSelectedCoachIndex].places!==void 0);return this.currSelectedDeckIndex>=e?this.currSelectedDeckIndex:e}_scrollPlaceIntoNearestViewport(e){this.shadowRoot?.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`nearest`})}_isOverhangingElementsPresent(e,t){return t?.some(t=>t.position.x===0||t.position.x+t.dimension.w>=e)??!1}_isLocomotive(e){return e?.graphicElements?.find(e=>e.icon===`DRIVER_AREA_NO_VERTICAL_WALL`)!==void 0}_onLeaveSeatReservationComponent(){this.hasNavigation&&(this.focusedCoachIndex=-1),this.unfocusPlaceElement()}}})();var $=`:host{--sbb-seat-reservation-grid-size:16px;--sbb-seat-reservation-height:0;--sbb-seat-reservation-decks:1;height:inherit;display:block}:host ::part(coach-floor){fill:var(--sbb-background-color-2)}@media (forced-colors:active){:host ::part(coach-floor){fill:#0000}}:host(:dir(rtl)) :not(.sbb-sr-place-ctrl--type-bicycle,.sbb-sr-place-ctrl--orientation-90,.sbb-sr-place-ctrl--orientation-270,.sbb-sr-place-ctrl--state-selected) ::part(coach-floor){rotate:180deg}.sbb-sr-popover{margin-block:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}:host([align-vertical]) .sbb-sr__component{justify-content:flex-end;gap:calc(22 * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:inherit;flex-direction:row-reverse}@media (width>=37.5rem){:host([align-vertical]) .sbb-sr__component{gap:calc(54 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation,:host([align-vertical]) .sbb-sr__component ul.sbb-sr-navigation__list-coaches{flex-direction:column}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation{padding:calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) 0}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button{left:calc(1 * var(--sbb-seat-reservation-one-px-rem,.0625rem));top:0;rotate:90deg}@media (width>=64rem){:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button{left:calc(-1 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches{max-width:initial;padding:calc(5 * var(--sbb-seat-reservation-one-px-rem,.0625rem));overflow:hidden scroll}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches li{display:flex}:host([align-vertical]) .sbb-sr__wrapper-coach-decks{flex-direction:column}:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels{width:calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:initial;flex-direction:column-reverse}:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b{inline-size:calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));block-size:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-bottom:calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));rotate:initial;writing-mode:initial}:host([align-vertical]) .sbb-sr__wrapper-scrollarea{width:calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:100%;overflow:hidden scroll}:host([align-vertical]) .sbb-sr__wrapper-scrollarea .sbb-sr__parent{rotate:90deg}:host([align-vertical]) .sbb-sr-travel-direction-wrapper{width:calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block-start:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr-navigation{gap:calc(3 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr-navigation .sbb-sr__navigation-control-button{top:calc(2 * var(--sbb-seat-reservation-one-px-rem,.0625rem));position:relative}@media (width>=64rem){.sbb-sr-navigation .sbb-sr__navigation-control-button{top:0}}.sbb-sr__component{gap:calc(64 * var(--sbb-seat-reservation-one-px-rem,.0625rem) - 16px);flex-direction:column;display:flex}.sbb-sr-travel-direction-wrapper{justify-content:center;align-items:center;column-gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));font-size:var(--sbb-text-font-size-s);display:flex}.sbb-sr-travel-direction-wrapper .sbb-sr__travel-direction--arrow{align-items:center;display:flex}.sbb-sr-navigation-wrapper{display:flex}.sbb-sr-navigation{justify-content:center;width:100%;padding-inline:16px;display:flex}.sbb-sr-navigation__list-coaches{gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));padding:calc(6 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(5 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) 0;--sbb-scrollbar-color:transparent;flex-wrap:nowrap;max-width:856px;display:flex;position:relative;overflow:scroll hidden}.sbb-sr__wrapper-coach-decks{height:inherit;display:flex;overflow:hidden}.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels{height:calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));writing-mode:vertical-lr;justify-content:space-between;display:flex}.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b{height:calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));width:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));text-align:center;line-height:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block-end:16px;rotate:180deg}.sbb-sr__wrapper-scrollarea{padding-block:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));overflow:scroll hidden}.sbb-sr__wrapper-scrollarea .sbb-sr__parent{flex-direction:column;display:flex;position:relative}.sbb-sr__list-decks{flex-direction:column;display:flex}.sbb-sr__list-decks--gap{gap:calc(48 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr__list-item-deck{position:relative}.sbb-sr__list-coaches{gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));display:flex}.sbb-sr__list-decks:has(.sbb-sr-coach-has-overhanging-elements) .sbb-sr__list-coaches{gap:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr__item-coach{position:relative}.sbb-sr-coach-wrapper__table{outline:0}
294
+ `,X=class extends r{static{this.elementName=`sbb-seat-reservation-scoped`}static{this.styles=[m(Y)]}render(){return d`<slot></slot>`}},Z;(function(e){e.right=`right`,e.left=`left`})(Z||={});const ee=[`sa-vo`,`sa-rs`,`sa-abteilkinderwagen`,`sa-wr`,`sa-fa`,`sa-bz`,`sa-rz`];var te=class extends Event{get detail(){return this._detail}constructor(e){super(`selectedplaces`,{bubbles:!0,composed:!0}),this._detail=e}},ne=class extends Event{get detail(){return this._detail}constructor(e){super(`selectedcoach`,{bubbles:!0,composed:!0}),this._detail=e}};let Q=(()=>{let n=r,i=[],a,c=[],l=[],u,d=[],p=[],m,v=[],y=[],b,x=[],S=[],C,w=[],T=[],E,D=[],O=[],k,N=[],F=[],I,L=[],R=[],z,B=[],V=[],H,U=[],W=[],G,K=[],q=[],J,Y=[],X=[],Q,$=[],re=[],ie,ae=[],oe=[],se;return class extends n{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;a=[g({attribute:`seat-reservations`,type:Array})],u=[g({attribute:`travel-direction`,type:String})],m=[o(),g({attribute:`has-navigation`,type:Boolean})],b=[o(),g({attribute:`align-vertical`,type:Boolean,reflect:!0,useDefault:!0})],C=[o(),g({attribute:`base-grid-size`,type:Number})],E=[o(),g({attribute:`height`,type:Number})],k=[o(),g({attribute:`max-seat-reservations`,type:Number})],I=[o(),g({attribute:`max-bicycle-reservations`,type:Number})],z=[o(),g({attribute:`prevent-place-click`,type:Boolean})],H=[o(),g({attribute:`preselect-coach-index`,type:Number})],G=[o(),g({attribute:`show-title-info`,type:Boolean})],J=[_()],Q=[_()],ie=[_()],se=[h({passive:!0})],e(this,null,a,{kind:`accessor`,name:`seatReservations`,static:!1,private:!1,access:{has:e=>`seatReservations`in e,get:e=>e.seatReservations,set:(e,t)=>{e.seatReservations=t}},metadata:t},c,l),e(this,null,u,{kind:`accessor`,name:`travelDirection`,static:!1,private:!1,access:{has:e=>`travelDirection`in e,get:e=>e.travelDirection,set:(e,t)=>{e.travelDirection=t}},metadata:t},d,p),e(this,null,m,{kind:`accessor`,name:`hasNavigation`,static:!1,private:!1,access:{has:e=>`hasNavigation`in e,get:e=>e.hasNavigation,set:(e,t)=>{e.hasNavigation=t}},metadata:t},v,y),e(this,null,b,{kind:`accessor`,name:`alignVertical`,static:!1,private:!1,access:{has:e=>`alignVertical`in e,get:e=>e.alignVertical,set:(e,t)=>{e.alignVertical=t}},metadata:t},x,S),e(this,null,C,{kind:`accessor`,name:`baseGridSize`,static:!1,private:!1,access:{has:e=>`baseGridSize`in e,get:e=>e.baseGridSize,set:(e,t)=>{e.baseGridSize=t}},metadata:t},w,T),e(this,null,E,{kind:`accessor`,name:`height`,static:!1,private:!1,access:{has:e=>`height`in e,get:e=>e.height,set:(e,t)=>{e.height=t}},metadata:t},D,O),e(this,null,k,{kind:`accessor`,name:`maxSeatReservations`,static:!1,private:!1,access:{has:e=>`maxSeatReservations`in e,get:e=>e.maxSeatReservations,set:(e,t)=>{e.maxSeatReservations=t}},metadata:t},N,F),e(this,null,I,{kind:`accessor`,name:`maxBicycleReservations`,static:!1,private:!1,access:{has:e=>`maxBicycleReservations`in e,get:e=>e.maxBicycleReservations,set:(e,t)=>{e.maxBicycleReservations=t}},metadata:t},L,R),e(this,null,z,{kind:`accessor`,name:`preventPlaceClick`,static:!1,private:!1,access:{has:e=>`preventPlaceClick`in e,get:e=>e.preventPlaceClick,set:(e,t)=>{e.preventPlaceClick=t}},metadata:t},B,V),e(this,null,H,{kind:`accessor`,name:`preselectCoachIndex`,static:!1,private:!1,access:{has:e=>`preselectCoachIndex`in e,get:e=>e.preselectCoachIndex,set:(e,t)=>{e.preselectCoachIndex=t}},metadata:t},U,W),e(this,null,G,{kind:`accessor`,name:`showTitleInfo`,static:!1,private:!1,access:{has:e=>`showTitleInfo`in e,get:e=>e.showTitleInfo,set:(e,t)=>{e.showTitleInfo=t}},metadata:t},K,q),e(this,null,J,{kind:`accessor`,name:`selectedCoachIndex`,static:!1,private:!1,access:{has:e=>`selectedCoachIndex`in e,get:e=>e.selectedCoachIndex,set:(e,t)=>{e.selectedCoachIndex=t}},metadata:t},Y,X),e(this,null,Q,{kind:`accessor`,name:`focusedCoachIndex`,static:!1,private:!1,access:{has:e=>`focusedCoachIndex`in e,get:e=>e.focusedCoachIndex,set:(e,t)=>{e.focusedCoachIndex=t}},metadata:t},$,re),e(this,null,ie,{kind:`accessor`,name:`hoveredCoachIndex`,static:!1,private:!1,access:{has:e=>`hoveredCoachIndex`in e,get:e=>e.hoveredCoachIndex,set:(e,t)=>{e.hoveredCoachIndex=t}},metadata:t},ae,oe),e(this,null,se,{kind:`method`,name:`coachAreaScrollend`,static:!1,private:!1,access:{has:e=>`coachAreaScrollend`in e,get:e=>e.coachAreaScrollend},metadata:t},null,i),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.events={selectedplaces:`selectedplaces`,selectedcoach:`selectedcoach`}}#e;get seatReservations(){return this.#e}set seatReservations(e){this.#e=e}#t;get travelDirection(){return this.#t}set travelDirection(e){this.#t=e}#n;get hasNavigation(){return this.#n}set hasNavigation(e){this.#n=e}#r;get alignVertical(){return this.#r}set alignVertical(e){this.#r=e}#i;get baseGridSize(){return this.#i}set baseGridSize(e){this.#i=e}#a;get height(){return this.#a}set height(e){this.#a=e}#o;get maxSeatReservations(){return this.#o}set maxSeatReservations(e){this.#o=e}#s;get maxBicycleReservations(){return this.#s}set maxBicycleReservations(e){this.#s=e}#c;get preventPlaceClick(){return this.#c}set preventPlaceClick(e){this.#c=e}#l;get preselectCoachIndex(){return this.#l}set preselectCoachIndex(e){this.#l=e}#u;get showTitleInfo(){return this.#u}set showTitleInfo(e){this.#u=e}#d;get selectedCoachIndex(){return this.#d}set selectedCoachIndex(e){this.#d=e}#f;get focusedCoachIndex(){return this.#f}set focusedCoachIndex(e){this.#f=e}#p;get hoveredCoachIndex(){return this.#p}set hoveredCoachIndex(e){this.#p=e}constructor(){super(),this.#e=(t(this,i),t(this,c,null)),this.#t=(t(this,l),t(this,d,`NONE`)),this.#n=(t(this,p),t(this,v,!0)),this.#r=(t(this,y),t(this,x,!1)),this.#i=(t(this,S),t(this,w,16)),this.#a=(t(this,T),t(this,D,null)),this.#o=(t(this,O),t(this,N,-1)),this.#s=(t(this,F),t(this,L,-1)),this.#c=(t(this,R),t(this,B,!1)),this.#l=(t(this,V),t(this,U,-1)),this.#u=(t(this,W),t(this,K,!1)),this.#d=(t(this,q),t(this,Y,-1)),this.#f=(t(this,X),t(this,$,-1)),this.#p=(t(this,re),t(this,ae,-1)),this.coachBorderPadding=(t(this,oe),6),this.gapBetweenCoaches=4,this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.gapBetweenCoachDecks=48,this.coachNavButtonDim=0,this.globalAreaIconDim={w:2,h:2},this.globalAreaIconPadding=.8,this.coachItemDetailsElements=[],this.currScrollDirection=Z.right,this.maxCalcCoachesWidth=0,this.scrollCoachesAreaWidth=0,this.scrollNavigationAreaDim=0,this.triggerCoachPositionsCollection=[],this.navigationScrollArea=null,this.coachScrollArea=null,this.currSelectedPlace=null,this.currSelectedPlaceElementId=null,this.currSelectedCoachIndex=-1,this.currSelectedDeckIndex=0,this.preventCoachScrollByPlaceClick=!1,this.selectedSeatReservationPlaces={seats:[],bicycles:[]},this.seatReservationWithoutNavigationHasFocus=!1,this.isCoachGridFocusable=!1,this.isAutoScrolling=!1,this.isKeyboardNavigation=!1,this.hasMultipleDecks=!1,this.hasSeatReservationNativeFocus=!1,this.keyboardNavigationEvents={ArrowLeft:`ArrowLeft`,ArrowRight:`ArrowRight`,ArrowUp:`ArrowUp`,ArrowDown:`ArrowDown`,Tab:`Tab`,Enter:`Enter`},this.seatReservationStructure={decks:[]},this.notFixedRotatableAreaIcons=[`ENTRY_EXIT`],this.notAreaElements=[`DRIVER_AREA`,`DRIVER_AREA_NO_VERTICAL_WALL`,`COACH_PASSAGE`,`COACH_WALL_NO_PASSAGE`,`COMPARTMENT_PASSAGE`,`COMPARTMENT_PASSAGE_HIGH`,`COMPARTMENT_PASSAGE_MIDDLE`,`COMPARTMENT_PASSAGE_LOW`,`COMPARTMENT_WALL`],this.middleBorderDockingElements=[`DRIVER_AREA`,`DRIVER_AREA_NO_VERTICAL_WALL`,`COACH_PASSAGE`,`COACH_WALL_NO_PASSAGE`],this._isRunningInitPreselectCoachIndex=!1,this._lastStartScrollPos=-1,this._prepareServiceIconsNavigation=e=>e&&e?.map(function(e){return{pId:e,svgName:P[e]?.svgName?P[e]?.svgName:``}}).filter(e=>ee.indexOf(e.svgName)!==-1).filter((e,t,n)=>n.map(e=>e.svgName).indexOf(e.svgName)===t).map(e=>e.pId).slice(0,3)||[],this.addEventListener(`blur`,()=>this._onLeaveSeatReservationComponent())}willUpdate(e){if(super.willUpdate(e),e.has(`seatReservations`)&&(this.hasMultipleDecks=this.seatReservations?.length>1,this._initPrepareSeatReservationData(),this._initSeatReservationPlaceSelection(),this.initNavigationSelectionByScrollEvent()),e.has(`baseGridSize`)&&(this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.style?.setProperty(`--sbb-seat-reservation-grid-size`,`${this.baseGridSize}px`),this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent()),e.has(`height`)&&this.height){let e=this.seatReservations[this.currSelectedDeckIndex]||null;e?.coachItems.length&&(this.baseGridSize=this.height/e.coachItems[0].dimension.h,this.coachBorderOffset=this.coachBorderPadding/this.baseGridSize,this.style?.setProperty(`--sbb-seat-reservation-grid-size`,`${this.baseGridSize}px`),this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent())}e.has(`alignVertical`)&&(this._initPrepareSeatReservationData(),this.initNavigationSelectionByScrollEvent()),e.has(`preselectCoachIndex`)&&(this._isRunningInitPreselectCoachIndex=!0,setTimeout(()=>this.scrollToSelectedNavCoach(this.preselectCoachIndex),1))}navigateByDirectionBtn(e){this.unfocusPlaceElement();let t=this.currSelectedCoachIndex;e==`DIRECTION_LEFT`&&t>0?t=this.currSelectedCoachIndex==-1?0:this.currSelectedCoachIndex-1:e==`DIRECTION_RIGHT`&&t<this.seatReservations[this.currSelectedDeckIndex]?.coachItems.length-1&&(t=this.currSelectedCoachIndex==-1?0:this.currSelectedCoachIndex+1),this.scrollToSelectedNavCoach(t)}_initPrepareSeatReservationData(){this._determineBaseFontSize(),this.hasMultipleDecks&&this._initEmptyCoachDeckOffsets(),this._prepareCoachItemDetailsData(),this._prepareSeatReservationStructureInformation(),this._prepareOptimizeAreaIconDimensionByMedian()}initNavigationSelectionByScrollEvent(){this.coachScrollArea=this.shadowRoot?.querySelector(`#sbb-sr__wrapper-scrollarea`),this.navigationScrollArea=this.shadowRoot?.querySelector(`#sbb-sr__navigation-list-coaches`);let e=this.seatReservations?this.seatReservations[this.currSelectedDeckIndex]:null;if(e&&e.coachItems.length>0){let t=e.coachItems[0].dimension.h*this.baseGridSize+this.coachBorderPadding,n=(this.seatReservations.length-1)*this.gapBetweenCoachDecks;this.style?.setProperty(`--sbb-seat-reservation-height`,`${t*this.seatReservations.length+n}`),this.style?.setProperty(`--sbb-seat-reservation-decks`,`${this.seatReservations.length}`)}if(this.navigationScrollArea){this.scrollNavigationAreaDim=this.alignVertical?this.navigationScrollArea.getBoundingClientRect().height:this.navigationScrollArea.getBoundingClientRect().width;let e=this.navigationScrollArea.querySelector(`ul > li`);if(e){let t=e?.getBoundingClientRect();this.coachNavButtonDim=this.alignVertical?t.height:t.width}}if(this.coachScrollArea&&e){let t=0;this.scrollCoachesAreaWidth=this.alignVertical?this.coachScrollArea.getBoundingClientRect().height:this.coachScrollArea.getBoundingClientRect().width,this.triggerCoachPositionsCollection=e.coachItems.map((e,n)=>{let r=this.seatReservationStructure.decks[this.currSelectedDeckIndex].deckCoaches[n],i=t;return t+=r.width+(r.hasOverhangingElements?2*this.gapBetweenCoaches:this.gapBetweenCoaches),{start:i,end:t,width:r.width}}),this.maxCalcCoachesWidth=t-this.gapBetweenCoaches}}coachAreaScrollend(){this._scrollTimeout&&clearTimeout(this._scrollTimeout),this._scrollTimeout=setTimeout(()=>this._handleCoachAreaScrollendEvent(),150)}onFocusTableCoachAndPreselectPlace(e){!this.seatReservationWithoutNavigationHasFocus&&!this.hasNavigation&&(this.seatReservationWithoutNavigationHasFocus=!0,this.currSelectedCoachIndex=e===0?this.getNextAvailableCoachIndex(-1):this.getPrevAvailableCoachIndex(e),this.preselectPlaceInCoach())}onFocusNavDirectionButton(){this.focusedCoachIndex=-1}onKeyNavigationNavCoachButton(e,t){if(e.key===this.keyboardNavigationEvents.Tab){this._handleTabKeyNavigation(e,`navigation`,t);return}s(e)&&this.keyboardSeatmapEventHandling(e)}_handleTabKeyNavigation(e,t,n){let r=e.key,i=e.shiftKey;r===this.keyboardNavigationEvents.Tab&&(t==`navigation`?(n==this.currSelectedCoachIndex?!this.currSelectedPlace||!i||this.coachItemDetailsElements[n].isDriverArea||this.focusedCoachIndex==-1?this.focusedCoachIndex=n:i&&this.currSelectedPlace&&(this.focusedCoachIndex=-1,this.focusPlaceElement(this.currSelectedPlace)):this.focusedCoachIndex=n,this._scrollToSelectedNavigationButton(n)):t==`seatmap`&&(e.preventDefault(),i?this._navigateCoachNavigationByKeyboard(`PREV_TAB`):this._navigateCoachNavigationByKeyboard(`NEXT_TAB`)))}keyboardSeatmapEventHandling(e){let t=e.key===this.keyboardNavigationEvents.Tab,n=e.shiftKey&&t;if(!this.hasNavigation&&this.currSelectedCoachIndex===0&&n||this.currSelectedCoachIndex===this.coachItemDetailsElements.length-1&&t)return;let r=e.key;if(this.preventCoachScrollByPlaceClick=!1,!this.hasSeatReservationNativeFocus&&(t||n)&&(this.hasSeatReservationNativeFocus=!0),t){this._handleTabKeyNavigation(e,`seatmap`);return}if(this.currSelectedCoachIndex!==-1&&s(e))switch(e.preventDefault(),r){case this.keyboardNavigationEvents.ArrowLeft:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowDown:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowRight:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowUp:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowUp:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowLeft:r;this._navigateToPlaceByKeyboard(e)}break;case this.keyboardNavigationEvents.ArrowDown:{let e=this.alignVertical?this.keyboardNavigationEvents.ArrowRight:r;this._navigateToPlaceByKeyboard(e)}break;default:break}}preselectPlaceInCoach(){if(this.isAutoScrolling){if(this._isRunningInitPreselectCoachIndex){this._isRunningInitPreselectCoachIndex=!1;return}if(this.coachItemDetailsElements[this.currSelectedCoachIndex]&&this.coachItemDetailsElements[this.currSelectedCoachIndex].isDriverArea){this._setFocusToSelectedCoachGrid();return}if(this.isKeyboardNavigation&&this.isAutoScrolling){let e=this._getClosestPlaceByKeyDirection();e?(this.unfocusPlaceElement(),this.focusPlaceElement(e),this.focusedCoachIndex=-1):this._setFocusToSelectedCoachGrid()}else this.unfocusPlaceElement(),this.isCoachGridFocusable=!0,this._setFocusToSelectedCoachGrid()}}scrollToSelectedNavCoach(e){if(this._isValidCoachIndex(e)&&e!==this.currSelectedCoachIndex){this.hoveredCoachIndex=e,this.isAutoScrolling=!0,this.isCoachGridFocusable=!0,this.currSelectedCoachIndex=e,this.currSelectedDeckIndex=this._getExistingCoachDeckIndex(),this._setScrollDirectionByCoachIndex();let t=this._getCoachScrollPositionX();(this.selectedCoachIndex!==-1||this.currSelectedCoachIndex>0)&&this._isScrollableToSelectedCoach()?(this._lastStartScrollPos=this.coachScrollArea.scrollLeft,this.coachScrollArea.scrollTo({top:this.alignVertical?t:0,left:this.alignVertical?0:t,behavior:`smooth`})):this.updateCurrentSelectedCoach(),this._scrollToSelectedNavigationButton(e)}}focusPlaceElement(e){if(this.unfocusPlaceElement(),e){this.currSelectedPlace=e,this._setCurrSelectedPlaceElementId(e);let t=this._getPlaceHtmlElement();if(t){t.setAttribute(`keyfocus`,`focus`);let n=setTimeout(()=>{let t=this.getPlaceElementId(this.currSelectedDeckIndex,this.currSelectedCoachIndex,e.number);this._scrollPlaceIntoNearestViewport(t),clearTimeout(n)},0)}}}unfocusPlaceElement(){let e=this._getPlaceHtmlElement();e&&(e.setAttribute(`keyfocus`,`unfocus`),this._setCurrSelectedPlaceElementId(null),this.currSelectedPlace=null)}getCalculatedDimension(e,t,n,r){return t&&!n&&(e.h+=this.coachBorderOffset*2),r&&(e.h+=this.coachBorderOffset),{w:Math.round(this.baseGridSize*e.w),h:Math.round(this.baseGridSize*e.h)}}getCalculatedPosition(e,t,n,r){if(n&&t){let i=r?n.h:n.h+this.coachBorderOffset;e.y===0?e.y-=this.coachBorderOffset:e.y+t.h===i&&(e.y+=this.coachBorderOffset)}return{x:Math.round(this.baseGridSize*e.x),y:Math.round(this.baseGridSize*e.y),z:e.z}}isElementDirectlyOnBorder(e,t){return e.position.y===0||e.position.y+e.dimension.h===t.h}getAvailableFreePlacesNumFromCoach(e){let t={seats:0,bicycles:0};return e?.reduce((e,t)=>(t.state===`FREE`&&(t.type===`SEAT`?e.seats++:e.bicycles++),e),t)||t}hasTravelDirection(){return this.travelDirection&&this.travelDirection!==`NONE`}_handleCoachAreaScrollendEvent(){let e=this.isAutoScrolling?this.currSelectedCoachIndex:this._getCoachIndexByScrollTriggerPosition();if(this.preventCoachScrollByPlaceClick){Math.abs(this._lastStartScrollPos-this.coachScrollArea.scrollLeft)>this.baseGridSize*2&&(this.selectedCoachIndex=e),this.preventCoachScrollByPlaceClick=!1;return}this._lastStartScrollPos=this.coachScrollArea.scrollLeft,this.hoveredCoachIndex=-1,this.currSelectedCoachIndex===-1&&(this.currSelectedCoachIndex=e),this._isScrollableToSelectedCoach()?this.currSelectedCoachIndex=e:this.currSelectedCoachIndex=e<this.currSelectedCoachIndex?this.currSelectedCoachIndex:e,this.isAutoScrolling||this._scrollToSelectedNavigationButton(e),this.preventCoachScrollByPlaceClick=!1,this.updateCurrentSelectedCoach(),this.hasNavigation||(this.preselectPlaceInCoach(),this.isAutoScrolling=!1)}_scrollToSelectedNavigationButton(e){setTimeout(()=>{if(this.hasNavigation&&this.navigationScrollArea){let t=this.scrollNavigationAreaDim/2,n=e*this.coachNavButtonDim-t+this.coachNavButtonDim;this.navigationScrollArea.scrollTo({top:this.alignVertical?n:0,left:this.alignVertical?0:n,behavior:`smooth`})}},10)}_setScrollDirectionByCoachIndex(){this.currScrollDirection=this.currSelectedCoachIndex>this.selectedCoachIndex?Z.right:Z.left}_getCoachScrollPositionX(){let e=this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];return this.isKeyboardNavigation&&this.currScrollDirection===Z.left&&e.width>this.scrollCoachesAreaWidth?e.end-this.scrollCoachesAreaWidth:e.start}_setFocusToSelectedCoachGrid(){if(this.isCoachGridFocusable&&this.hasSeatReservationNativeFocus){this.isCoachGridFocusable=!1;let e=this.shadowRoot?.querySelector(`#sbb-sr-coach-caption-`+this.currSelectedCoachIndex);e&&e.focus()}}_isScrollableToSelectedCoach(){let e=this.alignVertical?this.coachScrollArea.scrollTop:this.coachScrollArea.scrollLeft,t=this.alignVertical?this.coachScrollArea.getBoundingClientRect().height:this.coachScrollArea.getBoundingClientRect().width,n=this.maxCalcCoachesWidth-t,r=this.triggerCoachPositionsCollection[this.currSelectedCoachIndex],i=e===this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;return(e<n||e>r.start)&&!i}_getCoachIndexByScrollTriggerPosition(){let e=(this.alignVertical?this.coachScrollArea.scrollTop:this.coachScrollArea.scrollLeft)+this.scrollCoachesAreaWidth/2;return this.triggerCoachPositionsCollection.findIndex(t=>e>=t.start&&e<=t.end)}_getFirstPlaceInSelectedCoach(){let e=null,t=this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex],n=`cell-`+this.currSelectedDeckIndex+`-`+this.currSelectedCoachIndex+`-0-0`,r=this.shadowRoot?.querySelector(`#`+n)?.querySelector(`sbb-seat-reservation-place-control`)?.getAttribute(`text`)||null;return t&&r&&(e=t.places?.find(e=>e.number===r)||null),e}_getSwitchedCoachDeckIndexByKeyNavigation(e,t){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}_getClosestPlaceByKeyDirection(e){let t=this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex],n=null,r=t.places,i=null;if(r){if(!this.currSelectedPlaceElementId)return this._getFirstPlaceInSelectedCoach();if(this.currSelectedPlace){let a={...this.currSelectedPlace.position};e&&(i=this._getSwitchedCoachDeckIndexByKeyNavigation(e,t),i!==null&&(r=this.seatReservations[i].coachItems[this.currSelectedCoachIndex].places||[],a.y=i<this.currSelectedDeckIndex?t.dimension.h:-1));for(let t of r)e?t.number!==this.currSelectedPlace?.number&&(e===this.keyboardNavigationEvents.ArrowRight&&(t.position.y===a.y||t.position.y===a.y-1)&&t.position.x>a.x&&(!n||t.position.x<n.position.x)||e===this.keyboardNavigationEvents.ArrowDown&&(t.position.x===a.x||t.position.x===a.x+1)&&t.position.y>a.y&&(!n||t.position.y<n.position.y)||e===this.keyboardNavigationEvents.ArrowLeft&&(t.position.y===a.y||t.position.y===a.y+1)&&t.position.x<a.x&&(!n||t.position.x>n.position.x)||e===this.keyboardNavigationEvents.ArrowUp&&(t.position.x===a.x||t.position.x===a.x-1)&&t.position.y<a.y&&(!n||t.position.y>n.position.y))&&(n=t):(this.currScrollDirection===Z.right&&t.position.y===a.y&&(!n||t.position.x<n.position.x)||this.currScrollDirection===Z.left&&t.position.y===a.y&&(!n||t.position.x>n.position.x))&&(n=t);i!==null&&n&&(this.currSelectedDeckIndex=i)}}return n}_navigateCoachNavigationByKeyboard(e){let t=this.focusedCoachIndex===-1?this.currSelectedCoachIndex===-1?0:this.currSelectedCoachIndex:this.focusedCoachIndex,n=e===`NEXT_TAB`?this.getNextAvailableCoachIndex(t):this.getPrevAvailableCoachIndex(t);if(this.hasNavigation){let r=this._getPlaceHtmlElement(),i=r?r.getAttribute(`keyfocus`)===`focus`:!1;if(e===`PREV_TAB`&&this.selectedCoachIndex===t)if(i||this.currSelectedPlace!==null){this.focusedCoachIndex=t,this.unfocusPlaceElement();return}else t===0?this._refocusCurrentFocusedNavCoach(t):this.focusedCoachIndex=n;else n===this.currSelectedCoachIndex?e===`NEXT_TAB`&&n===this.coachItemDetailsElements.length-1?this._refocusCurrentFocusedNavCoach(t):(this.focusedCoachIndex=-1,this.selectedCoachIndex=n,i?this.focusPlaceElement(this.currSelectedPlace):(this.isCoachGridFocusable=!0,this._setFocusToSelectedCoachGrid())):this.focusedCoachIndex=n;this._scrollToSelectedNavigationButton(n)}else this.scrollToSelectedNavCoach(n)}_refocusCurrentFocusedNavCoach(e){this.focusedCoachIndex=-1,setTimeout(()=>this.focusedCoachIndex=e,0)}_navigateToPlaceByKeyboard(e){if(this.isKeyboardNavigation=!0,this.focusedCoachIndex!==-1&&(this.focusedCoachIndex=-1),!this.preventPlaceClick){let t=this._getClosestPlaceByKeyDirection(e);if(t)this.focusPlaceElement(t);else if(e===this.keyboardNavigationEvents.ArrowRight||e===this.keyboardNavigationEvents.ArrowLeft||this.alignVertical&&(e===this.keyboardNavigationEvents.ArrowUp||e===this.keyboardNavigationEvents.ArrowDown)){let t=e===this.keyboardNavigationEvents.ArrowRight?this.getNextAvailableCoachIndex():this.getPrevAvailableCoachIndex();this.scrollToSelectedNavCoach(t)}}}getNextAvailableCoachIndex(e){let t=e??this.currSelectedCoachIndex;return t<this.seatReservations[this.currSelectedDeckIndex].coachItems.length-1?t+1:t}getPrevAvailableCoachIndex(e){let t=e??this.currSelectedCoachIndex;return t>0?t-1:t}updateSelectedSeatReservationPlaces(e){let t=e.placeType===`SEAT`?`seats`:`bicycles`,n=e.placeType===`SEAT`?this.maxSeatReservations:this.maxBicycleReservations,r=this.selectedSeatReservationPlaces[t];this.selectedSeatReservationPlaces[t]=this._updateSelectedSeatReservationPlaces(r,n,e);let i=this.selectedSeatReservationPlaces;this.dispatchEvent(new te(i))}_updateSelectedSeatReservationPlaces(e,t,n){if(n.state===`SELECTED`){let t=this._getDeckIndexByPlaceId(n.id),r=this._getSeatReservationPlaceSelection(n,t);r&&e.push(r)}else e=e.filter(e=>e.id!==n.id);if(t>-1&&e.length>t){let r=t>0?n:void 0;e=this._resetAllPlaceSelections(e,r)}return e}updateCurrentSelectedPlaceInCoach(e){let t=this._getDeckIndexByPlaceId(e.id),n=e.coachIndex;if(t===null)return;let r=this.seatReservations[t].coachItems[n].places?.find(t=>t.number==e.number);if(!r)return;this.currSelectedDeckIndex=t,this.currSelectedCoachIndex=n,this.currSelectedPlace=r,this.currSelectedCoachIndex!==this.selectedCoachIndex&&this.updateCurrentSelectedCoach(),this._setCurrSelectedPlaceElementId(r);let i=setTimeout(()=>{this._scrollPlaceIntoNearestViewport(e.id),clearTimeout(i)},0)}updateCurrentSelectedCoach(){if(this.currSelectedCoachIndex==this.selectedCoachIndex)return;this.focusedCoachIndex!=-1&&(this.focusedCoachIndex=this.currSelectedCoachIndex),this.selectedCoachIndex=this.currSelectedCoachIndex;let e=this._getSeatReservationSelectedCoach(this.selectedCoachIndex);e&&this.dispatchEvent(new ne(e))}getPlaceElementId(e,t,n){return`seat-reservation__place-button-`+e+`-`+t+`-`+n}_initEmptyCoachDeckOffsets(){let e=Array(this.seatReservations.length-1).fill(0);this.seatReservations[this.seatReservations.length-1].coachItems.forEach(t=>{for(let n=0;n<this.seatReservations.length-1;n++){let r=this.seatReservations[n].coachItems[e[n]];if(t.id!=r?.id){let r={...t,places:void 0,propertyIds:void 0,graphicElements:void 0,serviceElements:void 0,travelClass:[]};this.seatReservations[n].coachItems.splice(e[n],0,r)}e[n]++}})}_initSeatReservationPlaceSelection(){this.selectedSeatReservationPlaces.seats=[],this.selectedSeatReservationPlaces.bicycles=[],this.seatReservations?.forEach((e,t)=>e.coachItems.map((n,r)=>{n.places?.filter(e=>e.state===`SELECTED`)?.forEach(n=>{let i=A(n,this.getPlaceElementId(t,r,n.number),e.deckCoachIndex,r),a=this._getSeatReservationPlaceSelection(i,t);a&&(a.placeType===`SEAT`?this.selectedSeatReservationPlaces.seats.push(a):this.selectedSeatReservationPlaces.bicycles.push(a))})}))}_resetAllPlaceSelections(e,t){for(let n of e)if(!t||t.id!==n.id){let e=this.shadowRoot?.getElementById(n.id);e&&e.setAttribute(`state`,`FREE`)}return e=t?e.filter(e=>e.id===t.id):[],e}_getSeatReservationPlaceSelection(e,t){if(t===null)return null;let n=this.seatReservations[t].coachItems[e.coachIndex],r=n.places?.find(t=>t.number===e.number);return r?j(r,n,e.id,e.deckIndex,e.coachIndex):null}_getSeatReservationSelectedCoach(e){if(!this.seatReservations[this.currSelectedDeckIndex].coachItems[e])return null;let t=this.seatReservations[this.currSelectedDeckIndex].coachItems[e];return M(e,t,this.getAvailableFreePlacesNumFromCoach(t.places))}_setCurrSelectedPlaceElementId(e){this.currSelectedPlaceElementId=e?this.getPlaceElementId(this.currSelectedDeckIndex,this.currSelectedCoachIndex,e.number):null}_determineBaseFontSize(){if(!f){let e=1/parseInt(window.getComputedStyle(document.body).fontSize,10);this.style?.setProperty(`--sbb-seat-reservation-one-px-rem`,`${e+`rem`}`)}}_prepareCoachItemDetailsData(){if(this.seatReservations){let e=this.seatReservations[this.seatReservations.length-1].coachItems;this.coachItemDetailsElements=[],e.forEach((e,t)=>{let n=[],r=[],i=[];this.seatReservations.map(e=>e.coachItems[t]).forEach(e=>{n.push(...e.travelClass),r.push(...e.propertyIds?e.propertyIds:[]),i.push(...e.places?e.places:[])}),this.coachItemDetailsElements.push({id:e.id,travelClass:this._prepareTravelClassNavigation(n),propertyIds:this._prepareServiceIconsNavigation(r),isDriverArea:!e.places||e.places.length===0,isLocomotive:this._isLocomotive(e),driverAreaSide:this._prepareDriverAreaSideNavigation(e),freePlaces:this.getAvailableFreePlacesNumFromCoach(i)})})}}_prepareOptimizeAreaIconDimensionByMedian(){if(this.seatReservations){let e=[];if(this.seatReservations.forEach(t=>t.coachItems.forEach(t=>t.serviceElements?.forEach(t=>e.push(t.dimension)))),e.length){e.sort((e,t)=>{if(e&&t){let n=e.w+e.h,r=t.w+t.h;return n>r?1:n<r?-1:0}return 0});let t=e[Math.floor(e.length/2)];this.globalAreaIconDim=this.getCalculatedDimension(t)}else{let e=this.seatReservations.flatMap(e=>e.coachItems.map(e=>e.dimension.h)).reduce((e,t)=>Math.max(e,t),0),t=Math.floor(e*.2);this.globalAreaIconDim=this.getCalculatedDimension({w:t,h:t})}}}_prepareTravelClassNavigation(e){return e.indexOf(`FIRST`)===-1?e.indexOf(`SECOND`)===-1?`ANY_CLASS`:`SECOND`:`FIRST`}_prepareDriverAreaSideNavigation(e){let t=e.graphicElements?.filter(e=>e.icon===`DRIVER_AREA`);if(t&&t.length>0){let e=t.find(e=>e.position.x===0)||!1,n=t.find(e=>e.position.x>0)||!1;return{left:!!e,right:!!n}}}_prepareSeatReservationStructureInformation(){this.seatReservations&&(this.seatReservationStructure={decks:[]},this.seatReservations.forEach((e,t)=>{let n={deckIndex:t,deckCoaches:[]};e?.coachItems?.forEach(e=>{let t=(e.graphicElements?.filter(e=>e.icon&&!this.notAreaElements.includes(e.icon)))?.concat(e.serviceElements||[]).concat(e.places||[])||[],r=this._isOverhangingElementsPresent(e.dimension.w,t),i=e.graphicElements?.filter(e=>!this.notAreaElements.includes(e.icon)).map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`AREA`)),a=e.graphicElements?.filter(e=>this.notAreaElements.includes(e.icon)).map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`OTHER`)),o=e.serviceElements?.map(t=>this._getCalculatedDimensionPositionElement(t,e.dimension,`SERVICE`)),s=this._getCalculatedMiddleBorderElement(e),c=this.getCalculatedDimension({...e.dimension}),l={width:c.w,height:c.h,otherElements:a||[],serviceElements:o||[],areaElements:i||[],borderMiddleElement:s,hasOverhangingElements:r};n.deckCoaches.push(l)}),this.seatReservationStructure.decks.push(n)}))}_getCalculatedMiddleBorderElement(e){let t=(e.dimension.h+this.coachBorderOffset*2)*this.baseGridSize,n=0,r=e.dimension.w;if(e.graphicElements){let t=this._getFirstLastDockingElements(e.graphicElements);if(t?.length==2){let i=t[0],a=t[1],o=i.position.x==0?a.dimension.w:i.dimension.w;n=i.position.x==0?i.dimension.w:a.dimension.w,r=e.dimension.w-o-n}else if(t?.length==1){let i=t[0];i.position.x===0?(n=i.dimension.w,r=e.dimension.w-i.dimension.w):i.position.x!==0&&(r=e.dimension.w-i.dimension.w)}}let i=this.coachBorderPadding*-1;return{position:{x:Math.floor(n*this.baseGridSize)-1,y:i,z:0},dimension:{w:Math.floor(r*this.baseGridSize)+2,h:t}}}_getFirstLastDockingElements(e){let t=(e.filter(e=>this.middleBorderDockingElements.includes(e.icon))||[]).sort((e,t)=>{let n=e.position.x,r=t.position.x;return n>r?1:n<r?-1:0});return t.filter((e,n)=>n==0||n==t.length-1)}_getCalculatedDimensionPositionElement(e,t,n){let r={...e.dimension},i={...e.position},a=e.rotation||0,o=this.notAreaElements.concat(this.notFixedRotatableAreaIcons).indexOf(e.icon)===-1,s=this.alignVertical&&o?a-90:a,c=null;if(n===`AREA`){let n=e.icon?.indexOf(`TABLE`)===-1,a=e.icon&&n?e.icon:null,o=this.isElementDirectlyOnBorder(e,t)&&a!==`ENTRY_EXIT`;e.position.y===0?(c=`upper-border`,i.y-=this.coachBorderOffset-this.coachBorderOffset/3):e.position.y+e.dimension.h===t.h&&(c=`lower-border`,o||(i.y+=this.coachBorderOffset-this.coachBorderOffset/3)),o&&(r.h+=this.coachBorderOffset-this.coachBorderOffset/3)}else n===`OTHER`&&(e.position.y===0&&(i.y-=this.coachBorderOffset),t.h===e.position.y+e.dimension.h&&(r.h+=this.coachBorderOffset*2));return r.w=Math.floor(r.w*this.baseGridSize),r.h=Math.floor(r.h*this.baseGridSize),i.x=Math.floor(i.x*this.baseGridSize),i.y=Math.floor(i.y*this.baseGridSize),{icon:e.icon&&e.icon.endsWith(`DRIVER_AREA`)?e.icon?.concat(`_`,this.seatReservations[this.currSelectedDeckIndex].vehicleType):e.icon,rotation:s,dimension:r,position:i,mounting:c}}_getPlaceHtmlElement(){return this.currSelectedPlaceElementId&&this.shadowRoot?.getElementById(this.currSelectedPlaceElementId)||null}_getDeckIndexByPlaceId(e){let t=this.shadowRoot?.querySelector(`#`+e)?.getAttribute(`data-deck-index`);return t&&!isNaN(+t)?+t:null}_isValidCoachIndex(e){return e>=0&&e<=this.seatReservations[this.seatReservations.length-1].coachItems.length}_getExistingCoachDeckIndex(){if(this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex].places!==void 0)return this.currSelectedDeckIndex;let e=this.seatReservations.findIndex(e=>e.coachItems[this.currSelectedCoachIndex].places!==void 0);return this.currSelectedDeckIndex>=e?this.currSelectedDeckIndex:e}_scrollPlaceIntoNearestViewport(e){this.shadowRoot?.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`nearest`})}_isOverhangingElementsPresent(e,t){return t?.some(t=>t.position.x===0||t.position.x+t.dimension.w>=e)??!1}_isLocomotive(e){return e?.graphicElements?.find(e=>e.icon===`DRIVER_AREA_NO_VERTICAL_WALL`)!==void 0}_onLeaveSeatReservationComponent(){this.hasNavigation&&(this.focusedCoachIndex=-1),this.unfocusPlaceElement()}}})();var $=`:host{--sbb-seat-reservation-grid-size:16px;--sbb-seat-reservation-height:0;--sbb-seat-reservation-decks:1;height:inherit;display:block}:host ::part(coach-floor){fill:var(--sbb-background-color-2)}@media (forced-colors:active){:host ::part(coach-floor){fill:#0000}}:host(:dir(rtl)) :not(.sbb-sr-place-ctrl--type-bicycle,.sbb-sr-place-ctrl--orientation-90,.sbb-sr-place-ctrl--orientation-270,.sbb-sr-place-ctrl--state-selected) ::part(coach-floor){rotate:180deg}.sbb-sr-popover{margin-block:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}:host([align-vertical]) .sbb-sr__component{justify-content:flex-end;gap:calc(22 * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:inherit;flex-direction:row-reverse}@media (width>=37.5rem){:host([align-vertical]) .sbb-sr__component{gap:calc(54 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}}:host([align-vertical]) .sbb-sr__component--has-travel-direction{padding-block-start:calc(36 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation,:host([align-vertical]) .sbb-sr__component ul.sbb-sr-navigation__list-coaches{flex-direction:column}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation{padding:calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) 0}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button{left:calc(1 * var(--sbb-seat-reservation-one-px-rem,.0625rem));top:0;rotate:90deg}@media (width>=64rem){:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation .sbb-sr__navigation-control-button{left:calc(-1 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches{max-width:initial;padding:calc(5 * var(--sbb-seat-reservation-one-px-rem,.0625rem));overflow:hidden scroll}:host([align-vertical]) .sbb-sr__component nav.sbb-sr-navigation ul.sbb-sr-navigation__list-coaches li{display:flex}:host([align-vertical]) .sbb-sr__wrapper-coach-decks{flex-direction:column}:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels{width:calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:initial;flex-direction:column-reverse}:host([align-vertical]) .sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b{inline-size:calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));block-size:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-bottom:calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));rotate:initial;writing-mode:initial}:host([align-vertical]) .sbb-sr__wrapper-scrollarea{width:calc((var(--sbb-seat-reservation-height) + 24) * var(--sbb-seat-reservation-one-px-rem,.0625rem));height:100%;overflow:hidden scroll}:host([align-vertical]) .sbb-sr__wrapper-scrollarea .sbb-sr__parent{rotate:90deg}:host([align-vertical]) .sbb-sr-travel-direction-wrapper{width:calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block-start:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));position:absolute}.sbb-sr-navigation{gap:calc(3 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr-navigation .sbb-sr__navigation-control-button{top:calc(2 * var(--sbb-seat-reservation-one-px-rem,.0625rem));position:relative}@media (width>=64rem){.sbb-sr-navigation .sbb-sr__navigation-control-button{top:0}}.sbb-sr__component{gap:calc(64 * var(--sbb-seat-reservation-one-px-rem,.0625rem) - 16px);flex-direction:column;display:flex}.sbb-sr-travel-direction-wrapper{justify-content:center;align-items:center;column-gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));font-size:var(--sbb-text-font-size-s);display:flex}.sbb-sr-travel-direction-wrapper .sbb-sr__travel-direction--arrow{align-items:center;display:flex}.sbb-sr-navigation-wrapper{display:flex}.sbb-sr-navigation{justify-content:center;width:100%;padding-inline:16px;display:flex}.sbb-sr-navigation__list-coaches{gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));padding:calc(6 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(5 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) 0;--sbb-scrollbar-color:transparent;flex-wrap:nowrap;max-width:856px;display:flex;position:relative;overflow:scroll hidden}.sbb-sr__wrapper-coach-decks{height:inherit;display:flex;overflow:hidden}.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels{height:calc(var(--sbb-seat-reservation-height) * var(--sbb-seat-reservation-one-px-rem,.0625rem));writing-mode:vertical-lr;justify-content:space-between;display:flex}.sbb-sr__wrapper-coach-decks .sbb-sr__wrapper-deck-labels b{height:calc(50% - 16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));width:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));text-align:center;line-height:calc(20 * var(--sbb-seat-reservation-one-px-rem,.0625rem));margin-block-end:16px;rotate:180deg}.sbb-sr__wrapper-scrollarea{padding-block:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem)) calc(16 * var(--sbb-seat-reservation-one-px-rem,.0625rem));overflow:scroll hidden}.sbb-sr__wrapper-scrollarea .sbb-sr__parent{flex-direction:column;display:flex;position:relative}.sbb-sr__list-decks{flex-direction:column;display:flex}.sbb-sr__list-decks--gap{gap:calc(48 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr__list-item-deck{position:relative}.sbb-sr__list-coaches{gap:calc(4 * var(--sbb-seat-reservation-one-px-rem,.0625rem));display:flex}.sbb-sr__list-decks:has(.sbb-sr-coach-has-overhanging-elements) .sbb-sr__list-coaches{gap:calc(8 * var(--sbb-seat-reservation-one-px-rem,.0625rem))}.sbb-sr__item-coach{position:relative}.sbb-sr-coach-wrapper__table{outline:0}
295
295
  `,re=class extends Q{constructor(){super(...arguments),this._language=new i(this)}static{this.elementName=`sbb-seat-reservation`}static{this.elementDependencies=[x,S,R,B,J,G,X]}static{this.styles=[c,u,l,m($)]}willUpdate(e){super.willUpdate(e),e.has(`hasNavigation`)&&(this.hasNavigation?this.shadowRoot?.querySelectorAll(`table`).forEach(e=>e.removeAttribute(`tabindex`)):this.shadowRoot?.querySelectorAll(`table`).forEach(e=>e.setAttribute(`tabindex`,`0`)))}firstUpdated(e){super.firstUpdated(e),this.updateComplete.then(()=>{this.initNavigationSelectionByScrollEvent()})}render(){return this._initVehicleSeatReservationConstruction(),this._coachesHtmlTemplate||null}_initVehicleSeatReservationConstruction(){this._coachesHtmlTemplate=d`
296
296
  ${this._renderTravelDirection()}
297
- <div class="sbb-sr__component">
297
+ <div
298
+ class="${y({"sbb-sr__component":!0,"sbb-sr__component--has-travel-direction":this.hasTravelDirection()})}"
299
+ >
298
300
  ${this._renderNavigation()}
299
301
  <div
300
302
  class="sbb-sr__wrapper-coach-decks"
@@ -335,7 +337,7 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{SbbButtonBase
335
337
  .disabledInteractive="${i||p}"
336
338
  .disabled="${i||p}"
337
339
  ></sbb-secondary-button>
338
- </div>`}_renderTravelDirection(){if(!this.travelDirection||this.travelDirection===`NONE`)return null;let e=I(`SEAT_RESERVATION_TRAVEL_DIRECTION`,this._language.current);return d`<div class="sbb-sr-travel-direction-wrapper">
340
+ </div>`}_renderTravelDirection(){if(!this.hasTravelDirection())return null;let e=I(`SEAT_RESERVATION_TRAVEL_DIRECTION`,this._language.current);return d`<div class="sbb-sr-travel-direction-wrapper">
339
341
  <div class="sbb-sr__travel-direction--arrow">
340
342
  <sbb-icon slot="icon" name="${`arrow-${this.alignVertical?this.travelDirection===`RIGHT`?`down`:`up`:this.travelDirection===`RIGHT`?`right`:`left`}-small`}"></sbb-icon>
341
343
  </div>