@sbb-esta/lyne-elements-experimental 3.0.0-next.1 → 3.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/core/datetime/date-helper.js +142 -142
  2. package/core/timetable/access-leg-helper.js +49 -52
  3. package/core/timetable/timetable-helper.js +7 -8
  4. package/development/core/datetime/date-helper.js +10 -10
  5. package/development/core/timetable/access-leg-helper.js +12 -15
  6. package/development/core/timetable/timetable-helper.js +6 -7
  7. package/development/{differenceInMinutes-CHSyWiQs.js → differenceInMinutes-D5Nj8Stc.js} +3 -3
  8. package/development/{format-D0-yhzi4.js → format-BQfaa1ZT.js} +22 -26
  9. package/development/{isValid-Bo4R7iA7.js → isValid-DvieCZVi.js} +3 -3
  10. package/development/journey-summary/journey-summary.component.js +4 -5
  11. package/development/pearl-chain/pearl-chain.component.d.ts.map +1 -1
  12. package/development/pearl-chain/pearl-chain.component.js +28 -39
  13. package/development/pearl-chain-time/pearl-chain-time.component.js +5 -6
  14. package/development/pearl-chain-vertical/pearl-chain-vertical.component.js +1 -1
  15. package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.js +1 -1
  16. package/development/seat-reservation/common/mapper/icon-mapper.js +1 -1
  17. package/development/seat-reservation/common/mapper/mapper.js +14 -16
  18. package/development/seat-reservation/common/mapper/seat-reservation-sample-data.js +1 -1
  19. package/development/seat-reservation/common/svgs.js +1 -1
  20. package/development/seat-reservation/common/translations/i18n.js +2 -3
  21. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.js +22 -33
  22. package/development/seat-reservation/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +6 -7
  23. package/development/seat-reservation/seat-reservation/seat-reservation.component.js +16 -23
  24. package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +1 -1
  25. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +2 -3
  26. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +7 -8
  27. package/development/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +7 -11
  28. package/development/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +2 -3
  29. package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +4 -5
  30. package/development/timetable-duration/timetable-duration.component.js +1 -1
  31. package/development/timetable-row/timetable-row.component.js +58 -89
  32. package/differenceInMinutes-CP_C5onR.js +23 -0
  33. package/{format-Dg8rkk7h.js → format-lqeCzmzS.js} +438 -442
  34. package/isValid-Ceq2O0NQ.js +45 -0
  35. package/journey-summary/journey-summary.component.js +3 -4
  36. package/package.json +2 -2
  37. package/pearl-chain/pearl-chain.component.d.ts.map +1 -1
  38. package/pearl-chain/pearl-chain.component.js +78 -95
  39. package/pearl-chain-time/pearl-chain-time.component.js +44 -45
  40. package/seat-reservation/common/mapper/mapper.js +50 -54
  41. package/seat-reservation/common/translations/i18n.js +5 -6
  42. package/seat-reservation/seat-reservation/seat-reservation-base-element.js +104 -115
  43. package/seat-reservation/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +40 -41
  44. package/seat-reservation/seat-reservation/seat-reservation.component.js +78 -87
  45. package/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +15 -18
  46. package/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +58 -59
  47. package/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +71 -75
  48. package/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +12 -13
  49. package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +23 -24
  50. package/timetable-row/timetable-row.component.js +207 -247
  51. package/differenceInMinutes-BMqUZdhj.js +0 -23
  52. package/isValid-DJ69OMZJ.js +0 -45
