@curless/hotel-storefront 0.85.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/dist/server.d.ts +1 -1
  2. package/dist/server.js +1 -1
  3. package/dist/tools/accept-terms.d.ts +4 -0
  4. package/dist/tools/accept-terms.d.ts.map +1 -0
  5. package/dist/tools/accept-terms.js +26 -0
  6. package/dist/tools/accept-terms.js.map +1 -0
  7. package/dist/tools/add-booking-addon.d.ts +4 -0
  8. package/dist/tools/add-booking-addon.d.ts.map +1 -0
  9. package/dist/tools/add-booking-addon.js +44 -0
  10. package/dist/tools/add-booking-addon.js.map +1 -0
  11. package/dist/tools/add-to-trip.d.ts +4 -0
  12. package/dist/tools/add-to-trip.d.ts.map +1 -0
  13. package/dist/tools/add-to-trip.js +49 -0
  14. package/dist/tools/add-to-trip.js.map +1 -0
  15. package/dist/tools/all-tools.d.ts +19124 -0
  16. package/dist/tools/all-tools.d.ts.map +1 -0
  17. package/dist/tools/all-tools.js +43 -0
  18. package/dist/tools/all-tools.js.map +1 -0
  19. package/dist/tools/answer.d.ts +3 -0
  20. package/dist/tools/answer.d.ts.map +1 -0
  21. package/dist/tools/answer.js +104 -0
  22. package/dist/tools/answer.js.map +1 -0
  23. package/dist/tools/args.d.ts +149 -0
  24. package/dist/tools/args.d.ts.map +1 -0
  25. package/dist/tools/args.js +176 -0
  26. package/dist/tools/args.js.map +1 -0
  27. package/dist/tools/base-output-schemas.d.ts +3 -0
  28. package/dist/tools/base-output-schemas.d.ts.map +1 -0
  29. package/dist/tools/base-output-schemas.js +396 -0
  30. package/dist/tools/base-output-schemas.js.map +1 -0
  31. package/dist/tools/book-picked.d.ts +4 -0
  32. package/dist/tools/book-picked.d.ts.map +1 -0
  33. package/dist/tools/book-picked.js +14 -0
  34. package/dist/tools/book-picked.js.map +1 -0
  35. package/dist/tools/booking-answer.d.ts +24 -0
  36. package/dist/tools/booking-answer.d.ts.map +1 -0
  37. package/dist/tools/booking-answer.js +567 -0
  38. package/dist/tools/booking-answer.js.map +1 -0
  39. package/dist/tools/buy-shop-item.d.ts +4 -0
  40. package/dist/tools/buy-shop-item.d.ts.map +1 -0
  41. package/dist/tools/buy-shop-item.js +45 -0
  42. package/dist/tools/buy-shop-item.js.map +1 -0
  43. package/dist/tools/call.d.ts +11 -0
  44. package/dist/tools/call.d.ts.map +1 -0
  45. package/dist/tools/call.js +2 -0
  46. package/dist/tools/call.js.map +1 -0
  47. package/dist/tools/cancel-facts.d.ts +281 -0
  48. package/dist/tools/cancel-facts.d.ts.map +1 -0
  49. package/dist/tools/cancel-facts.js +309 -0
  50. package/dist/tools/cancel-facts.js.map +1 -0
  51. package/dist/tools/cancel.d.ts +4 -0
  52. package/dist/tools/cancel.d.ts.map +1 -0
  53. package/dist/tools/cancel.js +415 -0
  54. package/dist/tools/cancel.js.map +1 -0
  55. package/dist/tools/capability-adjust.d.ts +31 -0
  56. package/dist/tools/capability-adjust.d.ts.map +1 -0
  57. package/dist/tools/capability-adjust.js +299 -0
  58. package/dist/tools/capability-adjust.js.map +1 -0
  59. package/dist/tools/card-addons.d.ts +4 -0
  60. package/dist/tools/card-addons.d.ts.map +1 -0
  61. package/dist/tools/card-addons.js +76 -0
  62. package/dist/tools/card-addons.js.map +1 -0
  63. package/dist/tools/change-booking.d.ts +4 -0
  64. package/dist/tools/change-booking.d.ts.map +1 -0
  65. package/dist/tools/change-booking.js +145 -0
  66. package/dist/tools/change-booking.js.map +1 -0
  67. package/dist/tools/clear-trip.d.ts +4 -0
  68. package/dist/tools/clear-trip.d.ts.map +1 -0
  69. package/dist/tools/clear-trip.js +10 -0
  70. package/dist/tools/clear-trip.js.map +1 -0
  71. package/dist/tools/compare.d.ts +4 -0
  72. package/dist/tools/compare.d.ts.map +1 -0
  73. package/dist/tools/compare.js +114 -0
  74. package/dist/tools/compare.js.map +1 -0
  75. package/dist/tools/current-trip.d.ts +70 -0
  76. package/dist/tools/current-trip.d.ts.map +1 -0
  77. package/dist/tools/current-trip.js +269 -0
  78. package/dist/tools/current-trip.js.map +1 -0
  79. package/dist/tools/deps.d.ts +229 -0
  80. package/dist/tools/deps.d.ts.map +1 -0
  81. package/dist/tools/deps.js +2 -0
  82. package/dist/tools/deps.js.map +1 -0
  83. package/dist/tools/follow-ups.d.ts +120 -0
  84. package/dist/tools/follow-ups.d.ts.map +1 -0
  85. package/dist/tools/follow-ups.js +369 -0
  86. package/dist/tools/follow-ups.js.map +1 -0
  87. package/dist/tools/forget-preferences.d.ts +4 -0
  88. package/dist/tools/forget-preferences.d.ts.map +1 -0
  89. package/dist/tools/forget-preferences.js +24 -0
  90. package/dist/tools/forget-preferences.js.map +1 -0
  91. package/dist/tools/get-hotel.d.ts +4 -0
  92. package/dist/tools/get-hotel.d.ts.map +1 -0
  93. package/dist/tools/get-hotel.js +350 -0
  94. package/dist/tools/get-hotel.js.map +1 -0
  95. package/dist/tools/hotel-choices.d.ts +132 -0
  96. package/dist/tools/hotel-choices.d.ts.map +1 -0
  97. package/dist/tools/hotel-choices.js +587 -0
  98. package/dist/tools/hotel-choices.js.map +1 -0
  99. package/dist/tools/itinerary.d.ts +4 -0
  100. package/dist/tools/itinerary.d.ts.map +1 -0
  101. package/dist/tools/itinerary.js +158 -0
  102. package/dist/tools/itinerary.js.map +1 -0
  103. package/dist/tools/list-booking-addons.d.ts +4 -0
  104. package/dist/tools/list-booking-addons.d.ts.map +1 -0
  105. package/dist/tools/list-booking-addons.js +21 -0
  106. package/dist/tools/list-booking-addons.js.map +1 -0
  107. package/dist/tools/list-bookings.d.ts +4 -0
  108. package/dist/tools/list-bookings.d.ts.map +1 -0
  109. package/dist/tools/list-bookings.js +119 -0
  110. package/dist/tools/list-bookings.js.map +1 -0
  111. package/dist/tools/list-extras.d.ts +4 -0
  112. package/dist/tools/list-extras.d.ts.map +1 -0
  113. package/dist/tools/list-extras.js +90 -0
  114. package/dist/tools/list-extras.js.map +1 -0
  115. package/dist/tools/list-hotels-ask.d.ts +133 -0
  116. package/dist/tools/list-hotels-ask.d.ts.map +1 -0
  117. package/dist/tools/list-hotels-ask.js +326 -0
  118. package/dist/tools/list-hotels-ask.js.map +1 -0
  119. package/dist/tools/list-hotels-empty.d.ts +5 -0
  120. package/dist/tools/list-hotels-empty.d.ts.map +1 -0
  121. package/dist/tools/list-hotels-empty.js +130 -0
  122. package/dist/tools/list-hotels-empty.js.map +1 -0
  123. package/dist/tools/list-hotels-home.d.ts +9 -0
  124. package/dist/tools/list-hotels-home.d.ts.map +1 -0
  125. package/dist/tools/list-hotels-home.js +181 -0
  126. package/dist/tools/list-hotels-home.js.map +1 -0
  127. package/dist/tools/list-hotels-page.d.ts +43 -0
  128. package/dist/tools/list-hotels-page.d.ts.map +1 -0
  129. package/dist/tools/list-hotels-page.js +344 -0
  130. package/dist/tools/list-hotels-page.js.map +1 -0
  131. package/dist/tools/list-hotels.d.ts +4 -0
  132. package/dist/tools/list-hotels.d.ts.map +1 -0
  133. package/dist/tools/list-hotels.js +24 -0
  134. package/dist/tools/list-hotels.js.map +1 -0
  135. package/dist/tools/list-shop-items.d.ts +4 -0
  136. package/dist/tools/list-shop-items.d.ts.map +1 -0
  137. package/dist/tools/list-shop-items.js +34 -0
  138. package/dist/tools/list-shop-items.js.map +1 -0
  139. package/dist/tools/list-shop-orders.d.ts +4 -0
  140. package/dist/tools/list-shop-orders.d.ts.map +1 -0
  141. package/dist/tools/list-shop-orders.js +22 -0
  142. package/dist/tools/list-shop-orders.js.map +1 -0
  143. package/dist/tools/look-up.d.ts +4 -0
  144. package/dist/tools/look-up.d.ts.map +1 -0
  145. package/dist/tools/look-up.js +207 -0
  146. package/dist/tools/look-up.js.map +1 -0
  147. package/dist/tools/output-schemas.d.ts +645 -0
  148. package/dist/tools/output-schemas.d.ts.map +1 -0
  149. package/dist/tools/output-schemas.js +503 -0
  150. package/dist/tools/output-schemas.js.map +1 -0
  151. package/dist/tools/paid-lines.d.ts +718 -0
  152. package/dist/tools/paid-lines.d.ts.map +1 -0
  153. package/dist/tools/paid-lines.js +359 -0
  154. package/dist/tools/paid-lines.js.map +1 -0
  155. package/dist/tools/pay-with-union-pay.d.ts +4 -0
  156. package/dist/tools/pay-with-union-pay.d.ts.map +1 -0
  157. package/dist/tools/pay-with-union-pay.js +112 -0
  158. package/dist/tools/pay-with-union-pay.js.map +1 -0
  159. package/dist/tools/payment-words.d.ts +269 -0
  160. package/dist/tools/payment-words.d.ts.map +1 -0
  161. package/dist/tools/payment-words.js +365 -0
  162. package/dist/tools/payment-words.js.map +1 -0
  163. package/dist/tools/pick-room.d.ts +4 -0
  164. package/dist/tools/pick-room.d.ts.map +1 -0
  165. package/dist/tools/pick-room.js +23 -0
  166. package/dist/tools/pick-room.js.map +1 -0
  167. package/dist/tools/policies.d.ts +4 -0
  168. package/dist/tools/policies.d.ts.map +1 -0
  169. package/dist/tools/policies.js +74 -0
  170. package/dist/tools/policies.js.map +1 -0
  171. package/dist/tools/pricing.d.ts +55 -0
  172. package/dist/tools/pricing.d.ts.map +1 -0
  173. package/dist/tools/pricing.js +260 -0
  174. package/dist/tools/pricing.js.map +1 -0
  175. package/dist/tools/put-room-line.d.ts +12 -0
  176. package/dist/tools/put-room-line.d.ts.map +1 -0
  177. package/dist/tools/put-room-line.js +347 -0
  178. package/dist/tools/put-room-line.js.map +1 -0
  179. package/dist/tools/quote-card.d.ts +234 -0
  180. package/dist/tools/quote-card.d.ts.map +1 -0
  181. package/dist/tools/quote-card.js +375 -0
  182. package/dist/tools/quote-card.js.map +1 -0
  183. package/dist/tools/refund-booking.d.ts +4 -0
  184. package/dist/tools/refund-booking.d.ts.map +1 -0
  185. package/dist/tools/refund-booking.js +112 -0
  186. package/dist/tools/refund-booking.js.map +1 -0
  187. package/dist/tools/request-booking.d.ts +4 -0
  188. package/dist/tools/request-booking.d.ts.map +1 -0
  189. package/dist/tools/request-booking.js +5 -0
  190. package/dist/tools/request-booking.js.map +1 -0
  191. package/dist/tools/request-words.d.ts +238 -0
  192. package/dist/tools/request-words.d.ts.map +1 -0
  193. package/dist/tools/request-words.js +487 -0
  194. package/dist/tools/request-words.js.map +1 -0
  195. package/dist/tools/room-choices.d.ts +64 -0
  196. package/dist/tools/room-choices.d.ts.map +1 -0
  197. package/dist/tools/room-choices.js +374 -0
  198. package/dist/tools/room-choices.js.map +1 -0
  199. package/dist/tools/session-notes.d.ts +164 -0
  200. package/dist/tools/session-notes.d.ts.map +1 -0
  201. package/dist/tools/session-notes.js +412 -0
  202. package/dist/tools/session-notes.js.map +1 -0
  203. package/dist/tools/sign-in.d.ts +4 -0
  204. package/dist/tools/sign-in.d.ts.map +1 -0
  205. package/dist/tools/sign-in.js +72 -0
  206. package/dist/tools/sign-in.js.map +1 -0
  207. package/dist/tools/sign-out.d.ts +4 -0
  208. package/dist/tools/sign-out.d.ts.map +1 -0
  209. package/dist/tools/sign-out.js +13 -0
  210. package/dist/tools/sign-out.js.map +1 -0
  211. package/dist/tools/terms-answer.d.ts +114 -0
  212. package/dist/tools/terms-answer.d.ts.map +1 -0
  213. package/dist/tools/terms-answer.js +492 -0
  214. package/dist/tools/terms-answer.js.map +1 -0
  215. package/dist/tools/tool-defs-account.d.ts +80 -0
  216. package/dist/tools/tool-defs-account.d.ts.map +1 -0
  217. package/dist/tools/tool-defs-account.js +65 -0
  218. package/dist/tools/tool-defs-account.js.map +1 -0
  219. package/dist/tools/tool-defs-addons.d.ts +251 -0
  220. package/dist/tools/tool-defs-addons.d.ts.map +1 -0
  221. package/dist/tools/tool-defs-addons.js +198 -0
  222. package/dist/tools/tool-defs-addons.js.map +1 -0
  223. package/dist/tools/tool-defs-booking.d.ts +410 -0
  224. package/dist/tools/tool-defs-booking.d.ts.map +1 -0
  225. package/dist/tools/tool-defs-booking.js +285 -0
  226. package/dist/tools/tool-defs-booking.js.map +1 -0
  227. package/dist/tools/tool-defs-browse.d.ts +444 -0
  228. package/dist/tools/tool-defs-browse.d.ts.map +1 -0
  229. package/dist/tools/tool-defs-browse.js +307 -0
  230. package/dist/tools/tool-defs-browse.js.map +1 -0
  231. package/dist/tools/tool-defs-trip.d.ts +136 -0
  232. package/dist/tools/tool-defs-trip.d.ts.map +1 -0
  233. package/dist/tools/tool-defs-trip.js +79 -0
  234. package/dist/tools/tool-defs-trip.js.map +1 -0
  235. package/dist/tools/tool-env.d.ts +64 -0
  236. package/dist/tools/tool-env.d.ts.map +1 -0
  237. package/dist/tools/tool-env.js +49 -0
  238. package/dist/tools/tool-env.js.map +1 -0
  239. package/dist/tools/tool-set.d.ts +1425 -0
  240. package/dist/tools/tool-set.d.ts.map +1 -0
  241. package/dist/tools/tool-set.js +244 -0
  242. package/dist/tools/tool-set.js.map +1 -0
  243. package/dist/tools/view-trip.d.ts +4 -0
  244. package/dist/tools/view-trip.d.ts.map +1 -0
  245. package/dist/tools/view-trip.js +7 -0
  246. package/dist/tools/view-trip.js.map +1 -0
  247. package/dist/tools.d.ts +13 -2089
  248. package/dist/tools.d.ts.map +1 -1
  249. package/dist/tools.js +11 -10685
  250. package/dist/tools.js.map +1 -1
  251. package/package.json +1 -1
