kaafil-react-uikit 0.1.0-beta.1

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 (79) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/LICENSE +21 -0
  3. package/README.md +187 -0
  4. package/dist/OfflineFallbackScreen-B5dfaJBN.d.ts +37 -0
  5. package/dist/OfflineFallbackScreen-Ctm7nBa-.d.cts +37 -0
  6. package/dist/SessionExpiredScreen-CytQNuak.d.cts +50 -0
  7. package/dist/SessionExpiredScreen-D8GHyZc3.d.ts +50 -0
  8. package/dist/admin/index.cjs +23779 -0
  9. package/dist/admin/index.cjs.map +1 -0
  10. package/dist/admin/index.d.cts +1157 -0
  11. package/dist/admin/index.d.ts +1157 -0
  12. package/dist/admin/index.js +23724 -0
  13. package/dist/admin/index.js.map +1 -0
  14. package/dist/chunk-6FPAGGFL.js +6028 -0
  15. package/dist/chunk-6FPAGGFL.js.map +1 -0
  16. package/dist/chunk-ACVU55PZ.cjs +294 -0
  17. package/dist/chunk-ACVU55PZ.cjs.map +1 -0
  18. package/dist/chunk-EM7JV3D7.cjs +6051 -0
  19. package/dist/chunk-EM7JV3D7.cjs.map +1 -0
  20. package/dist/chunk-IIPQ4JNC.js +287 -0
  21. package/dist/chunk-IIPQ4JNC.js.map +1 -0
  22. package/dist/chunk-LL243STJ.cjs +2195 -0
  23. package/dist/chunk-LL243STJ.cjs.map +1 -0
  24. package/dist/chunk-PJRZCOFF.cjs +958 -0
  25. package/dist/chunk-PJRZCOFF.cjs.map +1 -0
  26. package/dist/chunk-PTQ2CJKE.cjs +40 -0
  27. package/dist/chunk-PTQ2CJKE.cjs.map +1 -0
  28. package/dist/chunk-PZKXLQSU.js +10 -0
  29. package/dist/chunk-PZKXLQSU.js.map +1 -0
  30. package/dist/chunk-QHUDOVKW.cjs +111 -0
  31. package/dist/chunk-QHUDOVKW.cjs.map +1 -0
  32. package/dist/chunk-TOBZFADB.cjs +12 -0
  33. package/dist/chunk-TOBZFADB.cjs.map +1 -0
  34. package/dist/chunk-UUGMNP27.js +936 -0
  35. package/dist/chunk-UUGMNP27.js.map +1 -0
  36. package/dist/chunk-UYJ6LIWP.js +2154 -0
  37. package/dist/chunk-UYJ6LIWP.js.map +1 -0
  38. package/dist/chunk-VHTSTUCJ.cjs +346 -0
  39. package/dist/chunk-VHTSTUCJ.cjs.map +1 -0
  40. package/dist/chunk-WUAFL77X.js +340 -0
  41. package/dist/chunk-WUAFL77X.js.map +1 -0
  42. package/dist/chunk-XI7MK4Y7.js +38 -0
  43. package/dist/chunk-XI7MK4Y7.js.map +1 -0
  44. package/dist/chunk-YDGR7JSY.js +107 -0
  45. package/dist/chunk-YDGR7JSY.js.map +1 -0
  46. package/dist/core/index.cjs +1254 -0
  47. package/dist/core/index.cjs.map +1 -0
  48. package/dist/core/index.d.cts +1267 -0
  49. package/dist/core/index.d.ts +1267 -0
  50. package/dist/core/index.js +995 -0
  51. package/dist/core/index.js.map +1 -0
  52. package/dist/index.css +1 -0
  53. package/dist/manager/index.cjs +13562 -0
  54. package/dist/manager/index.cjs.map +1 -0
  55. package/dist/manager/index.d.cts +1054 -0
  56. package/dist/manager/index.d.ts +1054 -0
  57. package/dist/manager/index.js +13518 -0
  58. package/dist/manager/index.js.map +1 -0
  59. package/dist/testing/index.cjs +221 -0
  60. package/dist/testing/index.cjs.map +1 -0
  61. package/dist/testing/index.d.cts +269 -0
  62. package/dist/testing/index.d.ts +269 -0
  63. package/dist/testing/index.js +208 -0
  64. package/dist/testing/index.js.map +1 -0
  65. package/dist/tokenStyle-CToG5oOS.d.cts +3 -0
  66. package/dist/tokenStyle-CToG5oOS.d.ts +3 -0
  67. package/dist/traveller/index.cjs +1799 -0
  68. package/dist/traveller/index.cjs.map +1 -0
  69. package/dist/traveller/index.d.cts +58 -0
  70. package/dist/traveller/index.d.ts +58 -0
  71. package/dist/traveller/index.js +1789 -0
  72. package/dist/traveller/index.js.map +1 -0
  73. package/dist/useAgencyTrip-BUYSIaC2.d.cts +454 -0
  74. package/dist/useAgencyTrip-BzyJB1D9.d.ts +454 -0
  75. package/dist/useNotifications-BZW1Z_ur.d.cts +356 -0
  76. package/dist/useNotifications-D262i5BQ.d.ts +356 -0
  77. package/dist/useVendors-DXOuZWhZ.d.cts +784 -0
  78. package/dist/useVendors-DXOuZWhZ.d.ts +784 -0
  79. package/package.json +95 -0