@@ -1,191 +1,191 @@
1
- import { i18nDurationDay as h, i18nDurationHour as T, i18nDurationMinute as p } from "@sbb-esta/lyne-elements/core/i18n.js";
2
- import { t as d, c as N, b as m, m as w } from "../../toDate-BCXKL_wM.js";
3
- import { n as I, d as y, i as U } from "../../isValid-DJ69OMZJ.js";
4
- import { g as C, a as Y, d as F } from "../../differenceInMinutes-BMqUZdhj.js";
5
- function x(t, e, n) {
6
- const r = d(t, n == null ? void 0 : n.in);
7
- return isNaN(e) ? N(t, NaN) : (e && r.setDate(r.getDate() + e), r);
8
- }
9
- function z(t, e, n) {
10
- return N(t, +d(t) + e);
11
- }
12
- function H(t, e, n) {
13
- return z(t, e * m);
14
- }
15
- function S(t, e, n) {
16
- const [r, i] = I(
17
- n == null ? void 0 : n.in,
18
- t,
19
- e
20
- ), s = M(r, i), u = Math.abs(
21
- y(r, i)
1
+ import { i18nDurationDay as N, i18nDurationHour as h, i18nDurationMinute as T } from "@sbb-esta/lyne-elements/core/i18n.js";
2
+ import { t as d, c as g, b as m, m as w } from "../../toDate-BCXKL_wM.js";
3
+ import { n as I, d as y, i as U } from "../../isValid-Ceq2O0NQ.js";
4
+ import { g as C, a as Y, d as F } from "../../differenceInMinutes-CP_C5onR.js";
5
+ function x(e, t, n) {
6
+ const i = d(e, n?.in);
7
+ return isNaN(t) ? g(e, NaN) : (t && i.setDate(i.getDate() + t), i);
8
+ }
9
+ function z(e, t, n) {
10
+ return g(e, +d(e) + t);
11
+ }
12
+ function H(e, t, n) {
13
+ return z(e, t * m);
14
+ }
15
+ function S(e, t, n) {
16
+ const [i, s] = I(
17
+ n?.in,
18
+ e,
19
+ t
20
+ ), r = M(i, s), a = Math.abs(
21
+ y(i, s)
22
22
  );
23
- r.setDate(r.getDate() - s * u);
24
- const a = +(M(r, i) === -s), c = s * (u - a);
25
- return c === 0 ? 0 : c;
23
+ i.setDate(i.getDate() - r * a);
24
+ const o = +(M(i, s) === -r), u = r * (a - o);
25
+ return u === 0 ? 0 : u;
26
26
  }
27
- function M(t, e) {
28
- const n = t.getFullYear() - e.getFullYear() || t.getMonth() - e.getMonth() || t.getDate() - e.getDate() || t.getHours() - e.getHours() || t.getMinutes() - e.getMinutes() || t.getSeconds() - e.getSeconds() || t.getMilliseconds() - e.getMilliseconds();
27
+ function M(e, t) {
28
+ const n = e.getFullYear() - t.getFullYear() || e.getMonth() - t.getMonth() || e.getDate() - t.getDate() || e.getHours() - t.getHours() || e.getMinutes() - t.getMinutes() || e.getSeconds() - t.getSeconds() || e.getMilliseconds() - t.getMilliseconds();
29
29
  return n < 0 ? -1 : n > 0 ? 1 : n;
30
30
  }
31
- function Z(t, e, n) {
32
- const [r, i] = I(
33
- n == null ? void 0 : n.in,
34
- t,
35
- e
36
- ), s = (+r - +i) / m;
37
- return C(n == null ? void 0 : n.roundingMethod)(s);
38
- }
39
- function v(t, e, n) {
40
- return x(t, -e, n);
41
- }
42
- function O(t, e) {
43
- const n = () => N(e == null ? void 0 : e.in, NaN), i = k(t);
44
- let s;
45
- if (i.date) {
46
- const o = W(i.date, 2);
47
- s = j(o.restDateString, o.year);
31
+ function Z(e, t, n) {
32
+ const [i, s] = I(
33
+ n?.in,
34
+ e,
35
+ t
36
+ ), r = (+i - +s) / m;
37
+ return C(n?.roundingMethod)(r);
38
+ }
39
+ function v(e, t, n) {
40
+ return x(e, -t, n);
41
+ }
42
+ function O(e, t) {
43
+ const n = () => g(t?.in, NaN), s = k(e);
44
+ let r;
45
+ if (s.date) {
46
+ const c = W(s.date, 2);
47
+ r = j(c.restDateString, c.year);
48
48
  }
49
- if (!s || isNaN(+s)) return n();
50
- const u = +s;
51
- let a = 0, c;
52
- if (i.time && (a = A(i.time), isNaN(a)))
49
+ if (!r || isNaN(+r)) return n();
50
+ const a = +r;
51
+ let o = 0, u;
52
+ if (s.time && (o = A(s.time), isNaN(o)))
53
53
  return n();
54
- if (i.timezone) {
55
- if (c = E(i.timezone), isNaN(c)) return n();
54
+ if (s.timezone) {
55
+ if (u = E(s.timezone), isNaN(u)) return n();
56
56
  } else {
57
- const o = new Date(u + a), D = d(0, e == null ? void 0 : e.in);
58
- return D.setFullYear(
59
- o.getUTCFullYear(),
60
- o.getUTCMonth(),
61
- o.getUTCDate()
62
- ), D.setHours(
63
- o.getUTCHours(),
64
- o.getUTCMinutes(),
65
- o.getUTCSeconds(),
66
- o.getUTCMilliseconds()
67
- ), D;
57
+ const c = new Date(a + o), p = d(0, t?.in);
58
+ return p.setFullYear(
59
+ c.getUTCFullYear(),
60
+ c.getUTCMonth(),
61
+ c.getUTCDate()
62
+ ), p.setHours(
63
+ c.getUTCHours(),
64
+ c.getUTCMinutes(),
65
+ c.getUTCSeconds(),
66
+ c.getUTCMilliseconds()
67
+ ), p;
68
68
  }
69
- return d(u + a + c, e == null ? void 0 : e.in);
69
+ return d(a + o + u, t?.in);
70
70
  }
71
71
  const l = {
72
72
  dateTimeDelimiter: /[T ]/,
73
73
  timeZoneDelimiter: /[Z ]/i,
74
74
  timezone: /([Z+-].*)$/
75
75
  }, _ = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, b = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, R = /^([+-])(\d{2})(?::?(\d{2}))?$/;
76
- function k(t) {
77
- const e = {}, n = t.split(l.dateTimeDelimiter);
78
- let r;
76
+ function k(e) {
77
+ const t = {}, n = e.split(l.dateTimeDelimiter);
78
+ let i;
79
79
  if (n.length > 2)
80
- return e;
81
- if (/:/.test(n[0]) ? r = n[0] : (e.date = n[0], r = n[1], l.timeZoneDelimiter.test(e.date) && (e.date = t.split(l.timeZoneDelimiter)[0], r = t.substr(
82
- e.date.length,
83
- t.length
84
- ))), r) {
85
- const i = l.timezone.exec(r);
86
- i ? (e.time = r.replace(i[1], ""), e.timezone = i[1]) : e.time = r;
80
+ return t;
81
+ if (/:/.test(n[0]) ? i = n[0] : (t.date = n[0], i = n[1], l.timeZoneDelimiter.test(t.date) && (t.date = e.split(l.timeZoneDelimiter)[0], i = e.substr(
82
+ t.date.length,
83
+ e.length
84
+ ))), i) {
85
+ const s = l.timezone.exec(i);
86
+ s ? (t.time = i.replace(s[1], ""), t.timezone = s[1]) : t.time = i;
87
87
  }
88
- return e;
88
+ return t;
89
89
  }
90
- function W(t, e) {
90
+ function W(e, t) {
91
91
  const n = new RegExp(
92
- "^(?:(\\d{4}|[+-]\\d{" + (4 + e) + "})|(\\d{2}|[+-]\\d{" + (2 + e) + "})$)"
93
- ), r = t.match(n);
94
- if (!r) return { year: NaN, restDateString: "" };
95
- const i = r[1] ? parseInt(r[1]) : null, s = r[2] ? parseInt(r[2]) : null;
92
+ "^(?:(\\d{4}|[+-]\\d{" + (4 + t) + "})|(\\d{2}|[+-]\\d{" + (2 + t) + "})$)"
93
+ ), i = e.match(n);
94
+ if (!i) return { year: NaN, restDateString: "" };
95
+ const s = i[1] ? parseInt(i[1]) : null, r = i[2] ? parseInt(i[2]) : null;
96
96
  return {
97
- year: s === null ? i : s * 100,
98
- restDateString: t.slice((r[1] || r[2]).length)
97
+ year: r === null ? s : r * 100,
98
+ restDateString: e.slice((i[1] || i[2]).length)
99
99
  };
100
100
  }
101
- function j(t, e) {
102
- if (e === null) return /* @__PURE__ */ new Date(NaN);
103
- const n = t.match(_);
101
+ function j(e, t) {
102
+ if (t === null) return /* @__PURE__ */ new Date(NaN);
103
+ const n = e.match(_);
104
104
  if (!n) return /* @__PURE__ */ new Date(NaN);
105
- const r = !!n[4], i = f(n[1]), s = f(n[2]) - 1, u = f(n[3]), a = f(n[4]), c = f(n[5]) - 1;
106
- if (r)
107
- return G(e, a, c) ? J(e, a, c) : /* @__PURE__ */ new Date(NaN);
105
+ const i = !!n[4], s = f(n[1]), r = f(n[2]) - 1, a = f(n[3]), o = f(n[4]), u = f(n[5]) - 1;
106
+ if (i)
107
+ return G(t, o, u) ? J(t, o, u) : /* @__PURE__ */ new Date(NaN);
108
108
  {
109
- const o = /* @__PURE__ */ new Date(0);
110
- return !q(e, s, u) || !B(e, i) ? /* @__PURE__ */ new Date(NaN) : (o.setUTCFullYear(e, s, Math.max(i, u)), o);
109
+ const c = /* @__PURE__ */ new Date(0);
110
+ return !q(t, r, a) || !B(t, s) ? /* @__PURE__ */ new Date(NaN) : (c.setUTCFullYear(t, r, Math.max(s, a)), c);
111
111
  }
112
112
  }
113
- function f(t) {
114
- return t ? parseInt(t) : 1;
113
+ function f(e) {
114
+ return e ? parseInt(e) : 1;
115
115
  }
116
- function A(t) {
117
- const e = t.match(b);
118
- if (!e) return NaN;
119
- const n = g(e[1]), r = g(e[2]), i = g(e[3]);
120
- return K(n, r, i) ? n * m + r * w + i * 1e3 : NaN;
116
+ function A(e) {
117
+ const t = e.match(b);
118
+ if (!t) return NaN;
119
+ const n = D(t[1]), i = D(t[2]), s = D(t[3]);
120
+ return K(n, i, s) ? n * m + i * w + s * 1e3 : NaN;
121
121
  }
122
- function g(t) {
123
- return t && parseFloat(t.replace(",", ".")) || 0;
122
+ function D(e) {
123
+ return e && parseFloat(e.replace(",", ".")) || 0;
124
124
  }
125
- function E(t) {
126
- if (t === "Z") return 0;
127
- const e = t.match(R);
128
- if (!e) return 0;
129
- const n = e[1] === "+" ? -1 : 1, r = parseInt(e[2]), i = e[3] && parseInt(e[3]) || 0;
130
- return P(r, i) ? n * (r * m + i * w) : NaN;
125
+ function E(e) {
126
+ if (e === "Z") return 0;
127
+ const t = e.match(R);
128
+ if (!t) return 0;
129
+ const n = t[1] === "+" ? -1 : 1, i = parseInt(t[2]), s = t[3] && parseInt(t[3]) || 0;
130
+ return P(i, s) ? n * (i * m + s * w) : NaN;
131
131
  }
132
- function J(t, e, n) {
133
- const r = /* @__PURE__ */ new Date(0);
134
- r.setUTCFullYear(t, 0, 4);
135
- const i = r.getUTCDay() || 7, s = (e - 1) * 7 + n + 1 - i;
136
- return r.setUTCDate(r.getUTCDate() + s), r;
132
+ function J(e, t, n) {
133
+ const i = /* @__PURE__ */ new Date(0);
134
+ i.setUTCFullYear(e, 0, 4);
135
+ const s = i.getUTCDay() || 7, r = (t - 1) * 7 + n + 1 - s;
136
+ return i.setUTCDate(i.getUTCDate() + r), i;
137
137
  }
138
138
  const V = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
139
- function $(t) {
140
- return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
139
+ function $(e) {
140
+ return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
141
141
  }
142
- function q(t, e, n) {
143
- return e >= 0 && e <= 11 && n >= 1 && n <= (V[e] || ($(t) ? 29 : 28));
142
+ function q(e, t, n) {
143
+ return t >= 0 && t <= 11 && n >= 1 && n <= (V[t] || ($(e) ? 29 : 28));
144
144
  }
145
- function B(t, e) {
146
- return e >= 1 && e <= ($(t) ? 366 : 365);
145
+ function B(e, t) {
146
+ return t >= 1 && t <= ($(e) ? 366 : 365);
147
147
  }
148
- function G(t, e, n) {
149
- return e >= 1 && e <= 53 && n >= 0 && n <= 6;
148
+ function G(e, t, n) {
149
+ return t >= 1 && t <= 53 && n >= 0 && n <= 6;
150
150
  }
151
- function K(t, e, n) {
152
- return t === 24 ? e === 0 && n === 0 : n >= 0 && n < 60 && e >= 0 && e < 60 && t >= 0 && t < 25;
151
+ function K(e, t, n) {
152
+ return e === 24 ? t === 0 && n === 0 : n >= 0 && n < 60 && t >= 0 && t < 60 && e >= 0 && e < 25;
153
153
  }
154
- function P(t, e) {
155
- return e >= 0 && e <= 59;
154
+ function P(e, t) {
155
+ return t >= 0 && t <= 59;
156
156
  }
157
- function Q(t, e, n) {
158
- return H(t, -e);
157
+ function Q(e, t, n) {
158
+ return H(e, -t);
159
159
  }
160
- function ne(t) {
161
- if (!t)
160
+ function nt(e) {
161
+ if (!e)
162
162
  return;
163
- const e = O(t);
164
- if (U(e)) {
165
- if (t.includes("Z"))
166
- return new Date(t.replace("Z", ""));
167
- if (t.includes("T")) {
168
- const n = t.split("T");
163
+ const t = O(e);
164
+ if (U(t)) {
165
+ if (e.includes("Z"))
166
+ return new Date(e.replace("Z", ""));
167
+ if (e.includes("T")) {
168
+ const n = e.split("T");
169
169
  if (n[1] && (n[1].includes("+") || n[1].includes("-")))
170
170
  return /* @__PURE__ */ new Date(`${n[0]}T${n[1].split(/[+-]/)[0]}`);
171
171
  }
172
- return new Date(t);
172
+ return new Date(e);
173
173
  }
174
174
  }
175
- const re = (t, e) => {
176
- const n = [], r = [];
177
- let s = Y(0, t);
178
- const u = S(s, 0);
179
- u > 0 && (n.push(`${u} d`), e && r.push(`${u} ${u > 1 ? h.multiple.long[e] : h.single.long[e]}`), s = v(s, u));
180
- const a = Z(s, 0);
181
- a > 0 && (n.push(`${a} h`), e && r.push(`${a} ${a > 1 ? T.multiple.long[e] : T.single.long[e]}`), s = Q(s, a));
182
- const c = F(s, 0);
183
- return c > 0 && (n.push(`${c} min`), e && r.push(`${c} ${c > 1 ? p.multiple.long[e] : p.single.long[e]}`)), {
175
+ const it = (e, t) => {
176
+ const n = [], i = [];
177
+ let r = Y(0, e);
178
+ const a = S(r, 0);
179
+ a > 0 && (n.push(`${a} d`), t && i.push(`${a} ${a > 1 ? N.multiple.long[t] : N.single.long[t]}`), r = v(r, a));
180
+ const o = Z(r, 0);
181
+ o > 0 && (n.push(`${o} h`), t && i.push(`${o} ${o > 1 ? h.multiple.long[t] : h.single.long[t]}`), r = Q(r, o));
182
+ const u = F(r, 0);
183
+ return u > 0 && (n.push(`${u} min`), t && i.push(`${u} ${u > 1 ? T.multiple.long[t] : T.single.long[t]}`)), {
184
184
  short: n.join(" "),
185
- long: r.join(" ")
185
+ long: i.join(" ")
186
186
  };
187
187
  };
188
188
  export {
189
- re as durationToTime,
190
- ne as removeTimezoneFromISOTimeString
189
+ it as durationToTime,
190
+ nt as removeTimezoneFromISOTimeString
191
191
  };
@@ -1,42 +1,39 @@
1
- import { i18nWalkingDistanceDeparture as _, i18nWalkingDistanceArrival as A } from "@sbb-esta/lyne-elements/core/i18n.js";
2
- import { nothing as b, html as f } from "lit";
3
- import { isRideLeg as h, isConnectionLeg as w, extractTimeAndStringFromNoticeText as C } from "./timetable-helper.js";
1
+ import { i18nWalkingDistanceDeparture as T, i18nWalkingDistanceArrival as h } from "@sbb-esta/lyne-elements/core/i18n.js";
2
+ import { nothing as u, html as f } from "lit";
3
+ import { isRideLeg as $, isConnectionLeg as L, extractTimeAndStringFromNoticeText as k } from "./timetable-helper.js";
4
4
  import "@sbb-esta/lyne-elements/icon.js";
5
- function T(t, a) {
6
- var e, r;
7
- const n = w(t) ? t : null, i = n ? (e = n == null ? void 0 : n.notices) == null ? void 0 : e.filter((c) => a.includes(c.name))[0] : null;
8
- return i ? {
9
- duration: (n == null ? void 0 : n.duration) || 0,
10
- text: ((r = i == null ? void 0 : i.text) == null ? void 0 : r.template) || "",
5
+ function g(t, r) {
6
+ const i = L(t) ? t : null, n = i ? i?.notices?.filter((e) => r.includes(e.name))[0] : null;
7
+ return n ? {
8
+ duration: i?.duration || 0,
9
+ text: n?.text?.template || "",
11
10
  icon: "walk-small"
12
11
  } : null;
13
12
  }
14
- function R(t, a, n, i) {
15
- var c, l, s;
16
- const e = h(t) ? (l = (c = t == null ? void 0 : t.serviceJourney) == null ? void 0 : c.notices) == null ? void 0 : l.filter((u) => ["CI"].includes(u.name))[0] : null, r = e && C(e);
13
+ function M(t, r, i, n) {
14
+ const e = $(t) ? t?.serviceJourney?.notices?.filter((m) => ["CI"].includes(m.name))[0] : null, c = e && k(e);
17
15
  return e ? {
18
- duration: ((r == null ? void 0 : r.duration) || 0) + (a || 0),
19
- text: n ? _[i] : (r == null ? void 0 : r.text) || "",
20
- icon: n ? "wheelchair-small" : `sa-${(s = e == null ? void 0 : e.name) == null ? void 0 : s.toLowerCase()}`
16
+ duration: (c?.duration || 0) + (r || 0),
17
+ text: i ? T[n] : c?.text || "",
18
+ icon: i ? "wheelchair-small" : `sa-${e?.name?.toLowerCase()}`
21
19
  } : null;
22
20
  }
23
- function E(t, a, n, i) {
24
- var c, l, s;
25
- const e = h(t) ? (l = (c = t == null ? void 0 : t.serviceJourney) == null ? void 0 : c.notices) == null ? void 0 : l.filter((u) => ["CO"].includes(u.name))[0] : null, r = e && C(e);
21
+ function N(t, r, i, n) {
22
+ const e = $(t) ? t?.serviceJourney?.notices?.filter((m) => ["CO"].includes(m.name))[0] : null, c = e && k(e);
26
23
  return e ? {
27
- duration: ((r == null ? void 0 : r.duration) || 0) + (a || 0),
28
- text: n ? A[i] : (r == null ? void 0 : r.text) || "",
29
- icon: n ? "wheelchair-small" : `sa-${(s = e == null ? void 0 : e.name) == null ? void 0 : s.toLowerCase()}`
24
+ duration: (c?.duration || 0) + (r || 0),
25
+ text: i ? h[n] : c?.text || "",
26
+ icon: i ? "wheelchair-small" : `sa-${e?.name?.toLowerCase()}`
30
27
  } : null;
31
28
  }
32
- function v(t, a, n, i, e) {
29
+ function _(t, r, i, n, e) {
33
30
  return f`
34
- <span class="sbb-pearl-chain__time-transfer sbb-pearl-chain__time-transfer--${a}-${e}">
35
- <sbb-icon name=${a}></sbb-icon>
31
+ <span class="sbb-pearl-chain__time-transfer sbb-pearl-chain__time-transfer--${r}-${e}">
32
+ <sbb-icon name=${r}></sbb-icon>
36
33
  <time datetime=${t + "M"}>
37
34
  <span class="sbb-screen-reader-only">
38
- ${!i && e ? e === "departure" ? _[n] : A[n] : b}
39
- ${i ? f`<span>${i}</span>` : b}&nbsp;
35
+ ${!n && e ? e === "departure" ? T[i] : h[i] : u}
36
+ ${n ? f`<span>${n}</span>` : u}&nbsp;
40
37
  </span>
41
38
  ${t}
42
39
  <span class="sbb-pearl-chain__time-walktime-prime-symbol" aria-hidden="true">'</span>
@@ -45,50 +42,50 @@ function v(t, a, n, i, e) {
45
42
  </span>
46
43
  `;
47
44
  }
48
- function p(t, a, n, i) {
45
+ function p(t, r, i, n) {
49
46
  return f`
50
- <span class="sbb-pearl-chain__time-walktime sbb-pearl-chain__time-walktime--${i}-${n}">
51
- <sbb-icon name=${i}></sbb-icon>
47
+ <span class="sbb-pearl-chain__time-walktime sbb-pearl-chain__time-walktime--${n}-${i}">
48
+ <sbb-icon name=${n}></sbb-icon>
52
49
  <time datetime=${t + "M"}>
53
- <span class="sbb-screen-reader-only">${a}</span>
50
+ <span class="sbb-screen-reader-only">${r}</span>
54
51
  ${t}
55
52
  <span class="sbb-pearl-chain__time-walktime-prime-symbol" aria-hidden="true">'</span>
56
53
  </time>
57
54
  </span>
58
55
  `;
59
56
  }
60
- function O(t, a, n, i, e) {
61
- const r = t && t.filter((k) => h(k) || w(k))[0], c = ["YM", "YB", "Y", "YT"], l = T(r, c), s = R(r, a, e, i), u = a ? {
62
- text: _[i],
63
- duration: a,
57
+ function B(t, r, i, n, e) {
58
+ const c = t && t.filter((w) => $(w) || L(w))[0], m = ["YM", "YB", "Y", "YT"], o = g(c, m), s = M(c, r, e, n), d = r ? {
59
+ text: T[n],
60
+ duration: r,
64
61
  icon: e ? "wheelchair-small" : "walk-small"
65
- } : null, D = () => l || (u && !s && !l ? u : s || null);
66
- function L() {
62
+ } : null, v = () => o || (d && !s && !o ? d : s || null);
63
+ function C() {
67
64
  return f`
68
- ${l ? p(l.duration, l.text, "left", l.icon) : b}
69
- ${u && !s && !l ? p(u.duration, u.text, "left", u.icon) : b}
70
- ${s ? e ? p(s.duration, s.text, "left", s.icon) : v(s.duration, s.icon, i, s.text, "departure") : b}
65
+ ${o ? p(o.duration, o.text, "left", o.icon) : u}
66
+ ${d && !s && !o ? p(d.duration, d.text, "left", d.icon) : u}
67
+ ${s ? e ? p(s.duration, s.text, "left", s.icon) : _(s.duration, s.icon, n, s.text, "departure") : u}
71
68
  `;
72
69
  }
73
- const x = t && t[t.length - 1], $ = (w(x) || h(x)) && x, m = $ && T($, c), o = $ && E($, n, e, i), d = n ? {
74
- text: A[i],
75
- duration: n,
70
+ const A = t && t[t.length - 1], x = (L(A) || $(A)) && A, l = x && g(x, m), a = x && N(x, i, e, n), b = i ? {
71
+ text: h[n],
72
+ duration: i,
76
73
  icon: e ? "wheelchair-small" : "walk-small"
77
- } : null, Y = () => m || (d && !o && !m ? d : o || null);
78
- function M() {
74
+ } : null, D = () => l || (b && !a && !l ? b : a || null);
75
+ function Y() {
79
76
  return f`
80
- ${m ? p(m.duration, m.text, "right", m.icon) : b}
81
- ${d && !o && !m ? p(d.duration, d.text, "right", d.icon) : b}
82
- ${o ? e ? p(o.duration, o.text, "right", o.icon) : v(o.duration, o.icon, i, o.text, "arrival") : b}
77
+ ${l ? p(l.duration, l.text, "right", l.icon) : u}
78
+ ${b && !a && !l ? p(b.duration, b.text, "right", b.icon) : u}
79
+ ${a ? e ? p(a.duration, a.text, "right", a.icon) : _(a.duration, a.icon, n, a.text, "arrival") : u}
83
80
  `;
84
81
  }
85
82
  return {
86
- renderDepartureTimeAttribute: L,
87
- renderArrivalTimeAttribute: M,
88
- departureTimeAttribute: D(),
89
- arrivalTimeAttribute: Y()
83
+ renderDepartureTimeAttribute: C,
84
+ renderArrivalTimeAttribute: Y,
85
+ departureTimeAttribute: v(),
86
+ arrivalTimeAttribute: D()
90
87
  };
91
88
  }
92
89
  export {
93
- O as getDepartureArrivalTimeAttribute
90
+ B as getDepartureArrivalTimeAttribute
94
91
  };
@@ -1,13 +1,12 @@
1
- const n = (t) => (t == null ? void 0 : t.__typename) === "PTRideLeg", u = (t) => (t == null ? void 0 : t.__typename) === "PTConnectionLeg", L = (t) => {
2
- var e, s, x, a, m, p;
3
- const d = ((e = t == null ? void 0 : t.text) == null ? void 0 : e.template) && t.text.template.indexOf("(") + 1, r = (a = (s = t == null ? void 0 : t.text) == null ? void 0 : s.template) == null ? void 0 : a.substring(d || 0, (x = t == null ? void 0 : t.text) == null ? void 0 : x.template.indexOf(")"));
1
+ const r = (t) => t?.__typename === "PTRideLeg", i = (t) => t?.__typename === "PTConnectionLeg", s = (t) => {
2
+ const n = t?.text?.template && t.text.template.indexOf("(") + 1, e = t?.text?.template?.substring(n || 0, t?.text?.template.indexOf(")"));
4
3
  return {
5
- duration: r && +r.substring(0, r.length - 1) || 0,
6
- text: ((p = (m = t == null ? void 0 : t.text) == null ? void 0 : m.template) == null ? void 0 : p.split("(")[0]) || ""
4
+ duration: e && +e.substring(0, e.length - 1) || 0,
5
+ text: t?.text?.template?.split("(")[0] || ""
7
6
  };
8
7
  };
9
8
  export {
10
- L as extractTimeAndStringFromNoticeText,
11
- u as isConnectionLeg,
12
- n as isRideLeg
9
+ s as extractTimeAndStringFromNoticeText,
10
+ i as isConnectionLeg,
11
+ r as isRideLeg
13
12
  };