@@ -0,0 +1,347 @@
1
+ import { clockOf, minutesOf, startProblem, windowWords } from '../hourly.js';
2
+ import { formatMoney, multiplyMoney } from '../money.js';
3
+ import { namedExactly, roomTypeNamed } from '../names.js';
4
+ import { MAX_ROOMS_PER_LINE, clampCount } from '../trip.js';
5
+ import { asStay, str, unset } from './args.js';
6
+ import { currentTrip } from './current-trip.js';
7
+ import { common } from './paid-lines.js';
8
+ import { couponOf } from './pricing.js';
9
+ import { withZh } from './quote-card.js';
10
+ import { groupNameOf, guestsOf, priceWords, waysOnWords, wholeStayWords } from './request-words.js';
11
+ import { identity } from './session-notes.js';
12
+ /**
13
+ * A room line, validated and priced against the hotel's calendar and put into
14
+ * one slot of the trip store - THE ONE ROOM-LINE CODE, for `add_to_trip` (`store`
15
+ * the trip's own key) and for the card's pick (`pick_room`, `store` its
16
+ * `pickedKey`). `key` is the conversation's trip key and keeps everything else:
17
+ * the member the price is worked out for, and every answer's `common`.
18
+ */
19
+ export const putRoomLine = async (deps, t, ctx, key, store, args, detail) => {
20
+ const hotelId = detail.hotel.id;
21
+ const roomRef = str(args.room);
22
+ if (!roomRef) {
23
+ return {
24
+ structured: { view: 'error', ...common(deps, key), error: 'no-room-named' },
25
+ text: `Say which room type, or which add-on. ${t.getHotel} with the dates lists the room types.`,
26
+ };
27
+ }
28
+ // A room by the hour: today, from the start the guest gave - checked here,
29
+ // against the starts the room takes, and never moved to fit (总线程,
30
+ // 2026-10-12).
31
+ const who = identity(deps, ctx, key);
32
+ const startTime = str(args.startTime);
33
+ const cx = { deps, ctx, key, store, args, detail, hotelId, roomRef, who, startTime };
34
+ const removed = await removeHeldLine(cx);
35
+ if (removed)
36
+ return removed;
37
+ const { today, byTheHour } = hourlyLookup(cx);
38
+ if (startTime && deps.backend.hourlyRooms)
39
+ return hourlyLine(cx, today, byTheHour);
40
+ const stay = asStay(args);
41
+ // ⚠️ NO DATES, NO LINE. Guessing "tonight" or "this weekend" here is how a
42
+ // connector books someone the wrong nights, and the guest finds out at the
43
+ // desk. The trip stays as it was and the answer asks.
44
+ if (!stay)
45
+ return needsDatesAnswer(cx, byTheHour);
46
+ // The backend owns the calendar - it knows each hotel's own timezone, and a
47
+ // second opinion computed from this process's clock would disagree with it
48
+ // for eight hours a day.
49
+ const dated = await deps.backend.getHotel(hotelId, stay, identity(deps, ctx, key));
50
+ if (!dated?.rooms)
51
+ return noRoomsOnDates(cx, dated);
52
+ const wanted = Math.max(1, clampCount(args.rooms ?? 1, MAX_ROOMS_PER_LINE));
53
+ const { room, took, type } = chooseRoom(dated.rooms, roomRef, stay, wanted);
54
+ if (!room)
55
+ return noSuchRoomAnswer(cx, dated.rooms, stay, wanted, type);
56
+ // Listed, not booked here - see `prepaidNotHere`.
57
+ if (room.notSoldHere) {
58
+ const open = dated.rooms.filter((r) => !r.notSoldHere && r.sleeps >= stay.guests && r.roomsLeft >= wanted);
59
+ return prepaidNotHere(cx, room, open, stay, 'for those nights', wanted);
60
+ }
61
+ deps.trips.set(store, {
62
+ kind: 'room',
63
+ hotelId,
64
+ roomId: room.id,
65
+ stay,
66
+ rooms: clampCount(args.rooms ?? 1, MAX_ROOMS_PER_LINE),
67
+ });
68
+ const now = await currentTrip(deps, key, identity(deps, ctx, key), store, couponOf(deps, args), ctx);
69
+ // Which rate was taken, in the structure too and in the same words - see
70
+ // the itinerary's `nudges` (2026-10-27 audit, F11).
71
+ return took
72
+ ? { ...now, structured: { ...now.structured, took }, text: `${took}\n${now.text}` }
73
+ : now;
74
+ };
75
+ /**
76
+ * A room taken out of the trip: the line in it that was asked about, when the count is 0.
77
+ * Nothing when the call is not that, or no such line is held.
78
+ */
79
+ const removeHeldLine = async ({ deps, ctx, key, store, args, hotelId, roomRef, who, startTime, }) => {
80
+ // ⚠️ TAKING A ROOM OUT NEEDS NO ROOM FOR SALE. The lookups below are of
81
+ // what is for sale, so a room that had gone since it went into the trip -
82
+ // the stay a booking could not make - could not be taken out of it
83
+ // (2026-10-14). Nor could a room by the hour once its window had passed:
84
+ // the start was checked against today's window first, and every line of a
85
+ // trip must be removable (2026-10-27 audit, F6). The line in the trip is the
86
+ // one asked about - by its nights, or a room by the hour by its start.
87
+ if (args.rooms !== undefined && clampCount(args.rooms, MAX_ROOMS_PER_LINE) === 0) {
88
+ const asked = asStay(args);
89
+ const start = startTime ? minutesOf(startTime) : undefined;
90
+ const held = deps.trips
91
+ .read(store)
92
+ .find((l) => l.kind === 'room' &&
93
+ l.hotelId === hotelId &&
94
+ l.roomId === roomRef &&
95
+ (l.hourly
96
+ ? start !== undefined &&
97
+ minutesOf(l.hourly.start) === start &&
98
+ (!asked || l.stay.checkIn === asked.checkIn)
99
+ : !!asked && l.stay.checkIn === asked.checkIn && l.stay.checkOut === asked.checkOut));
100
+ if (held) {
101
+ deps.trips.set(store, unset(held));
102
+ return currentTrip(deps, key, who, store, couponOf(deps, args), ctx);
103
+ }
104
+ }
105
+ return undefined;
106
+ };
107
+ // ⚠️ LISTED, NOT BOOKED HERE (robin, 2026-10-30): a rate paid in advance
108
+ // where this deployment takes no payment goes in no trip and no pick. The
109
+ // press on its Reserve - or the assistant asking for it - is answered with
110
+ // what is true and what is left: nothing booked, nothing charged; the rates
111
+ // here paid at the hotel, a press each; other dates; or the group itself.
112
+ // Never a review that fails at Book, after the guest typed their name.
113
+ // ONE ANSWER FOR A ROOM BY THE NIGHT AND A ROOM BY THE HOUR (2026-11-03
114
+ // review, C6): the hourly branch put such a room in the trip before this was
115
+ // asked, and the guest met the refusal at "Book".
116
+ const prepaidNotHere = ({ deps, key, detail, hotelId }, room, bookable, stay, when, wanted = 1) => {
117
+ const group = groupNameOf(deps, hotelId);
118
+ // ⚠️ "PAID AT THE HOTEL" ONLY OF RATES THAT ARE (0.77.5): beside them, a hotel may have rates
119
+ // paid in advance that are booked here without payment (`Room.paymentNotConnected`) - said
120
+ // as those, never listed as paid at the hotel, and left off the card's list of them.
121
+ const unpaid = bookable
122
+ .filter((r) => r.paymentNotConnected)
123
+ .sort((a, b) => a.stayTotal.minor - b.stayTotal.minor);
124
+ const open = bookable.filter((r) => r.payment !== 'prepaid');
125
+ // ⚠️ WITH THEIR PRICES, CHEAPEST FIRST, AND THE WAYS ON SAID (总线程 11-09,
126
+ // Manus on Huazhu): the names alone and "the other ways on" last, and the
127
+ // model told the guest only that the room could not be booked here.
128
+ const priced = [...open].sort((a, b) => a.stayTotal.minor - b.stayTotal.minor);
129
+ const price = (r) => r.hourly
130
+ ? priceWords(r, true)
131
+ : r.stayTotalUnquoted
132
+ ? `${formatMoney(r.nightly)} a night, ${wholeStayWords(r)}`
133
+ : wanted > 1
134
+ ? `${formatMoney(multiplyMoney(r.stayTotal, wanted))} for ${wanted} rooms, for the stay incl. taxes and fees`
135
+ : `${formatMoney(r.stayTotal)} for the stay incl. taxes and fees`;
136
+ const named = (rs) => rs
137
+ .map((r) => `${withZh(r.name, r.roomType ? r.roomType.names : r.names, true)} (\`${r.id}\`) - ${price(r)}`)
138
+ .join('; ');
139
+ const said = [
140
+ unpaid.length
141
+ ? `Nothing was booked or charged: ${room.name} is paid in advance, and here a rate paid in advance is booked only while it is free to cancel for at least another hour - this one is not.`
142
+ : `Nothing was booked or charged: ${room.name} is paid in advance, and a stay paid in advance cannot be booked here yet - only rates paid at the hotel can be.`,
143
+ priced.length
144
+ ? `Paid at the hotel at ${detail.hotel.name} ${when}, cheapest first: ${named(priced)}.`
145
+ : `No rate at ${detail.hotel.name} ${when} is paid at the hotel.`,
146
+ unpaid.length
147
+ ? `Paid in advance and booked here with nothing charged (payment is not connected here yet) at ${detail.hotel.name} ${when}, cheapest first: ${named(unpaid)}.`
148
+ : '',
149
+ `Tell the guest that nothing was booked, and ${waysOnWords(group, priced.length || unpaid.length
150
+ ? `the rates ${priced.length ? 'paid at the hotel' : 'booked here with nothing charged'}${priced.length && unpaid.length ? ' and those booked here with nothing charged' : ''} above, by name and price - one of them is booked here as any other room`
151
+ : undefined)}`,
152
+ ]
153
+ .filter(Boolean)
154
+ .join(' ');
155
+ return {
156
+ structured: {
157
+ view: 'error',
158
+ ...common(deps, key),
159
+ error: 'prepaid-not-here',
160
+ room: { id: room.id, name: room.name, ...(room.names ? { names: room.names } : {}) },
161
+ rooms: open.map((r) => ({
162
+ id: r.id,
163
+ name: r.name,
164
+ ...(r.names ? { names: r.names } : {}),
165
+ })),
166
+ hotel: {
167
+ id: detail.hotel.id,
168
+ name: detail.hotel.name,
169
+ ...(detail.hotel.names ? { names: detail.hotel.names } : {}),
170
+ },
171
+ stay,
172
+ group,
173
+ said,
174
+ },
175
+ text: said,
176
+ };
177
+ };
178
+ /** Today's rooms by the hour, asked for once - and the room named, among the ones sold by the hour. */
179
+ const hourlyLookup = ({ deps, args, hotelId, roomRef, who, startTime }) => {
180
+ const today = (startTime || !asStay(args)
181
+ ? deps.backend.hourlyRooms?.(hotelId, guestsOf(args), who)
182
+ : undefined);
183
+ const byTheHour = async () => {
184
+ const sold = ((await today)?.rooms ?? []).filter((r) => r.hourly);
185
+ return sold.find((r) => r.id === roomRef) ?? namedExactly(sold, roomRef);
186
+ };
187
+ return { today, byTheHour };
188
+ };
189
+ /** A room by the hour put into the trip, or why it cannot be. */
190
+ const hourlyLine = async (cx, today, byTheHour) => {
191
+ const { deps, ctx, key, store, args, detail, hotelId, roomRef, who, startTime } = cx;
192
+ const hourlyRoom = await byTheHour();
193
+ if (!hourlyRoom?.hourly) {
194
+ const sold = ((await today)?.rooms ?? []).filter((r) => r.hourly);
195
+ return {
196
+ structured: {
197
+ view: 'error',
198
+ ...common(deps, key),
199
+ error: 'no-such-room',
200
+ query: roomRef,
201
+ rooms: sold.map((r) => ({
202
+ id: r.id,
203
+ name: r.name,
204
+ ...(r.names ? { names: r.names } : {}),
205
+ })),
206
+ },
207
+ text: sold.length
208
+ ? `${detail.hotel.name} has no room by the hour by that name today. It has: ${sold.map((r) => `${r.name} (\`${r.id}\`, ${windowWords(r.hourly)})`).join('; ')}. Call again with the id.`
209
+ : ((await today)?.noRooms ?? `${detail.hotel.name} has no rooms by the hour today.`),
210
+ };
211
+ }
212
+ if (hourlyRoom.notSoldHere) {
213
+ const wantedHere = Math.max(1, clampCount(args.rooms ?? 1, MAX_ROOMS_PER_LINE));
214
+ const open = ((await today)?.rooms ?? []).filter((r) => r.hourly && !r.notSoldHere && r.roomsLeft >= wantedHere);
215
+ return prepaidNotHere(cx, hourlyRoom, open, {
216
+ checkIn: hourlyRoom.hourly.date,
217
+ checkOut: hourlyRoom.hourly.date,
218
+ guests: guestsOf(args),
219
+ }, 'by the hour today', wantedHere);
220
+ }
221
+ const bad = startProblem(hourlyRoom.hourly, startTime);
222
+ if (bad) {
223
+ return {
224
+ structured: {
225
+ view: 'error',
226
+ ...common(deps, key),
227
+ error: 'start-time',
228
+ query: startTime,
229
+ // The starts it does take. Not `hourly`: that is the flag above.
230
+ window: hourlyRoom.hourly,
231
+ },
232
+ text: bad,
233
+ };
234
+ }
235
+ deps.trips.set(store, {
236
+ kind: 'room',
237
+ hotelId,
238
+ roomId: hourlyRoom.id,
239
+ stay: {
240
+ checkIn: hourlyRoom.hourly.date,
241
+ checkOut: hourlyRoom.hourly.date,
242
+ guests: guestsOf(args),
243
+ },
244
+ rooms: clampCount(args.rooms ?? 1, MAX_ROOMS_PER_LINE),
245
+ hourly: {
246
+ start: clockOf(minutesOf(startTime)),
247
+ hours: hourlyRoom.hourly.hours,
248
+ },
249
+ });
250
+ return currentTrip(deps, key, who, store, couponOf(deps, args), ctx);
251
+ };
252
+ /** A room named with no dates: asked for them, or told it is sold by the hour. */
253
+ const needsDatesAnswer = async ({ deps, key, detail, roomRef }, byTheHour) => {
254
+ const hourlyRoom = await byTheHour();
255
+ return {
256
+ structured: {
257
+ view: 'needs-dates',
258
+ ...common(deps, key),
259
+ hotel: detail.hotel,
260
+ room: roomRef,
261
+ ...(hourlyRoom?.hourly ? { window: hourlyRoom.hourly } : {}),
262
+ },
263
+ text: hourlyRoom?.hourly
264
+ ? `That is a room by the hour, sold for today: it takes \`startTime\` - ${windowWords(hourlyRoom.hourly)}.`
265
+ : 'Which nights? A room needs a check-in and a check-out date before it can go into the trip.',
266
+ };
267
+ };
268
+ /** The nights asked about cannot be booked at the hotel. */
269
+ const noRoomsOnDates = ({ deps, key, detail, roomRef }, dated) => {
270
+ return {
271
+ structured: {
272
+ view: 'needs-dates',
273
+ ...common(deps, key),
274
+ hotel: detail.hotel,
275
+ room: roomRef,
276
+ why: dated?.noRooms,
277
+ ...(dated?.noRoomsCode ? { whyCode: dated.noRoomsCode } : {}),
278
+ ...(dated?.noRoomsArgs ? { whyArgs: dated.noRoomsArgs } : {}),
279
+ },
280
+ text: dated?.noRooms ?? 'Those nights cannot be booked here.',
281
+ };
282
+ };
283
+ // ⚠️ BY THE ID, THE OFFER'S WHOLE NAME, OR A ROOM TYPE'S BARE NAME - in
284
+ // that order, and in any language the name has: a guest who read
285
+ // 「豪华大床房 · 双早 · 不可取消」 on the card says that, and it is the same offer
286
+ // as "Deluxe King Room · Breakfast for 2 · Non-refundable". Never a part of
287
+ // a name. A type's bare name ("Deluxe King Room") used to be no room at all
288
+ // when the type has several rates, and a model that planned a trip by the
289
+ // type's name was answered "no such room" three times over (the owner,
290
+ // 2026-10-26, Atour). It now takes the type's CHEAPEST rate that sleeps the
291
+ // stay's guests and has rooms left - and the answer says which rate that
292
+ // was and that there are others, so the guest is told what they got. Two
293
+ // types answering to one name, or none, is still no room.
294
+ const chooseRoom = (rooms, roomRef, stay, wanted) => {
295
+ let room = rooms.find((r) => r.id === roomRef) ?? namedExactly(rooms, roomRef);
296
+ let took = '';
297
+ const type = room ? undefined : roomTypeNamed(rooms, roomRef);
298
+ if (type) {
299
+ const fitting = type.rooms.filter((r) => r.sleeps >= stay.guests && r.roomsLeft >= wanted);
300
+ // A rate booked here before one only shown (`notSoldHere`), where the type has both.
301
+ const sold = fitting.filter((r) => !r.notSoldHere);
302
+ const fits = sold.length ? sold : fitting;
303
+ const [first, ...rest] = fits;
304
+ const cheapest = first
305
+ ? rest.reduce((a, b) => (b.stayTotal.minor < a.stayTotal.minor ? b : a), first)
306
+ : undefined;
307
+ if (cheapest) {
308
+ room = cheapest;
309
+ const others = fits.filter((r) => r !== cheapest);
310
+ took = `Took ${cheapest.name} (\`${cheapest.id}\`) - ${others.length
311
+ ? `the lowest of ${type.name}'s ${fits.length} rates for these nights; the others: ${others.map((r) => `${r.name} (\`${r.id}\`)`).join(', ')}.`
312
+ : `${type.name}'s only rate for these nights.`}`;
313
+ }
314
+ }
315
+ return { room, took, type };
316
+ };
317
+ /** No room by that name for these nights: every offer, with its id. */
318
+ const noSuchRoomAnswer = ({ deps, key, detail, roomRef }, rooms, stay, wanted, type) => {
319
+ const han = /\p{Script=Han}/u.test(roomRef);
320
+ return {
321
+ structured: {
322
+ view: 'error',
323
+ ...common(deps, key),
324
+ error: 'no-such-room',
325
+ query: roomRef,
326
+ rooms: rooms.map((r) => ({
327
+ id: r.id,
328
+ name: r.name,
329
+ ...(r.names ? { names: r.names } : {}),
330
+ })),
331
+ // The hotel and the nights, so the card can take the guest straight
332
+ // back to its rooms rather than to the start (round-2 jury).
333
+ hotel: {
334
+ id: detail.hotel.id,
335
+ name: detail.hotel.name,
336
+ // The card says the hotel in the guest's language (「没能放进行程:…」).
337
+ ...(detail.hotel.names ? { names: detail.hotel.names } : {}),
338
+ },
339
+ stay,
340
+ },
341
+ // ⚠️ EVERY OFFER WITH ITS ID: the model that was told "no such room" by
342
+ // a list of names it had just tried to match by name tried again by name.
343
+ // The ids are what it can say, and it says them once.
344
+ text: `${type ? `${detail.hotel.name} has no ${type.name} that sleeps ${stay.guests} and has ${wanted === 1 ? 'a room' : `${wanted} rooms`} left for those nights.` : `${detail.hotel.name} has no room type by that name for those nights.`} It has: ${rooms.map((r) => `${r.name} (${han && r.names?.zh ? `${r.names.zh}, ` : ''}\`${r.id}\`)`).join(', ')}. Call again with the id.`,
345
+ };
346
+ };
347
+ //# sourceMappingURL=put-room-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"put-room-line.js","sourceRoot":"","sources":["../../src/tools/put-room-line.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,iB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C,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,2BAA2B;KACxX,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,234 @@
1
+ import type { CouponKeptWhy, HeldCoupon, Member, Money, Names, Quote, Room } from '../types.js';
2
+ import type { Lang, ToolAnswer, ToolDeps } from './deps.js';
3
+ /**
4
+ * The language the CARD speaks to this guest - its own buttons, labels and
5
+ * dates. What the server writes for the model stays English.
6
+ *
7
+ * ⚠️ PER TRIP, NOT ONLY PER BRAND (总线程, 2026-10-12): today it is the
8
+ * deployment's (Huazhu's single store is Chinese), and a guest's own choice -
9
+ * as the market's \`set_language\` keeps one per buyer - is meant to come in
10
+ * HERE, by \`key\`, without the card or the schema changing.
11
+ */
12
+ export declare const langOf: (deps: ToolDeps, _key?: string) => Lang | undefined;
13
+ /**
14
+ * When a room stops being free to cancel, the way a guest reads it: the
15
+ * hotel's own clock when the backend knows it, else the instant in UTC - never
16
+ * the date alone (see `atHotelTime`).
17
+ */
18
+ /** A rate whose own name already says it cannot be refunded - see T10 where a booking is said. */
19
+ export declare const SAYS_NON_REFUNDABLE: RegExp;
20
+ export declare const freeUntilText: (r: {
21
+ freeCancellationUntil?: string;
22
+ freeCancellationLocal?: string;
23
+ }) => string;
24
+ /**
25
+ * A name as the words to a client that draws no card say it: the plain name,
26
+ * then the group's own Chinese name in () where it has one the plain name is
27
+ * not.
28
+ *
29
+ * ⚠️ THE GROUP'S NAME, NOT THE MODEL'S (2026-11-02 audit, P1-1). The Chinese
30
+ * names were only in the structure, and a model that is handed the text alone
31
+ * told a Chinese guest 「浦东凯里酒店」 for 上海浦东嘉里大酒店 - a name nobody
32
+ * can find the hotel by. A card host is told the plain name as ever: its card
33
+ * says the Chinese.
34
+ */
35
+ export declare const withZh: (name: string, names: Names | undefined, noCards: boolean | undefined) => string;
36
+ /**
37
+ * What a signed-in member's prices are, said once at the top of a hotel's
38
+ * rooms - with the cheapest one's public and member figures, so "member rate"
39
+ * is a number the guest can check (10-30: the rooms were at the member rate
40
+ * and nothing told the model so).
41
+ */
42
+ export declare const memberRatesOf: (rooms: Room[], roomsWanted: number) => {
43
+ programme: string;
44
+ tier: string;
45
+ discount: number;
46
+ said: string;
47
+ } | undefined;
48
+ /** A held coupon for the card: its amounts as text, like every amount the card is given. */
49
+ export declare const couponForCard: (c: HeldCoupon & {
50
+ off?: Money;
51
+ spend?: Money;
52
+ }) => {
53
+ spend?: string | Money | undefined;
54
+ off?: string | Money | undefined;
55
+ minSpend?: string | Money | undefined;
56
+ maxOff?: string | Money | undefined;
57
+ amountOff?: string | Money | undefined;
58
+ id: string;
59
+ kind: import("../types.js").CouponKind;
60
+ name: string;
61
+ names?: Names;
62
+ percentOff?: number;
63
+ brands?: {
64
+ name: string;
65
+ names?: Names;
66
+ }[];
67
+ hotels?: {
68
+ id: string;
69
+ name: string;
70
+ names?: Names;
71
+ }[];
72
+ validFrom: string;
73
+ validUntil: string;
74
+ state: "usable" | "used" | "expired" | "not-yet";
75
+ usedOn?: {
76
+ code?: string;
77
+ stands: boolean;
78
+ };
79
+ };
80
+ /** One line of a trip, flattened for the card. Prices are strings: the card never does arithmetic. */
81
+ export declare const quoteForCard: (quote: Quote, groupOf?: (hotelId: string) => string | undefined) => {
82
+ dropped?: import("../types.js").DroppedLine[] | undefined;
83
+ stay?: import("../types.js").Stay | undefined;
84
+ coupons?: {
85
+ spend?: string | Money | undefined;
86
+ off?: string | Money | undefined;
87
+ minSpend?: string | Money | undefined;
88
+ maxOff?: string | Money | undefined;
89
+ amountOff?: string | Money | undefined;
90
+ id: string;
91
+ kind: import("../types.js").CouponKind;
92
+ name: string;
93
+ names?: Names;
94
+ percentOff?: number;
95
+ brands?: {
96
+ name: string;
97
+ names?: Names;
98
+ }[];
99
+ hotels?: {
100
+ id: string;
101
+ name: string;
102
+ names?: Names;
103
+ }[];
104
+ validFrom: string;
105
+ validUntil: string;
106
+ state: "usable" | "used" | "expired" | "not-yet";
107
+ usedOn?: {
108
+ code?: string;
109
+ stands: boolean;
110
+ };
111
+ }[] | undefined;
112
+ couponRefused?: {
113
+ spend?: string | Money | undefined;
114
+ minSpend?: string | Money | undefined;
115
+ id: string;
116
+ name?: string;
117
+ names?: Names;
118
+ code: import("../types.js").CouponRefusal;
119
+ why: string;
120
+ } | undefined;
121
+ coupon?: {
122
+ off: string;
123
+ id: string;
124
+ name: string;
125
+ names?: Names;
126
+ kind: import("../types.js").CouponKind;
127
+ hotelId: string;
128
+ hotelName: string;
129
+ hotelNames?: Names;
130
+ checkIn: string;
131
+ checkOut: string;
132
+ validUntil: string;
133
+ } | undefined;
134
+ memberSaving?: {
135
+ memberTotal: string;
136
+ roomSaved?: string | undefined;
137
+ saved: string;
138
+ publicTotal: string;
139
+ publicSubtotal: string;
140
+ programme: string;
141
+ tier: string;
142
+ points: number;
143
+ } | undefined;
144
+ lines: {
145
+ day: string | undefined;
146
+ paymentNotConnected?: boolean | undefined;
147
+ payment?: "at-hotel" | "prepaid" | undefined;
148
+ freeCancellationLocalIso?: string | undefined;
149
+ freeCancellationLocal?: string | undefined;
150
+ freeCancellationUntil: string | undefined;
151
+ terms?: string | undefined;
152
+ refundable: boolean | undefined;
153
+ totalWithTaxes?: string | undefined;
154
+ total: string;
155
+ publicUnit?: string | undefined;
156
+ roomCharges?: string | undefined;
157
+ unit: string;
158
+ ordered?: number | undefined;
159
+ quantity: number | undefined;
160
+ hourly?: import("../types.js").HourlyStay | undefined;
161
+ stay: import("../types.js").Stay | undefined;
162
+ nights: number | undefined;
163
+ rate?: {
164
+ name: string;
165
+ kind?: import("../types.js").RateKind;
166
+ } | undefined;
167
+ meal?: import("../types.js").MealPlan | undefined;
168
+ window?: import("../types.js").WindowKind | undefined;
169
+ bedTypes?: import("../types.js").BedType[] | undefined;
170
+ detail: string | undefined;
171
+ titleNames?: Partial<Record<import("../types.js").NameLang, string>> | undefined;
172
+ roomRef: string | undefined;
173
+ extraRef: string | undefined;
174
+ title: string;
175
+ hotelNames?: Partial<Record<import("../types.js").NameLang, string>> | undefined;
176
+ hotelName: string;
177
+ supplier?: string | undefined;
178
+ kind: "room" | "extra";
179
+ hotelId: string;
180
+ }[];
181
+ subtotal: string;
182
+ taxesAndFees: string;
183
+ total: string;
184
+ };
185
+ /**
186
+ * A coupon's name as a guest of either language reads it: the programme's
187
+ * Chinese beside its English - "满500减50 (¥50 off a stay of ¥500)".
188
+ */
189
+ export declare const couponName: (c: {
190
+ name: string;
191
+ names?: Names;
192
+ }) => string;
193
+ /** "A, B or C". */
194
+ export declare const listOrWords: (xs: string[]) => string;
195
+ /** What a held coupon is - what it takes off, where, until when - and where it stands. */
196
+ export declare const couponTerms: (c: HeldCoupon, brand: string) => string;
197
+ /**
198
+ * What cancelling does to the coupon a booking used - and why.
199
+ *
200
+ * ⚠️ BACK ONLY FOR A FREE CANCELLATION IN THE COUPON'S DATES (robin,
201
+ * 2026-11-03, C10). A cancellation that charges a fee counts the coupon as
202
+ * used: it already took money off a stay that is being paid for. The reason is
203
+ * said in the words (`fee` / `expired`) and as the same code in the structure
204
+ * (`notReturnedBecause`), so a host that draws no card has it too. `fee` is the
205
+ * charge as text, for the sentence.
206
+ */
207
+ export declare const couponBackWords: (c: {
208
+ name: string;
209
+ names?: Names;
210
+ validUntil: string;
211
+ returned: boolean;
212
+ notReturnedBecause?: CouponKeptWhy;
213
+ }, fee?: string,
214
+ /** Said after the cancellation, not before it. */
215
+ done?: boolean,
216
+ /**
217
+ * The booking was never sent to its group: nothing is charged, and the fee is the
218
+ * terms' - "this cancellation was charged a fee" beside "nothing is charged" said
219
+ * money was taken (0.55.7, 总线程 11-05; the card says it the same way).
220
+ */
221
+ notSent?: boolean) => string;
222
+ /** Beside a member sign-in's answer where a card is drawn: the link and its short code, the card's alone. */
223
+ export declare const MEMBER_SIGN_IN_META_KEY = "curless/member-sign-in";
224
+ export declare const MEMBER_NEVER_IN_CHAT = "Never in this chat: do not ask for, or accept, a membership number or a surname here, and never write back one the guest typed - not even to say which to change.";
225
+ /**
226
+ * A signed-in member, as the model reads it (0.58.0): signed in, the tier and
227
+ * what it takes off, the points and the coupons - what pricing and booking
228
+ * need. ⚠️ NOT THE NAME OR THE NUMBER: those are the card's, beside the answer
229
+ * (server.ts `memberApart`) - the model is told who is signed in by what the
230
+ * membership does, not who it is.
231
+ */
232
+ export declare const memberAnswer: (deps: ToolDeps, key: string, member: Member, lead: string) => ToolAnswer;
233
+ export declare const tripText: (quote: Quote, noCards?: boolean) => string;
234
+ //# sourceMappingURL=quote-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quote-card.d.ts","sourceRoot":"","sources":["../../src/tools/quote-card.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,EAEL,IAAI,EACL,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAK5D;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,GAAI,MAAM,QAAQ,EAAE,OAAO,MAAM,KAAG,IAAI,GAAG,SAAsB,CAAC;AAErF;;;;GAIG;AACH,kGAAkG;AAClG,eAAO,MAAM,mBAAmB,QAAmC,CAAC;AACpE,eAAO,MAAM,aAAa,GAAI,GAAG;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,WAEwE,CAAC;AAK1E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,GACjB,MAAM,MAAM,EACZ,OAAO,KAAK,GAAG,SAAS,EACxB,SAAS,OAAO,GAAG,SAAS,KAC3B,MAIF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,IAAI,EAAE,EA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