@@ -0,0 +1,1799 @@
1
+ 'use strict';
2
+
3
+ var chunkVHTSTUCJ_cjs = require('../chunk-VHTSTUCJ.cjs');
4
+ require('../chunk-TOBZFADB.cjs');
5
+ require('../chunk-PTQ2CJKE.cjs');
6
+ var chunkACVU55PZ_cjs = require('../chunk-ACVU55PZ.cjs');
7
+ var chunkEM7JV3D7_cjs = require('../chunk-EM7JV3D7.cjs');
8
+ var react = require('react');
9
+ var jsxRuntime = require('react/jsx-runtime');
10
+
11
+ // src/traveller/KaafilShareView/internal/formatShareDate.ts
12
+ var WEEKDAY_FORMAT_CACHE = /* @__PURE__ */ new Map();
13
+ var DAY_MONTH_FORMAT_CACHE = /* @__PURE__ */ new Map();
14
+ var TIME_FORMAT_CACHE = /* @__PURE__ */ new Map();
15
+ function cachedFormatter(cache, timezone, options) {
16
+ const existing = cache.get(timezone);
17
+ if (existing !== void 0) {
18
+ return existing;
19
+ }
20
+ const created = new Intl.DateTimeFormat("en-GB", { ...options, timeZone: timezone });
21
+ cache.set(timezone, created);
22
+ return created;
23
+ }
24
+ function formatWeekdayShort(isoDate, timezone) {
25
+ const formatter = cachedFormatter(WEEKDAY_FORMAT_CACHE, timezone, { weekday: "short" });
26
+ return formatter.format(new Date(isoDate)).toUpperCase();
27
+ }
28
+ function formatDayMonth(isoDate, timezone) {
29
+ const formatter = cachedFormatter(DAY_MONTH_FORMAT_CACHE, timezone, {
30
+ day: "numeric",
31
+ month: "short"
32
+ });
33
+ return formatter.format(new Date(isoDate)).toUpperCase();
34
+ }
35
+ function formatWeekdayDay(isoDate, timezone) {
36
+ return `${formatWeekdayShort(isoDate, timezone)} ${new Intl.DateTimeFormat("en-GB", { day: "numeric", timeZone: timezone }).format(new Date(isoDate))}`;
37
+ }
38
+ function formatTimeOfDay(isoDateTime, timezone) {
39
+ const formatter = cachedFormatter(TIME_FORMAT_CACHE, timezone, {
40
+ hour: "2-digit",
41
+ minute: "2-digit",
42
+ hour12: false
43
+ });
44
+ return formatter.format(new Date(isoDateTime));
45
+ }
46
+ function wholeDaysBetween(fromIso, toIso, timezone) {
47
+ const dayKeyFormatter = new Intl.DateTimeFormat("en-CA", { timeZone: timezone });
48
+ const fromKey = dayKeyFormatter.format(new Date(fromIso));
49
+ const toKey = dayKeyFormatter.format(new Date(toIso));
50
+ const fromUtc = Date.parse(`${fromKey}T00:00:00Z`);
51
+ const toUtc = Date.parse(`${toKey}T00:00:00Z`);
52
+ const diffDays = Math.round((toUtc - fromUtc) / (24 * 60 * 60 * 1e3));
53
+ return diffDays > 0 ? diffDays : 0;
54
+ }
55
+
56
+ // src/traveller/KaafilShareView/internal/deriveTripStatus.ts
57
+ var PHASE_LABEL_KEY = {
58
+ PRE_DEPARTURE: "chrome.shareView.trip.phase.preDeparture",
59
+ ON_TRIP: "chrome.shareView.trip.phase.onTrip",
60
+ POST_TRIP: "chrome.shareView.trip.phase.postTrip"
61
+ };
62
+ function deriveTripStatus(trip, itinerary, serverTime, t) {
63
+ const totalDays = itinerary?.days.length ?? wholeDaysBetween(trip.startDate, trip.endDate, trip.timezone) + 1;
64
+ const todayDay = itinerary?.days.find((day) => day.isToday);
65
+ const currentDayNumber = todayDay !== void 0 ? todayDay.dayIndex + 1 : null;
66
+ const dayLabel2 = currentDayNumber !== null ? t("chrome.shareView.trip.dayOf").replace("{current}", String(currentDayNumber)).replace("{total}", String(totalDays)) : t(PHASE_LABEL_KEY[trip.phase]);
67
+ const dateRangeLabel = `${formatDayMonth(trip.startDate, trip.timezone)} \u2192 ${formatDayMonth(trip.endDate, trip.timezone)}`;
68
+ let daysLeftLabel = null;
69
+ if (trip.phase === "ON_TRIP" && serverTime !== void 0) {
70
+ const daysLeft = wholeDaysBetween(serverTime, trip.endDate, trip.timezone);
71
+ daysLeftLabel = daysLeft === 1 ? t("chrome.shareView.trip.daysLeftOne") : t("chrome.shareView.trip.daysLeftMany").replace("{count}", String(daysLeft));
72
+ } else if (trip.phase === "PRE_DEPARTURE" && serverTime !== void 0) {
73
+ const daysToStart = wholeDaysBetween(serverTime, trip.startDate, trip.timezone);
74
+ daysLeftLabel = daysToStart === 1 ? t("chrome.shareView.trip.startsInOne") : t("chrome.shareView.trip.startsInMany").replace("{count}", String(daysToStart));
75
+ }
76
+ let progressPercent = 0;
77
+ if (trip.phase === "POST_TRIP") {
78
+ progressPercent = 100;
79
+ } else if (trip.phase === "ON_TRIP" && currentDayNumber !== null && totalDays > 0) {
80
+ progressPercent = Math.min(100, Math.round(currentDayNumber / totalDays * 100));
81
+ }
82
+ return {
83
+ phase: trip.phase,
84
+ phaseLabel: t(PHASE_LABEL_KEY[trip.phase]),
85
+ totalDays,
86
+ currentDayNumber,
87
+ dayLabel: dayLabel2,
88
+ dateRangeLabel,
89
+ daysLeftLabel,
90
+ progressPercent
91
+ };
92
+ }
93
+ function HouseholdSheet({
94
+ open,
95
+ onClose,
96
+ label,
97
+ travellers
98
+ }) {
99
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
100
+ react.useEffect(() => {
101
+ if (!open) {
102
+ return;
103
+ }
104
+ function handleKeyDown(event) {
105
+ if (event.key === "Escape") {
106
+ onClose();
107
+ }
108
+ }
109
+ document.addEventListener("keydown", handleKeyDown);
110
+ return () => {
111
+ document.removeEventListener("keydown", handleKeyDown);
112
+ };
113
+ }, [open, onClose]);
114
+ if (!open) {
115
+ return null;
116
+ }
117
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__sheet-backdrop", children: /* @__PURE__ */ jsxRuntime.jsxs(
118
+ "div",
119
+ {
120
+ className: "kf-share-view__sheet",
121
+ role: "dialog",
122
+ "aria-modal": "true",
123
+ "aria-label": label ?? t("chrome.shareView.household.ariaLabelFallback"),
124
+ children: [
125
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__sheet-header", children: [
126
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
127
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-eyebrow", children: t("chrome.shareView.household.eyebrow") }),
128
+ label !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__sheet-title", children: label }) : null
129
+ ] }),
130
+ /* @__PURE__ */ jsxRuntime.jsx(
131
+ "button",
132
+ {
133
+ type: "button",
134
+ className: "kf-share-view__sheet-close kf-press",
135
+ onClick: onClose,
136
+ "aria-label": t("chrome.shareView.close"),
137
+ children: "\u2715"
138
+ }
139
+ )
140
+ ] }),
141
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "kf-share-view__list", children: travellers.map((traveller, index) => /* @__PURE__ */ jsxRuntime.jsxs(
142
+ "li",
143
+ {
144
+ className: "kf-share-view__row kf-share-view__sheet-row",
145
+ children: [
146
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__household-avatar", "aria-hidden": "true", children: traveller.initials }),
147
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__sheet-row-body", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "kf-share-view__contact-name", children: [
148
+ traveller.firstName,
149
+ traveller.isSubject ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "kf-share-view__sheet-you", children: [
150
+ " ",
151
+ "\xB7 ",
152
+ t("chrome.shareView.household.you")
153
+ ] }) : null
154
+ ] }) })
155
+ ]
156
+ },
157
+ `${traveller.firstName}-${String(index)}`
158
+ )) }),
159
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "kf-share-view__sheet-footer kf-eyebrow", children: [
160
+ travellers.length,
161
+ " ",
162
+ travellers.length === 1 ? t("chrome.shareView.household.travellerSingular") : t("chrome.shareView.household.travellerPlural"),
163
+ " ",
164
+ "\xB7 ",
165
+ t("chrome.shareView.household.readOnlyView")
166
+ ] })
167
+ ]
168
+ }
169
+ ) });
170
+ }
171
+ var COPY_KEY = {
172
+ ended: "chrome.shareView.ended.ended",
173
+ "not-found": "chrome.shareView.ended.notFound"
174
+ };
175
+ function ShareEndedScreen({ reason }) {
176
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
177
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__ended", role: "alert", "aria-live": "assertive", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__ended-message", children: t(COPY_KEY[reason]) }) });
178
+ }
179
+ function ShareSkeleton() {
180
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
181
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__skeleton", role: "status", "aria-live": "polite", "aria-busy": "true", children: [
182
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-visually-hidden", children: t("chrome.shareView.loading") }),
183
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__skeleton-line kf-share-view__skeleton-line--eyebrow kf-shimmer" }),
184
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__skeleton-line kf-share-view__skeleton-line--headline kf-shimmer" }),
185
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__skeleton-block kf-shimmer" }),
186
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__skeleton-block kf-share-view__skeleton-block--short kf-shimmer" }),
187
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__skeleton-block kf-shimmer" })
188
+ ] });
189
+ }
190
+ function svg(children, size = 16) {
191
+ return /* @__PURE__ */ jsxRuntime.jsx(
192
+ "svg",
193
+ {
194
+ width: size,
195
+ height: size,
196
+ viewBox: "0 0 24 24",
197
+ fill: "none",
198
+ stroke: "currentColor",
199
+ strokeWidth: 1.75,
200
+ strokeLinecap: "round",
201
+ strokeLinejoin: "round",
202
+ "aria-hidden": "true",
203
+ children
204
+ }
205
+ );
206
+ }
207
+ function PhoneIcon({ size }) {
208
+ return svg(
209
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 4h3.2l1.4 4.4-2 1.6a12.5 12.5 0 0 0 5.4 5.4l1.6-2 4.4 1.4V18a2 2 0 0 1-2 2C10 20 4 14 4 6a2 2 0 0 1 0-2Z" }),
210
+ size
211
+ );
212
+ }
213
+ function WhatsappIcon({ size }) {
214
+ return svg(
215
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
216
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.3 17.7 5 20l2.4-1.3A8 8 0 1 0 4 12a8 8 0 0 0 2.3 5.7Z" }),
217
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 9.5c0 3.5 2.9 6 6 6 .6 0 1-.9.6-1.4l-1.2-1.4a.7.7 0 0 0-.8-.2l-1 .4a5 5 0 0 1-2.5-2.5l.4-1a.7.7 0 0 0-.2-.8L9.4 7.4C8.9 7 8 7.4 8 8c0 .5.2 1 1 1.5Z" })
218
+ ] }),
219
+ size
220
+ );
221
+ }
222
+ function PlaneIcon({ size }) {
223
+ return svg(
224
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10.5 20.5 12 15l6.5-6.5a2.1 2.1 0 0 0-3-3L9 12l-5.5 1.5 3 2 1 3 2-1Z" }),
225
+ size
226
+ );
227
+ }
228
+ function HouseIcon({ size }) {
229
+ return svg(
230
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
231
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 11 12 4l8 7" }),
232
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 10v9a1 1 0 0 0 1 1h3v-5h4v5h3a1 1 0 0 0 1-1v-9" })
233
+ ] }),
234
+ size
235
+ );
236
+ }
237
+ function CarIcon({ size }) {
238
+ return svg(
239
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
240
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 16V12l2-5h12l2 5v4" }),
241
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 16h16v2a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-1H7v1a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1Z" }),
242
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7.5", cy: "16", r: "1.2" }),
243
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "16.5", cy: "16", r: "1.2" })
244
+ ] }),
245
+ size
246
+ );
247
+ }
248
+ function CompassIcon({ size }) {
249
+ return svg(
250
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
251
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "8" }),
252
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m14.5 9.5-1.8 4.2-4.2 1.8 1.8-4.2Z" })
253
+ ] }),
254
+ size
255
+ );
256
+ }
257
+ function BedIcon({ size }) {
258
+ return svg(
259
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
260
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 18v-7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v3" }),
261
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 18v2M21 18v2M3 15h18v3H3z" }),
262
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13 11h6a2 2 0 0 1 2 2v2" }),
263
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "11", r: "1.4" })
264
+ ] }),
265
+ size
266
+ );
267
+ }
268
+ function DownloadIcon({ size }) {
269
+ return svg(
270
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
271
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 4v11" }),
272
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m7.5 11.5 4.5 4.5 4.5-4.5" }),
273
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 19.5h16" })
274
+ ] }),
275
+ size
276
+ );
277
+ }
278
+ function PinIcon({ size }) {
279
+ return svg(
280
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
281
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 21s-6.5-5.6-6.5-10.5a6.5 6.5 0 0 1 13 0C18.5 15.4 12 21 12 21Z" }),
282
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "10.5", r: "2.2" })
283
+ ] }),
284
+ size
285
+ );
286
+ }
287
+ function initialsOf(name) {
288
+ const parts = name.trim().split(/\s+/).filter(Boolean);
289
+ const first = parts[0]?.[0] ?? "";
290
+ const last = parts.length > 1 ? parts[parts.length - 1]?.[0] ?? "" : "";
291
+ return `${first}${last}`.toUpperCase();
292
+ }
293
+ function ContactActions({ row }) {
294
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
295
+ if (row.phoneHref === null && row.whatsappHref === null) {
296
+ return null;
297
+ }
298
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__contact-actions", children: [
299
+ row.phoneHref !== null ? /* @__PURE__ */ jsxRuntime.jsxs(
300
+ "a",
301
+ {
302
+ className: "kf-share-view__contact-action kf-share-view__contact-action--call kf-press",
303
+ href: row.phoneHref,
304
+ children: [
305
+ /* @__PURE__ */ jsxRuntime.jsx(PhoneIcon, {}),
306
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-visually-hidden", children: t("chrome.shareView.contact.call").replace("{name}", row.name) })
307
+ ]
308
+ }
309
+ ) : null,
310
+ row.whatsappHref !== null ? /* @__PURE__ */ jsxRuntime.jsxs(
311
+ "a",
312
+ {
313
+ className: "kf-share-view__contact-action kf-share-view__contact-action--whatsapp kf-press",
314
+ href: row.whatsappHref,
315
+ children: [
316
+ /* @__PURE__ */ jsxRuntime.jsx(WhatsappIcon, {}),
317
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-visually-hidden", children: t("chrome.shareView.contact.whatsapp").replace("{name}", row.name) })
318
+ ]
319
+ }
320
+ ) : null
321
+ ] });
322
+ }
323
+ function ContactCard({
324
+ row,
325
+ roleLabel,
326
+ footer
327
+ }) {
328
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__card kf-share-view__contact", children: [
329
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__contact-main", children: [
330
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__contact-avatar", "aria-hidden": "true", children: initialsOf(row.name) }),
331
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__contact-identity", children: [
332
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__contact-name", children: row.name }),
333
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "kf-share-view__contact-role kf-num", children: [
334
+ roleLabel,
335
+ row.phoneDisplay !== null ? ` \xB7 ${row.phoneDisplay}` : ""
336
+ ] })
337
+ ] }),
338
+ /* @__PURE__ */ jsxRuntime.jsx(ContactActions, { row })
339
+ ] }),
340
+ footer
341
+ ] });
342
+ }
343
+ function AgencyContactSection({ data }) {
344
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
345
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": t("chrome.shareView.agency.eyebrow"), children: [
346
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.agency.eyebrow") }) }),
347
+ /* @__PURE__ */ jsxRuntime.jsx(ContactCard, { row: data, roleLabel: t("chrome.shareView.agency.roleLabel") })
348
+ ] });
349
+ }
350
+ var PARTY_KIND_KEY = {
351
+ FAMILY: "chrome.shareView.brand.partyKind.family",
352
+ COUPLE: "chrome.shareView.brand.partyKind.couple",
353
+ FRIENDS: "chrome.shareView.brand.partyKind.friends",
354
+ CORPORATE: "chrome.shareView.brand.partyKind.corporate",
355
+ OTHER: "chrome.shareView.brand.partyKind.other"
356
+ };
357
+ function BrandHeaderSection({
358
+ agencyContact,
359
+ partyKind
360
+ }) {
361
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
362
+ const initial = agencyContact.name.trim().slice(0, 1).toUpperCase();
363
+ const kindLabel = partyKind !== null ? t(PARTY_KIND_KEY[partyKind]) : null;
364
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__brand-header", children: [
365
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__brand-mark", "aria-hidden": "true", children: initial }),
366
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "kf-share-view__brand-name", children: [
367
+ agencyContact.name,
368
+ kindLabel !== null ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "kf-share-view__brand-kind", children: [
369
+ " \xB7 ",
370
+ kindLabel
371
+ ] }) : null
372
+ ] }),
373
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__brand-readonly kf-eyebrow", children: t("chrome.shareView.brand.readOnly") })
374
+ ] });
375
+ }
376
+ function groupBySectionTitle(items) {
377
+ const groups = /* @__PURE__ */ new Map();
378
+ for (const item of items) {
379
+ const existing = groups.get(item.sectionTitle);
380
+ if (existing !== void 0) {
381
+ existing.push(item);
382
+ } else {
383
+ groups.set(item.sectionTitle, [item]);
384
+ }
385
+ }
386
+ return groups;
387
+ }
388
+ function ChecklistSection({ data }) {
389
+ if (data.items.length === 0) {
390
+ return null;
391
+ }
392
+ const groups = groupBySectionTitle(data.items);
393
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from(groups.entries()).map(([sectionTitle, items]) => /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": sectionTitle, children: [
394
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: sectionTitle }) }),
395
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "kf-share-view__card kf-share-view__list", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "kf-share-view__row kf-share-view__checklist-row", children: [
396
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__checklist-marker", "aria-hidden": "true" }),
397
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__checklist-body", children: [
398
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__checklist-title", children: item.title }),
399
+ item.subLine !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__checklist-sub", children: item.subLine }) : null
400
+ ] })
401
+ ] }, item.title)) })
402
+ ] }, sectionTitle)) });
403
+ }
404
+ function formatSize(sizeBytes) {
405
+ if (sizeBytes < 1024) {
406
+ return `${String(sizeBytes)} B`;
407
+ }
408
+ const kb = sizeBytes / 1024;
409
+ if (kb < 1024) {
410
+ return `${kb.toFixed(0)} KB`;
411
+ }
412
+ return `${(kb / 1024).toFixed(1)} MB`;
413
+ }
414
+ function DocumentsSection({ data, timezone }) {
415
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
416
+ const files = data.files ?? [];
417
+ if (data.vouchers.length === 0 && files.length === 0) {
418
+ return null;
419
+ }
420
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": t("chrome.shareView.documents.eyebrow"), children: [
421
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.documents.eyebrow") }) }),
422
+ /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "kf-share-view__card kf-share-view__list", children: [
423
+ files.map((file) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "kf-share-view__row kf-share-view__document-row", children: [
424
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__document-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(DownloadIcon, {}) }),
425
+ /* @__PURE__ */ jsxRuntime.jsx(
426
+ "a",
427
+ {
428
+ className: "kf-share-view__document-link",
429
+ href: file.url,
430
+ target: "_blank",
431
+ rel: "noreferrer",
432
+ children: file.title
433
+ }
434
+ ),
435
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "kf-share-view__document-meta kf-num", children: [
436
+ file.scope === "yours" ? `${t("chrome.shareView.documents.yours")} \xB7 ` : "",
437
+ formatSize(file.sizeBytes)
438
+ ] })
439
+ ] }, file.id)),
440
+ data.vouchers.map((voucher) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "kf-share-view__row kf-share-view__document-row", children: [
441
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__document-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(DownloadIcon, {}) }),
442
+ /* @__PURE__ */ jsxRuntime.jsx(
443
+ "a",
444
+ {
445
+ className: "kf-share-view__document-link",
446
+ href: voucher.url,
447
+ target: "_blank",
448
+ rel: "noreferrer",
449
+ children: voucher.bookingLabel
450
+ }
451
+ ),
452
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "kf-share-view__document-meta kf-num", children: [
453
+ formatDayMonth(voucher.isoDate, timezone),
454
+ " \xB7 ",
455
+ formatSize(voucher.sizeBytes)
456
+ ] })
457
+ ] }, voucher.id))
458
+ ] })
459
+ ] });
460
+ }
461
+ function SelectFieldEditor({
462
+ id,
463
+ value,
464
+ options,
465
+ required,
466
+ onChange
467
+ }) {
468
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
469
+ const [open, setOpen] = react.useState(false);
470
+ const rootRef = react.useRef(null);
471
+ const selected = options.find((option) => option.value === value);
472
+ react.useEffect(() => {
473
+ if (!open) {
474
+ return;
475
+ }
476
+ function handlePointerDown(event) {
477
+ if (rootRef.current !== null && !rootRef.current.contains(event.target)) {
478
+ setOpen(false);
479
+ }
480
+ }
481
+ function handleKeyDown(event) {
482
+ if (event.key === "Escape") {
483
+ setOpen(false);
484
+ }
485
+ }
486
+ document.addEventListener("pointerdown", handlePointerDown);
487
+ document.addEventListener("keydown", handleKeyDown);
488
+ return () => {
489
+ document.removeEventListener("pointerdown", handlePointerDown);
490
+ document.removeEventListener("keydown", handleKeyDown);
491
+ };
492
+ }, [open]);
493
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__select", ref: rootRef, children: [
494
+ /* @__PURE__ */ jsxRuntime.jsxs(
495
+ "button",
496
+ {
497
+ type: "button",
498
+ id,
499
+ className: "kf-share-view__select-trigger",
500
+ "aria-haspopup": "listbox",
501
+ "aria-expanded": open,
502
+ onClick: () => setOpen((current) => !current),
503
+ children: [
504
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: selected === void 0 ? "kf-share-view__select-placeholder" : void 0, children: [
505
+ selected?.label ?? t("chrome.shareView.form.choosePlaceholder"),
506
+ required && selected === void 0 ? " *" : ""
507
+ ] }),
508
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__select-chevron", "aria-hidden": "true" })
509
+ ]
510
+ }
511
+ ),
512
+ open ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__select-listbox", role: "listbox", children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
513
+ "button",
514
+ {
515
+ type: "button",
516
+ role: "option",
517
+ "aria-selected": option.value === value,
518
+ className: "kf-share-view__select-option",
519
+ onClick: () => {
520
+ onChange(option.value);
521
+ setOpen(false);
522
+ },
523
+ children: option.label
524
+ },
525
+ option.value
526
+ )) }) : null
527
+ ] });
528
+ }
529
+ function configOf(field) {
530
+ return field.config;
531
+ }
532
+ function textValue(value) {
533
+ return typeof value === "string" ? value : "";
534
+ }
535
+ function numberValue(value) {
536
+ return typeof value === "number" ? String(value) : "";
537
+ }
538
+ function PlainPreview({ value }) {
539
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview", children: typeof value === "string" ? value : "" });
540
+ }
541
+ var fallback = {
542
+ editor: ({ field, t }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-unsupported", children: t("chrome.shareView.form.unsupported").replace("{label}", field.label) }),
543
+ preview: PlainPreview
544
+ };
545
+ var fieldRegistry = chunkEM7JV3D7_cjs.createRegistry({ fallback });
546
+ fieldRegistry.register("HEADING", {
547
+ editor: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "kf-share-view__form-heading", children: field.label }),
548
+ preview: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "kf-share-view__form-heading", children: field.label })
549
+ });
550
+ fieldRegistry.register("INFO_BLOCK", {
551
+ editor: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-info", children: field.contentText }),
552
+ preview: ({ field }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-info", children: field.contentText })
553
+ });
554
+ fieldRegistry.register("SHORT_TEXT", {
555
+ editor: ({ field, value, onChange }) => {
556
+ const config = configOf(field);
557
+ return /* @__PURE__ */ jsxRuntime.jsx(
558
+ "input",
559
+ {
560
+ type: "text",
561
+ className: "kf-share-view__form-input",
562
+ value: textValue(value),
563
+ maxLength: config.maxLength,
564
+ pattern: config.pattern,
565
+ required: field.required,
566
+ onChange: (event) => onChange(event.target.value)
567
+ }
568
+ );
569
+ },
570
+ preview: PlainPreview
571
+ });
572
+ fieldRegistry.register("LONG_TEXT", {
573
+ editor: ({ field, value, onChange }) => {
574
+ const config = configOf(field);
575
+ return /* @__PURE__ */ jsxRuntime.jsx(
576
+ "textarea",
577
+ {
578
+ className: "kf-share-view__form-textarea",
579
+ value: textValue(value),
580
+ maxLength: config.maxLength,
581
+ required: field.required,
582
+ onChange: (event) => onChange(event.target.value)
583
+ }
584
+ );
585
+ },
586
+ preview: PlainPreview
587
+ });
588
+ fieldRegistry.register("EMAIL", {
589
+ editor: ({ field, value, onChange }) => {
590
+ void configOf(field);
591
+ return /* @__PURE__ */ jsxRuntime.jsx(
592
+ "input",
593
+ {
594
+ type: "email",
595
+ className: "kf-share-view__form-input",
596
+ value: textValue(value),
597
+ required: field.required,
598
+ onChange: (event) => onChange(event.target.value)
599
+ }
600
+ );
601
+ },
602
+ preview: PlainPreview
603
+ });
604
+ fieldRegistry.register("PHONE", {
605
+ editor: ({ field, value, onChange }) => {
606
+ void configOf(field);
607
+ return /* @__PURE__ */ jsxRuntime.jsx(
608
+ "input",
609
+ {
610
+ type: "tel",
611
+ className: "kf-share-view__form-input",
612
+ value: textValue(value),
613
+ required: field.required,
614
+ onChange: (event) => onChange(event.target.value)
615
+ }
616
+ );
617
+ },
618
+ preview: PlainPreview
619
+ });
620
+ fieldRegistry.register("URL", {
621
+ editor: ({ field, value, onChange }) => /* @__PURE__ */ jsxRuntime.jsx(
622
+ "input",
623
+ {
624
+ type: "url",
625
+ className: "kf-share-view__form-input",
626
+ value: textValue(value),
627
+ required: field.required,
628
+ onChange: (event) => onChange(event.target.value)
629
+ }
630
+ ),
631
+ preview: PlainPreview
632
+ });
633
+ fieldRegistry.register("NUMBER", {
634
+ editor: ({ field, value, onChange }) => {
635
+ const config = configOf(field);
636
+ return /* @__PURE__ */ jsxRuntime.jsx(
637
+ "input",
638
+ {
639
+ type: "number",
640
+ className: "kf-share-view__form-input",
641
+ value: numberValue(value),
642
+ min: config.min,
643
+ max: config.max,
644
+ step: config.step ?? 1,
645
+ required: field.required,
646
+ onChange: (event) => onChange(event.target.value === "" ? void 0 : Number(event.target.value))
647
+ }
648
+ );
649
+ },
650
+ preview: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview kf-num", children: numberValue(value) })
651
+ });
652
+ fieldRegistry.register("CURRENCY", {
653
+ editor: ({ field, value, onChange }) => {
654
+ const config = configOf(field);
655
+ return /* @__PURE__ */ jsxRuntime.jsx(
656
+ "input",
657
+ {
658
+ type: "number",
659
+ className: "kf-share-view__form-input",
660
+ value: numberValue(value),
661
+ min: config.minMinor !== void 0 ? config.minMinor / 100 : void 0,
662
+ max: config.maxMinor !== void 0 ? config.maxMinor / 100 : void 0,
663
+ step: 0.01,
664
+ required: field.required,
665
+ onChange: (event) => onChange(
666
+ event.target.value === "" ? void 0 : Math.round(Number(event.target.value) * 100)
667
+ )
668
+ }
669
+ );
670
+ },
671
+ preview: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview kf-num", children: typeof value === "number" ? (value / 100).toFixed(2) : "" })
672
+ });
673
+ fieldRegistry.register("RATING", {
674
+ editor: ({ field, value, onChange }) => {
675
+ const config = configOf(field);
676
+ const max = config.ratingMax ?? 5;
677
+ return /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "kf-share-view__form-rating", children: [
678
+ /* @__PURE__ */ jsxRuntime.jsx("legend", { className: "kf-visually-hidden", children: field.label }),
679
+ Array.from({ length: max }, (_unused, index) => index + 1).map((score) => /* @__PURE__ */ jsxRuntime.jsx(
680
+ "button",
681
+ {
682
+ type: "button",
683
+ "aria-pressed": value === score,
684
+ className: `kf-share-view__form-rating-dot kf-press ${value === score ? "kf-share-view__form-rating-dot--selected" : ""}`,
685
+ onClick: () => onChange(score),
686
+ children: score
687
+ },
688
+ score
689
+ ))
690
+ ] });
691
+ },
692
+ preview: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview kf-num", children: numberValue(value) })
693
+ });
694
+ fieldRegistry.register("NPS", {
695
+ editor: ({ field, value, onChange }) => {
696
+ void configOf(field);
697
+ return /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "kf-share-view__form-rating", children: [
698
+ /* @__PURE__ */ jsxRuntime.jsx("legend", { className: "kf-visually-hidden", children: field.label }),
699
+ Array.from({ length: 11 }, (_unused, index) => index).map((score) => /* @__PURE__ */ jsxRuntime.jsx(
700
+ "button",
701
+ {
702
+ type: "button",
703
+ "aria-pressed": value === score,
704
+ className: `kf-share-view__form-rating-dot kf-press ${value === score ? "kf-share-view__form-rating-dot--selected" : ""}`,
705
+ onClick: () => onChange(score),
706
+ children: score
707
+ },
708
+ score
709
+ ))
710
+ ] });
711
+ },
712
+ preview: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview kf-num", children: numberValue(value) })
713
+ });
714
+ fieldRegistry.register("DATE", {
715
+ editor: ({ field, value, onChange }) => {
716
+ const config = configOf(field);
717
+ return /* @__PURE__ */ jsxRuntime.jsx(
718
+ "input",
719
+ {
720
+ type: "date",
721
+ className: "kf-share-view__form-input",
722
+ value: textValue(value),
723
+ min: config.minDate,
724
+ max: config.maxDate,
725
+ required: field.required,
726
+ onChange: (event) => onChange(event.target.value)
727
+ }
728
+ );
729
+ },
730
+ preview: PlainPreview
731
+ });
732
+ fieldRegistry.register("DATETIME", {
733
+ editor: ({ field, value, onChange }) => {
734
+ const config = configOf(field);
735
+ return /* @__PURE__ */ jsxRuntime.jsx(
736
+ "input",
737
+ {
738
+ type: "datetime-local",
739
+ className: "kf-share-view__form-input",
740
+ value: textValue(value),
741
+ step: config.minuteStep !== void 0 ? config.minuteStep * 60 : void 0,
742
+ required: field.required,
743
+ onChange: (event) => onChange(event.target.value)
744
+ }
745
+ );
746
+ },
747
+ preview: PlainPreview
748
+ });
749
+ fieldRegistry.register("TIME", {
750
+ editor: ({ field, value, onChange }) => {
751
+ void configOf(field);
752
+ const minutes = typeof value === "number" ? value : void 0;
753
+ const hh = minutes !== void 0 ? String(Math.floor(minutes / 60)).padStart(2, "0") : "";
754
+ const mm = minutes !== void 0 ? String(minutes % 60).padStart(2, "0") : "";
755
+ return /* @__PURE__ */ jsxRuntime.jsx(
756
+ "input",
757
+ {
758
+ type: "time",
759
+ className: "kf-share-view__form-input",
760
+ value: minutes !== void 0 ? `${hh}:${mm}` : "",
761
+ required: field.required,
762
+ onChange: (event) => {
763
+ const [h, m] = event.target.value.split(":");
764
+ if (h === void 0 || m === void 0) {
765
+ onChange(void 0);
766
+ return;
767
+ }
768
+ onChange(Number(h) * 60 + Number(m));
769
+ }
770
+ }
771
+ );
772
+ },
773
+ preview: ({ value }) => {
774
+ const minutes = typeof value === "number" ? value : void 0;
775
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview kf-num", children: minutes !== void 0 ? `${String(Math.floor(minutes / 60)).padStart(2, "0")}:${String(minutes % 60).padStart(2, "0")}` : "" });
776
+ }
777
+ });
778
+ fieldRegistry.register("SELECT", {
779
+ editor: ({ field, value, onChange, t }) => {
780
+ const config = configOf(field);
781
+ const options = [...config.options].sort((a, b) => a.sortOrder - b.sortOrder);
782
+ const withOther = config.otherAllowed === true ? [...options, { value: "__other__", label: t("chrome.shareView.form.other") }] : options;
783
+ return /* @__PURE__ */ jsxRuntime.jsx(
784
+ SelectFieldEditor,
785
+ {
786
+ id: field.id,
787
+ value: textValue(value),
788
+ options: withOther,
789
+ required: field.required,
790
+ onChange
791
+ }
792
+ );
793
+ },
794
+ preview: PlainPreview
795
+ });
796
+ fieldRegistry.register("MULTISELECT", {
797
+ editor: ({ field, value, onChange }) => {
798
+ const config = configOf(field);
799
+ const options = [...config.options].sort((a, b) => a.sortOrder - b.sortOrder);
800
+ const selected = Array.isArray(value) ? value : [];
801
+ return /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { className: "kf-share-view__form-multiselect", children: [
802
+ /* @__PURE__ */ jsxRuntime.jsx("legend", { className: "kf-visually-hidden", children: field.label }),
803
+ options.map((option) => {
804
+ const checked = selected.includes(option.value);
805
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "kf-share-view__form-checkbox-row", children: [
806
+ /* @__PURE__ */ jsxRuntime.jsx(
807
+ "input",
808
+ {
809
+ type: "checkbox",
810
+ checked,
811
+ onChange: (event) => {
812
+ const max = config.maxSelections ?? 50;
813
+ if (event.target.checked) {
814
+ if (selected.length >= max) {
815
+ return;
816
+ }
817
+ onChange([...selected, option.value]);
818
+ } else {
819
+ onChange(selected.filter((entry) => entry !== option.value));
820
+ }
821
+ }
822
+ }
823
+ ),
824
+ option.label
825
+ ] }, option.value);
826
+ })
827
+ ] });
828
+ },
829
+ preview: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview", children: Array.isArray(value) ? value.join(", ") : "" })
830
+ });
831
+ fieldRegistry.register("CHECKBOX", {
832
+ editor: ({ field, value, onChange }) => {
833
+ void configOf(field);
834
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "kf-share-view__form-checkbox-row", children: [
835
+ /* @__PURE__ */ jsxRuntime.jsx(
836
+ "input",
837
+ {
838
+ type: "checkbox",
839
+ checked: value === true,
840
+ onChange: (event) => onChange(event.target.checked)
841
+ }
842
+ ),
843
+ field.label
844
+ ] });
845
+ },
846
+ preview: ({ value, t }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview", children: value === true ? t("chrome.shareView.form.yes") : t("chrome.shareView.form.no") })
847
+ });
848
+ fieldRegistry.register("CONSENT", {
849
+ editor: ({ field, value, onChange }) => {
850
+ void configOf(field);
851
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "kf-share-view__form-checkbox-row", children: [
852
+ /* @__PURE__ */ jsxRuntime.jsx(
853
+ "input",
854
+ {
855
+ type: "checkbox",
856
+ checked: value === true,
857
+ required: field.required,
858
+ onChange: (event) => onChange(event.target.checked)
859
+ }
860
+ ),
861
+ field.contentText ?? field.label
862
+ ] });
863
+ },
864
+ preview: ({ value, t }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview", children: value === true ? t("chrome.shareView.form.agreed") : "" })
865
+ });
866
+ fieldRegistry.register("SIGNATURE", {
867
+ editor: ({ field, value, onChange }) => {
868
+ void configOf(field);
869
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__form-file", children: [
870
+ /* @__PURE__ */ jsxRuntime.jsx(
871
+ "input",
872
+ {
873
+ type: "file",
874
+ accept: "image/*",
875
+ onChange: (event) => onChange(event.target.files?.[0]?.name)
876
+ }
877
+ ),
878
+ typeof value === "string" ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-file-name", children: value }) : null
879
+ ] });
880
+ },
881
+ preview: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview", children: typeof value === "string" ? value : "" })
882
+ });
883
+ fieldRegistry.register("FILE_UPLOAD", {
884
+ editor: ({ field, value, onChange }) => {
885
+ const config = configOf(field);
886
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__form-file", children: [
887
+ /* @__PURE__ */ jsxRuntime.jsx(
888
+ "input",
889
+ {
890
+ type: "file",
891
+ accept: config.accept?.join(","),
892
+ multiple: (config.maxFiles ?? 1) > 1,
893
+ onChange: (event) => onChange(Array.from(event.target.files ?? []).map((file) => file.name))
894
+ }
895
+ ),
896
+ Array.isArray(value) ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-file-name", children: value.join(", ") }) : null
897
+ ] });
898
+ },
899
+ preview: ({ value }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview", children: Array.isArray(value) ? value.join(", ") : "" })
900
+ });
901
+ fieldRegistry.register("ADDRESS", {
902
+ editor: ({ field, value, onChange, t }) => {
903
+ void configOf(field);
904
+ const address = value ?? {};
905
+ const update = (patch) => onChange({ ...address, ...patch });
906
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__form-address", children: [
907
+ /* @__PURE__ */ jsxRuntime.jsx(
908
+ "input",
909
+ {
910
+ type: "text",
911
+ className: "kf-share-view__form-input",
912
+ placeholder: t("chrome.shareView.form.address.line1"),
913
+ value: address.line1 ?? "",
914
+ onChange: (event) => update({ line1: event.target.value })
915
+ }
916
+ ),
917
+ /* @__PURE__ */ jsxRuntime.jsx(
918
+ "input",
919
+ {
920
+ type: "text",
921
+ className: "kf-share-view__form-input",
922
+ placeholder: t("chrome.shareView.form.address.city"),
923
+ value: address.city ?? "",
924
+ onChange: (event) => update({ city: event.target.value })
925
+ }
926
+ ),
927
+ /* @__PURE__ */ jsxRuntime.jsx(
928
+ "input",
929
+ {
930
+ type: "text",
931
+ className: "kf-share-view__form-input",
932
+ placeholder: t("chrome.shareView.form.address.postalCode"),
933
+ value: address.postalCode ?? "",
934
+ onChange: (event) => update({ postalCode: event.target.value })
935
+ }
936
+ ),
937
+ /* @__PURE__ */ jsxRuntime.jsx(
938
+ "input",
939
+ {
940
+ type: "text",
941
+ className: "kf-share-view__form-input",
942
+ placeholder: t("chrome.shareView.form.address.country"),
943
+ value: address.country ?? "",
944
+ onChange: (event) => update({ country: event.target.value })
945
+ }
946
+ )
947
+ ] });
948
+ },
949
+ preview: ({ value }) => {
950
+ const address = value;
951
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-preview", children: address !== void 0 ? [address.line1, address.city, address.postalCode, address.country].filter(Boolean).join(", ") : "" });
952
+ }
953
+ });
954
+ function initialAnswers(fields) {
955
+ const map = /* @__PURE__ */ new Map();
956
+ for (const field of fields) {
957
+ if (field.kind === "HEADING" || field.kind === "INFO_BLOCK") {
958
+ continue;
959
+ }
960
+ map.set(field.key, field.prefill);
961
+ }
962
+ return map;
963
+ }
964
+ function FormFillScreen({
965
+ form,
966
+ save,
967
+ submit,
968
+ writeStatus,
969
+ travellerRef
970
+ }) {
971
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
972
+ const [clientToken] = react.useState(() => crypto.randomUUID());
973
+ const [answers, setAnswers] = react.useState(() => initialAnswers(form.fields));
974
+ const readOnly = form.responseStatus === "SUBMITTED";
975
+ const answerList = react.useMemo(() => {
976
+ const list = [];
977
+ for (const field of form.fields) {
978
+ if (field.kind === "HEADING" || field.kind === "INFO_BLOCK") {
979
+ continue;
980
+ }
981
+ list.push({ fieldKey: field.key, value: answers.get(field.key) });
982
+ }
983
+ return list;
984
+ }, [answers, form.fields]);
985
+ const setAnswer = (key, value) => {
986
+ setAnswers((current) => {
987
+ const next = new Map(current);
988
+ next.set(key, value);
989
+ return next;
990
+ });
991
+ };
992
+ const writeInput = () => ({
993
+ formId: form.formId,
994
+ answers: answerList,
995
+ clientToken,
996
+ ...travellerRef !== void 0 ? { travellerRef } : {}
997
+ });
998
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "kf-share-view__form-fill", "aria-label": form.title, children: [
999
+ form.introText !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-intro", children: form.introText }) : null,
1000
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__form-fields", children: form.fields.map((field) => {
1001
+ const handler = fieldRegistry.resolve(field.kind);
1002
+ const value = answers.get(field.key);
1003
+ const showPreview = readOnly || field.locked;
1004
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__form-field", children: [
1005
+ field.kind !== "HEADING" && field.kind !== "INFO_BLOCK" ? /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "kf-share-view__form-label", htmlFor: field.id, children: [
1006
+ field.label,
1007
+ field.required ? " *" : ""
1008
+ ] }) : null,
1009
+ showPreview ? handler.preview({ field, value, t }) : handler.editor({
1010
+ field,
1011
+ value,
1012
+ onChange: (next) => setAnswer(field.key, next),
1013
+ t
1014
+ }),
1015
+ field.helpText !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-help", children: field.helpText }) : null
1016
+ ] }, field.id);
1017
+ }) }),
1018
+ form.outroText !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-outro", children: form.outroText }) : null,
1019
+ !readOnly ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__form-actions", children: [
1020
+ /* @__PURE__ */ jsxRuntime.jsx(
1021
+ "button",
1022
+ {
1023
+ type: "button",
1024
+ className: "kf-share-view__form-action kf-share-view__form-action--save kf-press",
1025
+ disabled: writeStatus === "saving" || writeStatus === "submitting",
1026
+ onClick: () => void save(writeInput()),
1027
+ children: t("chrome.shareView.form.saveDraft")
1028
+ }
1029
+ ),
1030
+ /* @__PURE__ */ jsxRuntime.jsx(
1031
+ "button",
1032
+ {
1033
+ type: "button",
1034
+ className: "kf-share-view__form-action kf-share-view__form-action--submit kf-press",
1035
+ disabled: writeStatus === "saving" || writeStatus === "submitting",
1036
+ onClick: () => void submit(writeInput()),
1037
+ children: t("chrome.shareView.form.submit")
1038
+ }
1039
+ )
1040
+ ] }) : null,
1041
+ writeStatus === "submitted" ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-status", role: "status", children: t("chrome.shareView.form.submittedMessage") }) : null,
1042
+ writeStatus === "queued-offline" ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-status", role: "status", children: t("chrome.shareView.form.queuedOffline") }) : null,
1043
+ writeStatus === "conflicted" ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__form-status", role: "alert", children: t("chrome.shareView.form.conflicted") }) : null
1044
+ ] });
1045
+ }
1046
+ var FILL_STATE_KEY = {
1047
+ ok: "chrome.shareView.forms.status.open",
1048
+ window_closed: "chrome.shareView.forms.status.windowClosed",
1049
+ form_closed: "chrome.shareView.forms.status.closed",
1050
+ not_open_yet: "chrome.shareView.forms.status.notOpenYet",
1051
+ awaiting_dispatch: "chrome.shareView.forms.status.notSentYet",
1052
+ already_submitted: "chrome.shareView.forms.status.submitted",
1053
+ response_limit_reached: "chrome.shareView.forms.status.limitReached",
1054
+ trip_cancelled: "chrome.shareView.forms.status.tripCancelled"
1055
+ };
1056
+ function statusLabel(form, t) {
1057
+ if (form.responseStatus === "IN_PROGRESS") {
1058
+ return t("chrome.shareView.forms.status.inProgress");
1059
+ }
1060
+ if (form.responseStatus === "SUBMITTED") {
1061
+ return t("chrome.shareView.forms.status.submitted");
1062
+ }
1063
+ const key = FILL_STATE_KEY[form.fillState];
1064
+ return key !== void 0 ? t(key) : form.fillState;
1065
+ }
1066
+ function isPendingRequired(form) {
1067
+ return form.required && form.fillState === "ok" && form.responseStatus === null;
1068
+ }
1069
+ function FormsSection({ token, travellerRef }) {
1070
+ const engine = react.useContext(chunkEM7JV3D7_cjs.OfflineEngineContext);
1071
+ if (engine === null) {
1072
+ return null;
1073
+ }
1074
+ return /* @__PURE__ */ jsxRuntime.jsx(ReadyFormsSection, { token, travellerRef });
1075
+ }
1076
+ function ReadyFormsSection({ token, travellerRef }) {
1077
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
1078
+ const { status, forms, renderForm, save, submit, writeStatus, refresh } = chunkVHTSTUCJ_cjs.useShareForms(token);
1079
+ const [openFormId, setOpenFormId] = react.useState(null);
1080
+ const [openForm, setOpenForm] = react.useState(null);
1081
+ const autoOpenedRef = react.useRef(false);
1082
+ react.useEffect(() => {
1083
+ if (autoOpenedRef.current || status !== "list-populated") {
1084
+ return;
1085
+ }
1086
+ autoOpenedRef.current = true;
1087
+ const pending = forms.find(isPendingRequired);
1088
+ if (pending !== void 0) {
1089
+ setOpenFormId(pending.formId);
1090
+ }
1091
+ }, [status, forms]);
1092
+ react.useEffect(() => {
1093
+ if (openFormId === null) {
1094
+ setOpenForm(null);
1095
+ return;
1096
+ }
1097
+ let cancelled = false;
1098
+ void renderForm(openFormId, { travellerRef }).then((response) => {
1099
+ if (!cancelled) {
1100
+ setOpenForm(response);
1101
+ }
1102
+ });
1103
+ return () => {
1104
+ cancelled = true;
1105
+ };
1106
+ }, [openFormId, renderForm, travellerRef]);
1107
+ react.useEffect(() => {
1108
+ if (writeStatus === "submitted") {
1109
+ void refresh();
1110
+ }
1111
+ }, [writeStatus, refresh]);
1112
+ if (status === "loading") {
1113
+ return null;
1114
+ }
1115
+ if (status === "not-found" || status === "list-empty") {
1116
+ return null;
1117
+ }
1118
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": t("chrome.shareView.forms.eyebrow"), children: [
1119
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.forms.eyebrow") }) }),
1120
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "kf-share-view__card kf-share-view__list", children: forms.map((form) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "kf-share-view__row kf-share-view__form-row", children: /* @__PURE__ */ jsxRuntime.jsxs(
1121
+ "button",
1122
+ {
1123
+ type: "button",
1124
+ className: "kf-share-view__form-row-button kf-press",
1125
+ onClick: () => setOpenFormId(form.formId),
1126
+ children: [
1127
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__form-row-title", children: form.title }),
1128
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "kf-share-view__form-row-end", children: [
1129
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "kf-share-view__form-row-meta kf-eyebrow", children: [
1130
+ statusLabel(form, t),
1131
+ form.required ? ` \xB7 ${t("chrome.shareView.forms.required")}` : ""
1132
+ ] }),
1133
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__form-row-chevron", "aria-hidden": "true" })
1134
+ ] })
1135
+ ]
1136
+ }
1137
+ ) }, form.formId)) }),
1138
+ openForm !== null ? (
1139
+ // A popup, not an inline replacement of this section's own content
1140
+ // (user feedback: opening a form used to swap the whole "Forms"
1141
+ // section's body in place) — same backdrop/sheet dialog pattern as
1142
+ // `HouseholdSheet`.
1143
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__sheet-backdrop", children: /* @__PURE__ */ jsxRuntime.jsxs(
1144
+ "div",
1145
+ {
1146
+ className: "kf-share-view__sheet",
1147
+ role: "dialog",
1148
+ "aria-modal": "true",
1149
+ "aria-label": openForm.title,
1150
+ children: [
1151
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__sheet-header", children: [
1152
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1153
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-eyebrow", children: t("chrome.shareView.forms.dialogEyebrow") }),
1154
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__sheet-title", children: openForm.title })
1155
+ ] }),
1156
+ /* @__PURE__ */ jsxRuntime.jsx(
1157
+ "button",
1158
+ {
1159
+ type: "button",
1160
+ className: "kf-share-view__sheet-close kf-press",
1161
+ onClick: () => setOpenFormId(null),
1162
+ "aria-label": t("chrome.shareView.close"),
1163
+ children: "\u2715"
1164
+ }
1165
+ )
1166
+ ] }),
1167
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__sheet-body", children: /* @__PURE__ */ jsxRuntime.jsx(
1168
+ FormFillScreen,
1169
+ {
1170
+ form: openForm,
1171
+ save,
1172
+ submit,
1173
+ writeStatus,
1174
+ travellerRef
1175
+ }
1176
+ ) })
1177
+ ]
1178
+ }
1179
+ ) })
1180
+ ) : null
1181
+ ] });
1182
+ }
1183
+ var PHASE_MODIFIER = {
1184
+ PRE_DEPARTURE: "pre-departure",
1185
+ ON_TRIP: "on-trip",
1186
+ POST_TRIP: "post-trip"
1187
+ };
1188
+ function HeroSection({
1189
+ tripName,
1190
+ status,
1191
+ travellers,
1192
+ onOpenHousehold
1193
+ }) {
1194
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
1195
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "kf-share-view__hero", "aria-label": t("chrome.shareView.trip.ariaLabel"), children: [
1196
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__hero-code kf-eyebrow", children: tripName }),
1197
+ /* @__PURE__ */ jsxRuntime.jsx(
1198
+ "span",
1199
+ {
1200
+ className: `kf-share-view__hero-pill kf-share-view__hero-pill--${PHASE_MODIFIER[status.phase]}`,
1201
+ children: status.phaseLabel
1202
+ }
1203
+ ),
1204
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__hero-headline", children: status.dayLabel }),
1205
+ /* @__PURE__ */ jsxRuntime.jsx(
1206
+ "div",
1207
+ {
1208
+ className: "kf-share-view__hero-progress",
1209
+ role: "progressbar",
1210
+ "aria-valuenow": status.progressPercent,
1211
+ "aria-valuemin": 0,
1212
+ "aria-valuemax": 100,
1213
+ "aria-label": t("chrome.shareView.trip.progressAriaLabel"),
1214
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1215
+ "div",
1216
+ {
1217
+ className: "kf-share-view__hero-progress-fill",
1218
+ style: { inlineSize: `${String(status.progressPercent)}%` }
1219
+ }
1220
+ )
1221
+ }
1222
+ ),
1223
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__hero-meta", children: [
1224
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: status.dateRangeLabel }),
1225
+ status.daysLeftLabel !== null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: status.daysLeftLabel }) : null
1226
+ ] }),
1227
+ travellers.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
1228
+ "button",
1229
+ {
1230
+ type: "button",
1231
+ className: "kf-share-view__hero-travellers kf-press",
1232
+ onClick: onOpenHousehold,
1233
+ disabled: onOpenHousehold === void 0,
1234
+ children: [
1235
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "kf-share-view__household-avatars", "aria-hidden": "true", children: travellers.map((traveller, index) => /* @__PURE__ */ jsxRuntime.jsx(
1236
+ "li",
1237
+ {
1238
+ className: "kf-share-view__household-avatar kf-share-view__household-avatar--on-dark",
1239
+ children: traveller.initials
1240
+ },
1241
+ `${traveller.firstName}-${String(index)}`
1242
+ )) }),
1243
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__hero-travellers-names", children: travellers.map((traveller) => traveller.firstName).join(" & ") })
1244
+ ]
1245
+ }
1246
+ ) : null
1247
+ ] });
1248
+ }
1249
+ function HouseholdBanner({ label, names }) {
1250
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
1251
+ if (names.length === 0 && label === null) {
1252
+ return null;
1253
+ }
1254
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1255
+ "section",
1256
+ {
1257
+ className: "kf-share-view__household",
1258
+ "aria-label": t("chrome.shareView.household.ariaLabelFallback"),
1259
+ children: [
1260
+ names.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "kf-share-view__household-greeting", children: [
1261
+ t("chrome.shareView.household.greeting"),
1262
+ " ",
1263
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__household-name", children: names }),
1264
+ ","
1265
+ ] }) : null,
1266
+ label !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__household-label", children: label }) : null
1267
+ ]
1268
+ }
1269
+ );
1270
+ }
1271
+ function ItineraryDayStrip({
1272
+ itinerary,
1273
+ timezone,
1274
+ selectedIndex,
1275
+ onSelectIndex
1276
+ }) {
1277
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
1278
+ const todayIndex = itinerary.days.findIndex((day) => day.isToday);
1279
+ const selectedDay = itinerary.days[selectedIndex] ?? itinerary.days[0];
1280
+ if (itinerary.days.length === 0 || selectedDay === void 0) {
1281
+ return null;
1282
+ }
1283
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": t("chrome.shareView.itinerary.ariaLabel"), children: [
1284
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.itinerary.eyebrow") }) }),
1285
+ /* @__PURE__ */ jsxRuntime.jsx(
1286
+ "div",
1287
+ {
1288
+ className: "kf-share-view__day-strip",
1289
+ role: "tablist",
1290
+ "aria-label": t("chrome.shareView.itinerary.tripDaysAriaLabel"),
1291
+ children: itinerary.days.map((day, index) => {
1292
+ const isSelected = index === selectedIndex;
1293
+ const isPast = index < todayIndex;
1294
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1295
+ "button",
1296
+ {
1297
+ type: "button",
1298
+ role: "tab",
1299
+ "aria-selected": isSelected,
1300
+ className: `kf-share-view__day-chip kf-press ${isSelected ? "kf-share-view__day-chip--selected" : isPast ? "kf-share-view__day-chip--past" : ""}`,
1301
+ onClick: () => onSelectIndex(index),
1302
+ children: [
1303
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__day-chip-number", children: day.dayIndex + 1 }),
1304
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__day-chip-label kf-eyebrow", children: formatWeekdayDay(day.isoDate, timezone) }),
1305
+ isSelected ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__day-chip-dot", "aria-hidden": "true" }) : null
1306
+ ]
1307
+ },
1308
+ day.dayIndex
1309
+ );
1310
+ })
1311
+ }
1312
+ ),
1313
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__card kf-share-view__day-detail", children: [
1314
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__day-detail-header", children: [
1315
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "kf-share-view__day-detail-eyebrow kf-eyebrow", children: [
1316
+ t("chrome.shareView.dayLabel").replace("{n}", String(selectedDay.dayIndex + 1)),
1317
+ " \xB7",
1318
+ " ",
1319
+ formatWeekdayDay(selectedDay.isoDate, timezone)
1320
+ ] }),
1321
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__day-detail-title", children: selectedDay.cardTitle }),
1322
+ selectedDay.summaryLine !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__day-detail-summary", children: selectedDay.summaryLine }) : null
1323
+ ] }),
1324
+ selectedDay.items.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "kf-share-view__list kf-share-view__day-detail-items", children: selectedDay.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
1325
+ "li",
1326
+ {
1327
+ className: `kf-share-view__row kf-share-view__plan-row kf-share-view__plan-row--${item.timeState}`,
1328
+ children: [
1329
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__plan-time kf-num", children: item.timeState === "now" ? t("chrome.shareView.plan.now") : item.startTime !== null ? formatTimeOfDay(item.startTime, timezone) : "" }),
1330
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__plan-title", children: item.title })
1331
+ ]
1332
+ },
1333
+ item.id
1334
+ )) }) : null
1335
+ ] })
1336
+ ] });
1337
+ }
1338
+ function ManagerContactSection({ data }) {
1339
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
1340
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": t("chrome.shareView.manager.eyebrow"), children: [
1341
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__eyebrow-row", children: [
1342
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.manager.eyebrow") }),
1343
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.manager.available") })
1344
+ ] }),
1345
+ /* @__PURE__ */ jsxRuntime.jsx(
1346
+ ContactCard,
1347
+ {
1348
+ row: data,
1349
+ roleLabel: t("chrome.shareView.manager.roleLabel"),
1350
+ footer: data.coManagers?.map((coManager) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__contact-footer", children: [
1351
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__contact-footer-label kf-eyebrow", children: t("chrome.shareView.manager.coManagerLabel").replace("{name}", coManager.name) }),
1352
+ coManager.phoneDisplay !== null ? coManager.phoneHref !== null ? /* @__PURE__ */ jsxRuntime.jsx(
1353
+ "a",
1354
+ {
1355
+ href: coManager.phoneHref,
1356
+ className: "kf-share-view__contact-footer-phone kf-num",
1357
+ children: coManager.phoneDisplay
1358
+ }
1359
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__contact-footer-phone kf-num", children: coManager.phoneDisplay }) : null
1360
+ ] }, coManager.name))
1361
+ }
1362
+ )
1363
+ ] });
1364
+ }
1365
+ function formatMinor(minor, currency) {
1366
+ return new Intl.NumberFormat(void 0, { style: "currency", currency }).format(minor / 100);
1367
+ }
1368
+ function MoneySection({ data }) {
1369
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
1370
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": t("chrome.shareView.money.eyebrow"), children: [
1371
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__eyebrow-row", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.money.eyebrow") }) }),
1372
+ /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "kf-share-view__card kf-share-view__money", children: [
1373
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__money-row", children: [
1374
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { children: t("chrome.shareView.money.total") }),
1375
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { className: "kf-num", children: formatMinor(data.totalMinor, data.currency) })
1376
+ ] }),
1377
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__money-row", children: [
1378
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { children: t("chrome.shareView.money.collected") }),
1379
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { className: "kf-num", children: formatMinor(data.collectedMinor, data.currency) })
1380
+ ] }),
1381
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__money-row kf-share-view__money-row--due", children: [
1382
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { children: t("chrome.shareView.money.due") }),
1383
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { className: "kf-num", children: formatMinor(data.dueMinor, data.currency) })
1384
+ ] })
1385
+ ] })
1386
+ ] });
1387
+ }
1388
+ var ITEM_TYPE_ICON = chunkEM7JV3D7_cjs.createRegistry({
1389
+ fallback: () => /* @__PURE__ */ jsxRuntime.jsx(CompassIcon, {})
1390
+ });
1391
+ ITEM_TYPE_ICON.register("FLIGHT", () => /* @__PURE__ */ jsxRuntime.jsx(PlaneIcon, {}));
1392
+ ITEM_TYPE_ICON.register("TRANSPORT", () => /* @__PURE__ */ jsxRuntime.jsx(CarIcon, {}));
1393
+ ITEM_TYPE_ICON.register("ACCOMMODATION", () => /* @__PURE__ */ jsxRuntime.jsx(HouseIcon, {}));
1394
+ ITEM_TYPE_ICON.register("STAY", () => /* @__PURE__ */ jsxRuntime.jsx(HouseIcon, {}));
1395
+ function pickNextItem(itinerary) {
1396
+ const todayIndex = itinerary.days.findIndex((day) => day.isToday);
1397
+ if (todayIndex !== -1) {
1398
+ const today = itinerary.days[todayIndex];
1399
+ if (today !== void 0) {
1400
+ const nowItem = today.items.find((item) => item.timeState === "now");
1401
+ if (nowItem !== void 0) {
1402
+ return nowItem;
1403
+ }
1404
+ const upcomingItem = today.items.find((item) => item.timeState === "upcoming");
1405
+ if (upcomingItem !== void 0) {
1406
+ return upcomingItem;
1407
+ }
1408
+ }
1409
+ for (let index = todayIndex + 1; index < itinerary.days.length; index += 1) {
1410
+ const day = itinerary.days[index];
1411
+ const firstItem = day?.items[0];
1412
+ if (firstItem !== void 0) {
1413
+ return firstItem;
1414
+ }
1415
+ }
1416
+ return void 0;
1417
+ }
1418
+ for (const day of itinerary.days) {
1419
+ const firstItem = day.items[0];
1420
+ if (firstItem !== void 0) {
1421
+ return firstItem;
1422
+ }
1423
+ }
1424
+ return void 0;
1425
+ }
1426
+ function NextUpBanner({ itinerary, timezone }) {
1427
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
1428
+ const item = pickNextItem(itinerary);
1429
+ if (item === void 0) {
1430
+ return null;
1431
+ }
1432
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "kf-share-view__next-up", "aria-label": t("chrome.shareView.nextUp.ariaLabel"), children: [
1433
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__next-up-icon", "aria-hidden": "true", children: ITEM_TYPE_ICON.resolve(item.type)() }),
1434
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__next-up-body", children: [
1435
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__next-up-title", children: item.title }),
1436
+ item.startTime !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__next-up-time kf-num", children: formatTimeOfDay(item.startTime, timezone) }) : null
1437
+ ] })
1438
+ ] });
1439
+ }
1440
+ function deriveBookingState(startAt, endAt, serverTime) {
1441
+ if (serverTime === void 0) {
1442
+ return null;
1443
+ }
1444
+ const now = new Date(serverTime).getTime();
1445
+ const start = new Date(startAt).getTime();
1446
+ const end = endAt !== null ? new Date(endAt).getTime() : start;
1447
+ if (now < start) {
1448
+ return "upcoming";
1449
+ }
1450
+ if (now > end) {
1451
+ return "done";
1452
+ }
1453
+ return "now";
1454
+ }
1455
+ var STATE_LABEL_KEY = {
1456
+ done: "chrome.shareView.stay.state.done",
1457
+ now: "chrome.shareView.plan.now",
1458
+ upcoming: "chrome.shareView.stay.state.upcoming"
1459
+ };
1460
+ function dayLabel(t, n) {
1461
+ return t("chrome.shareView.dayLabel").replace("{n}", String(n));
1462
+ }
1463
+ var ROW_ICON = chunkEM7JV3D7_cjs.createRegistry({ fallback: () => /* @__PURE__ */ jsxRuntime.jsx(CompassIcon, {}) });
1464
+ ROW_ICON.register("transport", () => /* @__PURE__ */ jsxRuntime.jsx(CarIcon, {}));
1465
+ ROW_ICON.register("stay", () => /* @__PURE__ */ jsxRuntime.jsx(HouseIcon, {}));
1466
+ ROW_ICON.register("activity", () => /* @__PURE__ */ jsxRuntime.jsx(CompassIcon, {}));
1467
+ ROW_ICON.register("rooming", () => /* @__PURE__ */ jsxRuntime.jsx(BedIcon, {}));
1468
+ ROW_ICON.register("pickup", () => /* @__PURE__ */ jsxRuntime.jsx(PinIcon, {}));
1469
+ ROW_ICON.register("vehicle", () => /* @__PURE__ */ jsxRuntime.jsx(CarIcon, {}));
1470
+ function mergeDayBookings(section, kind, typeLabel, timezone, serverTime, t) {
1471
+ if (section === void 0) {
1472
+ return [];
1473
+ }
1474
+ const rows = [];
1475
+ for (const day of section.days) {
1476
+ for (const item of day.items) {
1477
+ const whenLabel = item.endAt !== null ? `${formatDayMonth(item.startAt, timezone)} \u2192 ${formatDayMonth(item.endAt, timezone)}` : formatDayMonth(item.startAt, timezone);
1478
+ const state = deriveBookingState(item.startAt, item.endAt, serverTime);
1479
+ const eyebrow = `${typeLabel} \xB7 ${dayLabel(t, item.dayIndex + 1)}${state !== null ? ` \xB7 ${t(STATE_LABEL_KEY[state])}` : ""}`;
1480
+ rows.push({
1481
+ key: item.bookingId,
1482
+ sortKey: item.dayIndex,
1483
+ dayEnd: item.dayIndex,
1484
+ kind,
1485
+ eyebrow,
1486
+ title: item.title,
1487
+ whenLabel: t("chrome.shareView.stay.when").replace("{when}", whenLabel),
1488
+ locationText: item.locationText
1489
+ });
1490
+ }
1491
+ }
1492
+ return rows;
1493
+ }
1494
+ function dayRangeLabel(assignment, t) {
1495
+ return assignment.startDayIndex === assignment.endDayIndex ? dayLabel(t, assignment.startDayIndex + 1) : t("chrome.shareView.dayRangeLabel").replace("{start}", String(assignment.startDayIndex + 1)).replace("{end}", String(assignment.endDayIndex + 1));
1496
+ }
1497
+ function mergeRooming(section, t) {
1498
+ if (section === void 0) {
1499
+ return [];
1500
+ }
1501
+ return section.assignments.map((assignment) => {
1502
+ const roomLabel = t("chrome.shareView.stay.room").replace("{room}", assignment.room);
1503
+ const roomBed = assignment.bed !== null ? t("chrome.shareView.stay.roomBed").replace("{room}", assignment.room).replace("{bed}", assignment.bed) : roomLabel;
1504
+ return {
1505
+ key: assignment.stayWindowId,
1506
+ sortKey: assignment.startDayIndex,
1507
+ dayEnd: assignment.endDayIndex,
1508
+ kind: "rooming",
1509
+ eyebrow: `${t("chrome.shareView.stay.rooming")} \xB7 ${dayRangeLabel(assignment, t)}`,
1510
+ title: assignment.label !== "" ? assignment.label : roomLabel,
1511
+ whenLabel: roomBed,
1512
+ locationText: assignment.roommates.length > 0 ? t("chrome.shareView.stay.with").replace("{names}", assignment.roommates.join(", ")) : null
1513
+ };
1514
+ });
1515
+ }
1516
+ var PICKUP_KIND_LABEL_KEY = {
1517
+ PICKUP: "chrome.shareView.stay.pickup.kind.pickup",
1518
+ DROP: "chrome.shareView.stay.pickup.kind.drop"
1519
+ };
1520
+ var PICKUP_STATUS_LABEL_KEY = {
1521
+ PENDING: "chrome.shareView.stay.pickup.status.pending",
1522
+ BOARDED: "chrome.shareView.stay.pickup.status.boarded",
1523
+ NO_SHOW: "chrome.shareView.stay.pickup.status.noShow"
1524
+ };
1525
+ function pickupRow(stop, index, timezone, t) {
1526
+ const kindLabel = PICKUP_KIND_LABEL_KEY[stop.kind];
1527
+ const statusLabel2 = PICKUP_STATUS_LABEL_KEY[stop.status];
1528
+ return {
1529
+ key: `pickup-${String(index)}`,
1530
+ sortKey: Number.POSITIVE_INFINITY,
1531
+ dayEnd: Number.POSITIVE_INFINITY,
1532
+ kind: "pickup",
1533
+ eyebrow: `${kindLabel !== void 0 ? t(kindLabel) : stop.kind} \xB7 ${statusLabel2 !== void 0 ? t(statusLabel2) : stop.status}`,
1534
+ title: stop.point,
1535
+ whenLabel: formatTimeOfDay(stop.time, timezone),
1536
+ locationText: stop.locationLabel
1537
+ };
1538
+ }
1539
+ function StayAndTransportSection({
1540
+ accommodation,
1541
+ transport,
1542
+ activities,
1543
+ rooming,
1544
+ seating,
1545
+ pickup,
1546
+ timezone,
1547
+ selectedDayIndex,
1548
+ serverTime
1549
+ }) {
1550
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
1551
+ const allDayRows = [
1552
+ ...mergeDayBookings(
1553
+ transport,
1554
+ "transport",
1555
+ t("chrome.shareView.stay.typeLabel.transport"),
1556
+ timezone,
1557
+ serverTime,
1558
+ t
1559
+ ),
1560
+ ...mergeDayBookings(
1561
+ accommodation,
1562
+ "stay",
1563
+ t("chrome.shareView.stay.typeLabel.stay"),
1564
+ timezone,
1565
+ serverTime,
1566
+ t
1567
+ ),
1568
+ ...mergeDayBookings(
1569
+ activities,
1570
+ "activity",
1571
+ t("chrome.shareView.stay.typeLabel.activity"),
1572
+ timezone,
1573
+ serverTime,
1574
+ t
1575
+ ),
1576
+ ...mergeRooming(rooming, t)
1577
+ ].sort((a, b) => a.sortKey - b.sortKey || a.key.localeCompare(b.key));
1578
+ const dayRows = selectedDayIndex === void 0 ? allDayRows : allDayRows.filter(
1579
+ (row) => row.sortKey <= selectedDayIndex && selectedDayIndex <= row.dayEnd
1580
+ );
1581
+ const rows = [
1582
+ ...dayRows,
1583
+ ...pickup?.stops.map((stop, index) => pickupRow(stop, index, timezone, t)) ?? []
1584
+ ];
1585
+ const hasVehicle = seating !== void 0;
1586
+ if (rows.length === 0 && !hasVehicle) {
1587
+ return null;
1588
+ }
1589
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": t("chrome.shareView.stay.eyebrow"), children: [
1590
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__eyebrow-row", children: [
1591
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.stay.eyebrow") }),
1592
+ selectedDayIndex !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: dayLabel(t, selectedDayIndex + 1) }) : null
1593
+ ] }),
1594
+ /* @__PURE__ */ jsxRuntime.jsxs("ul", { className: "kf-share-view__card kf-share-view__list", children: [
1595
+ hasVehicle && seating !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "kf-share-view__row kf-share-view__booking-row", children: [
1596
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__booking-icon", "aria-hidden": "true", children: ROW_ICON.resolve("vehicle")() }),
1597
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__booking-body", children: [
1598
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__booking-eyebrow kf-eyebrow", children: t("chrome.shareView.stay.vehicle") }),
1599
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__booking-title", children: seating.vehicle.regNo }),
1600
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "kf-share-view__booking-when", children: [
1601
+ seating.vehicle.label,
1602
+ " \xB7 ",
1603
+ seating.vehicle.regNo
1604
+ ] }),
1605
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__booking-when", children: t("chrome.shareView.stay.capacity").replace(
1606
+ "{n}",
1607
+ String(seating.vehicle.capacity)
1608
+ ) }),
1609
+ seating.vehicle.driver !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__booking-when", children: t("chrome.shareView.stay.driver").replace("{name}", seating.vehicle.driver.name) }) : null,
1610
+ seating.seat !== null && seating.seat !== void 0 || seating.vehicle.driver !== null && seating.vehicle.driver.phoneHref !== null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__booking-assignment", children: [
1611
+ seating.seat !== null && seating.seat !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__booking-when", children: t("chrome.shareView.stay.yourSeat").replace("{seat}", seating.seat) }) : null,
1612
+ seating.vehicle.driver !== null && seating.vehicle.driver.phoneHref !== null ? /* @__PURE__ */ jsxRuntime.jsxs(
1613
+ "a",
1614
+ {
1615
+ className: "kf-share-view__booking-driver-link",
1616
+ href: seating.vehicle.driver.phoneHref,
1617
+ children: [
1618
+ t("chrome.shareView.stay.callDriver"),
1619
+ seating.vehicle.driver.phoneDisplay !== null ? ` \xB7 ${seating.vehicle.driver.phoneDisplay}` : ""
1620
+ ]
1621
+ }
1622
+ ) : null
1623
+ ] }) : null
1624
+ ] })
1625
+ ] }) : null,
1626
+ rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "kf-share-view__row kf-share-view__booking-row", children: [
1627
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view__booking-icon", "aria-hidden": "true", children: ROW_ICON.resolve(row.kind)() }),
1628
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__booking-body", children: [
1629
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__booking-eyebrow kf-eyebrow", children: row.eyebrow }),
1630
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__booking-title", children: row.title }),
1631
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__booking-when", children: row.whenLabel }),
1632
+ row.locationText !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "kf-share-view__booking-when", children: row.locationText }) : null
1633
+ ] })
1634
+ ] }, row.key))
1635
+ ] })
1636
+ ] });
1637
+ }
1638
+ function TodayPlanSection({ itinerary, timezone }) {
1639
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
1640
+ const today = itinerary.days.find((day) => day.isToday);
1641
+ if (today === void 0 || today.items.length === 0) {
1642
+ return null;
1643
+ }
1644
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { "aria-label": t("chrome.shareView.today.eyebrow"), children: [
1645
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view__eyebrow-row", children: [
1646
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.today.eyebrow") }),
1647
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-eyebrow", children: t("chrome.shareView.dayLabel").replace("{n}", String(today.dayIndex + 1)) })
1648
+ ] }),
1649
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "kf-share-view__card kf-share-view__list", children: today.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
1650
+ "li",
1651
+ {
1652
+ className: `kf-share-view__row kf-share-view__plan-row kf-share-view__plan-row--${item.timeState}`,
1653
+ children: [
1654
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__plan-time kf-num", children: item.timeState === "now" ? t("chrome.shareView.plan.now") : item.startTime !== null ? formatTimeOfDay(item.startTime, timezone) : "" }),
1655
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "kf-share-view__plan-title", children: item.title })
1656
+ ]
1657
+ },
1658
+ item.id
1659
+ )) })
1660
+ ] });
1661
+ }
1662
+ function isVisible(key, overrides) {
1663
+ return overrides?.[key] !== false;
1664
+ }
1665
+ function KaafilShareView(props) {
1666
+ const session = chunkEM7JV3D7_cjs.useSession();
1667
+ if (session.status !== "authenticated") {
1668
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view", "data-kf-family": "traveller", children: /* @__PURE__ */ jsxRuntime.jsx(ShareSkeleton, {}) });
1669
+ }
1670
+ return /* @__PURE__ */ jsxRuntime.jsx(ReadyKaafilShareView, { ...props });
1671
+ }
1672
+ function ReadyKaafilShareView({
1673
+ token,
1674
+ travellerRef,
1675
+ headStrategy = "own-page",
1676
+ sections: sectionOverrides,
1677
+ household: householdProp,
1678
+ renderSection,
1679
+ style
1680
+ }) {
1681
+ const { t } = chunkEM7JV3D7_cjs.useKaafilChrome();
1682
+ const snapshot = chunkVHTSTUCJ_cjs.useShareSnapshot(token, { travellerRef });
1683
+ const [householdSheetOpen, setHouseholdSheetOpen] = react.useState(false);
1684
+ const [chosenDayIndex, setChosenDayIndex] = react.useState(-1);
1685
+ const itinerary = snapshot.sections.get("itinerary");
1686
+ const rooming = isVisible("rooming", sectionOverrides) ? snapshot.sections.get("rooming") : void 0;
1687
+ const seating = isVisible("seating", sectionOverrides) ? snapshot.sections.get("seating") : void 0;
1688
+ const pickup = isVisible("pickup", sectionOverrides) ? snapshot.sections.get("pickup") : void 0;
1689
+ const accommodation = isVisible("accommodation", sectionOverrides) ? snapshot.sections.get("accommodation") : void 0;
1690
+ const transport = isVisible("transport", sectionOverrides) ? snapshot.sections.get("transport") : void 0;
1691
+ const activities = isVisible("activities", sectionOverrides) ? snapshot.sections.get("activities") : void 0;
1692
+ const checklists = snapshot.sections.get("checklists");
1693
+ const documents = snapshot.sections.get("documents");
1694
+ const money = snapshot.sections.get("money");
1695
+ const managerContact = snapshot.sections.get("managerContact");
1696
+ const agencyContact = snapshot.sections.get("agencyContact");
1697
+ const household = snapshot.sections.get("household");
1698
+ const tripStatus = react.useMemo(
1699
+ () => snapshot.trip !== void 0 ? deriveTripStatus(snapshot.trip, itinerary, snapshot.serverTime, t) : void 0,
1700
+ [snapshot.trip, itinerary, snapshot.serverTime, t]
1701
+ );
1702
+ const rootStyle = chunkEM7JV3D7_cjs.tokenStyle(style);
1703
+ if (snapshot.status === "loading") {
1704
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view", "data-kf-family": "traveller", style: rootStyle, children: /* @__PURE__ */ jsxRuntime.jsx(ShareSkeleton, {}) });
1705
+ }
1706
+ if (snapshot.status === "expired" || snapshot.status === "revoked") {
1707
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view", "data-kf-family": "traveller", style: rootStyle, children: /* @__PURE__ */ jsxRuntime.jsx(ShareEndedScreen, { reason: "ended" }) });
1708
+ }
1709
+ if (snapshot.status === "not-found" || snapshot.trip === void 0 || tripStatus === void 0) {
1710
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "kf-share-view", "data-kf-family": "traveller", style: rootStyle, children: /* @__PURE__ */ jsxRuntime.jsx(ShareEndedScreen, { reason: "not-found" }) });
1711
+ }
1712
+ const timezone = snapshot.trip.timezone;
1713
+ const tripName = snapshot.trip.name;
1714
+ const householdLabel = household?.partyLabel ?? householdProp?.label ?? null;
1715
+ const householdTravellers = household?.travellers ?? householdProp?.travellers?.map((entry) => ({ ...entry, isSubject: false })) ?? [];
1716
+ const householdNames = householdTravellers.map((traveller) => traveller.firstName).join(" & ");
1717
+ const showHousehold = isVisible("household", sectionOverrides) && (householdTravellers.length > 0 || householdLabel !== null);
1718
+ const showItinerary = isVisible("itinerary", sectionOverrides) && itinerary !== void 0;
1719
+ const todayDayIndex = itinerary?.days.findIndex((day) => day.isToday) ?? -1;
1720
+ const selectedDayIndex = chosenDayIndex !== -1 ? chosenDayIndex : todayDayIndex !== -1 ? todayDayIndex : 0;
1721
+ const showStayAndTransport = accommodation !== void 0 || transport !== void 0 || activities !== void 0 || rooming !== void 0 || seating !== void 0 || pickup !== void 0;
1722
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "kf-share-view", "data-kf-family": "traveller", style: rootStyle, children: [
1723
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkVHTSTUCJ_cjs.BrandShell, { headStrategy, appName: tripName, children: [
1724
+ agencyContact !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1725
+ BrandHeaderSection,
1726
+ {
1727
+ agencyContact,
1728
+ partyKind: household?.partyKind ?? null
1729
+ }
1730
+ ) : null,
1731
+ showHousehold ? (renderSection?.household ?? (() => /* @__PURE__ */ jsxRuntime.jsx(HouseholdBanner, { label: householdLabel, names: householdNames })))(household) : null,
1732
+ /* @__PURE__ */ jsxRuntime.jsx(
1733
+ HeroSection,
1734
+ {
1735
+ tripName,
1736
+ status: tripStatus,
1737
+ travellers: householdTravellers,
1738
+ onOpenHousehold: householdTravellers.length > 0 ? () => setHouseholdSheetOpen(true) : void 0
1739
+ }
1740
+ ),
1741
+ showItinerary && itinerary !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(NextUpBanner, { itinerary, timezone }) : null,
1742
+ showItinerary && itinerary !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(TodayPlanSection, { itinerary, timezone }) : null,
1743
+ isVisible("managerContact", sectionOverrides) && managerContact !== void 0 ? (renderSection?.managerContact ?? (() => /* @__PURE__ */ jsxRuntime.jsx(ManagerContactSection, { data: managerContact })))(managerContact) : null,
1744
+ showItinerary && itinerary !== void 0 ? (renderSection?.itinerary ?? (() => /* @__PURE__ */ jsxRuntime.jsx(
1745
+ ItineraryDayStrip,
1746
+ {
1747
+ itinerary,
1748
+ timezone,
1749
+ selectedIndex: selectedDayIndex,
1750
+ onSelectIndex: setChosenDayIndex
1751
+ }
1752
+ )))(itinerary) : null,
1753
+ showStayAndTransport ? /* @__PURE__ */ jsxRuntime.jsx(
1754
+ StayAndTransportSection,
1755
+ {
1756
+ accommodation,
1757
+ transport,
1758
+ activities,
1759
+ rooming,
1760
+ seating,
1761
+ pickup,
1762
+ timezone,
1763
+ selectedDayIndex: showItinerary ? selectedDayIndex : void 0,
1764
+ serverTime: snapshot.serverTime
1765
+ }
1766
+ ) : null,
1767
+ isVisible("checklists", sectionOverrides) && checklists !== void 0 ? (renderSection?.checklists ?? (() => /* @__PURE__ */ jsxRuntime.jsx(ChecklistSection, { data: checklists })))(
1768
+ checklists
1769
+ ) : null,
1770
+ isVisible("documents", sectionOverrides) && documents !== void 0 ? (renderSection?.documents ?? (() => /* @__PURE__ */ jsxRuntime.jsx(DocumentsSection, { data: documents, timezone })))(documents) : null,
1771
+ isVisible("money", sectionOverrides) && money !== void 0 ? (renderSection?.money ?? (() => /* @__PURE__ */ jsxRuntime.jsx(MoneySection, { data: money })))(money) : null,
1772
+ isVisible("agencyContact", sectionOverrides) && agencyContact !== void 0 ? (renderSection?.agencyContact ?? (() => /* @__PURE__ */ jsxRuntime.jsx(AgencyContactSection, { data: agencyContact })))(
1773
+ agencyContact
1774
+ ) : null,
1775
+ isVisible("forms", sectionOverrides) ? (renderSection?.forms ?? (() => /* @__PURE__ */ jsxRuntime.jsx(FormsSection, { token, travellerRef })))(void 0) : null
1776
+ ] }),
1777
+ /* @__PURE__ */ jsxRuntime.jsx(
1778
+ HouseholdSheet,
1779
+ {
1780
+ open: householdSheetOpen,
1781
+ onClose: () => setHouseholdSheetOpen(false),
1782
+ label: householdLabel,
1783
+ travellers: householdTravellers
1784
+ }
1785
+ )
1786
+ ] });
1787
+ }
1788
+
1789
+ Object.defineProperty(exports, "BootErrorScreen", {
1790
+ enumerable: true,
1791
+ get: function () { return chunkACVU55PZ_cjs.BootErrorScreen; }
1792
+ });
1793
+ Object.defineProperty(exports, "OfflineFallbackScreen", {
1794
+ enumerable: true,
1795
+ get: function () { return chunkACVU55PZ_cjs.OfflineFallbackScreen; }
1796
+ });
1797
+ exports.KaafilShareView = KaafilShareView;
1798
+ //# sourceMappingURL=index.cjs.map
1799
+ //# sourceMappingURL=index.cjs.map