@findhotel/sapi 1.0.8 → 1.0.10
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.
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ hotels, hotels\' offers and rooms.
|
|
|
22
22
|
- [SAPI client](#sapi-client)
|
|
23
23
|
- [Supported options](#supported-options)
|
|
24
24
|
- [Available client callbacks](#available-client-callbacks)
|
|
25
|
-
|
|
25
|
+
- [Response](#response)
|
|
26
26
|
- [`search()` method](#search-method)
|
|
27
27
|
- [Search parameters](#search-parameters)
|
|
28
28
|
- [Callbacks](#callbacks)
|
|
@@ -40,6 +40,7 @@ hotels, hotels\' offers and rooms.
|
|
|
40
40
|
- [Offers parameters](#offers-parameters)
|
|
41
41
|
- [Callbacks](#callbacks-1)
|
|
42
42
|
- [Response](#response-5)
|
|
43
|
+
- [Rooms Configuration](#rooms-configuration)
|
|
43
44
|
|
|
44
45
|
# Release process
|
|
45
46
|
|
|
@@ -59,7 +60,7 @@ creates a PR before publishing every release, so this allows:
|
|
|
59
60
|
|
|
60
61
|
GitHub token is required for the release process:
|
|
61
62
|
|
|
62
|
-
- Go to [your
|
|
63
|
+
- Go to [your GitHub account](https://github.com/settings/tokens/new)
|
|
63
64
|
- Check \"repo(Full control of private repositories)\"
|
|
64
65
|
- Generate/copy the token
|
|
65
66
|
- Add it in your command line like: `GITHUB_TOKEN=xxx`
|
|
@@ -70,19 +71,19 @@ To create and deploy a new release of SAPI SDK please follow the next
|
|
|
70
71
|
steps:
|
|
71
72
|
|
|
72
73
|
- Merge your changes. There can be multiple changes in one release
|
|
73
|
-
- Checkout the
|
|
74
|
+
- Checkout the latest version of the `main` branch
|
|
74
75
|
- In the root directory run `make release` command - this
|
|
75
|
-
will start the
|
|
76
|
+
will start the release process
|
|
76
77
|
- Review and confirm (or change) the new release version number
|
|
77
|
-
- After installing
|
|
78
|
+
- After installing dependencies and running deployment scripts a new
|
|
78
79
|
pull request will be automatically created
|
|
79
80
|
- Review/update `CHANGELOG.md` in the root directory. Write down
|
|
80
81
|
changes with descriptions using [keep a changelog] guiding
|
|
81
|
-
principles and commit your changes to the
|
|
82
|
+
principles and commit your changes to the newly created release
|
|
82
83
|
PR
|
|
83
84
|
- Review the PR/ask SAPI engineer(s) for approval
|
|
84
85
|
- `Squash and merge` the PR. This will trigger automated
|
|
85
|
-
release
|
|
86
|
+
release process using GitHub actions and after some time the new
|
|
86
87
|
release will be published to NMP
|
|
87
88
|
- Check if the new version has been published to NPM
|
|
88
89
|
|
|
@@ -272,7 +273,7 @@ const sapiClient = await sapi(profileKey, {
|
|
|
272
273
|
<a id="client-options"></a>
|
|
273
274
|
|
|
274
275
|
| name | required | type | default | description | example |
|
|
275
|
-
| ---------------------- | -------- | ------------------------ | -----------------------------------
|
|
276
|
+
| ---------------------- | -------- | ------------------------ | ----------------------------------- |-------------------------------------------------------------------------------------------------------------------------------| ------------------------------------------------ |
|
|
276
277
|
| `anonymousId` | yes | `string` | | Unique ID identifying users | `2d360284-577b-4a53-8b91-68f72b9227fa` |
|
|
277
278
|
| `language` | no | `string` | `en` | 2-char language code | `en` |
|
|
278
279
|
| `currency` | no | `string` | `USD` | 3-char uppercased ISO currency code | `USD` |
|
|
@@ -282,7 +283,7 @@ const sapiClient = await sapi(profileKey, {
|
|
|
282
283
|
| `initWithAppConfig` | no | `AppConfig` | | External app config to override internal one | |
|
|
283
284
|
| `algoliaClientOptions` | no | `AlgoliaSearchOptions` | | Algolia client options used for debugging and setting additional options like timeouts etc. | |
|
|
284
285
|
| `variations` | no | `Record<string, string>` | | A/B test variations | `{'pp000004-tags2': 'b', 'pp000004-tags3': '1'}` |
|
|
285
|
-
| `callbacks` | no | `Record<string, fnc>` | | Client
|
|
286
|
+
| `callbacks` | no | `Record<string, fnc>` | | Client callbacks | |
|
|
286
287
|
| `getTotalRate` | no | `function` | Total rate including taxes and fees | Function to calculate total display rate based on tax display logic. Used for price filter and sort by price functionalities. | |
|
|
287
288
|
|
|
288
289
|
### Available client callbacks
|
|
@@ -292,10 +293,10 @@ const sapiClient = await sapi(profileKey, {
|
|
|
292
293
|
|
|
293
294
|
Returns configuration settings that are used by sapiClient.
|
|
294
295
|
|
|
295
|
-
|
|
296
|
+
### Response
|
|
296
297
|
<a id="config-response"></a>
|
|
297
298
|
|
|
298
|
-
```
|
|
299
|
+
```json
|
|
299
300
|
{
|
|
300
301
|
"exchangeRates": {
|
|
301
302
|
"EUR": 0.982994
|
|
@@ -336,29 +337,29 @@ const search = await sapiClient.search(searchParameters, callbacks)
|
|
|
336
337
|
|
|
337
338
|
All parameters are optional.
|
|
338
339
|
|
|
339
|
-
| name | type | description
|
|
340
|
-
|
|
341
|
-
| `hotelId` | `string` | Hotel Id for hotel search. If present, takes precedence over `placeId`, `query` and `geolocation`.
|
|
342
|
-
| `placeId` | `string` | Place Id for place search. If present, takes precedence over `query` and `geolocation`.
|
|
343
|
-
| `geolocation` | `{lat: number, lon: number}` | Geolocation query. If present, takes precedence over `query`
|
|
344
|
-
| `query` | `string` | Free-text query
|
|
345
|
-
| `boundingBox` | `[p1Lat, p1Lng, p2Lat, p2Lng]` | `topLeft` and `bottomRight` coordinates of bounding box to perform search inside it
|
|
346
|
-
| `checkIn` | `string` | Check in date (`YYYY-MM-DD`)
|
|
347
|
-
| `checkOut` | `string` | Check out date (`YYYY-MM-DD`)
|
|
348
|
-
| `rooms` | `string` | [Rooms configuration](
|
|
349
|
-
| `dayDistance` | `number` | Amount of full days from now to desired check in date (works in combination with `nights` parameter)
|
|
350
|
-
| `nights` | `number` | Number of nights of stay
|
|
351
|
-
| `sortField` | `string` | Defines the sort by criteria
|
|
352
|
-
| `sortOrder` | `string` | Defines the sort order
|
|
353
|
-
| `filters` | `Object` | Object with filters
|
|
354
|
-
| `cugDeals` | `string[]` | Codes of closed user group deals to retrieve offers
|
|
355
|
-
| `tier` | `string` | User tier
|
|
356
|
-
| `originId` | `string` | Identifier of origin where the request was originated
|
|
357
|
-
| `preferredRate` | `number` | Offer\'s price user saw on a CA (meta) platform
|
|
358
|
-
| `trafficSource` | `string` | Visitor\'s traffic source. Opaque value that will be passed to tracking systems
|
|
359
|
-
| `userId` | `string` | An authenticated user ID, e.g. the Google ID of a user. Used by ACL
|
|
360
|
-
| `emailDomain` | `string` | Email domain for authenticated user, Used by ACL
|
|
361
|
-
| `screenshots` | `number` | Number of of screenshot taken by the user and detected by website, Used by ACL
|
|
340
|
+
| name | type | description | example |
|
|
341
|
+
|-----------------|--------------------------------|------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
|
|
342
|
+
| `hotelId` | `string` | Hotel Id for hotel search. If present, takes precedence over `placeId`, `query` and `geolocation`. | `1371626` |
|
|
343
|
+
| `placeId` | `string` | Place Id for place search. If present, takes precedence over `query` and `geolocation`. | `47319` |
|
|
344
|
+
| `geolocation` | `{lat: number, lon: number}` | Geolocation query. If present, takes precedence over `query` | `{lat: 36.114303, lon: -115.178312}` |
|
|
345
|
+
| `query` | `string` | Free-text query | `Amsterdam city` |
|
|
346
|
+
| `boundingBox` | `[p1Lat, p1Lng, p2Lat, p2Lng]` | `topLeft` and `bottomRight` coordinates of bounding box to perform search inside it | `[46.650828100116044, 7.123046875, 45.17210966999772, 1.009765625]` |
|
|
347
|
+
| `checkIn` | `string` | Check in date (`YYYY-MM-DD`) | `2021-10-10` |
|
|
348
|
+
| `checkOut` | `string` | Check out date (`YYYY-MM-DD`) | `2021-10-11` |
|
|
349
|
+
| `rooms` | `string` | [Rooms configuration](#rooms-configuration) | `2` |
|
|
350
|
+
| `dayDistance` | `number` | Amount of full days from now to desired check in date (works in combination with `nights` parameter) | `15` |
|
|
351
|
+
| `nights` | `number` | Number of nights of stay | `3` |
|
|
352
|
+
| `sortField` | `string` | Defines the sort by criteria | `popularity, price` |
|
|
353
|
+
| `sortOrder` | `string` | Defines the sort order | `ascending, descending` |
|
|
354
|
+
| `filters` | `Object` | Object with filters | `{starRatings: 5}` |
|
|
355
|
+
| `cugDeals` | `string[]` | Codes of closed user group deals to retrieve offers | `['signed_in', 'offline']` |
|
|
356
|
+
| `tier` | `string` | User tier | `member` |
|
|
357
|
+
| `originId` | `string` | Identifier of origin where the request was originated | `c3po6twr70` |
|
|
358
|
+
| `preferredRate` | `number` | Offer\'s price user saw on a CA (meta) platform | `196` |
|
|
359
|
+
| `trafficSource` | `string` | Visitor\'s traffic source. Opaque value that will be passed to tracking systems | `gha-vr` |
|
|
360
|
+
| `userId` | `string` | An authenticated user ID, e.g. the Google ID of a user. Used by ACL | `c34b0018-d434-4fad-8de6-9d8e8e18cb35` |
|
|
361
|
+
| `emailDomain` | `string` | Email domain for authenticated user, Used by ACL | `@manatuscostarica.com` |
|
|
362
|
+
| `screenshots` | `number` | Number of of screenshot taken by the user and detected by website, Used by ACL | `2` |
|
|
362
363
|
|
|
363
364
|
|
|
364
365
|
### Callbacks
|
|
@@ -393,7 +394,7 @@ the state can be repeated between different callbacks.
|
|
|
393
394
|
|
|
394
395
|
1. ### onStart()
|
|
395
396
|
|
|
396
|
-
Runs at the beginning of
|
|
397
|
+
Runs at the beginning of each new search.
|
|
397
398
|
|
|
398
399
|
The callback is supplied with generated `searchId` and
|
|
399
400
|
actual search parameters that are used for the search, like dates,
|
|
@@ -431,7 +432,7 @@ the state can be repeated between different callbacks.
|
|
|
431
432
|
5. ### onComplete()
|
|
432
433
|
|
|
433
434
|
Runs when current search is complete and all offers are retrieved\
|
|
434
|
-
Return complete SAPI
|
|
435
|
+
Return complete SAPI search response.\
|
|
435
436
|
The offers response with the detailed description can be found in the [Offers Response](./docs/offers.md)
|
|
436
437
|
|
|
437
438
|
### Response
|
|
@@ -440,7 +441,7 @@ the state can be repeated between different callbacks.
|
|
|
440
441
|
The complete SAPI search response is too big to be displayed on the page
|
|
441
442
|
so there is a simplified example:
|
|
442
443
|
|
|
443
|
-
```
|
|
444
|
+
```json
|
|
444
445
|
{
|
|
445
446
|
"anchor": {
|
|
446
447
|
"admDivisionLevel1": "The Netherlands",
|
|
@@ -465,7 +466,7 @@ so there is a simplified example:
|
|
|
465
466
|
"pricing.minRateBkt": {"2": 22, "3": 38, "4": 46, "5": 98},
|
|
466
467
|
"propertyTypeId": {"0": 1030, "2": 6, "3": 601, "4": 86},
|
|
467
468
|
"starRating": {"1": 351, "2": 313, "3": 596, "4": 441, "5": 86},
|
|
468
|
-
"themeIds": {"1": 9, "2": 1373, "3": 143, "5": 1092, "8": 119}
|
|
469
|
+
"themeIds": {"1": 9, "2": 1373, "3": 143, "5": 1092, "8": 119}
|
|
469
470
|
},
|
|
470
471
|
"hotelEntities": {
|
|
471
472
|
"1041597": {
|
|
@@ -579,7 +580,8 @@ const suggestions = await sapiClient.suggest('London', 6)
|
|
|
579
580
|
|
|
580
581
|
```js
|
|
581
582
|
const suggestions = await sapiClient.suggest('London', 2)
|
|
582
|
-
|
|
583
|
+
```
|
|
584
|
+
```json
|
|
583
585
|
[
|
|
584
586
|
{
|
|
585
587
|
"highlightValue": "<em>London</em>",
|
|
@@ -598,9 +600,11 @@ const suggestions = await sapiClient.suggest('London', 2)
|
|
|
598
600
|
"value": "London Heathrow Airport"
|
|
599
601
|
}
|
|
600
602
|
]
|
|
601
|
-
|
|
603
|
+
```
|
|
604
|
+
```js
|
|
602
605
|
const suggestions = await sapiClient.suggest('London hotel', 2)
|
|
603
|
-
|
|
606
|
+
```
|
|
607
|
+
```json
|
|
604
608
|
[
|
|
605
609
|
{
|
|
606
610
|
"highlightValue": "Park Plaza Westminster Bridge <em>London</em>",
|
|
@@ -621,6 +625,7 @@ const suggestions = await sapiClient.suggest('London hotel', 2)
|
|
|
621
625
|
]
|
|
622
626
|
```
|
|
623
627
|
|
|
628
|
+
|
|
624
629
|
## `rooms()` method
|
|
625
630
|
<a id="rooms-method"></a>
|
|
626
631
|
|
|
@@ -639,26 +644,28 @@ const rooms = await sapiClient.rooms({
|
|
|
639
644
|
### Rooms parameters
|
|
640
645
|
<a id="rooms-parameters"></a>
|
|
641
646
|
|
|
642
|
-
| name | type | description
|
|
643
|
-
|
|
644
|
-
| `hotelId` | `string` | Hotel Id to retrieve rooms
|
|
645
|
-
| `checkIn` | `string` | Check in date (`YYYY-MM-DD`)
|
|
646
|
-
| `checkOut` | `string` | Check out date (`YYYY-MM-DD`)
|
|
647
|
-
| `rooms` | `string` | [Rooms configuration](
|
|
648
|
-
| `providerCode` | `string` | Provider code used for retrieving rooms offers
|
|
649
|
-
| `cugDeals` | `string` | Type of cug (closed user group) deals to retrieve
|
|
650
|
-
| `tier` | `string` | User tier
|
|
651
|
-
| `clickedOfferId` | `string` | Offer id that user clicked on SRP
|
|
652
|
-
| `clickedOfferBaseRate` | `number` | Base rate value of the offer which user clicked on SRP
|
|
653
|
-
| `clickedOfferTaxes` | `number` | Taxes value of the offer which user clicked on SRP
|
|
654
|
-
| `clickedOfferHotelFees` | `number` | Hotel fees value of the offer which the user clicked on SRP
|
|
655
|
-
| `preHeat` | `number` | Enables pre-heat mode
|
|
656
|
-
| `trafficSource` | `string` | Visitor\'s traffic source. Opaque value that will be passed to tracking systems
|
|
647
|
+
| name | type | description | required | example |
|
|
648
|
+
|-------------------------|----------|----------------------------------------------------------------------------------|----------|----------------------------------------|
|
|
649
|
+
| `hotelId` | `string` | Hotel Id to retrieve rooms | yes | `1714808` |
|
|
650
|
+
| `checkIn` | `string` | Check in date (`YYYY-MM-DD`) | yes | `2021-10-10` |
|
|
651
|
+
| `checkOut` | `string` | Check out date (`YYYY-MM-DD`) | yes | `2021-10-11` |
|
|
652
|
+
| `rooms` | `string` | [Rooms configuration](#rooms-configuration) | yes | `2` |
|
|
653
|
+
| `providerCode` | `string` | Provider code used for retrieving rooms offers | no | `GAR` |
|
|
654
|
+
| `cugDeals` | `string` | Type of cug (closed user group) deals to retrieve | no | `signed_in,offline` |
|
|
655
|
+
| `tier` | `string` | User tier | no | `plus` |
|
|
656
|
+
| `clickedOfferId` | `string` | Offer id that user clicked on SRP | no | `oXstvXafDb2o` |
|
|
657
|
+
| `clickedOfferBaseRate` | `number` | Base rate value of the offer which user clicked on SRP | no | `25` |
|
|
658
|
+
| `clickedOfferTaxes` | `number` | Taxes value of the offer which user clicked on SRP | no | `10` |
|
|
659
|
+
| `clickedOfferHotelFees` | `number` | Hotel fees value of the offer which the user clicked on SRP | no | `5` |
|
|
660
|
+
| `preHeat` | `number` | Enables pre-heat mode | no | `1` |
|
|
661
|
+
| `trafficSource` | `string` | Visitor\'s traffic source. Opaque value that will be passed to tracking systems | no | `gha-vr` |
|
|
662
|
+
| `userId` | `string` | User ID is an authenticated user ID, e.g. the Google ID of a user. | no | `7ea95191-b929-469d-8b02-0397dafd53a1` |
|
|
663
|
+
| `emailDomain` | `string` | User email domain is for authenticated user as a value, if email is available. | no | `@findhotel.net` |
|
|
657
664
|
|
|
658
665
|
### Response
|
|
659
666
|
<a id="rooms-response"></a>
|
|
660
667
|
|
|
661
|
-
```
|
|
668
|
+
```json
|
|
662
669
|
{
|
|
663
670
|
"anonymousId": "fd9dbb5f-b337-4dd7-b640-1f177d1d3caa",
|
|
664
671
|
"hotelId": "1714808",
|
|
@@ -699,6 +706,7 @@ const rooms = await sapiClient.rooms({
|
|
|
699
706
|
}
|
|
700
707
|
```
|
|
701
708
|
|
|
709
|
+
|
|
702
710
|
## `hotel()` method
|
|
703
711
|
<a id="hotel-method"></a>
|
|
704
712
|
|
|
@@ -721,7 +729,7 @@ const hotel = await sapiClient.hotel('1196472')
|
|
|
721
729
|
An example of the response for request with `hotelId` 1196472
|
|
722
730
|
and \"pt-BR\" `language`
|
|
723
731
|
|
|
724
|
-
```
|
|
732
|
+
```json
|
|
725
733
|
{
|
|
726
734
|
"objectID": "1196472",
|
|
727
735
|
"guestRating": {
|
|
@@ -838,20 +846,20 @@ const offers = await sapiClient.offers(parameters, callbacks)
|
|
|
838
846
|
### Offers parameters
|
|
839
847
|
<a id="hotel-parameters"></a>
|
|
840
848
|
|
|
841
|
-
| name | type | description
|
|
842
|
-
|
|
843
|
-
| `hotelId` | `string` | Hotel Id
|
|
844
|
-
| `checkIn` | `string` | Check in date (YYYY-MM-DD) (SDK generates default date if no provided)
|
|
845
|
-
| `checkOut` | `string` | Check out date (YYYY-MM-DD)) (SDK generates default date if no provided)
|
|
846
|
-
| `rooms` | `string` | [Rooms configuration](
|
|
847
|
-
| `searchId` | `string` | SearchId override (SDK generates a new one if no provided)
|
|
848
|
-
| `cugDeals` | `string[]` | Codes of closed user group deals to retrieve offers
|
|
849
|
-
| `tier` | `string` | User tier
|
|
850
|
-
| `freeCancellation` | `boolean` | Promote offers with free
|
|
851
|
-
| `isAnchor` | `boolean` | Anchor/Non anchor hotel (default `false`)
|
|
852
|
-
| `originId` | `string` | Identifier of origin where the request was originated
|
|
853
|
-
| `trafficSource` | `string` | Visitor\'s traffic source. Opaque value that will be passed to tracking systems
|
|
854
|
-
| `preferredRate` | `number` | Offer\'s price user saw on a CA (meta) platform
|
|
849
|
+
| name | type | description | required | example |
|
|
850
|
+
|--------------------|------------|----------------------------------------------------------------------------------|----------|--------------------------------------------|
|
|
851
|
+
| `hotelId` | `string` | Hotel Id | yes | `1196472` |
|
|
852
|
+
| `checkIn` | `string` | Check in date (YYYY-MM-DD) (SDK generates default date if no provided) | no | `2022-10-10` |
|
|
853
|
+
| `checkOut` | `string` | Check out date (YYYY-MM-DD)) (SDK generates default date if no provided) | no | `2022-10-11` |
|
|
854
|
+
| `rooms` | `string` | [Rooms configuration](#rooms-configuration) | no | `2` |
|
|
855
|
+
| `searchId` | `string` | SearchId override (SDK generates a new one if no provided) | no | `08230dfcc5f0fb95caaa82ce559ea60c4a975d6f` |
|
|
856
|
+
| `cugDeals` | `string[]` | Codes of closed user group deals to retrieve offers | no | `['signed_in', 'offline']` |
|
|
857
|
+
| `tier` | `string` | User tier | no | `member` |
|
|
858
|
+
| `freeCancellation` | `boolean` | Promote offers with free cancellation (default `false`) | no | `true` |
|
|
859
|
+
| `isAnchor` | `boolean` | Anchor/Non anchor hotel (default `false`) | no | `true` |
|
|
860
|
+
| `originId` | `string` | Identifier of origin where the request was originated | no | `c3po6twr70` |
|
|
861
|
+
| `trafficSource` | `string` | Visitor\'s traffic source. Opaque value that will be passed to tracking systems | no | `gha-vr` |
|
|
862
|
+
| `preferredRate` | `number` | Offer\'s price user saw on a CA (meta) platform | no | `196` |
|
|
855
863
|
|
|
856
864
|
### Callbacks
|
|
857
865
|
<a id="offers-callbacks"></a>
|
|
@@ -874,7 +882,7 @@ const callbacks = {
|
|
|
874
882
|
|
|
875
883
|
1. ### onStart()
|
|
876
884
|
|
|
877
|
-
Runs at the beginning of
|
|
885
|
+
Runs at the beginning of each new offers request.\
|
|
878
886
|
Returns adjusted and validated offers request parameters.
|
|
879
887
|
|
|
880
888
|
2. ### onOffersReceived()
|
|
@@ -902,3 +910,17 @@ const parameters = {
|
|
|
902
910
|
```
|
|
903
911
|
|
|
904
912
|
The response with the detailed description can be found in the [Offers Response](./docs/offers.md)
|
|
913
|
+
|
|
914
|
+
## Rooms configuration
|
|
915
|
+
<a id="rooms-configuration"></a>
|
|
916
|
+
`rooms` is a string that encodes the configuration of rooms requested by the user and follows the next rules:
|
|
917
|
+
- Rooms are separated by pipe `|`
|
|
918
|
+
- Adults and children are separated by colon `:`
|
|
919
|
+
- Children ages are separated by comma `,`
|
|
920
|
+
|
|
921
|
+
#### Examples
|
|
922
|
+
|
|
923
|
+
- `1:4,6|3` → Two rooms, one with one adult and two children ages four and six and the other with three adults and no children
|
|
924
|
+
- `3` → One room with three adults and no children
|
|
925
|
+
- `2:4` → One room with two adults and one child aged four
|
|
926
|
+
- `1:0,13,16` → One room with one adult and three children (aged zero, thirteen and sixteen)
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).sapi=t()}(this,(function(){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}function r(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};var o=function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};var a=Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function i(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function u(e){return this instanceof u?(this.v=e,this):new u(e)}var c=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};var l=Object.freeze({__proto__:null,__extends:function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},get __assign(){return o},__rest:function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},__decorate:function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},__param:function(e,t){return function(r,n){t(r,n,e)}},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__awaiter:function(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}u((n=n.apply(e,t||[])).next())}))},__generator:function(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},__createBinding:a,__exportStar:function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)},__values:i,__read:s,__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(s(arguments[t]));return e},__spreadArrays:function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var a=arguments[t],i=0,s=a.length;i<s;i++,o++)n[o]=a[i];return n},__spreadArray:function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},__await:u,__asyncGenerator:function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),a=[];return n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n;function i(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){a.push([e,t,r,n])>1||s(e,t)}))})}function s(e,t){try{!function(e){e.value instanceof u?Promise.resolve(e.value.v).then(c,l):f(a[0][2],e)}(o[e](t))}catch(e){f(a[0][3],e)}}function c(e){s("next",e)}function l(e){s("throw",e)}function f(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}},__asyncDelegator:function(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:u(e[n](t)),done:"return"===n}:o?o(t):t}:o}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=i(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&a(t,e,r);return c(t,e),t},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__classPrivateFieldGet:function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},__classPrivateFieldSet:function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},__classPrivateFieldIn:function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}});function f(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if("production"!==process.env.NODE_ENV){var o=ae[e],a=o?"function"==typeof o?o.apply(null,r):o:"unknown error nr: "+e;throw Error("[Immer] "+a)}throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function d(e){return!!e&&!!e[ne]}function h(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===ie}(e)||Array.isArray(e)||!!e[re]||!!e.constructor[re]||_(e)||w(e))}function p(e,t,r){void 0===r&&(r=!1),0===v(e)?(r?Object.keys:se)(e).forEach((function(n){r&&"symbol"==typeof n||t(n,e[n],e)})):e.forEach((function(r,n){return t(n,r,e)}))}function v(e){var t=e[ne];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:_(e)?2:w(e)?3:0}function g(e,t){return 2===v(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function m(e,t){return 2===v(e)?e.get(t):e[t]}function y(e,t,r){var n=v(e);2===n?e.set(t,r):3===n?(e.delete(t),e.add(r)):e[t]=r}function b(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function _(e){return $&&e instanceof Map}function w(e){return Z&&e instanceof Set}function O(e){return e.o||e.t}function P(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ue(e);delete t[ne];for(var r=se(t),n=0;n<r.length;n++){var o=r[n],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function S(e,t){return void 0===t&&(t=!1),D(e)||d(e)||!h(e)||(v(e)>1&&(e.set=e.add=e.clear=e.delete=T),Object.freeze(e),t&&p(e,(function(e,t){return S(t,!0)}),!0)),e}function T(){f(2)}function D(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function I(e){var t=ce[e];return t||f(18,e),t}function k(e,t){ce[e]||(ce[e]=t)}function j(){return"production"===process.env.NODE_ENV||V||f(0),V}function E(e,t){t&&(I("Patches"),e.u=[],e.s=[],e.v=t)}function x(e){C(e),e.p.forEach(N),e.p=null}function C(e){e===V&&(V=e.l)}function R(e){return V={p:[],l:V,h:e,m:!0,_:0}}function N(e){var t=e[ne];0===t.i||1===t.i?t.j():t.O=!0}function M(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.g||I("ES5").S(t,e,n),n?(r[ne].P&&(x(t),f(4)),h(e)&&(e=A(t,e),t.l||q(t,e)),t.u&&I("Patches").M(r[ne].t,e,t.u,t.s)):e=A(t,r,[]),x(t),t.u&&t.v(t.u,t.s),e!==te?e:void 0}function A(e,t,r){if(D(t))return t;var n=t[ne];if(!n)return p(t,(function(o,a){return U(e,n,t,o,a,r)}),!0),t;if(n.A!==e)return t;if(!n.P)return q(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var o=4===n.i||5===n.i?n.o=P(n.k):n.o;p(3===n.i?new Set(o):o,(function(t,a){return U(e,n,o,t,a,r)})),q(e,o,!1),r&&e.u&&I("Patches").R(n,r,e.u,e.s)}return n.o}function U(e,t,r,n,o,a){if("production"!==process.env.NODE_ENV&&o===r&&f(5),d(o)){var i=A(e,o,a&&t&&3!==t.i&&!g(t.D,n)?a.concat(n):void 0);if(y(r,n,i),!d(i))return;e.m=!1}if(h(o)&&!D(o)){if(!e.h.F&&e._<1)return;A(e,o),t&&t.A.l||q(e,o)}}function q(e,t,r){void 0===r&&(r=!1),e.h.F&&e.m&&S(t,r)}function F(e,t){var r=e[ne];return(r?O(r):e)[t]}function H(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function W(e){e.P||(e.P=!0,e.l&&W(e.l))}function B(e){e.o||(e.o=P(e.t))}function L(e,t,r){var n=_(t)?I("MapSet").N(t,r):w(t)?I("MapSet").T(t,r):e.g?function(e,t){var r=Array.isArray(e),n={i:r?1:0,A:t?t.A:j(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=n,a=le;r&&(o=[n],a=fe);var i=Proxy.revocable(o,a),s=i.revoke,u=i.proxy;return n.k=u,n.j=s,u}(t,r):I("ES5").J(t,r);return(r?r.A:j()).p.push(n),n}function z(e){return d(e)||f(22,e),function e(t){if(!h(t))return t;var r,n=t[ne],o=v(t);if(n){if(!n.P&&(n.i<4||!I("ES5").K(n)))return n.t;n.I=!0,r=Y(t,o),n.I=!1}else r=Y(t,o);return p(r,(function(t,o){n&&m(n.t,t)===o||y(r,t,e(o))})),3===o?new Set(r):r}(e)}function Y(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return P(e)}function G(){function e(e,t){var r=a[e];return r?r.enumerable=t:a[e]=r={configurable:!0,enumerable:t,get:function(){var t=this[ne];return"production"!==process.env.NODE_ENV&&o(t),le.get(t,e)},set:function(t){var r=this[ne];"production"!==process.env.NODE_ENV&&o(r),le.set(r,e,t)}},r}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ne];if(!o.P)switch(o.i){case 5:n(o)&&W(o);break;case 4:r(o)&&W(o)}}}function r(e){for(var t=e.t,r=e.k,n=se(r),o=n.length-1;o>=0;o--){var a=n[o];if(a!==ne){var i=t[a];if(void 0===i&&!g(t,a))return!0;var s=r[a],u=s&&s[ne];if(u?u.t!==i:!b(s,i))return!0}}var c=!!t[ne];return n.length!==se(t).length+(c?0:1)}function n(e){var t=e.k;if(t.length!==e.t.length)return!0;var r=Object.getOwnPropertyDescriptor(t,t.length-1);if(r&&!r.get)return!0;for(var n=0;n<t.length;n++)if(!t.hasOwnProperty(n))return!0;return!1}function o(e){e.O&&f(3,JSON.stringify(O(e)))}var a={};k("ES5",{J:function(t,r){var n=Array.isArray(t),o=function(t,r){if(t){for(var n=Array(r.length),o=0;o<r.length;o++)Object.defineProperty(n,""+o,e(o,!0));return n}var a=ue(r);delete a[ne];for(var i=se(a),s=0;s<i.length;s++){var u=i[s];a[u]=e(u,t||!!a[u].enumerable)}return Object.create(Object.getPrototypeOf(r),a)}(n,t),a={i:n?5:4,A:r?r.A:j(),P:!1,I:!1,D:{},l:r,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ne,{value:a,writable:!0}),o},S:function(e,r,o){o?d(r)&&r[ne].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var r=t[ne];if(r){var o=r.t,a=r.k,i=r.D,s=r.i;if(4===s)p(a,(function(t){t!==ne&&(void 0!==o[t]||g(o,t)?i[t]||e(a[t]):(i[t]=!0,W(r)))})),p(o,(function(e){void 0!==a[e]||g(a,e)||(i[e]=!1,W(r))}));else if(5===s){if(n(r)&&(W(r),i.length=!0),a.length<o.length)for(var u=a.length;u<o.length;u++)i[u]=!1;else for(var c=o.length;c<a.length;c++)i[c]=!0;for(var l=Math.min(a.length,o.length),f=0;f<l;f++)a.hasOwnProperty(f)||(i[f]=!0),void 0===i[f]&&e(a[f])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?r(e):n(e)}})}function K(){function e(t){if(!h(t))return t;if(Array.isArray(t))return t.map(e);if(_(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(w(t))return new Set(Array.from(t).map(e));var r=Object.create(Object.getPrototypeOf(t));for(var n in t)r[n]=e(t[n]);return g(t,re)&&(r[re]=t[re]),r}function t(t){return d(t)?e(t):t}var r="add";k("Patches",{$:function(t,n){return n.forEach((function(n){for(var o=n.path,a=n.op,i=t,s=0;s<o.length-1;s++){var u=v(i),c=""+o[s];0!==u&&1!==u||"__proto__"!==c&&"constructor"!==c||f(24),"function"==typeof i&&"prototype"===c&&f(24),"object"!=typeof(i=m(i,c))&&f(15,o.join("/"))}var l=v(i),d=e(n.value),h=o[o.length-1];switch(a){case"replace":switch(l){case 2:return i.set(h,d);case 3:f(16);default:return i[h]=d}case r:switch(l){case 1:return"-"===h?i.push(d):i.splice(h,0,d);case 2:return i.set(h,d);case 3:return i.add(d);default:return i[h]=d}case"remove":switch(l){case 1:return i.splice(h,1);case 2:return i.delete(h);case 3:return i.delete(n.value);default:return delete i[h]}default:f(17,a)}})),t},R:function(e,n,o,a){switch(e.i){case 0:case 4:case 2:return function(e,n,o,a){var i=e.t,s=e.o;p(e.D,(function(e,u){var c=m(i,e),l=m(s,e),f=u?g(i,e)?"replace":r:"remove";if(c!==l||"replace"!==f){var d=n.concat(e);o.push("remove"===f?{op:f,path:d}:{op:f,path:d,value:l}),a.push(f===r?{op:"remove",path:d}:"remove"===f?{op:r,path:d,value:t(c)}:{op:"replace",path:d,value:t(c)})}}))}(e,n,o,a);case 5:case 1:return function(e,n,o,a){var i=e.t,s=e.D,u=e.o;if(u.length<i.length){var c=[u,i];i=c[0],u=c[1];var l=[a,o];o=l[0],a=l[1]}for(var f=0;f<i.length;f++)if(s[f]&&u[f]!==i[f]){var d=n.concat([f]);o.push({op:"replace",path:d,value:t(u[f])}),a.push({op:"replace",path:d,value:t(i[f])})}for(var h=i.length;h<u.length;h++){var p=n.concat([h]);o.push({op:r,path:p,value:t(u[h])})}i.length<u.length&&a.push({op:"replace",path:n.concat(["length"]),value:i.length})}(e,n,o,a);case 3:return function(e,t,n,o){var a=e.t,i=e.o,s=0;a.forEach((function(e){if(!i.has(e)){var a=t.concat([s]);n.push({op:"remove",path:a,value:e}),o.unshift({op:r,path:a,value:e})}s++})),s=0,i.forEach((function(e){if(!a.has(e)){var i=t.concat([s]);n.push({op:r,path:i,value:e}),o.unshift({op:"remove",path:i,value:e})}s++}))}(e,n,o,a)}},M:function(e,t,r,n){r.push({op:"replace",path:[],value:t===te?void 0:t}),n.push({op:"replace",path:[],value:e})}})}function J(){function e(e,t){function r(){this.constructor=e}o(e,t),e.prototype=(r.prototype=t.prototype,new r)}function t(e){e.o||(e.D=new Map,e.o=new Map(e.t))}function r(e){e.o||(e.o=new Set,e.t.forEach((function(t){if(h(t)){var r=L(e.A.h,t,e);e.p.set(t,r),e.o.add(r)}else e.o.add(t)})))}function n(e){e.O&&f(3,JSON.stringify(O(e)))}var o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},a=function(){function r(e,t){return this[ne]={i:2,l:t,A:t?t.A:j(),P:!1,I:!1,o:void 0,D:void 0,t:e,k:this,C:!1,O:!1},this}e(r,Map);var o=r.prototype;return Object.defineProperty(o,"size",{get:function(){return O(this[ne]).size}}),o.has=function(e){return O(this[ne]).has(e)},o.set=function(e,r){var o=this[ne];return n(o),O(o).has(e)&&O(o).get(e)===r||(t(o),W(o),o.D.set(e,!0),o.o.set(e,r),o.D.set(e,!0)),this},o.delete=function(e){if(!this.has(e))return!1;var r=this[ne];return n(r),t(r),W(r),r.t.has(e)?r.D.set(e,!1):r.D.delete(e),r.o.delete(e),!0},o.clear=function(){var e=this[ne];n(e),O(e).size&&(t(e),W(e),e.D=new Map,p(e.t,(function(t){e.D.set(t,!1)})),e.o.clear())},o.forEach=function(e,t){var r=this;O(this[ne]).forEach((function(n,o){e.call(t,r.get(o),o,r)}))},o.get=function(e){var r=this[ne];n(r);var o=O(r).get(e);if(r.I||!h(o))return o;if(o!==r.t.get(e))return o;var a=L(r.A.h,o,r);return t(r),r.o.set(e,a),a},o.keys=function(){return O(this[ne]).keys()},o.values=function(){var e,t=this,r=this.keys();return(e={})[oe]=function(){return t.values()},e.next=function(){var e=r.next();return e.done?e:{done:!1,value:t.get(e.value)}},e},o.entries=function(){var e,t=this,r=this.keys();return(e={})[oe]=function(){return t.entries()},e.next=function(){var e=r.next();if(e.done)return e;var n=t.get(e.value);return{done:!1,value:[e.value,n]}},e},o[oe]=function(){return this.entries()},r}(),i=function(){function t(e,t){return this[ne]={i:3,l:t,A:t?t.A:j(),P:!1,I:!1,o:void 0,t:e,k:this,p:new Map,O:!1,C:!1},this}e(t,Set);var o=t.prototype;return Object.defineProperty(o,"size",{get:function(){return O(this[ne]).size}}),o.has=function(e){var t=this[ne];return n(t),t.o?!!t.o.has(e)||!(!t.p.has(e)||!t.o.has(t.p.get(e))):t.t.has(e)},o.add=function(e){var t=this[ne];return n(t),this.has(e)||(r(t),W(t),t.o.add(e)),this},o.delete=function(e){if(!this.has(e))return!1;var t=this[ne];return n(t),r(t),W(t),t.o.delete(e)||!!t.p.has(e)&&t.o.delete(t.p.get(e))},o.clear=function(){var e=this[ne];n(e),O(e).size&&(r(e),W(e),e.o.clear())},o.values=function(){var e=this[ne];return n(e),r(e),e.o.values()},o.entries=function(){var e=this[ne];return n(e),r(e),e.o.entries()},o.keys=function(){return this.values()},o[oe]=function(){return this.values()},o.forEach=function(e,t){for(var r=this.values(),n=r.next();!n.done;)e.call(t,n.value,n.value,this),n=r.next()},t}();k("MapSet",{N:function(e,t){return new a(e,t)},T:function(e,t){return new i(e,t)}})}var Q,V,X="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),$="undefined"!=typeof Map,Z="undefined"!=typeof Set,ee="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,te=X?Symbol.for("immer-nothing"):((Q={})["immer-nothing"]=!0,Q),re=X?Symbol.for("immer-draftable"):"__$immer_draftable",ne=X?Symbol.for("immer-state"):"__$immer_state",oe="undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator",ae={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(e){return"Cannot apply patch, path doesn't resolve: "+e},16:'Sets cannot have "replace" patches.',17:function(e){return"Unsupported patch operation: "+e},18:function(e){return"The plugin for '"+e+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+e+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(e){return"produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+e+"'"},22:function(e){return"'current' expects a draft, got: "+e},23:function(e){return"'original' expects a draft, got: "+e},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},ie=""+Object.prototype.constructor,se="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,ue=Object.getOwnPropertyDescriptors||function(e){var t={};return se(e).forEach((function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)})),t},ce={},le={get:function(e,t){if(t===ne)return e;var r=O(e);if(!g(r,t))return function(e,t,r){var n,o=H(t,r);return o?"value"in o?o.value:null===(n=o.get)||void 0===n?void 0:n.call(e.k):void 0}(e,r,t);var n=r[t];return e.I||!h(n)?n:n===F(e.t,t)?(B(e),e.o[t]=L(e.A.h,n,e)):n},has:function(e,t){return t in O(e)},ownKeys:function(e){return Reflect.ownKeys(O(e))},set:function(e,t,r){var n=H(O(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var o=F(O(e),t),a=null==o?void 0:o[ne];if(a&&a.t===r)return e.o[t]=r,e.D[t]=!1,!0;if(b(r,o)&&(void 0!==r||g(e.t,t)))return!0;B(e),W(e)}return e.o[t]===r&&"number"!=typeof r&&(void 0!==r||t in e.o)||(e.o[t]=r,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==F(e.t,t)||t in e.t?(e.D[t]=!1,B(e),W(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=O(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty:function(){f(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){f(12)}},fe={};p(le,(function(e,t){fe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),fe.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&f(13),fe.set.call(this,e,t,void 0)},fe.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&f(14),le.set.call(this,e[0],t,r,e[0])};var de=function(){function e(e){var t=this;this.g=ee,this.F=!0,this.produce=function(e,r,n){if("function"==typeof e&&"function"!=typeof r){var o=r;r=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var n=arguments.length,i=Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return a.produce(e,(function(e){var n;return(n=r).call.apply(n,[t,e].concat(i))}))}}var i;if("function"!=typeof r&&f(6),void 0!==n&&"function"!=typeof n&&f(7),h(e)){var s=R(t),u=L(t,e,void 0),c=!0;try{i=r(u),c=!1}finally{c?x(s):C(s)}return"undefined"!=typeof Promise&&i instanceof Promise?i.then((function(e){return E(s,n),M(e,s)}),(function(e){throw x(s),e})):(E(s,n),M(i,s))}if(!e||"object"!=typeof e){if(void 0===(i=r(e))&&(i=e),i===te&&(i=void 0),t.F&&S(i,!0),n){var l=[],d=[];I("Patches").M(e,i,l,d),n(l,d)}return i}f(21,e)},this.produceWithPatches=function(e,r){if("function"==typeof e)return function(r){for(var n=arguments.length,o=Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return t.produceWithPatches(r,(function(t){return e.apply(void 0,[t].concat(o))}))};var n,o,a=t.produce(e,r,(function(e,t){n=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,n,o]})):[a,n,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){h(e)||f(8),d(e)&&(e=z(e));var t=R(this),r=L(this,e,void 0);return r[ne].C=!0,C(t),r},t.finishDraft=function(e,t){var r=e&&e[ne];"production"!==process.env.NODE_ENV&&(r&&r.C||f(9),r.I&&f(10));var n=r.A;return E(n,t),M(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ee&&f(20),this.g=e},t.applyPatches=function(e,t){var r;for(r=t.length-1;r>=0;r--){var n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));var o=I("Patches").$;return d(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),he=new de,pe=he.produce,ve=he.produceWithPatches.bind(he),ge=he.setAutoFreeze.bind(he),me=he.setUseProxies.bind(he),ye=he.applyPatches.bind(he),be=he.createDraft.bind(he),_e=he.finishDraft.bind(he),we=Object.freeze({__proto__:null,default:pe,Immer:de,applyPatches:ye,castDraft:function(e){return e},castImmutable:function(e){return e},createDraft:be,current:z,enableAllPlugins:function(){G(),J(),K()},enableES5:G,enableMapSet:J,enablePatches:K,finishDraft:_e,freeze:S,immerable:re,isDraft:d,isDraftable:h,nothing:te,original:function(e){return d(e)||f(23,e),e[ne].t},produce:pe,produceWithPatches:ve,setAutoFreeze:ge,setUseProxies:me}),Oe=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===Pe}(e)}(e)};var Pe="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function Se(e,t){return!1!==t.clone&&t.isMergeableObject(e)?je((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function Te(e,t,r){return e.concat(t).map((function(e){return Se(e,r)}))}function De(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function Ie(e,t){try{return t in e}catch(e){return!1}}function ke(e,t,r){var n={};return r.isMergeableObject(e)&&De(e).forEach((function(t){n[t]=Se(e[t],r)})),De(t).forEach((function(o){(function(e,t){return Ie(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(Ie(e,o)&&r.isMergeableObject(t[o])?n[o]=function(e,t){if(!t.customMerge)return je;var r=t.customMerge(e);return"function"==typeof r?r:je}(o,r)(e[o],t[o],r):n[o]=Se(t[o],r))})),n}function je(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||Te,r.isMergeableObject=r.isMergeableObject||Oe,r.cloneUnlessOtherwiseSpecified=Se;var n=Array.isArray(t);return n===Array.isArray(e)?n?r.arrayMerge(e,t,r):ke(e,t,r):Se(t,r)}je.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return je(e,r,t)}),{})};var Ee=je,xe=r(l),Ce=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getAppConfig=void 0;var r=xe.__importDefault(Ee),n={sapiBackend:{baseUrl:"dikcjxfwieazv.cloudfront.net",endpoints:{anchor:"anchor",search:"search",offers:"ws/offers"}},saf:{baseUrl:"sapi.findhotel.services",endpoints:{offersRooms:"1/offers-rooms",search:"1/search",hotel:"1/hotel"}},algolia:{appId:"4UYGJP42KQ",apiKey:"efa703d5c0057a24487bc9bdcb597770",autocompleteIndex:"prod_autocomplete_v2_os000007"},client:{defaultRooms:"2",features:["offers","search","suggests","configs","rooms","get-hotel"],blockedDefaultDates:["2022-12-25","2023-01-01"],daysFromNow:45,fallbackLanguages:{"pt-BR":["pt"],"zh-CN":["zh"],"zh-HK":["zh"],"zh-TW":["zh"],iw:["he"],nb:["no"],nn:["no"]}}},o={"findhotel-website":n,"findhotel-website-e2e":xe.__assign(xe.__assign({},n),{saf:xe.__assign(xe.__assign({},n.saf),{baseUrl:"sapi-e2e.findhotel.services"}),sapiBackend:xe.__assign(xe.__assign({},n.sapiBackend),{baseUrl:"d30gf1e3i1dery.cloudfront.net"})}),"findhotel-website-stg":xe.__assign(xe.__assign({},n),{sapiBackend:xe.__assign(xe.__assign({},n.sapiBackend),{baseUrl:"d3vuhpa0o0tale.cloudfront.net"})}),"findhotel-website-ci":xe.__assign(xe.__assign({},n),{sapiBackend:xe.__assign(xe.__assign({},n.sapiBackend),{baseUrl:"d1ue1wauc6u0m5.cloudfront.net"})}),"findhotel-website-dev":xe.__assign(xe.__assign({},n),{sapiBackend:xe.__assign(xe.__assign({},n.sapiBackend),{baseUrl:"d3b8t16k1aaypx.cloudfront.net"})}),"findhotel-checkout":xe.__assign(xe.__assign({},n),{client:xe.__assign(xe.__assign({},n.client),{features:["rooms","get-hotel"]})}),"findhotel-checkout-e2e":xe.__assign(xe.__assign({},n),{saf:xe.__assign(xe.__assign({},n.saf),{baseUrl:"sapi-e2e.findhotel.services"}),client:xe.__assign(xe.__assign({},n.client),{features:["rooms","get-hotel"]})}),"findhotel-checkout-stg":xe.__assign(xe.__assign({},n),{saf:xe.__assign(xe.__assign({},n.saf),{baseUrl:"sapi-stg.findhotel.services"}),client:xe.__assign(xe.__assign({},n.client),{features:["rooms","get-hotel"]})})};t.getAppConfig=function(e,t){var n=o[e];if(void 0===n)throw new Error("Profile key is not valid");return t&&(n=(0,r.default)(n,t,{arrayMerge:function(e,t){return t}})),n}}));var Re=Object.freeze({__proto__:null,default:function(e,t){return t=t||{},new Promise((function(r,n){var o=new XMLHttpRequest,a=[],i=[],s={},u=function(){return{ok:2==(o.status/100|0),statusText:o.statusText,status:o.status,url:o.responseURL,text:function(){return Promise.resolve(o.responseText)},json:function(){return Promise.resolve(o.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([o.response]))},clone:u,headers:{keys:function(){return a},entries:function(){return i},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var c in o.open(t.method||"get",e,!0),o.onload=function(){o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,r){a.push(t=t.toLowerCase()),i.push([t,r]),s[t]=s[t]?s[t]+","+r:r})),r(u())},o.onerror=n,o.withCredentials="include"==t.credentials,t.headers)o.setRequestHeader(c,t.headers[c]);o.send(t.body||null)}))}}),Ne={};try{!function(e,t){if(new e("q=%2B").get("q")!==t||new e({q:t}).get("q")!==t||new e([["q",t]]).get("q")!==t||"q=%0A"!==new e("q=\n").toString()||"q=+%26"!==new e({q:" &"}).toString()||"q=%25zx"!==new e({q:"%zx"}).toString())throw e;Ne.URLSearchParams=e}(URLSearchParams,"+")}catch(e){!function(e,t,r){var n=e.create,o=e.defineProperty,a=/[!'\(\)~]|%20|%00/g,i=/%(?![0-9a-fA-F]{2})/g,s=/\+/g,u={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"},c={append:function(e,t){h(this._ungap,e,t)},delete:function(e){delete this._ungap[e]},get:function(e){return this.has(e)?this._ungap[e][0]:null},getAll:function(e){return this.has(e)?this._ungap[e].slice(0):[]},has:function(e){return e in this._ungap},set:function(e,r){this._ungap[e]=[t(r)]},forEach:function(e,r){var n=this;for(var o in n._ungap)n._ungap[o].forEach(a,o);function a(a){e.call(r,a,t(o),n)}},toJSON:function(){return{}},toString:function(){var e=[];for(var t in this._ungap)for(var r=v(t),n=0,o=this._ungap[t];n<o.length;n++)e.push(r+"="+v(o[n]));return e.join("&")}};for(var l in c)o(f.prototype,l,{configurable:!0,writable:!0,value:c[l]});function f(e){var t=n(null);switch(o(this,"_ungap",{value:t}),!0){case!e:break;case"string"==typeof e:"?"===e.charAt(0)&&(e=e.slice(1));for(var a=e.split("&"),i=0,s=a.length;i<s;i++){var u=(c=a[i]).indexOf("=");-1<u?h(t,p(c.slice(0,u)),p(c.slice(u+1))):c.length&&h(t,p(c),"")}break;case r(e):for(i=0,s=e.length;i<s;i++){var c;h(t,(c=e[i])[0],c[1])}break;case"forEach"in e:e.forEach(d,t);break;default:for(var l in e)h(t,l,e[l])}}function d(e,t){h(this,t,e)}function h(e,t,n){var o=r(n)?n.join(","):n;t in e?e[t].push(o):e[t]=[o]}function p(e){return decodeURIComponent(e.replace(i,"%25").replace(s," "))}function v(e){return encodeURIComponent(e).replace(a,g)}function g(e){return u[e]}Ne.URLSearchParams=f}(Object,String,Array.isArray)}!function(e){var t=!1;try{t=!!Symbol.iterator}catch(e){}function r(e,r){var n=[];return e.forEach(r,n),t?n[Symbol.iterator]():{next:function(){var e=n.shift();return{done:void 0===e,value:e}}}}"forEach"in e||(e.forEach=function(e,t){var r=this,n=Object.create(null);this.toString().replace(/=[\s\S]*?(?:&|$)/g,"=").split("=").forEach((function(o){o.length&&!(o in n)&&(n[o]=r.getAll(o)).forEach((function(n){e.call(t,n,o,r)}))}))}),"keys"in e||(e.keys=function(){return r(this,(function(e,t){this.push(t)}))}),"values"in e||(e.values=function(){return r(this,(function(e,t){this.push(e)}))}),"entries"in e||(e.entries=function(){return r(this,(function(e,t){this.push([t,e])}))}),t&&!(Symbol.iterator in e)&&(e[Symbol.iterator]=e.entries),"sort"in e||(e.sort=function(){for(var e,t,r,n=this.entries(),o=n.next(),a=o.done,i=[],s=Object.create(null);!a;)t=(r=o.value)[0],i.push(t),t in s||(s[t]=[]),s[t].push(r[1]),a=(o=n.next()).done;for(i.sort(),e=0;e<i.length;e++)this.delete(i[e]);for(e=0;e<i.length;e++)t=i[e],this.append(t,s[t].shift())}),function(t){var r=t.defineProperty,n=t.getOwnPropertyDescriptor,o=function(t){var r=t.append;t.append=e.append,URLSearchParams.call(t,t._usp.search.slice(1)),t.append=r},a=function(e,t){if(!(e instanceof t))throw new TypeError("'searchParams' accessed on an object that does not implement interface "+t.name)},i=function(i){var s,u,c=i.prototype,l=n(c,"searchParams"),f=n(c,"href"),d=n(c,"search");!l&&d&&d.set&&(u=function(t){function n(r,n){e.append.call(this,r,n),r=this.toString(),t.set.call(this._usp,r?"?"+r:"")}function o(r){e.delete.call(this,r),r=this.toString(),t.set.call(this._usp,r?"?"+r:"")}function a(r,n){e.set.call(this,r,n),r=this.toString(),t.set.call(this._usp,r?"?"+r:"")}return function(e,t){return e.append=n,e.delete=o,e.set=a,r(e,"_usp",{configurable:!0,writable:!0,value:t})}}(d),s=function(e,t){return r(e,"_searchParams",{configurable:!0,writable:!0,value:u(t,e)}),t},t.defineProperties(c,{href:{get:function(){return f.get.call(this)},set:function(e){var t=this._searchParams;f.set.call(this,e),t&&o(t)}},search:{get:function(){return d.get.call(this)},set:function(e){var t=this._searchParams;d.set.call(this,e),t&&o(t)}},searchParams:{get:function(){return a(this,i),this._searchParams||s(this,new URLSearchParams(this.search.slice(1)))},set:function(e){a(this,i),s(this,e)}}}))};try{i(HTMLAnchorElement),/^function|object$/.test(typeof URL)&&URL.prototype&&i(URL)}catch(e){}}(Object)}(Ne.URLSearchParams.prototype);var Me=Ne.URLSearchParams,Ae=r(Object.freeze({__proto__:null,default:Me})),Ue=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getSapiOverrideParameter=void 0;var r=xe.__importDefault(Ae);t.getSapiOverrideParameter=function(e){if("undefined"==typeof window)return null;var t,n=new r.default(window.location.search).get("sapiOverride");try{n?(window.sessionStorage.setItem("sapiOverride",n),t=n):t=window.sessionStorage.getItem("sapiOverride")}catch(e){}return e?t&&t.length<=2e3?t:void 0:t}})),qe=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCheapestRate=void 0,t.getCheapestRate=function(e,t){if(0!==e.offers.length)return Math.min.apply(Math,e.offers.map((function(e){return t(e.rate)})))}})),Fe=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateDiscount=void 0,t.calculateDiscount=function(e,t,r){return void 0===t||void 0===r||0===r?0:e<t?-1*(e-t)/t:e>r?-1*(e-r)/r:0}}));function He(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function We(e){return He(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function Be(e){He(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}function Le(e){if(He(1,arguments),!We(e)&&"number"!=typeof e)return!1;var t=Be(e);return!isNaN(Number(t))}var ze={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ye=function(e,t,r){var n,o=ze[e];return n="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),null!=r&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function Ge(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.width?String(t.width):e.defaultWidth,n=e.formats[r]||e.formats[e.defaultWidth];return n}}var Ke={date:Ge({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Ge({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:Ge({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Je={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Qe=function(e,t,r,n){return Je[e]};function Ve(e){return function(t,r){var n,o=r||{};if("formatting"===(o.context?String(o.context):"standalone")&&e.formattingValues){var a=e.defaultFormattingWidth||e.defaultWidth,i=o.width?String(o.width):a;n=e.formattingValues[i]||e.formattingValues[a]}else{var s=e.defaultWidth,u=o.width?String(o.width):e.defaultWidth;n=e.values[u]||e.values[s]}return n[e.argumentCallback?e.argumentCallback(t):t]}}var Xe={ordinalNumber:function(e,t){var r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:Ve({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Ve({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:Ve({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Ve({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Ve({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function $e(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(o);if(!a)return null;var i,s=a[0],u=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(u)?et(u,(function(e){return e.test(s)})):Ze(u,(function(e){return e.test(s)}));i=e.valueCallback?e.valueCallback(c):c,i=r.valueCallback?r.valueCallback(i):i;var l=t.slice(s.length);return{value:i,rest:l}}}function Ze(e,t){for(var r in e)if(e.hasOwnProperty(r)&&t(e[r]))return r}function et(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return r}var tt,rt={ordinalNumber:(tt={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.match(tt.matchPattern);if(!r)return null;var n=r[0],o=e.match(tt.parsePattern);if(!o)return null;var a=tt.valueCallback?tt.valueCallback(o[0]):o[0];a=t.valueCallback?t.valueCallback(a):a;var i=e.slice(n.length);return{value:a,rest:i}}),era:$e({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:$e({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:$e({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:$e({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:$e({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},nt={code:"en-US",formatDistance:Ye,formatLong:Ke,formatRelative:Qe,localize:Xe,match:rt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ot(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function at(e,t){He(2,arguments);var r=Be(e).getTime(),n=ot(t);return new Date(r+n)}function it(e,t){He(2,arguments);var r=ot(t);return at(e,-r)}var st=864e5;function ut(e){He(1,arguments);var t=1,r=Be(e),n=r.getUTCDay(),o=(n<t?7:0)+n-t;return r.setUTCDate(r.getUTCDate()-o),r.setUTCHours(0,0,0,0),r}function ct(e){He(1,arguments);var t=Be(e),r=t.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(r+1,0,4),n.setUTCHours(0,0,0,0);var o=ut(n),a=new Date(0);a.setUTCFullYear(r,0,4),a.setUTCHours(0,0,0,0);var i=ut(a);return t.getTime()>=o.getTime()?r+1:t.getTime()>=i.getTime()?r:r-1}function lt(e){He(1,arguments);var t=ct(e),r=new Date(0);r.setUTCFullYear(t,0,4),r.setUTCHours(0,0,0,0);var n=ut(r);return n}var ft=6048e5;function dt(e,t){He(1,arguments);var r=t||{},n=r.locale,o=n&&n.options&&n.options.weekStartsOn,a=null==o?0:ot(o),i=null==r.weekStartsOn?a:ot(r.weekStartsOn);if(!(i>=0&&i<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var s=Be(e),u=s.getUTCDay(),c=(u<i?7:0)+u-i;return s.setUTCDate(s.getUTCDate()-c),s.setUTCHours(0,0,0,0),s}function ht(e,t){He(1,arguments);var r=Be(e),n=r.getUTCFullYear(),o=t||{},a=o.locale,i=a&&a.options&&a.options.firstWeekContainsDate,s=null==i?1:ot(i),u=null==o.firstWeekContainsDate?s:ot(o.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var c=new Date(0);c.setUTCFullYear(n+1,0,u),c.setUTCHours(0,0,0,0);var l=dt(c,t),f=new Date(0);f.setUTCFullYear(n,0,u),f.setUTCHours(0,0,0,0);var d=dt(f,t);return r.getTime()>=l.getTime()?n+1:r.getTime()>=d.getTime()?n:n-1}function pt(e,t){He(1,arguments);var r=t||{},n=r.locale,o=n&&n.options&&n.options.firstWeekContainsDate,a=null==o?1:ot(o),i=null==r.firstWeekContainsDate?a:ot(r.firstWeekContainsDate),s=ht(e,t),u=new Date(0);u.setUTCFullYear(s,0,i),u.setUTCHours(0,0,0,0);var c=dt(u,t);return c}var vt=6048e5;function gt(e,t){for(var r=e<0?"-":"",n=Math.abs(e).toString();n.length<t;)n="0"+n;return r+n}var mt={y:function(e,t){var r=e.getUTCFullYear(),n=r>0?r:1-r;return gt("yy"===t?n%100:n,t.length)},M:function(e,t){var r=e.getUTCMonth();return"M"===t?String(r+1):gt(r+1,2)},d:function(e,t){return gt(e.getUTCDate(),t.length)},a:function(e,t){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return"am"===r?"a.m.":"p.m."}},h:function(e,t){return gt(e.getUTCHours()%12||12,t.length)},H:function(e,t){return gt(e.getUTCHours(),t.length)},m:function(e,t){return gt(e.getUTCMinutes(),t.length)},s:function(e,t){return gt(e.getUTCSeconds(),t.length)},S:function(e,t){var r=t.length,n=e.getUTCMilliseconds();return gt(Math.floor(n*Math.pow(10,r-3)),t.length)}},yt="midnight",bt="noon",_t="morning",wt="afternoon",Ot="evening",Pt="night",St={G:function(e,t,r){var n=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){var n=e.getUTCFullYear(),o=n>0?n:1-n;return r.ordinalNumber(o,{unit:"year"})}return mt.y(e,t)},Y:function(e,t,r,n){var o=ht(e,n),a=o>0?o:1-o;return"YY"===t?gt(a%100,2):"Yo"===t?r.ordinalNumber(a,{unit:"year"}):gt(a,t.length)},R:function(e,t){return gt(ct(e),t.length)},u:function(e,t){return gt(e.getUTCFullYear(),t.length)},Q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return gt(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return gt(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){var n=e.getUTCMonth();switch(t){case"M":case"MM":return mt.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){var n=e.getUTCMonth();switch(t){case"L":return String(n+1);case"LL":return gt(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){var o=function(e,t){He(1,arguments);var r=Be(e),n=dt(r,t).getTime()-pt(r,t).getTime();return Math.round(n/vt)+1}(e,n);return"wo"===t?r.ordinalNumber(o,{unit:"week"}):gt(o,t.length)},I:function(e,t,r){var n=function(e){He(1,arguments);var t=Be(e),r=ut(t).getTime()-lt(t).getTime();return Math.round(r/ft)+1}(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):gt(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getUTCDate(),{unit:"date"}):mt.d(e,t)},D:function(e,t,r){var n=function(e){He(1,arguments);var t=Be(e),r=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var n=t.getTime(),o=r-n;return Math.floor(o/st)+1}(e);return"Do"===t?r.ordinalNumber(n,{unit:"dayOfYear"}):gt(n,t.length)},E:function(e,t,r){var n=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){var o=e.getUTCDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return gt(a,2);case"eo":return r.ordinalNumber(a,{unit:"day"});case"eee":return r.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(o,{width:"short",context:"formatting"});default:return r.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){var o=e.getUTCDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return gt(a,t.length);case"co":return r.ordinalNumber(a,{unit:"day"});case"ccc":return r.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(o,{width:"narrow",context:"standalone"});case"cccccc":return r.day(o,{width:"short",context:"standalone"});default:return r.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,r){var n=e.getUTCDay(),o=0===n?7:n;switch(t){case"i":return String(o);case"ii":return gt(o,t.length);case"io":return r.ordinalNumber(o,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){var n,o=e.getUTCHours();switch(n=12===o?bt:0===o?yt:o/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,r){var n,o=e.getUTCHours();switch(n=o>=17?Ot:o>=12?wt:o>=4?_t:Pt,t){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){var n=e.getUTCHours()%12;return 0===n&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return mt.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getUTCHours(),{unit:"hour"}):mt.H(e,t)},K:function(e,t,r){var n=e.getUTCHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):gt(n,t.length)},k:function(e,t,r){var n=e.getUTCHours();return 0===n&&(n=24),"ko"===t?r.ordinalNumber(n,{unit:"hour"}):gt(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):mt.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):mt.s(e,t)},S:function(e,t){return mt.S(e,t)},X:function(e,t,r,n){var o=(n._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return Dt(o);case"XXXX":case"XX":return It(o);default:return It(o,":")}},x:function(e,t,r,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"x":return Dt(o);case"xxxx":case"xx":return It(o);default:return It(o,":")}},O:function(e,t,r,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Tt(o,":");default:return"GMT"+It(o,":")}},z:function(e,t,r,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Tt(o,":");default:return"GMT"+It(o,":")}},t:function(e,t,r,n){var o=n._originalDate||e;return gt(Math.floor(o.getTime()/1e3),t.length)},T:function(e,t,r,n){return gt((n._originalDate||e).getTime(),t.length)}};function Tt(e,t){var r=e>0?"-":"+",n=Math.abs(e),o=Math.floor(n/60),a=n%60;if(0===a)return r+String(o);var i=t||"";return r+String(o)+i+gt(a,2)}function Dt(e,t){return e%60==0?(e>0?"-":"+")+gt(Math.abs(e)/60,2):It(e,t)}function It(e,t){var r=t||"",n=e>0?"-":"+",o=Math.abs(e);return n+gt(Math.floor(o/60),2)+r+gt(o%60,2)}var kt=St;function jt(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}}function Et(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}}var xt={p:Et,P:function(e,t){var r,n=e.match(/(P+)(p+)?/)||[],o=n[1],a=n[2];if(!a)return jt(e,t);switch(o){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",jt(o,t)).replace("{{time}}",Et(a,t))}},Ct=xt;function Rt(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}var Nt=["D","DD"],Mt=["YY","YYYY"];function At(e){return-1!==Nt.indexOf(e)}function Ut(e){return-1!==Mt.indexOf(e)}function qt(e,t,r){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://git.io/fxCyr"))}var Ft=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ht=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Wt=/^'([^]*?)'?$/,Bt=/''/g,Lt=/[a-zA-Z]/;function zt(e){return e.match(Wt)[1].replace(Bt,"'")}var Yt=Object.freeze({__proto__:null,default:function(e,t,r){He(2,arguments);var n=String(t),o=r||{},a=o.locale||nt,i=a.options&&a.options.firstWeekContainsDate,s=null==i?1:ot(i),u=null==o.firstWeekContainsDate?s:ot(o.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var c=a.options&&a.options.weekStartsOn,l=null==c?0:ot(c),f=null==o.weekStartsOn?l:ot(o.weekStartsOn);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!a.localize)throw new RangeError("locale must contain localize property");if(!a.formatLong)throw new RangeError("locale must contain formatLong property");var d=Be(e);if(!Le(d))throw new RangeError("Invalid time value");var h=Rt(d),p=it(d,h),v={firstWeekContainsDate:u,weekStartsOn:f,locale:a,_originalDate:d},g=n.match(Ht).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,Ct[t])(e,a.formatLong,v):e})).join("").match(Ft).map((function(r){if("''"===r)return"'";var n=r[0];if("'"===n)return zt(r);var i=kt[n];if(i)return!o.useAdditionalWeekYearTokens&&Ut(r)&&qt(r,t,e),!o.useAdditionalDayOfYearTokens&&At(r)&&qt(r,t,e),i(p,r,a.localize,v);if(n.match(Lt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+n+"`");return r})).join("");return g}});function Gt(e,t){He(2,arguments);var r=Be(e),n=ot(t);return isNaN(n)?new Date(NaN):n?(r.setDate(r.getDate()+n),r):r}var Kt=Object.freeze({__proto__:null,default:Gt});function Jt(e,t){He(1,arguments);var r=t||{},n=r.locale,o=n&&n.options&&n.options.weekStartsOn,a=null==o?0:ot(o),i=null==r.weekStartsOn?a:ot(r.weekStartsOn);if(!(i>=0&&i<=6))throw new RangeError("weekStartsOn must be between 0 and 6");var s=Be(e),u=s.getDay(),c=6+(u<i?-7:0)-(u-i);return s.setHours(0,0,0,0),s.setDate(s.getDate()+c),s}var Qt=Object.freeze({__proto__:null,default:function(e){return He(1,arguments),Jt(e,{weekStartsOn:1})}});var Vt=Object.freeze({__proto__:null,default:function(e,t){He(2,arguments);var r=ot(t),n=7*r;return Gt(e,n)}}),Xt=36e5;var $t={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Zt=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,er=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,tr=/^([+-])(\d{2})(?::?(\d{2}))?$/;function rr(e){var t,r={},n=e.split($t.dateTimeDelimiter);if(n.length>2)return r;if(/:/.test(n[0])?t=n[0]:(r.date=n[0],t=n[1],$t.timeZoneDelimiter.test(r.date)&&(r.date=e.split($t.timeZoneDelimiter)[0],t=e.substr(r.date.length,e.length))),t){var o=$t.timezone.exec(t);o?(r.time=t.replace(o[1],""),r.timezone=o[1]):r.time=t}return r}function nr(e,t){var r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(r);if(!n)return{year:NaN,restDateString:""};var o=n[1]?parseInt(n[1]):null,a=n[2]?parseInt(n[2]):null;return{year:null===a?o:100*a,restDateString:e.slice((n[1]||n[2]).length)}}function or(e,t){if(null===t)return new Date(NaN);var r=e.match(Zt);if(!r)return new Date(NaN);var n=!!r[4],o=ar(r[1]),a=ar(r[2])-1,i=ar(r[3]),s=ar(r[4]),u=ar(r[5])-1;if(n)return function(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}(0,s,u)?function(e,t,r){var n=new Date(0);n.setUTCFullYear(e,0,4);var o=n.getUTCDay()||7,a=7*(t-1)+r+1-o;return n.setUTCDate(n.getUTCDate()+a),n}(t,s,u):new Date(NaN);var c=new Date(0);return function(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(cr[t]||(lr(e)?29:28))}(t,a,i)&&function(e,t){return t>=1&&t<=(lr(e)?366:365)}(t,o)?(c.setUTCFullYear(t,a,Math.max(o,i)),c):new Date(NaN)}function ar(e){return e?parseInt(e):1}function ir(e){var t=e.match(er);if(!t)return NaN;var r=sr(t[1]),n=sr(t[2]),o=sr(t[3]);return function(e,t,r){if(24===e)return 0===t&&0===r;return r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}(r,n,o)?r*Xt+6e4*n+1e3*o:NaN}function sr(e){return e&&parseFloat(e.replace(",","."))||0}function ur(e){if("Z"===e)return 0;var t=e.match(tr);if(!t)return 0;var r="+"===t[1]?-1:1,n=parseInt(t[2]),o=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,o)?r*(n*Xt+6e4*o):NaN}var cr=[31,null,31,30,31,30,31,31,30,31,30,31];function lr(e){return e%400==0||e%4==0&&e%100!=0}var fr=Object.freeze({__proto__:null,default:function(e,t){He(1,arguments);var r=t||{},n=null==r.additionalDigits?2:ot(r.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var o,a=rr(e);if(a.date){var i=nr(a.date,n);o=or(i.restDateString,i.year)}if(!o||isNaN(o.getTime()))return new Date(NaN);var s,u=o.getTime(),c=0;if(a.time&&(c=ir(a.time),isNaN(c)))return new Date(NaN);if(!a.timezone){var l=new Date(u+c),f=new Date(0);return f.setFullYear(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()),f.setHours(l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()),f}return s=ur(a.timezone),isNaN(s)?new Date(NaN):new Date(u+c+s)}}),dr=r(Yt),hr=r(Kt),pr=r(Qt),vr=r(Vt),gr=r(fr),mr=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCheckInCheckOutDates=t.shouldUseClientDates=t.dateToMiddayUTC=t.DATE_FORMAT=void 0;var r=xe.__importDefault(dr),n=xe.__importDefault(hr),o=xe.__importDefault(pr),a=xe.__importDefault(vr),i=xe.__importDefault(gr);function s(e){return(0,i.default)("".concat(e," 12:00:00"))}t.DATE_FORMAT="yyyy-MM-dd",t.dateToMiddayUTC=s;var u=function(e,t){return(0,n.default)(e,t)};t.shouldUseClientDates=function(e,t){var r,n=e.checkIn,o=e.checkOut,a=e.dayDistance,i=e.nights,s=Boolean(n&&o||a&&(void 0===i?1:i)),u=!(null===(r=t.variations)||void 0===r?void 0:r.includes("sapi4eva-sid-landing-unavailability-b"));return s||u},t.getCheckInCheckOutDates=function(e,i){var c,l=e.checkIn,f=e.checkOut,d=e.dayDistance,h=e.nights,p=void 0===h?1:h,v=s((0,r.default)(new Date,t.DATE_FORMAT));c=void 0!==l?s(l):d?u(v,d):function(e){for(var i,u=e.daysFromNow,c=e.blockedDefaultDates,l=s((0,r.default)(new Date,t.DATE_FORMAT)),f=(0,o.default)((0,n.default)(l,u));i=(0,r.default)(f,t.DATE_FORMAT),c.includes(i);)f=(0,a.default)(f,1);return f}(i);var g=void 0===f?u(c,p):s(f);return{checkIn:(0,r.default)(c,t.DATE_FORMAT),checkOut:(0,r.default)(g,t.DATE_FORMAT)}}}));function yr(e){He(1,arguments);var t=Be(e);return t.setHours(0,0,0,0),t}var br=864e5;function _r(e,t){He(2,arguments);var r=yr(e),n=yr(t),o=r.getTime()-Rt(r),a=n.getTime()-Rt(n);return Math.round((o-a)/br)}function wr(e,t){var r=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return r<0?-1:r>0?1:r}var Or,Pr=Object.freeze({__proto__:null,default:function(e,t){He(2,arguments);var r=Be(e),n=Be(t),o=wr(r,n),a=Math.abs(_r(r,n));r.setDate(r.getDate()-o*a);var i=Number(wr(r,n)===-o),s=o*(a-i);return 0===s?0:s}}),Sr=r(Pr),Tr=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDealScores=t.calculateDealScores=void 0;var r=xe.__importDefault(Sr);function n(e){void 0===e&&(e=[]);for(var t={},r={},n=0,o=e;n<o.length;n++){var a=o[n],i=a[0],s=a[1],u=a[2],c=a[3];s&&(t[i]=(0,Fe.calculateDiscount)(s,u,c))}for(var l=Math.min.apply(Math,Object.values(t)),f=Math.max.apply(Math,Object.values(t)),d=0,h=e;d<h.length;d++){var p=h[d],v=(i=p[0],s=p[1],u=p[2],c=p[3],s&&c&&c>0?f===l?1:(t[i]-l)/(f-l):void 0);void 0!==v&&(r[i]=Number(v.toFixed(2)))}return r}t.calculateDealScores=n,t.getDealScores=function(e){var t=e.offset,o=e.anchorHotelId,a=e.hotelIds,i=e.hotelEntities,s=e.hotelOfferEntities,u=e.searchParameters,c=void 0===o||t>0?a:xe.__spreadArray([o],a,!0),l=(0,r.default)((0,mr.dateToMiddayUTC)(u.checkOut),(0,mr.dateToMiddayUTC)(u.checkIn)),f=c.map((function(e){var t,r,n=i[e],o=s[e],a=null!==(t=null==n?void 0:n.regularPriceRange)&&void 0!==t?t:[],u=a[0],c=a[1],f=null===(r=null==o?void 0:o.offers)||void 0===r?void 0:r[0],d=f?f.rate.base+f.rate.taxes+f.rate.hotelFees:void 0;return[e,d?d/l:void 0,u,c]}));return n(f)}})),Dr=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.omit=void 0,t.omit=function(e,t){for(var r={},n={},o=0,a=e.length;o<a;)n[e[o]]=1,o+=1;for(var i in t)Object.prototype.hasOwnProperty.call(n,i)||(r[i]=t[i]);return r}})),Ir=r(we),kr=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.createState=void 0,t.createState=function(e){var t=e;return{current:function(){return t},get:function(e){return t[e]},update:function(e){t=(0,Ir.produce)(t,e)}}}})),jr=new Uint8Array(16);function Er(){if(!Or&&!(Or="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Or(jr)}var xr=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Cr(e){return"string"==typeof e&&xr.test(e)}for(var Rr,Nr,Mr=[],Ar=0;Ar<256;++Ar)Mr.push((Ar+256).toString(16).substr(1));function Ur(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(Mr[e[t+0]]+Mr[e[t+1]]+Mr[e[t+2]]+Mr[e[t+3]]+"-"+Mr[e[t+4]]+Mr[e[t+5]]+"-"+Mr[e[t+6]]+Mr[e[t+7]]+"-"+Mr[e[t+8]]+Mr[e[t+9]]+"-"+Mr[e[t+10]]+Mr[e[t+11]]+Mr[e[t+12]]+Mr[e[t+13]]+Mr[e[t+14]]+Mr[e[t+15]]).toLowerCase();if(!Cr(r))throw TypeError("Stringified UUID is invalid");return r}var qr=0,Fr=0;function Hr(e){if(!Cr(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}function Wr(e,t,r){function n(e,n,o,a){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=Hr(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var i=new Uint8Array(16+e.length);if(i.set(n),i.set(e,n.length),(i=r(i))[6]=15&i[6]|t,i[8]=63&i[8]|128,o){a=a||0;for(var s=0;s<16;++s)o[a+s]=i[s];return o}return Ur(i)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function Br(e){return 14+(e+64>>>9<<4)+1}function Lr(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function zr(e,t,r,n,o,a){return Lr((i=Lr(Lr(t,e),Lr(n,a)))<<(s=o)|i>>>32-s,r);var i,s}function Yr(e,t,r,n,o,a,i){return zr(t&r|~t&n,e,t,o,a,i)}function Gr(e,t,r,n,o,a,i){return zr(t&n|r&~n,e,t,o,a,i)}function Kr(e,t,r,n,o,a,i){return zr(t^r^n,e,t,o,a,i)}function Jr(e,t,r,n,o,a,i){return zr(r^(t|~n),e,t,o,a,i)}var Qr=Wr("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function(e){for(var t=[],r=32*e.length,n="0123456789abcdef",o=0;o<r;o+=8){var a=e[o>>5]>>>o%32&255,i=parseInt(n.charAt(a>>>4&15)+n.charAt(15&a),16);t.push(i)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[Br(t)-1]=t;for(var r=1732584193,n=-271733879,o=-1732584194,a=271733878,i=0;i<e.length;i+=16){var s=r,u=n,c=o,l=a;r=Yr(r,n,o,a,e[i],7,-680876936),a=Yr(a,r,n,o,e[i+1],12,-389564586),o=Yr(o,a,r,n,e[i+2],17,606105819),n=Yr(n,o,a,r,e[i+3],22,-1044525330),r=Yr(r,n,o,a,e[i+4],7,-176418897),a=Yr(a,r,n,o,e[i+5],12,1200080426),o=Yr(o,a,r,n,e[i+6],17,-1473231341),n=Yr(n,o,a,r,e[i+7],22,-45705983),r=Yr(r,n,o,a,e[i+8],7,1770035416),a=Yr(a,r,n,o,e[i+9],12,-1958414417),o=Yr(o,a,r,n,e[i+10],17,-42063),n=Yr(n,o,a,r,e[i+11],22,-1990404162),r=Yr(r,n,o,a,e[i+12],7,1804603682),a=Yr(a,r,n,o,e[i+13],12,-40341101),o=Yr(o,a,r,n,e[i+14],17,-1502002290),r=Gr(r,n=Yr(n,o,a,r,e[i+15],22,1236535329),o,a,e[i+1],5,-165796510),a=Gr(a,r,n,o,e[i+6],9,-1069501632),o=Gr(o,a,r,n,e[i+11],14,643717713),n=Gr(n,o,a,r,e[i],20,-373897302),r=Gr(r,n,o,a,e[i+5],5,-701558691),a=Gr(a,r,n,o,e[i+10],9,38016083),o=Gr(o,a,r,n,e[i+15],14,-660478335),n=Gr(n,o,a,r,e[i+4],20,-405537848),r=Gr(r,n,o,a,e[i+9],5,568446438),a=Gr(a,r,n,o,e[i+14],9,-1019803690),o=Gr(o,a,r,n,e[i+3],14,-187363961),n=Gr(n,o,a,r,e[i+8],20,1163531501),r=Gr(r,n,o,a,e[i+13],5,-1444681467),a=Gr(a,r,n,o,e[i+2],9,-51403784),o=Gr(o,a,r,n,e[i+7],14,1735328473),r=Kr(r,n=Gr(n,o,a,r,e[i+12],20,-1926607734),o,a,e[i+5],4,-378558),a=Kr(a,r,n,o,e[i+8],11,-2022574463),o=Kr(o,a,r,n,e[i+11],16,1839030562),n=Kr(n,o,a,r,e[i+14],23,-35309556),r=Kr(r,n,o,a,e[i+1],4,-1530992060),a=Kr(a,r,n,o,e[i+4],11,1272893353),o=Kr(o,a,r,n,e[i+7],16,-155497632),n=Kr(n,o,a,r,e[i+10],23,-1094730640),r=Kr(r,n,o,a,e[i+13],4,681279174),a=Kr(a,r,n,o,e[i],11,-358537222),o=Kr(o,a,r,n,e[i+3],16,-722521979),n=Kr(n,o,a,r,e[i+6],23,76029189),r=Kr(r,n,o,a,e[i+9],4,-640364487),a=Kr(a,r,n,o,e[i+12],11,-421815835),o=Kr(o,a,r,n,e[i+15],16,530742520),r=Jr(r,n=Kr(n,o,a,r,e[i+2],23,-995338651),o,a,e[i],6,-198630844),a=Jr(a,r,n,o,e[i+7],10,1126891415),o=Jr(o,a,r,n,e[i+14],15,-1416354905),n=Jr(n,o,a,r,e[i+5],21,-57434055),r=Jr(r,n,o,a,e[i+12],6,1700485571),a=Jr(a,r,n,o,e[i+3],10,-1894986606),o=Jr(o,a,r,n,e[i+10],15,-1051523),n=Jr(n,o,a,r,e[i+1],21,-2054922799),r=Jr(r,n,o,a,e[i+8],6,1873313359),a=Jr(a,r,n,o,e[i+15],10,-30611744),o=Jr(o,a,r,n,e[i+6],15,-1560198380),n=Jr(n,o,a,r,e[i+13],21,1309151649),r=Jr(r,n,o,a,e[i+4],6,-145523070),a=Jr(a,r,n,o,e[i+11],10,-1120210379),o=Jr(o,a,r,n,e[i+2],15,718787259),n=Jr(n,o,a,r,e[i+9],21,-343485551),r=Lr(r,s),n=Lr(n,u),o=Lr(o,c),a=Lr(a,l)}return[r,n,o,a]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(Br(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))})),Vr=Qr;function Xr(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function $r(e,t){return e<<t|e>>>32-t}var Zr=Wr("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var o=0;o<n.length;++o)e.push(n.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var a=e.length/4+2,i=Math.ceil(a/16),s=new Array(i),u=0;u<i;++u){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=e[64*u+4*l]<<24|e[64*u+4*l+1]<<16|e[64*u+4*l+2]<<8|e[64*u+4*l+3];s[u]=c}s[i-1][14]=8*(e.length-1)/Math.pow(2,32),s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=8*(e.length-1)&4294967295;for(var f=0;f<i;++f){for(var d=new Uint32Array(80),h=0;h<16;++h)d[h]=s[f][h];for(var p=16;p<80;++p)d[p]=$r(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var v=r[0],g=r[1],m=r[2],y=r[3],b=r[4],_=0;_<80;++_){var w=Math.floor(_/20),O=$r(v,5)+Xr(w,g,m,y)+b+t[w]+d[_]>>>0;b=y,y=m,m=$r(g,30)>>>0,g=v,v=O}r[0]=r[0]+v>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+y>>>0,r[4]=r[4]+b>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]})),en=Zr;var tn=Object.freeze({__proto__:null,v1:function(e,t,r){var n=t&&r||0,o=t||new Array(16),a=(e=e||{}).node||Rr,i=void 0!==e.clockseq?e.clockseq:Nr;if(null==a||null==i){var s=e.random||(e.rng||Er)();null==a&&(a=Rr=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==i&&(i=Nr=16383&(s[6]<<8|s[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:Fr+1,l=u-qr+(c-Fr)/1e4;if(l<0&&void 0===e.clockseq&&(i=i+1&16383),(l<0||u>qr)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");qr=u,Fr=c,Nr=i;var f=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;o[n++]=f>>>24&255,o[n++]=f>>>16&255,o[n++]=f>>>8&255,o[n++]=255&f;var d=u/4294967296*1e4&268435455;o[n++]=d>>>8&255,o[n++]=255&d,o[n++]=d>>>24&15|16,o[n++]=d>>>16&255,o[n++]=i>>>8|128,o[n++]=255&i;for(var h=0;h<6;++h)o[n+h]=a[h];return t||Ur(o)},v3:Vr,v4:function(e,t,r){var n=(e=e||{}).random||(e.rng||Er)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=n[o];return t}return Ur(n)},v5:en,NIL:"00000000-0000-0000-0000-000000000000",version:function(e){if(!Cr(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)},validate:Cr,stringify:Ur,parse:Hr}),rn=r(tn),nn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.generateSearchId=void 0,t.generateSearchId=function(){return(0,rn.v4)()}})),on=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.augmentHotelWithRegularPriceRange=void 0,t.augmentHotelWithRegularPriceRange=function(e,t,r){var n;if(void 0===(null===(n=e.pricing)||void 0===n?void 0:n.medianRateBkt)||void 0===r)return e;var o=e.pricing.medianRateBkt*r*t,a=(e.pricing.medianRateBkt+1)*r*t;return xe.__assign(xe.__assign({},e),{regularPriceRange:[Math.floor(o),Math.ceil(a)]})}})),an=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.removeEmpty=void 0,t.removeEmpty=function e(t){return Object.entries(t).filter((function(e){e[0];var t=e[1];return null!=t})).reduce((function(t,r){var n,o=r[0],a=r[1];return xe.__assign(xe.__assign({},t),((n={})[o]=a===new Object(a)?e(a):a,n))}),{})}})),sn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.generateSortingBoost=void 0,t.generateSortingBoost=function(e){var t;return(null===(t=null==e?void 0:e.filters)||void 0===t?void 0:t.freeCancellation)?"freeCancellation=true:100":void 0}})),un=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.buildOffersResponse=t.applySort=t.applyPriceFilter=t.isRateInPriceRange=void 0;var r=xe.__importDefault(Sr);function n(e,t,r,n){return!(r&&e<r)&&!(n&&n<t&&e>n)}function o(e,t){var o,a=e.filters,i=void 0===a?{}:a,s=e.priceBucketWidth,u=e.priceBucketsCount,c=e.exchangeRate,l=e.getTotalRate;if(void 0===s)return t;var f=u*Math.round(s*c);if(void 0!==i.priceMin||void 0!==i.priceMax){var d=(0,r.default)((0,mr.dateToMiddayUTC)(e.checkOut),(0,mr.dateToMiddayUTC)(e.checkIn));if(!(null===(o=t.offers)||void 0===o?void 0:o.some((function(e){return n((t=l(e.rate),void 0===(r=d)&&(r=1),1===r?t:t/r),f,i.priceMin,i.priceMax);var t,r}))))return xe.__assign(xe.__assign({},t),{offers:[]})}return t}function a(e,t){var r=t.sortField,n=t.sortOrder,o=void 0===n?"ascending":n,a=t.getTotalRate;return"price"===r?function(e,t,r){return e.sort((function(e,n){var o,a,i=(null!==(o=(0,qe.getCheapestRate)(e,r))&&void 0!==o?o:0)-(null!==(a=(0,qe.getCheapestRate)(n,r))&&void 0!==a?a:0);return"ascending"===t?i:-i}))}(e,o,a):e}t.isRateInPriceRange=n,t.applyPriceFilter=o,t.applySort=a,t.buildOffersResponse=function(e,t){var r,n=e.hotelOfferEntities,i=e.anchorHotelOfferEntity;n&&(r=n.map((function(e){return o(t,e)})),void 0!==t.sortField&&(r=a(r,t)));var s=[],u={};if(r)for(var c=0,l=r;c<l.length;c++){var f=l[c];s.push(f.id),u[f.id]=f}return void 0!==i&&(u[i.id]=i),{hotelIds:s,hotelOfferEntities:u}}})),cn=t((function(e,t){function r(e){return Boolean(e&&""!==(null==e?void 0:e.trim()))}function n(e,t){for(var n=0,o=t;n<o.length;n++){var a=o[n];if(r(null==e?void 0:e[a]))return e[a]}return""}function o(e,t,o){void 0===o&&(o=", ");for(var a={},i=0,s=t;i<s.length;i++){var u=s[i],c=(null==e?void 0:e[u])||[];a[u]=c.map((function(n,o){if(r(n))return n;var a=t.find((function(t){var n;return r(null===(n=null==e?void 0:e[t])||void 0===n?void 0:n[o])}));return a?e[a][o]:""})).join("".concat(o))}return n(a,t)}function a(e,t,o){for(var a={},i=0,s=t;i<s.length;i++){var u=s[i],c=e[u]||[],l=-1===o?void 0:o+1,f=c.slice(o,l).toString();if(r(f))a[u]=f;else{var d=t.find((function(t){var n;return r(null===(n=null==e?void 0:e[t])||void 0===n?void 0:n[o])}));a[u]=d?e[d][o]:""}}return n(a,t)}function i(e,t){for(var o,a={},i=0,s=t;i<s.length;i++){var u=s[i],c=null===(o=e[u])||void 0===o?void 0:o.value;if(r(c))a[u]=c;else{var l=t.find((function(t){var n;return r(null===(n=e[t])||void 0===n?void 0:n.value)}));a[u]=l?e[l].value:""}}return n(a,t)}function s(e,t,r){var n,o=e[t];if(!o){var a=r.indexOf(t),i=null!==(n=r.slice(a).find((function(t){return e[t]})))&&void 0!==n?n:"en";o=e[i]}return void 0===o&&(o=[]),"string"==typeof o?[o]:o}function u(e,t,r){if(void 0===e)return t;try{for(var n in t)if(void 0===e[n])throw new TypeError("Hotel ".concat(e.objectID," is missing ").concat(n," field"))}catch(e){r||console.error(e)}return xe.__assign(xe.__assign({},t),e)}function c(e){if(void 0===e)return"property";switch(e){case 0:return"country";case 23:return"city";case 64:case 1010:return"airport";case 199:case 232:case 251:case 1024:return"station";default:return"area"}}Object.defineProperty(t,"__esModule",{value:!0}),t.hitToPlaceSuggest=t.hitToHotelSuggest=t.placeTypeToPlaceTypeName=t.validateHit=t.mergeTranslatedAttributes=t.attributeWithFallback=t.getValueFromTranslatedHightlightResult=t.getStringFromTranslatedArray=t.translatedArrayToString=t.toString=t.getTranslatedAttributes=t.isNotEmptyOrWhiteSpace=void 0,t.isNotEmptyOrWhiteSpace=r,t.getTranslatedAttributes=function(e,t){for(var r=[],n=function(e){var n=t.map((function(t){return"".concat(t,".").concat(e)}));r.push.apply(r,n)},o=0,a=e;o<a.length;o++){n(a[o])}return r},t.toString=n,t.translatedArrayToString=o,t.getStringFromTranslatedArray=a,t.getValueFromTranslatedHightlightResult=i,t.attributeWithFallback=s,t.mergeTranslatedAttributes=function(e,t,r){for(var n={},a=0,i=r;a<i.length;a++){var u=i[a];n[u]=xe.__spreadArray(xe.__spreadArray([],s(e,u,r),!0),s(t,u,r),!0)}return o(n,r)},t.validateHit=u,t.placeTypeToPlaceTypeName=c,t.hitToHotelSuggest=function(e,t){var o=u(e,{objectID:"",placeADN:{},placeDN:{},objectType:"",hotelName:{},_highlightResult:{}}),s=a(o.placeADN,t,-1),l=a(o.placeDN,t,1),f=r(l)?"".concat(l,", ").concat(s):s,d=i(o._highlightResult.hotelName,t);return{objectID:o.objectID.replace("".concat(o.objectType,":"),""),objectType:o.objectType,value:n(o.hotelName,t),highlightValue:d,placeDisplayName:f,placeTypeName:c()}},t.hitToPlaceSuggest=function(e,t){var o=u(e,{objectID:"",placeADN:{},placeDN:{},objectType:"",placeName:{},placeType:0,_highlightResult:{}}),s=a(o.placeADN,t,-1),l=a(o.placeDN,t,1),f=r(l)?"".concat(l,", ").concat(s):s,d=i(o._highlightResult.placeName,t);return{objectID:o.objectID.replace("".concat(o.objectType,":"),""),objectType:o.objectType,value:n(o.placeName,t),highlightValue:d,placeDisplayName:f,placeTypeName:c(o.placeType)}}})),ln=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.hasRequiredSearchParameters=void 0;t.hasRequiredSearchParameters=function(e){var t=e,r=t.checkIn,n=t.checkOut,o=t.rooms;return Boolean(r&&n&&o)}})),fn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getTotalRate=void 0,t.getTotalRate=function(e){return e.base+e.hotelFees+e.taxes}})),dn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),xe.__exportStar(qe,t),xe.__exportStar(Fe,t),xe.__exportStar(mr,t),xe.__exportStar(Tr,t),xe.__exportStar(Dr,t),xe.__exportStar(kr,t),xe.__exportStar(nn,t),xe.__exportStar(on,t),xe.__exportStar(an,t),xe.__exportStar(sn,t),xe.__exportStar(un,t),xe.__exportStar(cn,t),xe.__exportStar(ln,t),xe.__exportStar(fn,t)})),hn=t((function(e,t){function r(e,t){return void 0===e&&(e=""),void 0===t&&(t=500),{name:"ApiError",message:e,status:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.createBackendError=t.createApiError=void 0,t.createApiError=r,t.createBackendError=function(e,t){var n,o;return xe.__awaiter(this,void 0,void 0,(function(){var a,i;return xe.__generator(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,e.json()];case 1:return i=s.sent(),a=null!==(o=null!==(n=i.message)&&void 0!==n?n:e.statusText)&&void 0!==o?o:t,[3,3];case 2:return s.sent(),[3,3];case 3:return[2,r(a,e.status)]}}))}))}})),pn=r(Re),vn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.search=t.createAnchorRequestString=t.createSearchRequestString=t.prepareSearchParameters=void 0;var r=xe.__importDefault(pn),n=xe.__importDefault(Ae),o=31;function a(e,t,r){var n;e.checkIn,e.checkOut,e.dayDistance,e.nights;var o=xe.__rest(e,["checkIn","checkOut","dayDistance","nights"]);return xe.__assign(xe.__assign(xe.__assign({},o),(0,dn.shouldUseClientDates)(e,r)?(0,dn.getCheckInCheckOutDates)(e,t):{}),{rooms:null!==(n=e.rooms)&&void 0!==n?n:"2"})}function i(e){var t,r,o,a,i,s,u,c,l,f,d,h,p,v,g,m,y,b,_,w,O=e.profileKey,P=e.searchId,S=e.searchParameters,T=e.options,D=e.offset,I=e.attributes,k=(0,dn.removeEmpty)({offset:D,searchId:P,profileId:O,query:S.query,hotelId:S.hotelId,placeId:S.hotelId?void 0:S.placeId,checkIn:S.checkIn,checkOut:S.checkOut,rooms:S.rooms,dayDistance:S.dayDistance,nights:S.nights,sortField:S.sortField,sortOrder:S.sortOrder,boundingBox:null===(t=S.boundingBox)||void 0===t?void 0:t.join(","),currency:T.currency,language:T.language,variations:null===(r=T.variations)||void 0===r?void 0:r.join(","),starRating:null===(a=null===(o=S.filters)||void 0===o?void 0:o.starRating)||void 0===a?void 0:a.join(","),guestRating:null===(s=null===(i=S.filters)||void 0===i?void 0:i.guestRating)||void 0===s?void 0:s.join(","),propertyTypeId:null===(c=null===(u=S.filters)||void 0===u?void 0:u.propertyTypeId)||void 0===c?void 0:c.join(","),facilities:null===(f=null===(l=S.filters)||void 0===l?void 0:l.facilities)||void 0===f?void 0:f.join(","),themeIds:null===(h=null===(d=S.filters)||void 0===d?void 0:d.themeIds)||void 0===h?void 0:h.join(","),chainIds:null===(v=null===(p=S.filters)||void 0===p?void 0:p.chainIds)||void 0===v?void 0:v.join(","),noHostels:null===(g=S.filters)||void 0===g?void 0:g.noHostels,priceMin:null===(m=S.filters)||void 0===m?void 0:m.priceMin,priceMax:null===(y=S.filters)||void 0===y?void 0:y.priceMax,hotelName:null===(b=S.filters)||void 0===b?void 0:b.hotelName,freeCancellation:null===(_=S.filters)||void 0===_?void 0:_.freeCancellation,attributes:null==I?void 0:I.join(","),anonymousId:T.anonymousId,cugDeals:null===(w=S.cugDeals)||void 0===w?void 0:w.join(","),tier:S.tier,deviceType:T.deviceType,originId:S.originId,brand:T.brand,sortingBoost:(0,dn.generateSortingBoost)(S),preferredRate:S.preferredRate,label:S.trafficSource,countryCode:T.countryCode,userId:S.userId,emailDomain:S.emailDomain,screenshots:S.screenshots});return new n.default(k).toString()}function s(e,t){var n=e.baseUrl,o=e.endpoints;return xe.__awaiter(this,void 0,void 0,(function(){var e,a,s,u,c,l,f,d;return xe.__generator(this,(function(h){switch(h.label){case 0:return e=i(t),a=(0,Ue.getSapiOverrideParameter)(),s={credentials:"include"},a&&(s.method="POST",s.headers={"Content-Type":"application/json"},s.body=JSON.stringify({sapiOverride:a})),[4,(0,r.default)("https://".concat(n,"/").concat(o.search,"?").concat(e),s)];case 1:return(u=h.sent()).ok?[4,u.json()]:[3,3];case 2:return[2,h.sent()];case 3:return c=t.searchParameters,l=t.options,f=t.offset,d=t.attributes,l.logger.log({name:"SearchFailed",value:xe.__assign(xe.__assign({},c),{offset:f,attributes:d,language:l.language,currency:l.currency,deviceType:l.deviceType})}),[4,(0,hn.createBackendError)(u,"Search request failed")];case 4:throw h.sent()}}))}))}function u(e){var t,r,o,a=e.profileKey,i=e.searchId,s=e.searchParameters,u=e.options,c=e.attributes,l=(0,dn.removeEmpty)({searchId:i,profileId:a,query:s.query,hotelId:s.hotelId,placeId:s.hotelId?void 0:s.placeId,boundingBox:null===(t=s.boundingBox)||void 0===t?void 0:t.join(","),currency:u.currency,language:u.language,variations:null===(r=u.variations)||void 0===r?void 0:r.join(","),attributes:null==c?void 0:c.join(","),anonymousId:u.anonymousId,cugDeals:null===(o=s.cugDeals)||void 0===o?void 0:o.join(","),tier:s.tier,sapiOverride:(0,Ue.getSapiOverrideParameter)(!0),userId:s.userId,emailDomain:s.emailDomain,screenshots:s.screenshots});return new n.default(l).toString()}function c(e,t){var n=e.baseUrl,o=e.endpoints;return xe.__awaiter(this,void 0,void 0,(function(){var e,a,i,s,c;return xe.__generator(this,(function(l){switch(l.label){case 0:return e=u(t),[4,(0,r.default)("https://".concat(n,"/").concat(o.anchor,"?").concat(e))];case 1:return(a=l.sent()).ok?[4,a.json()]:[3,3];case 2:return[2,l.sent()];case 3:return i=t.searchParameters,s=t.options,c=t.attributes,s.logger.log({name:"AnchorSearchFailed",value:xe.__assign(xe.__assign({},i),{attributes:c,language:s.language,currency:s.currency,deviceType:s.deviceType})}),[4,(0,hn.createBackendError)(a,"Anchor request failed")];case 4:throw l.sent()}}))}))}t.prepareSearchParameters=a,t.createSearchRequestString=i,t.createAnchorRequestString=u,t.search=function(e){var t,r=this,n=e.getFeatureEnabled,i=e.profileKey,u=e.appConfig,l=e.offersClient,f=e.options,d=n("offers"),h=!1;return function(e,n){return void 0===n&&(n={}),xe.__awaiter(r,void 0,void 0,(function(){function r(){var e=p.current().searchParameters;if(!(0,dn.hasRequiredSearchParameters)(e))throw new Error("Dates must be set by client, SDK or response");return e}var p,v,g,m,y,b,_,w,O,P,S,T,D,I=this;return xe.__generator(this,(function(k){switch(k.label){case 0:return p=(0,dn.createState)({}),v=n.onStart,g=n.onAnchorReceived,m=n.onHotelsReceived,y=n.onOffersReceived,b=n.onComplete,_=0,w=a(e,u.client,f),O=(0,dn.generateSearchId)(),p.update((function(e){e.searchParameters=w,e.searchId=O})),"function"==typeof v&&v(p.current()),P=function(e,n,a){return void 0===e&&(e=0),xe.__awaiter(I,void 0,void 0,(function(){var a,c,v,_,P,S,T;return xe.__generator(this,(function(D){switch(D.label){case 0:return[4,s(u.sapiBackend,{profileKey:i,searchParameters:w,options:f,offset:e,attributes:n,searchId:O})];case 1:return a=D.sent(),h||(t=a.exchangeRates[f.currency],(null===(S=f.callbacks)||void 0===S?void 0:S.onConfigReceived)&&f.callbacks.onConfigReceived({lov:a.lov,exchangeRates:a.exchangeRates}),h=!0),(void 0===n||n.includes("anchor"))&&(p.update((function(e){e.anchor=a.anchor,e.anchorHotelId=a.anchorHotelId,e.anchorType=a.anchorType,e.hotelEntities=a.hotelEntities,e.searchParameters=xe.__assign(xe.__assign({},e.searchParameters),{checkIn:a.searchParameters.checkIn,checkOut:a.searchParameters.checkOut})})),"function"==typeof g&&g(p.current())),p.update((function(e){e.facets=a.facets,e.hotelEntities=a.hotelEntities,e.hotelIds=a.hotelIds,e.hotelsHaveStaticPosition=a.hotelsHaveStaticPosition,e.offset=a.offset,e.resultsCount=a.resultsCount,e.resultsCountTotal=a.resultsCountTotal})),"function"==typeof m&&m(p.current()),d&&void 0!==l?(c=p.get("hotelIds"),v=xe.__assign(xe.__assign({},r()),{searchId:O,hotelIds:c,anchorHotelId:p.get("anchorHotelId")}),[4,l.getOffers(v,(function(e){var r,n=(0,dn.buildOffersResponse)(e,{checkIn:v.checkIn,checkOut:v.checkOut,sortField:v.sortField,sortOrder:v.sortOrder,filters:v.filters,priceBucketWidth:null===(r=p.get("anchor"))||void 0===r?void 0:r.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate});p.update((function(e){n.hotelIds.length>0&&(e.hotelIds=n.hotelIds),e.hotelOfferEntities=xe.__assign(xe.__assign({},e.hotelOfferEntities),n.hotelOfferEntities)})),"function"==typeof y&&y(p.current())}))]):[3,3];case 2:_=D.sent(),P=(0,dn.buildOffersResponse)(_,{checkIn:v.checkIn,checkOut:v.checkOut,sortField:v.sortField,sortOrder:v.sortOrder,filters:v.filters,priceBucketWidth:null===(T=p.get("anchor"))||void 0===T?void 0:T.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate}),p.update((function(e){e.hotelIds=P.hotelIds,e.hotelOfferEntities=P.hotelOfferEntities})),p.update((function(e){if(!(0,dn.hasRequiredSearchParameters)(e.searchParameters))throw new Error("Dates must be set by client, SDK or response");e.dealScores=(0,dn.getDealScores)(xe.__assign(xe.__assign({},e),{searchParameters:e.searchParameters}))})),D.label=3;case 3:return"function"==typeof b&&b(p.current()),[2,p.current()]}}))}))},S=function(e,n,a){return void 0===e&&(e=0),void 0===a&&(a=!0),xe.__awaiter(I,void 0,void 0,(function(){var v,_,P=this;return xe.__generator(this,(function(S){switch(S.label){case 0:return v=function(){return xe.__awaiter(P,void 0,void 0,(function(){var e,n,a,s;return xe.__generator(this,(function(v){switch(v.label){case 0:return e=["anchor","anchorHotelId","anchorType","hotelEntities","searchParameters"],h||e.push("lov","exchangeRates"),[4,c(u.sapiBackend,{searchId:O,profileKey:i,searchParameters:w,options:f,attributes:e})];case 1:return n=v.sent(),h||(t=n.exchangeRates[f.currency],(null===(s=f.callbacks)||void 0===s?void 0:s.onConfigReceived)&&f.callbacks.onConfigReceived({lov:n.lov,exchangeRates:n.exchangeRates}),h=!0),p.update((function(e){e.anchor=n.anchor,e.anchorHotelId=n.anchorHotelId,e.anchorType=n.anchorType,e.hotelEntities=xe.__assign(xe.__assign({},e.hotelEntities),n.hotelEntities),e.searchParameters=xe.__assign(xe.__assign({},e.searchParameters),{checkIn:n.searchParameters.checkIn,checkOut:n.searchParameters.checkOut})})),"function"==typeof g&&g(p.current()),d&&void 0!==l&&"hotel"===n.anchorType?(a=xe.__assign(xe.__assign({},r()),{anchorHotelId:n.anchorHotelId,searchId:O}),[4,l.getOffers(a,(function(e){var r,n=(0,dn.buildOffersResponse)(e,{checkIn:a.checkIn,checkOut:a.checkOut,sortField:a.sortField,sortOrder:a.sortOrder,filters:a.filters,priceBucketWidth:null===(r=p.get("anchor"))||void 0===r?void 0:r.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate});p.update((function(e){e.hotelOfferEntities=xe.__assign(xe.__assign({},e.hotelOfferEntities),n.hotelOfferEntities)})),"function"==typeof y&&y(p.current())}))]):[3,3];case 2:v.sent(),v.label=3;case 3:return[2,p.current()]}}))}))},_=function(){return xe.__awaiter(P,void 0,void 0,(function(){var n,c,h,v,g;return xe.__generator(this,(function(b){switch(b.label){case 0:return[4,s(u.sapiBackend,{searchId:O,profileKey:i,searchParameters:w,options:f,offset:e,attributes:["facets","hotelEntities","hotelIds","hotelsHaveStaticPosition","offset","resultsCount","resultsCountTotal","searchParameters"]})];case 1:return n=b.sent(),p.update((function(e){e.facets=n.facets,e.hotelEntities=a?xe.__assign(xe.__assign({},e.hotelEntities),n.hotelEntities):n.hotelEntities,e.hotelIds=n.hotelIds,e.hotelsHaveStaticPosition=n.hotelsHaveStaticPosition,e.offset=n.offset,e.resultsCount=n.resultsCount,e.resultsCountTotal=n.resultsCountTotal,e.searchParameters=xe.__assign(xe.__assign({},e.searchParameters),{checkIn:n.searchParameters.checkIn,checkOut:n.searchParameters.checkOut})})),"function"==typeof m&&m(p.current()),d&&void 0!==l?(c=xe.__assign(xe.__assign({},r()),{searchId:O,hotelIds:p.get("hotelIds")}),[4,l.getOffers(c,(function(e){var r,n=(0,dn.buildOffersResponse)(e,{checkIn:c.checkIn,checkOut:c.checkOut,sortField:c.sortField,sortOrder:c.sortOrder,filters:c.filters,priceBucketWidth:null===(r=p.get("anchor"))||void 0===r?void 0:r.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate});p.update((function(e){n.hotelIds.length>0&&(e.hotelIds=n.hotelIds),e.hotelOfferEntities=xe.__assign(xe.__assign({},e.hotelOfferEntities),n.hotelOfferEntities)})),"function"==typeof y&&y(p.current())}))]):[3,3];case 2:h=b.sent(),v=(0,dn.buildOffersResponse)(h,{checkIn:c.checkIn,checkOut:c.checkOut,sortField:c.sortField,sortOrder:c.sortOrder,filters:c.filters,priceBucketWidth:null===(g=p.get("anchor"))||void 0===g?void 0:g.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate}),p.update((function(e){e.hotelIds=v.hotelIds,e.hotelOfferEntities=a?xe.__assign(xe.__assign({},e.hotelOfferEntities),v.hotelOfferEntities):v.hotelOfferEntities})),p.update((function(e){if(!(0,dn.hasRequiredSearchParameters)(e.searchParameters))throw new Error("Dates must be set by client, SDK or response");e.dealScores=(0,dn.getDealScores)(xe.__assign(xe.__assign({},e),{searchParameters:e.searchParameters}))})),b.label=3;case 3:return[2,p.current()]}}))}))},[4,void 0===n||n.includes("anchor")?Promise.all([v(),_()]):_()];case 1:return S.sent(),"function"==typeof b&&b(p.current()),[2,p.current()]}}))}))},T=(null===(D=f.variations)||void 0===D?void 0:D.includes("sapi4eva2-magic-sort-b"))?S:P,[4,h?T(w.offset,["anchor","anchorHotelId","anchorType","facets","resultsCount","resultsCountTotal","offset","hotelIds","hotelEntities","hotelsHaveStaticPosition","searchParameters"]):T(w.offset)];case 1:return k.sent(),[2,{loadOffers:function(e){var n,a;return xe.__awaiter(this,void 0,void 0,(function(){var i,s,u,c;return xe.__generator(this,(function(h){switch(h.label){case 0:if(!e)throw new Error("Hotel id must be provided");if(!d||!l)throw new Error("Offers loading is disabled");return i=e===p.get("anchorHotelId"),s=xe.__assign(xe.__assign({},r()),{searchId:O,getAllOffers:!0,hotelIds:i?void 0:[e],anchorHotelId:i?e:void 0}),[4,l.getOffers(s)];case 1:return u=h.sent(),c=(0,dn.buildOffersResponse)(u,{checkIn:s.checkIn,checkOut:s.checkOut,sortField:s.sortField,sortOrder:s.sortOrder,filters:s.filters,priceBucketWidth:null===(n=p.get("anchor"))||void 0===n?void 0:n.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate}),[2,null===(a=c.hotelOfferEntities)||void 0===a?void 0:a[e]]}}))}))},loadMore:function(){return xe.__awaiter(this,void 0,void 0,(function(){return xe.__generator(this,(function(e){return _+=p.get("resultsCount"),[2,T(_,["offset","facets","resultsCount","resultsCountTotal","hotelIds","hotelEntities","hotelsHaveStaticPosition"],!1)]}))}))}}]}}))}))}}})),gn=t((function(e,t){e.exports=function(){function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}function n(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function i(e){var t,r="algoliasearch-client-js-".concat(e.key),n=function(){return void 0===t&&(t=e.localStorage||window.localStorage),t},a=function(){return JSON.parse(n().getItem(r)||"{}")};return{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){var r=JSON.stringify(e),n=a()[r];return Promise.all([n||t(),void 0!==n])})).then((function(e){var t=o(e,2),n=t[0],a=t[1];return Promise.all([n,a||r.miss(n)])})).then((function(e){return o(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var o=a();return o[JSON.stringify(e)]=t,n().setItem(r,JSON.stringify(o)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=a();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function s(e){var t=a(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return t().then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return o(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,o).catch((function(){return s({caches:t}).get(e,n,o)}))},set:function(e,n){return r.set(e,n).catch((function(){return s({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return s({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return s({caches:t}).clear()}))}}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(r);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var i=n(),s=o&&o.miss||function(){return Promise.resolve()};return i.then((function(e){return s(e)})).then((function(){return i}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function c(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===v.WithinHeaders?n:{}},queryParameters:function(){return e===v.WithinQueryParameters?n:{}}}}function l(e){var t=0;return e((function r(){return t++,new Promise((function(n){setTimeout((function(){n(e(r))}),Math.min(100*t,1e3))}))}))}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e,t){return Promise.resolve()};return Object.assign(e,{wait:function(r){return f(e.then((function(e){return Promise.all([t(e,r),e])})).then((function(e){return e[1]})))}})}function d(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function h(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function p(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=0;return e.replace(/%s/g,(function(){return encodeURIComponent(r[o++])}))}var v={WithinQueryParameters:0,WithinHeaders:1};function g(e,t){var r=e||{},n=r.data||{};return Object.keys(r).forEach((function(e){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var m={Read:1,Write:2,Any:3},y=1,b=2,_=3;function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function O(e){return"string"==typeof e?{protocol:"https",url:e,accept:m.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||m.Any}}var P="DELETE",S="GET",T="POST",D="PUT";function I(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(w(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===y||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===_&&Date.now()-e.lastUpdate<=12e4}(e)})),o=[].concat(a(r),a(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:o.length>0?o.map((function(e){return O(e)})):t}}))}function k(e,t,n,o){var i=[],s=function(e,t){if(e.method!==S&&(void 0!==e.data||void 0!==t.data)){var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}}(n,o),u=function(e,t){var n=r(r({},e.headers),t.headers),o={};return Object.keys(n).forEach((function(e){var t=n[e];o[e.toLowerCase()]=t})),o}(e,o),c=n.method,l=n.method!==S?{}:r(r({},n.data),o.data),f=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),l),o.queryParameters),d=0,h=function t(r,a){var l=r.pop();if(void 0===l)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:R(i)};var h={data:s,headers:u,method:c,url:x(l,n.path,f),connectTimeout:a(d,e.timeouts.connect),responseTimeout:a(d,o.timeout)},p=function(e){var t={request:h,response:e,host:l,triesLeft:r.length};return i.push(t),t},v={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var o=p(n);return n.isTimedOut&&d++,Promise.all([e.logger.info("Retryable failure",N(o)),e.hostsCache.set(l,w(l,n.isTimedOut?_:b))]).then((function(){return t(r,a)}))},onFail:function(e){throw p(e),function(e,t){var r=e.content,n=e.status,o=r;try{o=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(o,n,t)}(e,R(i))}};return e.requester.send(h).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&0==~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,v)}))};return I(e.hostsCache,t).then((function(e){return h(a(e.statelessHosts).reverse(),e.getTimeout)}))}function j(e){var t=e.hostsCache,r=e.logger,n=e.requester,a=e.requestsCache,i=e.responsesCache,s=e.timeouts,u=e.userAgent,c=e.hosts,l=e.queryParameters,f={hostsCache:t,logger:r,requester:n,requestsCache:a,responsesCache:i,timeouts:s,userAgent:u,headers:e.headers,queryParameters:l,hosts:c.map((function(e){return O(e)})),read:function(e,t){var r=g(t,f.timeouts.read),n=function(){return k(f,f.hosts.filter((function(e){return 0!=(e.accept&m.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var a={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(a,(function(){return f.requestsCache.get(a,(function(){return f.requestsCache.set(a,n()).then((function(e){return Promise.all([f.requestsCache.delete(a),e])}),(function(e){return Promise.all([f.requestsCache.delete(a),Promise.reject(e)])})).then((function(e){var t=o(e,2);return t[0],t[1]}))}))}),{miss:function(e){return f.responsesCache.set(a,e)}})},write:function(e,t){return k(f,f.hosts.filter((function(e){return 0!=(e.accept&m.Write)})),e,g(t,f.timeouts.write))}};return f}function E(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function x(e,t,r){var n=C(r),o="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(o+="?".concat(n)),o}function C(e){return Object.keys(e).map((function(t){return p("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function R(e){return e.map((function(e){return N(e)}))}function N(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var M=function(e){return function(t,r){return e.transporter.write({method:T,path:"2/abtests",data:t},r)}},A=function(e){return function(t,r){return e.transporter.write({method:P,path:p("2/abtests/%s",t)},r)}},U=function(e){return function(t,r){return e.transporter.read({method:S,path:p("2/abtests/%s",t)},r)}},q=function(e){return function(t){return e.transporter.read({method:S,path:"2/abtests"},t)}},F=function(e){return function(t,r){return e.transporter.write({method:T,path:p("2/abtests/%s/stop",t)},r)}},H=function(e){return function(t){return e.transporter.read({method:S,path:"1/strategies/personalization"},t)}},W=function(e){return function(t,r){return e.transporter.write({method:T,path:"1/strategies/personalization",data:t},r)}};function B(e){return function t(r){return e.request(r).then((function(n){if(void 0!==e.batch&&e.batch(n.hits),!e.shouldStop(n))return n.cursor?t({cursor:n.cursor}):t({page:(r.page||0)+1})}))}({})}var L=function(e){return function(t,o){var a=o||{},i=a.queryParameters,s=n(a,["queryParameters"]),u=r({acl:t},void 0!==i?{queryParameters:i}:{});return f(e.transporter.write({method:T,path:"1/keys",data:u},s),(function(t,r){return l((function(n){return ee(e)(t.key,r).catch((function(e){if(404!==e.status)throw e;return n()}))}))}))}},z=function(e){return function(t,r,n){var o=g(n);return o.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:T,path:"1/clusters/mapping",data:{cluster:r}},o)}},Y=function(e){return function(t,r,n){return e.transporter.write({method:T,path:"1/clusters/mapping/batch",data:{users:t,cluster:r}},n)}},G=function(e){return function(t,r){return f(e.transporter.write({method:T,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},r),(function(t,r){return Te(e)(t.taskID,r)}))}},K=function(e){return function(t,r,n){return f(e.transporter.write({method:T,path:p("1/indexes/%s/operation",t),data:{operation:"copy",destination:r}},n),(function(r,n){return se(e)(t,{methods:{waitTask:ft}}).waitTask(r.taskID,n)}))}},J=function(e){return function(t,n,o){return K(e)(t,n,r(r({},o),{},{scope:[ht.Rules]}))}},Q=function(e){return function(t,n,o){return K(e)(t,n,r(r({},o),{},{scope:[ht.Settings]}))}},V=function(e){return function(t,n,o){return K(e)(t,n,r(r({},o),{},{scope:[ht.Synonyms]}))}},X=function(e){return function(t,r){return t.method===S?e.transporter.read(t,r):e.transporter.write(t,r)}},$=function(e){return function(t,r){return f(e.transporter.write({method:P,path:p("1/keys/%s",t)},r),(function(r,n){return l((function(r){return ee(e)(t,n).then(r).catch((function(e){if(404!==e.status)throw e}))}))}))}},Z=function(e){return function(t,r,n){var o=r.map((function(e){return{action:"deleteEntry",body:{objectID:e}}}));return f(e.transporter.write({method:T,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!1,requests:o}},n),(function(t,r){return Te(e)(t.taskID,r)}))}},ee=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/keys/%s",t)},r)}},te=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/task/%s",t.toString())},r)}},re=function(e){return function(t){return e.transporter.read({method:S,path:"/1/dictionaries/*/settings"},t)}},ne=function(e){return function(t){return e.transporter.read({method:S,path:"1/logs"},t)}},oe=function(e){return function(t){return e.transporter.read({method:S,path:"1/clusters/mapping/top"},t)}},ae=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/clusters/mapping/%s",t)},r)}},ie=function(e){return function(t){var r=t||{},o=r.retrieveMappings,a=n(r,["retrieveMappings"]);return!0===o&&(a.getClusters=!0),e.transporter.read({method:S,path:"1/clusters/mapping/pending"},a)}},se=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return h({transporter:e.transporter,appId:e.appId,indexName:t},r.methods)}},ue=function(e){return function(t){return e.transporter.read({method:S,path:"1/keys"},t)}},ce=function(e){return function(t){return e.transporter.read({method:S,path:"1/clusters"},t)}},le=function(e){return function(t){return e.transporter.read({method:S,path:"1/indexes"},t)}},fe=function(e){return function(t){return e.transporter.read({method:S,path:"1/clusters/mapping"},t)}},de=function(e){return function(t,r,n){return f(e.transporter.write({method:T,path:p("1/indexes/%s/operation",t),data:{operation:"move",destination:r}},n),(function(r,n){return se(e)(t,{methods:{waitTask:ft}}).waitTask(r.taskID,n)}))}},he=function(e){return function(t,r){return f(e.transporter.write({method:T,path:"1/indexes/*/batch",data:{requests:t}},r),(function(t,r){return Promise.all(Object.keys(t.taskID).map((function(n){return se(e)(n,{methods:{waitTask:ft}}).waitTask(t.taskID[n],r)})))}))}},pe=function(e){return function(t,r){return e.transporter.read({method:T,path:"1/indexes/*/objects",data:{requests:t}},r)}},ve=function(e){return function(t,n){var o=t.map((function(e){return r(r({},e),{},{params:C(e.params||{})})}));return e.transporter.read({method:T,path:"1/indexes/*/queries",data:{requests:o},cacheable:!0},n)}},ge=function(e){return function(t,o){return Promise.all(t.map((function(t){var a=t.params,i=a.facetName,s=a.facetQuery,u=n(a,["facetName","facetQuery"]);return se(e)(t.indexName,{methods:{searchForFacetValues:st}}).searchForFacetValues(i,s,r(r({},o),u))})))}},me=function(e){return function(t,r){var n=g(r);return n.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:P,path:"1/clusters/mapping"},n)}},ye=function(e){return function(t,r,n){var o=r.map((function(e){return{action:"addEntry",body:e}}));return f(e.transporter.write({method:T,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!0,requests:o}},n),(function(t,r){return Te(e)(t.taskID,r)}))}},be=function(e){return function(t,r){return f(e.transporter.write({method:T,path:p("1/keys/%s/restore",t)},r),(function(r,n){return l((function(r){return ee(e)(t,n).catch((function(e){if(404!==e.status)throw e;return r()}))}))}))}},_e=function(e){return function(t,r,n){var o=r.map((function(e){return{action:"addEntry",body:e}}));return f(e.transporter.write({method:T,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!1,requests:o}},n),(function(t,r){return Te(e)(t.taskID,r)}))}},we=function(e){return function(t,r,n){return e.transporter.read({method:T,path:p("/1/dictionaries/%s/search",t),data:{query:r},cacheable:!0},n)}},Oe=function(e){return function(t,r){return e.transporter.read({method:T,path:"1/clusters/mapping/search",data:{query:t}},r)}},Pe=function(e){return function(t,r){return f(e.transporter.write({method:D,path:"/1/dictionaries/*/settings",data:t},r),(function(t,r){return Te(e)(t.taskID,r)}))}},Se=function(e){return function(t,r){var o=Object.assign({},r),a=r||{},i=a.queryParameters,s=n(a,["queryParameters"]),u=i?{queryParameters:i}:{},c=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"];return f(e.transporter.write({method:D,path:p("1/keys/%s",t),data:u},s),(function(r,n){return l((function(r){return ee(e)(t,n).then((function(e){return function(e){return Object.keys(o).filter((function(e){return-1!==c.indexOf(e)})).every((function(t){return e[t]===o[t]}))}(e)?Promise.resolve():r()}))}))}))}},Te=function(e){return function(t,r){return l((function(n){return te(e)(t,r).then((function(e){return"published"!==e.status?n():void 0}))}))}},De=function(e){return function(t,r){return f(e.transporter.write({method:T,path:p("1/indexes/%s/batch",e.indexName),data:{requests:t}},r),(function(t,r){return ft(e)(t.taskID,r)}))}},Ie=function(e){return function(t){return B(r(r({shouldStop:function(e){return void 0===e.cursor}},t),{},{request:function(r){return e.transporter.read({method:T,path:p("1/indexes/%s/browse",e.indexName),data:r},t)}}))}},ke=function(e){return function(t){var n=r({hitsPerPage:1e3},t);return B(r(r({shouldStop:function(e){return e.hits.length<n.hitsPerPage}},n),{},{request:function(t){return ut(e)("",r(r({},n),t)).then((function(e){return r(r({},e),{},{hits:e.hits.map((function(e){return delete e._highlightResult,e}))})}))}}))}},je=function(e){return function(t){var n=r({hitsPerPage:1e3},t);return B(r(r({shouldStop:function(e){return e.hits.length<n.hitsPerPage}},n),{},{request:function(t){return ct(e)("",r(r({},n),t)).then((function(e){return r(r({},e),{},{hits:e.hits.map((function(e){return delete e._highlightResult,e}))})}))}}))}},Ee=function(e){return function(t,r,o){var a=o||{},i=a.batchSize,s=n(a,["batchSize"]),u={taskIDs:[],objectIDs:[]};return f(function n(){var o,a=[];for(o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;o<t.length&&(a.push(t[o]),a.length!==(i||1e3));o++);return 0===a.length?Promise.resolve(u):De(e)(a.map((function(e){return{action:r,body:e}})),s).then((function(e){return u.objectIDs=u.objectIDs.concat(e.objectIDs),u.taskIDs.push(e.taskID),o++,n(o)}))}(),(function(t,r){return Promise.all(t.taskIDs.map((function(t){return ft(e)(t,r)})))}))}},xe=function(e){return function(t){return f(e.transporter.write({method:T,path:p("1/indexes/%s/clear",e.indexName)},t),(function(t,r){return ft(e)(t.taskID,r)}))}},Ce=function(e){return function(t){var r=t||{},o=r.forwardToReplicas,a=g(n(r,["forwardToReplicas"]));return o&&(a.queryParameters.forwardToReplicas=1),f(e.transporter.write({method:T,path:p("1/indexes/%s/rules/clear",e.indexName)},a),(function(t,r){return ft(e)(t.taskID,r)}))}},Re=function(e){return function(t){var r=t||{},o=r.forwardToReplicas,a=g(n(r,["forwardToReplicas"]));return o&&(a.queryParameters.forwardToReplicas=1),f(e.transporter.write({method:T,path:p("1/indexes/%s/synonyms/clear",e.indexName)},a),(function(t,r){return ft(e)(t.taskID,r)}))}},Ne=function(e){return function(t,r){return f(e.transporter.write({method:T,path:p("1/indexes/%s/deleteByQuery",e.indexName),data:t},r),(function(t,r){return ft(e)(t.taskID,r)}))}},Me=function(e){return function(t){return f(e.transporter.write({method:P,path:p("1/indexes/%s",e.indexName)},t),(function(t,r){return ft(e)(t.taskID,r)}))}},Ae=function(e){return function(t,r){return f(Ue(e)([t],r).then((function(e){return{taskID:e.taskIDs[0]}})),(function(t,r){return ft(e)(t.taskID,r)}))}},Ue=function(e){return function(t,r){var n=t.map((function(e){return{objectID:e}}));return Ee(e)(n,dt.DeleteObject,r)}},qe=function(e){return function(t,r){var o=r||{},a=o.forwardToReplicas,i=g(n(o,["forwardToReplicas"]));return a&&(i.queryParameters.forwardToReplicas=1),f(e.transporter.write({method:P,path:p("1/indexes/%s/rules/%s",e.indexName,t)},i),(function(t,r){return ft(e)(t.taskID,r)}))}},Fe=function(e){return function(t,r){var o=r||{},a=o.forwardToReplicas,i=g(n(o,["forwardToReplicas"]));return a&&(i.queryParameters.forwardToReplicas=1),f(e.transporter.write({method:P,path:p("1/indexes/%s/synonyms/%s",e.indexName,t)},i),(function(t,r){return ft(e)(t.taskID,r)}))}},He=function(e){return function(t){return Ke(e)(t).then((function(){return!0})).catch((function(e){if(404!==e.status)throw e;return!1}))}},We=function(e){return function(t,r,n){return e.transporter.read({method:T,path:p("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},Be=function(e){return function(t,a){var i=a||{},s=i.query,u=i.paginate,c=n(i,["query","paginate"]),l=0;return function n(){return it(e)(s||"",r(r({},c),{},{page:l})).then((function(e){for(var r=0,a=Object.entries(e.hits);r<a.length;r++){var i=o(a[r],2),s=i[0],c=i[1];if(t(c))return{object:c,position:parseInt(s,10),page:l}}if(l++,!1===u||l>=e.nbPages)throw{name:"ObjectNotFoundError",message:"Object not found."};return n()}))}()}},Le=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/indexes/%s/%s",e.indexName,t)},r)}},ze=function(){return function(e,t){for(var r=0,n=Object.entries(e.hits);r<n.length;r++){var a=o(n[r],2),i=a[0];if(a[1].objectID===t)return parseInt(i,10)}return-1}},Ye=function(e){return function(t,o){var a=o||{},i=a.attributesToRetrieve,s=n(a,["attributesToRetrieve"]),u=t.map((function(t){return r({indexName:e.indexName,objectID:t},i?{attributesToRetrieve:i}:{})}));return e.transporter.read({method:T,path:"1/indexes/*/objects",data:{requests:u}},s)}},Ge=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/indexes/%s/rules/%s",e.indexName,t)},r)}},Ke=function(e){return function(t){return e.transporter.read({method:S,path:p("1/indexes/%s/settings",e.indexName),data:{getVersion:2}},t)}},Je=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/indexes/%s/synonyms/%s",e.indexName,t)},r)}},Qe=function(e){return function(t,r){return f(Ve(e)([t],r).then((function(e){return{objectID:e.objectIDs[0],taskID:e.taskIDs[0]}})),(function(t,r){return ft(e)(t.taskID,r)}))}},Ve=function(e){return function(t,r){var o=r||{},a=o.createIfNotExists,i=n(o,["createIfNotExists"]),s=a?dt.PartialUpdateObject:dt.PartialUpdateObjectNoCreate;return Ee(e)(t,s,i)}},Xe=function(e){return function(t,i){var s=i||{},u=s.safe,c=s.autoGenerateObjectIDIfNotExist,l=s.batchSize,d=n(s,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),h=function(t,r,n,o){return f(e.transporter.write({method:T,path:p("1/indexes/%s/operation",t),data:{operation:n,destination:r}},o),(function(t,r){return ft(e)(t.taskID,r)}))},v=Math.random().toString(36).substring(7),g="".concat(e.indexName,"_tmp_").concat(v),m=tt({appId:e.appId,transporter:e.transporter,indexName:g}),y=[],b=h(e.indexName,g,"copy",r(r({},d),{},{scope:["settings","synonyms","rules"]}));return y.push(b),f((u?b.wait(d):b).then((function(){var e=m(t,r(r({},d),{},{autoGenerateObjectIDIfNotExist:c,batchSize:l}));return y.push(e),u?e.wait(d):e})).then((function(){var t=h(g,e.indexName,"move",d);return y.push(t),u?t.wait(d):t})).then((function(){return Promise.all(y)})).then((function(e){var t=o(e,3),r=t[0],n=t[1],i=t[2];return{objectIDs:n.objectIDs,taskIDs:[r.taskID].concat(a(n.taskIDs),[i.taskID])}})),(function(e,t){return Promise.all(y.map((function(e){return e.wait(t)})))}))}},$e=function(e){return function(t,n){return nt(e)(t,r(r({},n),{},{clearExistingRules:!0}))}},Ze=function(e){return function(t,n){return at(e)(t,r(r({},n),{},{clearExistingSynonyms:!0}))}},et=function(e){return function(t,r){return f(tt(e)([t],r).then((function(e){return{objectID:e.objectIDs[0],taskID:e.taskIDs[0]}})),(function(t,r){return ft(e)(t.taskID,r)}))}},tt=function(e){return function(t,r){var o=r||{},a=o.autoGenerateObjectIDIfNotExist,i=n(o,["autoGenerateObjectIDIfNotExist"]),s=a?dt.AddObject:dt.UpdateObject;if(s===dt.UpdateObject){var u=!0,c=!1,l=void 0;try{for(var d,h=t[Symbol.iterator]();!(u=(d=h.next()).done);u=!0)if(void 0===d.value.objectID)return f(Promise.reject({name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}))}catch(e){c=!0,l=e}finally{try{u||null==h.return||h.return()}finally{if(c)throw l}}}return Ee(e)(t,s,i)}},rt=function(e){return function(t,r){return nt(e)([t],r)}},nt=function(e){return function(t,r){var o=r||{},a=o.forwardToReplicas,i=o.clearExistingRules,s=g(n(o,["forwardToReplicas","clearExistingRules"]));return a&&(s.queryParameters.forwardToReplicas=1),i&&(s.queryParameters.clearExistingRules=1),f(e.transporter.write({method:T,path:p("1/indexes/%s/rules/batch",e.indexName),data:t},s),(function(t,r){return ft(e)(t.taskID,r)}))}},ot=function(e){return function(t,r){return at(e)([t],r)}},at=function(e){return function(t,r){var o=r||{},a=o.forwardToReplicas,i=o.clearExistingSynonyms,s=o.replaceExistingSynonyms,u=g(n(o,["forwardToReplicas","clearExistingSynonyms","replaceExistingSynonyms"]));return a&&(u.queryParameters.forwardToReplicas=1),(s||i)&&(u.queryParameters.replaceExistingSynonyms=1),f(e.transporter.write({method:T,path:p("1/indexes/%s/synonyms/batch",e.indexName),data:t},u),(function(t,r){return ft(e)(t.taskID,r)}))}},it=function(e){return function(t,r){return e.transporter.read({method:T,path:p("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},st=function(e){return function(t,r,n){return e.transporter.read({method:T,path:p("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},ut=function(e){return function(t,r){return e.transporter.read({method:T,path:p("1/indexes/%s/rules/search",e.indexName),data:{query:t}},r)}},ct=function(e){return function(t,r){return e.transporter.read({method:T,path:p("1/indexes/%s/synonyms/search",e.indexName),data:{query:t}},r)}},lt=function(e){return function(t,r){var o=r||{},a=o.forwardToReplicas,i=g(n(o,["forwardToReplicas"]));return a&&(i.queryParameters.forwardToReplicas=1),f(e.transporter.write({method:D,path:p("1/indexes/%s/settings",e.indexName),data:t},i),(function(t,r){return ft(e)(t.taskID,r)}))}},ft=function(e){return function(t,r){return l((function(n){return function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/indexes/%s/task/%s",e.indexName,t.toString())},r)}}(e)(t,r).then((function(e){return"published"!==e.status?n():void 0}))}))}},dt={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},ht={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},pt=1,vt=2,gt=3;function mt(e,t,n){var o,a={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,o=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},a=o(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=o(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(o=gt,{debug:function(e,t){return pt>=o&&console.debug(e,t),Promise.resolve()},info:function(e,t){return vt>=o&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:s({caches:[i({key:"".concat("4.14.0","-").concat(e)}),u()]}),userAgent:E("4.14.0").add({segment:"Browser"})},l=r(r({},a),n),f=function(){return function(e){return function(e){var t=e.region||"us",n=c(v.WithinHeaders,e.appId,e.apiKey),o=j(r(r({hosts:[{url:"personalization.".concat(t,".algolia.com")}]},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/json"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({appId:e.appId,transporter:o},e.methods)}(r(r(r({},a),e),{},{methods:{getPersonalizationStrategy:H,setPersonalizationStrategy:W}}))}};return function(e){var t=e.appId,n=c(void 0!==e.authMode?e.authMode:v.WithinHeaders,t,e.apiKey),o=j(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:m.Read},{url:"".concat(t,".algolia.net"),accept:m.Write}].concat(d([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({transporter:o,appId:t,addAlgoliaAgent:function(e,t){o.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then((function(){}))}},e.methods)}(r(r({},l),{},{methods:{search:ve,searchForFacetValues:ge,multipleBatch:he,multipleGetObjects:pe,multipleQueries:ve,copyIndex:K,copySettings:Q,copySynonyms:V,copyRules:J,moveIndex:de,listIndices:le,getLogs:ne,listClusters:ce,multipleSearchForFacetValues:ge,getApiKey:ee,addApiKey:L,listApiKeys:ue,updateApiKey:Se,deleteApiKey:$,restoreApiKey:be,assignUserID:z,assignUserIDs:Y,getUserID:ae,searchUserIDs:Oe,listUserIDs:fe,getTopUserIDs:oe,removeUserID:me,hasPendingMappings:ie,clearDictionaryEntries:G,deleteDictionaryEntries:Z,getDictionarySettings:re,getAppTask:te,replaceDictionaryEntries:ye,saveDictionaryEntries:_e,searchDictionaryEntries:we,setDictionarySettings:Pe,waitAppTask:Te,customRequest:X,initIndex:function(e){return function(t){return se(e)(t,{methods:{batch:De,delete:Me,findAnswers:We,getObject:Le,getObjects:Ye,saveObject:et,saveObjects:tt,search:it,searchForFacetValues:st,waitTask:ft,setSettings:lt,getSettings:Ke,partialUpdateObject:Qe,partialUpdateObjects:Ve,deleteObject:Ae,deleteObjects:Ue,deleteBy:Ne,clearObjects:xe,browseObjects:Ie,getObjectPosition:ze,findObject:Be,exists:He,saveSynonym:ot,saveSynonyms:at,getSynonym:Je,searchSynonyms:ct,browseSynonyms:je,deleteSynonym:Fe,clearSynonyms:Re,replaceAllObjects:Xe,replaceAllSynonyms:Ze,searchRules:ut,getRule:Ge,deleteRule:qe,saveRule:rt,saveRules:nt,replaceAllRules:$e,browseRules:ke,clearRules:Ce}})}},initAnalytics:function(){return function(e){return function(e){var t=e.region||"us",n=c(v.WithinHeaders,e.appId,e.apiKey),o=j(r(r({hosts:[{url:"analytics.".concat(t,".algolia.com")}]},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/json"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({appId:e.appId,transporter:o},e.methods)}(r(r(r({},a),e),{},{methods:{addABTest:M,getABTest:U,getABTests:q,stopABTest:F,deleteABTest:A}}))}},initPersonalization:f,initRecommendation:function(){return function(e){return l.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),f()(e)}}}}))}return mt.version="4.14.0",mt}()})),mn=gn,yn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.suggest=void 0;var r=xe.__importDefault(mn);function n(e){return(0,dn.getTranslatedAttributes)(e,["placeName","hotelName"])}function o(e){var t=(0,dn.getTranslatedAttributes)(e,["placeName","placeADN","placeDN","hotelName"]);return xe.__spreadArray(["objectType","objectID","placeType"],t,!0)}function a(e,t,r){var a=this,i=e.search,s=t.autocompleteIndex,u=r.languages,c=r.suggestsCount,l=void 0===c?6:c;return function(e){return xe.__awaiter(a,void 0,void 0,(function(){var t,r,a;return xe.__generator(this,(function(c){switch(c.label){case 0:return t=[{indexName:s,params:{query:e,filters:"isDeleted != 1",hitsPerPage:l,attributesToRetrieve:o(u),attributesToHighlight:n(u)}}],[4,i(t)];case 1:return r=c.sent().results,[2,null===(a=r[0])||void 0===a?void 0:a.hits.map((function(e){return"hotel"===e.objectType?(0,dn.hitToHotelSuggest)(e,u):(0,dn.hitToPlaceSuggest)(e,u)}))]}}))}))}}t.suggest=function(e){var t=this,n=e.appConfig,o=e.options,i=(0,r.default)(n.algolia.appId,n.algolia.apiKey,o.algoliaClientOptions);return function(e,r){return xe.__awaiter(t,void 0,void 0,(function(){var t;return xe.__generator(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,a(i,n.algolia,{suggestsCount:r,languages:o.languages})(e)];case 1:return[2,s.sent()];case 2:throw t=s.sent(),(0,hn.createApiError)(null==t?void 0:t.message,null==t?void 0:t.status);case 3:return[2]}}))}))}}})),bn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.rooms=t.createRequestString=void 0;var r=xe.__importDefault(pn),n=xe.__importDefault(Ae);function o(e,t){var r,o=e.hotelId,a=e.checkIn,i=e.checkOut,s=e.rooms,u=e.providerCode,c=e.cugDeals,l=e.tier,f=e.clickedOfferId,d=e.clickedOfferBaseRate,h=e.clickedOfferTaxes,p=e.clickedOfferHotelFees,v=e.preHeat,g=e.trafficSource,m=e.userId,y=e.emailDomain,b=(0,dn.removeEmpty)({hotelId:o,checkIn:a,checkOut:i,rooms:s,providerCode:u,cugDeals:c,tier:l,clickedOfferId:f,clickedOfferBaseRate:d,clickedOfferHotelFees:p,clickedOfferTaxes:h,deviceType:t.deviceType,language:t.language,currency:t.currency,aid:t.anonymousId,variations:null===(r=t.variations)||void 0===r?void 0:r.join(","),sapiOverride:(0,Ue.getSapiOverrideParameter)(),preHeat:v,trafficSource:g,userId:m,emailDomain:y});return new n.default(b).toString()}t.createRequestString=o,t.rooms=function(e){var t=this,n=e.appConfig,a=e.options;return function(e){return xe.__awaiter(t,void 0,void 0,(function(){var t,i,s;return xe.__generator(this,(function(u){switch(u.label){case 0:return t=o(e,a),[4,(0,r.default)("https://".concat(n.saf.baseUrl,"/").concat(n.saf.endpoints.offersRooms,"?").concat(t))];case 1:return(i=u.sent()).ok?[4,i.json()]:[3,3];case 2:return s=u.sent(),[2,xe.__assign({hotelId:e.hotelId,anonymousId:a.anonymousId},s)];case 3:return[4,(0,hn.createBackendError)(i,"Failed to get rooms offers")];case 4:throw u.sent()}}))}))}}})),_n=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.hotel=t.createRequestString=t.safToSapiHotel=void 0;var r=xe.__importDefault(pn),n=xe.__importDefault(Ae);function o(e,t){var r=e.checkInInst,n=e.checkInSpInst,o=e.feesMnd,a=e.feesOpt,i=e.policies,s=e.hotelName,u=e.placeDN,c=e.address,l=e.placeADName,f=e.propertyType,d=e.facilities,h=e.sentiments,p=e.themes,v=xe.__assign(xe.__assign({},e),{checkInInst:r&&(0,dn.toString)(r,t),checkInSpInst:n&&(0,dn.toString)(n,t),feesMnd:o&&(0,dn.toString)(o,t),feesOpt:a&&(0,dn.toString)(a,t),hotelName:(0,dn.toString)(s,t),policies:i&&(0,dn.toString)(i,t),placeDisplayName:u&&(0,dn.translatedArrayToString)(u,t),displayAddress:c&&l&&(0,dn.mergeTranslatedAttributes)(c,l,t),facilities:null==d?void 0:d.map((function(e){return xe.__assign(xe.__assign({},e),{value:(0,dn.toString)(e.value,t)})})),sentiments:null==h?void 0:h.map((function(e){return xe.__assign(xe.__assign({},e),{value:(0,dn.toString)(e.value,t)})})),themes:null==p?void 0:p.map((function(e){return xe.__assign(xe.__assign({},e),{value:(0,dn.toString)(e.value,t)})})),propertyType:f&&xe.__assign(xe.__assign({},f),{value:(0,dn.toString)(f.value,t)})});return(0,dn.omit)(["placeDN","placeADName","address"],v)}function a(e,t){var r=(0,dn.removeEmpty)({id:e,language:t.join(","),attributes:["objectID","address","country","guestRating","isDeleted","starRating","_geoloc","placeADName","checkInSpInst","checkInMinAge","checkOutTime","checkInInst","checkInTime","checkInEnd","feesOpt","policies","phone","imageURIs","placeDN","reviewCount","chainID","parentChainID","lastBooked","feesMnd","reviewCountBkt","hotelName","sentiments","facilities","placeID","guestType","themes","propertyType","pricing","currency"].join(",")});return new n.default(r).toString()}t.safToSapiHotel=o,t.createRequestString=a,t.hotel=function(e){var t=this,n=e.appConfig,i=e.options;return function(e){return xe.__awaiter(t,void 0,void 0,(function(){var t,s;return xe.__generator(this,(function(u){switch(u.label){case 0:return t=a(e,i.languages),[4,(0,r.default)("https://".concat(n.saf.baseUrl,"/").concat(n.saf.endpoints.hotel,"?").concat(t))];case 1:return(s=u.sent()).ok?[4,s.json()]:[3,3];case 2:return[2,o(u.sent(),i.languages)];case 3:return[4,(0,hn.createBackendError)(s,"Failed to fetch hotel data")];case 4:throw u.sent()}}))}))}}})),wn=t((function(e,t){function r(e,t){var r=e.hotelId,n=e.isAnchor,o=e.freeCancellation,a=e.rooms,i=void 0===a?t.client.defaultRooms:a,s=xe.__rest(e,["hotelId","isAnchor","freeCancellation","rooms"]),u=(0,dn.getCheckInCheckOutDates)(e,t.client),c=u.checkIn,l=u.checkOut,f=xe.__assign(xe.__assign({},s),{checkIn:c,checkOut:l,rooms:i});return o&&(f.filters={freeCancellation:!0}),e.searchId||(f.searchId=(0,dn.generateSearchId)()),n?f.anchorHotelId=r:f.hotelIds=[r],f}Object.defineProperty(t,"__esModule",{value:!0}),t.offers=t.getOffersParameters=void 0,t.getOffersParameters=r,t.offers=function(e){var t=this,n=e.offersClient,o=e.appConfig;return function(e,a){return void 0===a&&(a={}),xe.__awaiter(t,void 0,void 0,(function(){var t,i,s,u,c,l,f,d;return xe.__generator(this,(function(h){switch(h.label){case 0:return n?(t=e.isAnchor,i=a.onStart,s=a.onOffersReceived,u=a.onComplete,c=r(e,o),"function"==typeof i&&i(c),[4,n.getOffers(c,(function(e){var r;"function"==typeof s&&s(t?e.anchorHotelOfferEntity:null===(r=e.hotelOfferEntities)||void 0===r?void 0:r[0])}))]):[2];case 1:return l=h.sent(),"function"==typeof u&&u(t?l.anchorHotelOfferEntity:null===(f=l.hotelOfferEntities)||void 0===f?void 0:f[0]),[2,t?l.anchorHotelOfferEntity:null===(d=l.hotelOfferEntities)||void 0===d?void 0:d[0]]}}))}))}}})),On=function(e,t){return On=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},On(e,t)};function Pn(e,t){function r(){this.constructor=e}On(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Sn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function Tn(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Sn(arguments[t]));return e}var Dn=function(e,t){this.target=t,this.type=e},In=function(e){function t(t,r){var n=e.call(this,"error",r)||this;return n.message=t.message,n.error=t,n}return Pn(t,e),t}(Dn),kn=function(e){function t(t,r,n){void 0===t&&(t=1e3),void 0===r&&(r="");var o=e.call(this,"close",n)||this;return o.wasClean=!0,o.code=t,o.reason=r,o}return Pn(t,e),t}(Dn),jn=function(){if("undefined"!=typeof WebSocket)return WebSocket},En={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+4e3*Math.random(),minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},xn=function(){function e(e,t,r){var n=this;void 0===r&&(r={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(e){n._debug("open event");var t=n._options.minUptime,r=void 0===t?En.minUptime:t;clearTimeout(n._connectTimeout),n._uptimeTimeout=setTimeout((function(){return n._acceptOpen()}),r),n._ws.binaryType=n._binaryType,n._messageQueue.forEach((function(e){return n._ws.send(e)})),n._messageQueue=[],n.onopen&&n.onopen(e),n._listeners.open.forEach((function(t){return n._callEventListener(e,t)}))},this._handleMessage=function(e){n._debug("message event"),n.onmessage&&n.onmessage(e),n._listeners.message.forEach((function(t){return n._callEventListener(e,t)}))},this._handleError=function(e){n._debug("error event",e.message),n._disconnect(void 0,"TIMEOUT"===e.message?"timeout":void 0),n.onerror&&n.onerror(e),n._debug("exec error listeners"),n._listeners.error.forEach((function(t){return n._callEventListener(e,t)})),n._connect()},this._handleClose=function(e){n._debug("close event"),n._clearTimeouts(),n._shouldReconnect&&n._connect(),n.onclose&&n.onclose(e),n._listeners.close.forEach((function(t){return n._callEventListener(e,t)}))},this._url=e,this._protocols=t,this._options=r,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){return this._messageQueue.reduce((function(e,t){return"string"==typeof t?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e}),0)+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(e,t){void 0===e&&(e=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),this._ws?this._ws.readyState!==this.CLOSED?this._ws.close(e,t):this._debug("close: already closed"):this._debug("close enqueued: no ws instance")},e.prototype.reconnect=function(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,this._ws&&this._ws.readyState!==this.CLOSED?(this._disconnect(e,t),this._connect()):this._connect()},e.prototype.send=function(e){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",e),this._ws.send(e);else{var t=this._options.maxEnqueuedMessages,r=void 0===t?En.maxEnqueuedMessages:t;this._messageQueue.length<r&&(this._debug("enqueue",e),this._messageQueue.push(e))}},e.prototype.addEventListener=function(e,t){this._listeners[e]&&this._listeners[e].push(t)},e.prototype.dispatchEvent=function(e){var t,r,n=this._listeners[e.type];if(n)try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(n),a=o.next();!a.done;a=o.next()){var i=a.value;this._callEventListener(e,i)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return!0},e.prototype.removeEventListener=function(e,t){this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter((function(e){return e!==t})))},e.prototype._debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._options.debug&&console.log.apply(console,Tn(["RWS>"],e))},e.prototype._getNextDelay=function(){var e=this._options,t=e.reconnectionDelayGrowFactor,r=void 0===t?En.reconnectionDelayGrowFactor:t,n=e.minReconnectionDelay,o=void 0===n?En.minReconnectionDelay:n,a=e.maxReconnectionDelay,i=void 0===a?En.maxReconnectionDelay:a,s=0;return this._retryCount>0&&(s=o*Math.pow(r,this._retryCount-1))>i&&(s=i),this._debug("next delay",s),s},e.prototype._wait=function(){var e=this;return new Promise((function(t){setTimeout(t,e._getNextDelay())}))},e.prototype._getNextUrl=function(e){if("string"==typeof e)return Promise.resolve(e);if("function"==typeof e){var t=e();if("string"==typeof t)return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")},e.prototype._connect=function(){var e=this;if(!this._connectLock&&this._shouldReconnect){this._connectLock=!0;var t=this._options,r=t.maxRetries,n=void 0===r?En.maxRetries:r,o=t.connectionTimeout,a=void 0===o?En.connectionTimeout:o,i=t.WebSocket,s=void 0===i?jn():i;if(this._retryCount>=n)this._debug("max retries reached",this._retryCount,">=",n);else{if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!function(e){return void 0!==e&&!!e&&2===e.CLOSING}(s))throw Error("No valid WebSocket class provided");this._wait().then((function(){return e._getNextUrl(e._url)})).then((function(t){e._closeCalled||(e._debug("connect",{url:t,protocols:e._protocols}),e._ws=e._protocols?new s(t,e._protocols):new s(t),e._ws.binaryType=e._binaryType,e._connectLock=!1,e._addListeners(),e._connectTimeout=setTimeout((function(){return e._handleTimeout()}),a))}))}}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new In(Error("TIMEOUT"),this))},e.prototype._disconnect=function(e,t){if(void 0===e&&(e=1e3),this._clearTimeouts(),this._ws){this._removeListeners();try{this._ws.close(e,t),this._handleClose(new kn(e,t,this))}catch(e){}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(e,t){"handleEvent"in t?t.handleEvent(e):t(e)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e}(),Cn=r(Object.freeze({__proto__:null,default:xn})),Rn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.offersClient=t.sapiResponseToHotelOfferEntity=void 0;var r,n=xe.__importDefault(Ae),o=xe.__importDefault(Cn);function a(e){var t;return{availableOffersCount:e.availableOffersCount,anchorRate:e.anchorRate,id:e.id,offers:null===(t=e.offers)||void 0===t?void 0:t.map((function(t){return function(e,t){var r;return(0,Dr.omit)(["roomID","occupancy"],xe.__assign(xe.__assign({},e),{roomName:null===(r=null==t?void 0:t[e.roomID])||void 0===r?void 0:r.name}))}(t,e.rooms)})),discount:e.discount}}!function(e){e[e.Connecting=0]="Connecting",e[e.Open=1]="Open",e[e.Closing=2]="Closing",e[e.Closed=3]="Closed"}(r||(r={})),t.sapiResponseToHotelOfferEntity=a,t.offersClient=function(e,t){if("undefined"==typeof WebSocket&&void 0===t.WebSocket)throw new TypeError("Client does not support WebSocket");var i=(0,an.removeEmpty)({sapiOverride:(0,Ue.getSapiOverrideParameter)(!0)}),s=new n.default(i).toString(),u="wss://".concat(e.baseUrl,"/").concat(e.endpoints.offers,"?").concat(s),c=new o.default(u,[],{maxRetries:15,WebSocket:t.WebSocket}),l={},f={};function d(e){t.logger.log({name:"WebsocketConnectionClosed",value:{service:"sapi",code:e.code,reason:e.reason,wasClean:e.wasClean}})}function h(e){t.logger.log({name:"WebsocketError",value:xe.__assign(xe.__assign({},e),{service:"sapi"})})}function p(){for(var e=0,t=Object.keys(l);e<t.length;e++){var r=t[e],n=l[r];void 0!==n&&c.send(n)}}function v(e){var t;try{t=JSON.parse(e.data)}catch(e){return void console.log("WEBSOCKET: error parsing message")}var r=f[t.clientRequestId];"function"==typeof r&&r(t)}return c.addEventListener("open",p),c.addEventListener("close",d),c.addEventListener("error",h),c.addEventListener("message",v),{getOffers:function(e,n){return xe.__awaiter(this,void 0,void 0,(function(){var o,i;return xe.__generator(this,(function(s){return o={},i=(0,rn.v4)(),l[i]=function(e,t,r){var n,o={checkIn:e.checkIn,checkOut:e.checkOut,anchorHotelId:e.anchorHotelId,hotelIds:e.hotelIds,rooms:e.rooms,searchId:e.searchId,cugDeals:e.cugDeals,tier:e.tier,language:t.language,deviceType:t.deviceType,anonymousId:t.anonymousId,currency:t.currency,originId:e.originId,brand:t.brand,clientRequestId:r,sortingBoost:(0,sn.generateSortingBoost)(e),getAllOffers:Boolean(e.getAllOffers),preferredRate:e.preferredRate,label:e.trafficSource,countryCode:t.countryCode,variations:t.variations};try{n=JSON.stringify(o)}catch(e){console.log("WEBSOCKET: error serialising request")}return n}(e,t,i),[2,new Promise((function(t){f[i]=function(r){var s,u;if(void 0!==r)if(r.status.complete)t(o),l[i]=void 0,f[i]=void 0;else{var c=null===(s=r.results)||void 0===s?void 0:s.find((function(t){return t.id===e.anchorHotelId}));c?o.anchorHotelOfferEntity=a(c):o.hotelOfferEntities=null===(u=r.results)||void 0===u?void 0:u.map((function(e){return a(e)})),"function"==typeof n&&n(xe.__assign({},o))}};var s=l[i];void 0!==s&&(c.readyState===r.Open?c.send(s):c.readyState===r.Closed&&(c._connectLock=!1,c.reconnect()))}))]}))}))}}}})),Nn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sapi=t.variationsToArray=void 0;var r={log:function(){}};function n(e){void 0===e&&(e={});var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push("".concat(r,"-").concat(e[r]));return t}t.variationsToArray=n,t.sapi=function(e,t){var o,a,i,s,u,c,l;return xe.__awaiter(this,void 0,void 0,(function(){function f(e){return h.client.features.includes(e)}function d(){var e,t;if(f("search")){if((null===(e=v.options.variations)||void 0===e?void 0:e.includes("sapi4eva-room-mapping-rsp-v8-1-a"))||(null===(t=v.options.variations)||void 0===t?void 0:t.includes("sapi4eva-room-mapping-rsp-v8-1-b"))){return function(e,t){return void 0===t&&(t={}),xe.__awaiter(this,void 0,void 0,(function(){return xe.__generator(this,(function(r){return[2,(0,vn.search)(v)(e,xe.__assign(xe.__assign({},t),{onComplete:function(e){var r,n=e.anchorHotelId,o=e.hotelOfferEntities,a=e.searchParameters,i=e.offset;if(!(0,dn.hasRequiredSearchParameters)(a))throw new Error("Dates must be set by client, SDK or response");if(n&&0===i){var s=o[n],u=null==s?void 0:s.offers.find((function(e){return"FHT"===e.intermediaryProvider}));if(u)try{(0,bn.rooms)(v)({hotelId:n,checkIn:a.checkIn,checkOut:a.checkOut,rooms:a.rooms,cugDeals:null===(r=a.cugDeals)||void 0===r?void 0:r.join(","),tier:a.tier,preHeat:1,trafficSource:a.trafficSource,clickedOfferId:u.id,clickedOfferBaseRate:u.rate.base,clickedOfferHotelFees:u.rate.hotelFees,clickedOfferTaxes:u.rate.taxes})}catch(e){}}"function"==typeof t.onComplete&&t.onComplete(e)}}))]}))}))}}return(0,vn.search)(v)}return function(){throw new Error("Search is not enabled for this profile key")}}var h,p,v;return xe.__generator(this,(function(g){if(!e)throw new Error("Profile key is required");return h=(0,Ce.getAppConfig)(e,t.initWithAppConfig),p=xe.__assign(xe.__assign({},t),{logger:null!==(o=t.logger)&&void 0!==o?o:r,variations:n(t.variations),currency:null!==(i=null===(a=t.currency)||void 0===a?void 0:a.toUpperCase())&&void 0!==i?i:"USD",deviceType:null!==(s=t.deviceType)&&void 0!==s?s:"desktop",countryCode:t.countryCode,pageSize:null!==(u=t.pageSize)&&void 0!==u?u:20,getTotalRate:null!==(c=t.getTotalRate)&&void 0!==c?c:dn.getTotalRate,languages:xe.__spreadArray(xe.__spreadArray([t.language],null!==(l=h.client.fallbackLanguages[t.language])&&void 0!==l?l:[],!0),["en"],!1)}),v={appConfig:h,getFeatureEnabled:f,profileKey:e,options:p,offersClient:f("offers")?(0,Rn.offersClient)(h.sapiBackend,p):void 0},[2,{rooms:f("rooms")?(0,bn.rooms)(v):function(){throw new Error("Rooms search is not enabled for this profile key")},search:d(),suggest:f("suggests")?(0,yn.suggest)(v):function(){throw new Error("Autosuggest is not enabled for this profile key")},hotel:f("get-hotel")?(0,_n.hotel)(v):function(){throw new Error("Get hotel is not alowed for this profile key")},offers:f("offers")?(0,wn.offers)(v):function(){throw new Error("Get offers is not alowed for this profile key")}}]}))}))}})),Mn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),An=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Un=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),qn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Fn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Hn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Wn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Bn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Ln=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),xe.__exportStar(Mn,t),xe.__exportStar(An,t),xe.__exportStar(Un,t),xe.__exportStar(qn,t),xe.__exportStar(Fn,t),xe.__exportStar(Hn,t),xe.__exportStar(Wn,t),xe.__exportStar(Bn,t)}));return e(t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,(0,Ir.enableES5)(),xe.__exportStar(Nn,t),xe.__exportStar(Ce,t),xe.__exportStar(Ln,t);var r=Nn;Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r.sapi}})})))}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).sapi=t()}(this,(function(){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}function r(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};var o=function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};var a=Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function i(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function u(e){return this instanceof u?(this.v=e,this):new u(e)}var c=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};var l=Object.freeze({__proto__:null,__extends:function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},get __assign(){return o},__rest:function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},__decorate:function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},__param:function(e,t){return function(r,n){t(r,n,e)}},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__awaiter:function(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}u((n=n.apply(e,t||[])).next())}))},__generator:function(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},__createBinding:a,__exportStar:function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)},__values:i,__read:s,__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(s(arguments[t]));return e},__spreadArrays:function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var a=arguments[t],i=0,s=a.length;i<s;i++,o++)n[o]=a[i];return n},__spreadArray:function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},__await:u,__asyncGenerator:function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),a=[];return n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n;function i(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){a.push([e,t,r,n])>1||s(e,t)}))})}function s(e,t){try{!function(e){e.value instanceof u?Promise.resolve(e.value.v).then(c,l):f(a[0][2],e)}(o[e](t))}catch(e){f(a[0][3],e)}}function c(e){s("next",e)}function l(e){s("throw",e)}function f(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}},__asyncDelegator:function(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:u(e[n](t)),done:"return"===n}:o?o(t):t}:o}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=i(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&a(t,e,r);return c(t,e),t},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__classPrivateFieldGet:function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},__classPrivateFieldSet:function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},__classPrivateFieldIn:function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}});function f(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if("production"!==process.env.NODE_ENV){var o=ae[e],a=o?"function"==typeof o?o.apply(null,r):o:"unknown error nr: "+e;throw Error("[Immer] "+a)}throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function d(e){return!!e&&!!e[ne]}function h(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===ie}(e)||Array.isArray(e)||!!e[re]||!!e.constructor[re]||_(e)||w(e))}function p(e,t,r){void 0===r&&(r=!1),0===v(e)?(r?Object.keys:se)(e).forEach((function(n){r&&"symbol"==typeof n||t(n,e[n],e)})):e.forEach((function(r,n){return t(n,r,e)}))}function v(e){var t=e[ne];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:_(e)?2:w(e)?3:0}function g(e,t){return 2===v(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function m(e,t){return 2===v(e)?e.get(t):e[t]}function y(e,t,r){var n=v(e);2===n?e.set(t,r):3===n?(e.delete(t),e.add(r)):e[t]=r}function b(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function _(e){return $&&e instanceof Map}function w(e){return Z&&e instanceof Set}function O(e){return e.o||e.t}function P(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ue(e);delete t[ne];for(var r=se(t),n=0;n<r.length;n++){var o=r[n],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function S(e,t){return void 0===t&&(t=!1),D(e)||d(e)||!h(e)||(v(e)>1&&(e.set=e.add=e.clear=e.delete=T),Object.freeze(e),t&&p(e,(function(e,t){return S(t,!0)}),!0)),e}function T(){f(2)}function D(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function I(e){var t=ce[e];return t||f(18,e),t}function k(e,t){ce[e]||(ce[e]=t)}function j(){return"production"===process.env.NODE_ENV||V||f(0),V}function E(e,t){t&&(I("Patches"),e.u=[],e.s=[],e.v=t)}function x(e){C(e),e.p.forEach(N),e.p=null}function C(e){e===V&&(V=e.l)}function R(e){return V={p:[],l:V,h:e,m:!0,_:0}}function N(e){var t=e[ne];0===t.i||1===t.i?t.j():t.O=!0}function M(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.g||I("ES5").S(t,e,n),n?(r[ne].P&&(x(t),f(4)),h(e)&&(e=A(t,e),t.l||q(t,e)),t.u&&I("Patches").M(r[ne].t,e,t.u,t.s)):e=A(t,r,[]),x(t),t.u&&t.v(t.u,t.s),e!==te?e:void 0}function A(e,t,r){if(D(t))return t;var n=t[ne];if(!n)return p(t,(function(o,a){return U(e,n,t,o,a,r)}),!0),t;if(n.A!==e)return t;if(!n.P)return q(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var o=4===n.i||5===n.i?n.o=P(n.k):n.o;p(3===n.i?new Set(o):o,(function(t,a){return U(e,n,o,t,a,r)})),q(e,o,!1),r&&e.u&&I("Patches").R(n,r,e.u,e.s)}return n.o}function U(e,t,r,n,o,a){if("production"!==process.env.NODE_ENV&&o===r&&f(5),d(o)){var i=A(e,o,a&&t&&3!==t.i&&!g(t.D,n)?a.concat(n):void 0);if(y(r,n,i),!d(i))return;e.m=!1}if(h(o)&&!D(o)){if(!e.h.F&&e._<1)return;A(e,o),t&&t.A.l||q(e,o)}}function q(e,t,r){void 0===r&&(r=!1),e.h.F&&e.m&&S(t,r)}function F(e,t){var r=e[ne];return(r?O(r):e)[t]}function H(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function W(e){e.P||(e.P=!0,e.l&&W(e.l))}function B(e){e.o||(e.o=P(e.t))}function L(e,t,r){var n=_(t)?I("MapSet").N(t,r):w(t)?I("MapSet").T(t,r):e.g?function(e,t){var r=Array.isArray(e),n={i:r?1:0,A:t?t.A:j(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=n,a=le;r&&(o=[n],a=fe);var i=Proxy.revocable(o,a),s=i.revoke,u=i.proxy;return n.k=u,n.j=s,u}(t,r):I("ES5").J(t,r);return(r?r.A:j()).p.push(n),n}function z(e){return d(e)||f(22,e),function e(t){if(!h(t))return t;var r,n=t[ne],o=v(t);if(n){if(!n.P&&(n.i<4||!I("ES5").K(n)))return n.t;n.I=!0,r=Y(t,o),n.I=!1}else r=Y(t,o);return p(r,(function(t,o){n&&m(n.t,t)===o||y(r,t,e(o))})),3===o?new Set(r):r}(e)}function Y(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return P(e)}function G(){function e(e,t){var r=a[e];return r?r.enumerable=t:a[e]=r={configurable:!0,enumerable:t,get:function(){var t=this[ne];return"production"!==process.env.NODE_ENV&&o(t),le.get(t,e)},set:function(t){var r=this[ne];"production"!==process.env.NODE_ENV&&o(r),le.set(r,e,t)}},r}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ne];if(!o.P)switch(o.i){case 5:n(o)&&W(o);break;case 4:r(o)&&W(o)}}}function r(e){for(var t=e.t,r=e.k,n=se(r),o=n.length-1;o>=0;o--){var a=n[o];if(a!==ne){var i=t[a];if(void 0===i&&!g(t,a))return!0;var s=r[a],u=s&&s[ne];if(u?u.t!==i:!b(s,i))return!0}}var c=!!t[ne];return n.length!==se(t).length+(c?0:1)}function n(e){var t=e.k;if(t.length!==e.t.length)return!0;var r=Object.getOwnPropertyDescriptor(t,t.length-1);if(r&&!r.get)return!0;for(var n=0;n<t.length;n++)if(!t.hasOwnProperty(n))return!0;return!1}function o(e){e.O&&f(3,JSON.stringify(O(e)))}var a={};k("ES5",{J:function(t,r){var n=Array.isArray(t),o=function(t,r){if(t){for(var n=Array(r.length),o=0;o<r.length;o++)Object.defineProperty(n,""+o,e(o,!0));return n}var a=ue(r);delete a[ne];for(var i=se(a),s=0;s<i.length;s++){var u=i[s];a[u]=e(u,t||!!a[u].enumerable)}return Object.create(Object.getPrototypeOf(r),a)}(n,t),a={i:n?5:4,A:r?r.A:j(),P:!1,I:!1,D:{},l:r,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ne,{value:a,writable:!0}),o},S:function(e,r,o){o?d(r)&&r[ne].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var r=t[ne];if(r){var o=r.t,a=r.k,i=r.D,s=r.i;if(4===s)p(a,(function(t){t!==ne&&(void 0!==o[t]||g(o,t)?i[t]||e(a[t]):(i[t]=!0,W(r)))})),p(o,(function(e){void 0!==a[e]||g(a,e)||(i[e]=!1,W(r))}));else if(5===s){if(n(r)&&(W(r),i.length=!0),a.length<o.length)for(var u=a.length;u<o.length;u++)i[u]=!1;else for(var c=o.length;c<a.length;c++)i[c]=!0;for(var l=Math.min(a.length,o.length),f=0;f<l;f++)a.hasOwnProperty(f)||(i[f]=!0),void 0===i[f]&&e(a[f])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?r(e):n(e)}})}function K(){function e(t){if(!h(t))return t;if(Array.isArray(t))return t.map(e);if(_(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(w(t))return new Set(Array.from(t).map(e));var r=Object.create(Object.getPrototypeOf(t));for(var n in t)r[n]=e(t[n]);return g(t,re)&&(r[re]=t[re]),r}function t(t){return d(t)?e(t):t}var r="add";k("Patches",{$:function(t,n){return n.forEach((function(n){for(var o=n.path,a=n.op,i=t,s=0;s<o.length-1;s++){var u=v(i),c=""+o[s];0!==u&&1!==u||"__proto__"!==c&&"constructor"!==c||f(24),"function"==typeof i&&"prototype"===c&&f(24),"object"!=typeof(i=m(i,c))&&f(15,o.join("/"))}var l=v(i),d=e(n.value),h=o[o.length-1];switch(a){case"replace":switch(l){case 2:return i.set(h,d);case 3:f(16);default:return i[h]=d}case r:switch(l){case 1:return"-"===h?i.push(d):i.splice(h,0,d);case 2:return i.set(h,d);case 3:return i.add(d);default:return i[h]=d}case"remove":switch(l){case 1:return i.splice(h,1);case 2:return i.delete(h);case 3:return i.delete(n.value);default:return delete i[h]}default:f(17,a)}})),t},R:function(e,n,o,a){switch(e.i){case 0:case 4:case 2:return function(e,n,o,a){var i=e.t,s=e.o;p(e.D,(function(e,u){var c=m(i,e),l=m(s,e),f=u?g(i,e)?"replace":r:"remove";if(c!==l||"replace"!==f){var d=n.concat(e);o.push("remove"===f?{op:f,path:d}:{op:f,path:d,value:l}),a.push(f===r?{op:"remove",path:d}:"remove"===f?{op:r,path:d,value:t(c)}:{op:"replace",path:d,value:t(c)})}}))}(e,n,o,a);case 5:case 1:return function(e,n,o,a){var i=e.t,s=e.D,u=e.o;if(u.length<i.length){var c=[u,i];i=c[0],u=c[1];var l=[a,o];o=l[0],a=l[1]}for(var f=0;f<i.length;f++)if(s[f]&&u[f]!==i[f]){var d=n.concat([f]);o.push({op:"replace",path:d,value:t(u[f])}),a.push({op:"replace",path:d,value:t(i[f])})}for(var h=i.length;h<u.length;h++){var p=n.concat([h]);o.push({op:r,path:p,value:t(u[h])})}i.length<u.length&&a.push({op:"replace",path:n.concat(["length"]),value:i.length})}(e,n,o,a);case 3:return function(e,t,n,o){var a=e.t,i=e.o,s=0;a.forEach((function(e){if(!i.has(e)){var a=t.concat([s]);n.push({op:"remove",path:a,value:e}),o.unshift({op:r,path:a,value:e})}s++})),s=0,i.forEach((function(e){if(!a.has(e)){var i=t.concat([s]);n.push({op:r,path:i,value:e}),o.unshift({op:"remove",path:i,value:e})}s++}))}(e,n,o,a)}},M:function(e,t,r,n){r.push({op:"replace",path:[],value:t===te?void 0:t}),n.push({op:"replace",path:[],value:e})}})}function J(){function e(e,t){function r(){this.constructor=e}o(e,t),e.prototype=(r.prototype=t.prototype,new r)}function t(e){e.o||(e.D=new Map,e.o=new Map(e.t))}function r(e){e.o||(e.o=new Set,e.t.forEach((function(t){if(h(t)){var r=L(e.A.h,t,e);e.p.set(t,r),e.o.add(r)}else e.o.add(t)})))}function n(e){e.O&&f(3,JSON.stringify(O(e)))}var o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},a=function(){function r(e,t){return this[ne]={i:2,l:t,A:t?t.A:j(),P:!1,I:!1,o:void 0,D:void 0,t:e,k:this,C:!1,O:!1},this}e(r,Map);var o=r.prototype;return Object.defineProperty(o,"size",{get:function(){return O(this[ne]).size}}),o.has=function(e){return O(this[ne]).has(e)},o.set=function(e,r){var o=this[ne];return n(o),O(o).has(e)&&O(o).get(e)===r||(t(o),W(o),o.D.set(e,!0),o.o.set(e,r),o.D.set(e,!0)),this},o.delete=function(e){if(!this.has(e))return!1;var r=this[ne];return n(r),t(r),W(r),r.t.has(e)?r.D.set(e,!1):r.D.delete(e),r.o.delete(e),!0},o.clear=function(){var e=this[ne];n(e),O(e).size&&(t(e),W(e),e.D=new Map,p(e.t,(function(t){e.D.set(t,!1)})),e.o.clear())},o.forEach=function(e,t){var r=this;O(this[ne]).forEach((function(n,o){e.call(t,r.get(o),o,r)}))},o.get=function(e){var r=this[ne];n(r);var o=O(r).get(e);if(r.I||!h(o))return o;if(o!==r.t.get(e))return o;var a=L(r.A.h,o,r);return t(r),r.o.set(e,a),a},o.keys=function(){return O(this[ne]).keys()},o.values=function(){var e,t=this,r=this.keys();return(e={})[oe]=function(){return t.values()},e.next=function(){var e=r.next();return e.done?e:{done:!1,value:t.get(e.value)}},e},o.entries=function(){var e,t=this,r=this.keys();return(e={})[oe]=function(){return t.entries()},e.next=function(){var e=r.next();if(e.done)return e;var n=t.get(e.value);return{done:!1,value:[e.value,n]}},e},o[oe]=function(){return this.entries()},r}(),i=function(){function t(e,t){return this[ne]={i:3,l:t,A:t?t.A:j(),P:!1,I:!1,o:void 0,t:e,k:this,p:new Map,O:!1,C:!1},this}e(t,Set);var o=t.prototype;return Object.defineProperty(o,"size",{get:function(){return O(this[ne]).size}}),o.has=function(e){var t=this[ne];return n(t),t.o?!!t.o.has(e)||!(!t.p.has(e)||!t.o.has(t.p.get(e))):t.t.has(e)},o.add=function(e){var t=this[ne];return n(t),this.has(e)||(r(t),W(t),t.o.add(e)),this},o.delete=function(e){if(!this.has(e))return!1;var t=this[ne];return n(t),r(t),W(t),t.o.delete(e)||!!t.p.has(e)&&t.o.delete(t.p.get(e))},o.clear=function(){var e=this[ne];n(e),O(e).size&&(r(e),W(e),e.o.clear())},o.values=function(){var e=this[ne];return n(e),r(e),e.o.values()},o.entries=function(){var e=this[ne];return n(e),r(e),e.o.entries()},o.keys=function(){return this.values()},o[oe]=function(){return this.values()},o.forEach=function(e,t){for(var r=this.values(),n=r.next();!n.done;)e.call(t,n.value,n.value,this),n=r.next()},t}();k("MapSet",{N:function(e,t){return new a(e,t)},T:function(e,t){return new i(e,t)}})}var Q,V,X="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),$="undefined"!=typeof Map,Z="undefined"!=typeof Set,ee="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,te=X?Symbol.for("immer-nothing"):((Q={})["immer-nothing"]=!0,Q),re=X?Symbol.for("immer-draftable"):"__$immer_draftable",ne=X?Symbol.for("immer-state"):"__$immer_state",oe="undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator",ae={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(e){return"Cannot apply patch, path doesn't resolve: "+e},16:'Sets cannot have "replace" patches.',17:function(e){return"Unsupported patch operation: "+e},18:function(e){return"The plugin for '"+e+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+e+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(e){return"produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+e+"'"},22:function(e){return"'current' expects a draft, got: "+e},23:function(e){return"'original' expects a draft, got: "+e},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},ie=""+Object.prototype.constructor,se="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,ue=Object.getOwnPropertyDescriptors||function(e){var t={};return se(e).forEach((function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)})),t},ce={},le={get:function(e,t){if(t===ne)return e;var r=O(e);if(!g(r,t))return function(e,t,r){var n,o=H(t,r);return o?"value"in o?o.value:null===(n=o.get)||void 0===n?void 0:n.call(e.k):void 0}(e,r,t);var n=r[t];return e.I||!h(n)?n:n===F(e.t,t)?(B(e),e.o[t]=L(e.A.h,n,e)):n},has:function(e,t){return t in O(e)},ownKeys:function(e){return Reflect.ownKeys(O(e))},set:function(e,t,r){var n=H(O(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var o=F(O(e),t),a=null==o?void 0:o[ne];if(a&&a.t===r)return e.o[t]=r,e.D[t]=!1,!0;if(b(r,o)&&(void 0!==r||g(e.t,t)))return!0;B(e),W(e)}return e.o[t]===r&&"number"!=typeof r&&(void 0!==r||t in e.o)||(e.o[t]=r,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==F(e.t,t)||t in e.t?(e.D[t]=!1,B(e),W(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=O(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty:function(){f(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){f(12)}},fe={};p(le,(function(e,t){fe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),fe.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&f(13),fe.set.call(this,e,t,void 0)},fe.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&f(14),le.set.call(this,e[0],t,r,e[0])};var de=function(){function e(e){var t=this;this.g=ee,this.F=!0,this.produce=function(e,r,n){if("function"==typeof e&&"function"!=typeof r){var o=r;r=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var n=arguments.length,i=Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return a.produce(e,(function(e){var n;return(n=r).call.apply(n,[t,e].concat(i))}))}}var i;if("function"!=typeof r&&f(6),void 0!==n&&"function"!=typeof n&&f(7),h(e)){var s=R(t),u=L(t,e,void 0),c=!0;try{i=r(u),c=!1}finally{c?x(s):C(s)}return"undefined"!=typeof Promise&&i instanceof Promise?i.then((function(e){return E(s,n),M(e,s)}),(function(e){throw x(s),e})):(E(s,n),M(i,s))}if(!e||"object"!=typeof e){if(void 0===(i=r(e))&&(i=e),i===te&&(i=void 0),t.F&&S(i,!0),n){var l=[],d=[];I("Patches").M(e,i,l,d),n(l,d)}return i}f(21,e)},this.produceWithPatches=function(e,r){if("function"==typeof e)return function(r){for(var n=arguments.length,o=Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return t.produceWithPatches(r,(function(t){return e.apply(void 0,[t].concat(o))}))};var n,o,a=t.produce(e,r,(function(e,t){n=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,n,o]})):[a,n,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){h(e)||f(8),d(e)&&(e=z(e));var t=R(this),r=L(this,e,void 0);return r[ne].C=!0,C(t),r},t.finishDraft=function(e,t){var r=e&&e[ne];"production"!==process.env.NODE_ENV&&(r&&r.C||f(9),r.I&&f(10));var n=r.A;return E(n,t),M(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ee&&f(20),this.g=e},t.applyPatches=function(e,t){var r;for(r=t.length-1;r>=0;r--){var n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));var o=I("Patches").$;return d(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),he=new de,pe=he.produce,ve=he.produceWithPatches.bind(he),ge=he.setAutoFreeze.bind(he),me=he.setUseProxies.bind(he),ye=he.applyPatches.bind(he),be=he.createDraft.bind(he),_e=he.finishDraft.bind(he),we=Object.freeze({__proto__:null,default:pe,Immer:de,applyPatches:ye,castDraft:function(e){return e},castImmutable:function(e){return e},createDraft:be,current:z,enableAllPlugins:function(){G(),J(),K()},enableES5:G,enableMapSet:J,enablePatches:K,finishDraft:_e,freeze:S,immerable:re,isDraft:d,isDraftable:h,nothing:te,original:function(e){return d(e)||f(23,e),e[ne].t},produce:pe,produceWithPatches:ve,setAutoFreeze:ge,setUseProxies:me}),Oe=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===Pe}(e)}(e)};var Pe="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function Se(e,t){return!1!==t.clone&&t.isMergeableObject(e)?je((r=e,Array.isArray(r)?[]:{}),e,t):e;var r}function Te(e,t,r){return e.concat(t).map((function(e){return Se(e,r)}))}function De(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function Ie(e,t){try{return t in e}catch(e){return!1}}function ke(e,t,r){var n={};return r.isMergeableObject(e)&&De(e).forEach((function(t){n[t]=Se(e[t],r)})),De(t).forEach((function(o){(function(e,t){return Ie(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(Ie(e,o)&&r.isMergeableObject(t[o])?n[o]=function(e,t){if(!t.customMerge)return je;var r=t.customMerge(e);return"function"==typeof r?r:je}(o,r)(e[o],t[o],r):n[o]=Se(t[o],r))})),n}function je(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||Te,r.isMergeableObject=r.isMergeableObject||Oe,r.cloneUnlessOtherwiseSpecified=Se;var n=Array.isArray(t);return n===Array.isArray(e)?n?r.arrayMerge(e,t,r):ke(e,t,r):Se(t,r)}je.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return je(e,r,t)}),{})};var Ee=je,xe=r(l),Ce=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getAppConfig=void 0;var r=xe.__importDefault(Ee),n={sapiBackend:{baseUrl:"dikcjxfwieazv.cloudfront.net",endpoints:{anchor:"anchor",search:"search",offers:"ws/offers"}},saf:{baseUrl:"sapi.findhotel.services",endpoints:{offersRooms:"1/offers-rooms",search:"1/search",hotel:"1/hotel"}},algolia:{appId:"4UYGJP42KQ",apiKey:"efa703d5c0057a24487bc9bdcb597770",autocompleteIndex:"prod_autocomplete_v2_os000007"},client:{defaultRooms:"2",features:["offers","search","suggests","configs","rooms","get-hotel"],blockedDefaultDates:["2022-12-25","2023-01-01"],daysFromNow:45,fallbackLanguages:{"pt-BR":["pt"],"zh-CN":["zh"],"zh-HK":["zh"],"zh-TW":["zh"],iw:["he"],nb:["no"],nn:["no"]}}},o={"findhotel-website":n,"findhotel-website-e2e":xe.__assign(xe.__assign({},n),{saf:xe.__assign(xe.__assign({},n.saf),{baseUrl:"sapi-e2e.findhotel.services"}),sapiBackend:xe.__assign(xe.__assign({},n.sapiBackend),{baseUrl:"d30gf1e3i1dery.cloudfront.net"})}),"findhotel-website-stg":xe.__assign(xe.__assign({},n),{sapiBackend:xe.__assign(xe.__assign({},n.sapiBackend),{baseUrl:"d3vuhpa0o0tale.cloudfront.net"})}),"findhotel-website-ci":xe.__assign(xe.__assign({},n),{sapiBackend:xe.__assign(xe.__assign({},n.sapiBackend),{baseUrl:"d1ue1wauc6u0m5.cloudfront.net"})}),"findhotel-website-dev":xe.__assign(xe.__assign({},n),{sapiBackend:xe.__assign(xe.__assign({},n.sapiBackend),{baseUrl:"d3b8t16k1aaypx.cloudfront.net"})}),"findhotel-checkout":xe.__assign(xe.__assign({},n),{client:xe.__assign(xe.__assign({},n.client),{features:["rooms","get-hotel"]})}),"findhotel-checkout-e2e":xe.__assign(xe.__assign({},n),{saf:xe.__assign(xe.__assign({},n.saf),{baseUrl:"sapi-e2e.findhotel.services"}),client:xe.__assign(xe.__assign({},n.client),{features:["rooms","get-hotel"]})}),"findhotel-checkout-stg":xe.__assign(xe.__assign({},n),{saf:xe.__assign(xe.__assign({},n.saf),{baseUrl:"sapi-stg.findhotel.services"}),client:xe.__assign(xe.__assign({},n.client),{features:["rooms","get-hotel"]})})};t.getAppConfig=function(e,t){var n=o[e];if(void 0===n)throw new Error("Profile key is not valid");return t&&(n=(0,r.default)(n,t,{arrayMerge:function(e,t){return t}})),n}}));var Re=Object.freeze({__proto__:null,default:function(e,t){return t=t||{},new Promise((function(r,n){var o=new XMLHttpRequest,a=[],i=[],s={},u=function(){return{ok:2==(o.status/100|0),statusText:o.statusText,status:o.status,url:o.responseURL,text:function(){return Promise.resolve(o.responseText)},json:function(){return Promise.resolve(o.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([o.response]))},clone:u,headers:{keys:function(){return a},entries:function(){return i},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var c in o.open(t.method||"get",e,!0),o.onload=function(){o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,r){a.push(t=t.toLowerCase()),i.push([t,r]),s[t]=s[t]?s[t]+","+r:r})),r(u())},o.onerror=n,o.withCredentials="include"==t.credentials,t.headers)o.setRequestHeader(c,t.headers[c]);o.send(t.body||null)}))}}),Ne={};try{!function(e,t){if(new e("q=%2B").get("q")!==t||new e({q:t}).get("q")!==t||new e([["q",t]]).get("q")!==t||"q=%0A"!==new e("q=\n").toString()||"q=+%26"!==new e({q:" &"}).toString()||"q=%25zx"!==new e({q:"%zx"}).toString())throw e;Ne.URLSearchParams=e}(URLSearchParams,"+")}catch(e){!function(e,t,r){var n=e.create,o=e.defineProperty,a=/[!'\(\)~]|%20|%00/g,i=/%(?![0-9a-fA-F]{2})/g,s=/\+/g,u={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"},c={append:function(e,t){h(this._ungap,e,t)},delete:function(e){delete this._ungap[e]},get:function(e){return this.has(e)?this._ungap[e][0]:null},getAll:function(e){return this.has(e)?this._ungap[e].slice(0):[]},has:function(e){return e in this._ungap},set:function(e,r){this._ungap[e]=[t(r)]},forEach:function(e,r){var n=this;for(var o in n._ungap)n._ungap[o].forEach(a,o);function a(a){e.call(r,a,t(o),n)}},toJSON:function(){return{}},toString:function(){var e=[];for(var t in this._ungap)for(var r=v(t),n=0,o=this._ungap[t];n<o.length;n++)e.push(r+"="+v(o[n]));return e.join("&")}};for(var l in c)o(f.prototype,l,{configurable:!0,writable:!0,value:c[l]});function f(e){var t=n(null);switch(o(this,"_ungap",{value:t}),!0){case!e:break;case"string"==typeof e:"?"===e.charAt(0)&&(e=e.slice(1));for(var a=e.split("&"),i=0,s=a.length;i<s;i++){var u=(c=a[i]).indexOf("=");-1<u?h(t,p(c.slice(0,u)),p(c.slice(u+1))):c.length&&h(t,p(c),"")}break;case r(e):for(i=0,s=e.length;i<s;i++){var c;h(t,(c=e[i])[0],c[1])}break;case"forEach"in e:e.forEach(d,t);break;default:for(var l in e)h(t,l,e[l])}}function d(e,t){h(this,t,e)}function h(e,t,n){var o=r(n)?n.join(","):n;t in e?e[t].push(o):e[t]=[o]}function p(e){return decodeURIComponent(e.replace(i,"%25").replace(s," "))}function v(e){return encodeURIComponent(e).replace(a,g)}function g(e){return u[e]}Ne.URLSearchParams=f}(Object,String,Array.isArray)}!function(e){var t=!1;try{t=!!Symbol.iterator}catch(e){}function r(e,r){var n=[];return e.forEach(r,n),t?n[Symbol.iterator]():{next:function(){var e=n.shift();return{done:void 0===e,value:e}}}}"forEach"in e||(e.forEach=function(e,t){var r=this,n=Object.create(null);this.toString().replace(/=[\s\S]*?(?:&|$)/g,"=").split("=").forEach((function(o){o.length&&!(o in n)&&(n[o]=r.getAll(o)).forEach((function(n){e.call(t,n,o,r)}))}))}),"keys"in e||(e.keys=function(){return r(this,(function(e,t){this.push(t)}))}),"values"in e||(e.values=function(){return r(this,(function(e,t){this.push(e)}))}),"entries"in e||(e.entries=function(){return r(this,(function(e,t){this.push([t,e])}))}),t&&!(Symbol.iterator in e)&&(e[Symbol.iterator]=e.entries),"sort"in e||(e.sort=function(){for(var e,t,r,n=this.entries(),o=n.next(),a=o.done,i=[],s=Object.create(null);!a;)t=(r=o.value)[0],i.push(t),t in s||(s[t]=[]),s[t].push(r[1]),a=(o=n.next()).done;for(i.sort(),e=0;e<i.length;e++)this.delete(i[e]);for(e=0;e<i.length;e++)t=i[e],this.append(t,s[t].shift())}),function(t){var r=t.defineProperty,n=t.getOwnPropertyDescriptor,o=function(t){var r=t.append;t.append=e.append,URLSearchParams.call(t,t._usp.search.slice(1)),t.append=r},a=function(e,t){if(!(e instanceof t))throw new TypeError("'searchParams' accessed on an object that does not implement interface "+t.name)},i=function(i){var s,u,c=i.prototype,l=n(c,"searchParams"),f=n(c,"href"),d=n(c,"search");!l&&d&&d.set&&(u=function(t){function n(r,n){e.append.call(this,r,n),r=this.toString(),t.set.call(this._usp,r?"?"+r:"")}function o(r){e.delete.call(this,r),r=this.toString(),t.set.call(this._usp,r?"?"+r:"")}function a(r,n){e.set.call(this,r,n),r=this.toString(),t.set.call(this._usp,r?"?"+r:"")}return function(e,t){return e.append=n,e.delete=o,e.set=a,r(e,"_usp",{configurable:!0,writable:!0,value:t})}}(d),s=function(e,t){return r(e,"_searchParams",{configurable:!0,writable:!0,value:u(t,e)}),t},t.defineProperties(c,{href:{get:function(){return f.get.call(this)},set:function(e){var t=this._searchParams;f.set.call(this,e),t&&o(t)}},search:{get:function(){return d.get.call(this)},set:function(e){var t=this._searchParams;d.set.call(this,e),t&&o(t)}},searchParams:{get:function(){return a(this,i),this._searchParams||s(this,new URLSearchParams(this.search.slice(1)))},set:function(e){a(this,i),s(this,e)}}}))};try{i(HTMLAnchorElement),/^function|object$/.test(typeof URL)&&URL.prototype&&i(URL)}catch(e){}}(Object)}(Ne.URLSearchParams.prototype);var Me=Ne.URLSearchParams,Ae=r(Object.freeze({__proto__:null,default:Me})),Ue=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getSapiOverrideParameter=void 0;var r=xe.__importDefault(Ae);t.getSapiOverrideParameter=function(e){if("undefined"==typeof window)return null;var t,n=new r.default(window.location.search).get("sapiOverride");try{n?(window.sessionStorage.setItem("sapiOverride",n),t=n):t=window.sessionStorage.getItem("sapiOverride")}catch(e){}return e?t&&t.length<=2e3?t:void 0:t}})),qe=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCheapestRate=void 0,t.getCheapestRate=function(e,t){if(0!==e.offers.length)return Math.min.apply(Math,e.offers.map((function(e){return t(e.rate)})))}})),Fe=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateDiscount=void 0,t.calculateDiscount=function(e,t,r){return void 0===t||void 0===r||0===r?0:e<t?-1*(e-t)/t:e>r?-1*(e-r)/r:0}}));function He(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function We(e){return He(1,arguments),e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}function Be(e){He(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}function Le(e){if(He(1,arguments),!We(e)&&"number"!=typeof e)return!1;var t=Be(e);return!isNaN(Number(t))}var ze={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ye=function(e,t,r){var n,o=ze[e];return n="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),null!=r&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function Ge(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.width?String(t.width):e.defaultWidth,n=e.formats[r]||e.formats[e.defaultWidth];return n}}var Ke={date:Ge({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Ge({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:Ge({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Je={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Qe=function(e,t,r,n){return Je[e]};function Ve(e){return function(t,r){var n,o=r||{};if("formatting"===(o.context?String(o.context):"standalone")&&e.formattingValues){var a=e.defaultFormattingWidth||e.defaultWidth,i=o.width?String(o.width):a;n=e.formattingValues[i]||e.formattingValues[a]}else{var s=e.defaultWidth,u=o.width?String(o.width):e.defaultWidth;n=e.values[u]||e.values[s]}return n[e.argumentCallback?e.argumentCallback(t):t]}}var Xe={ordinalNumber:function(e,t){var r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:Ve({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Ve({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:Ve({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Ve({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Ve({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function $e(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(o);if(!a)return null;var i,s=a[0],u=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(u)?et(u,(function(e){return e.test(s)})):Ze(u,(function(e){return e.test(s)}));i=e.valueCallback?e.valueCallback(c):c,i=r.valueCallback?r.valueCallback(i):i;var l=t.slice(s.length);return{value:i,rest:l}}}function Ze(e,t){for(var r in e)if(e.hasOwnProperty(r)&&t(e[r]))return r}function et(e,t){for(var r=0;r<e.length;r++)if(t(e[r]))return r}var tt,rt={ordinalNumber:(tt={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.match(tt.matchPattern);if(!r)return null;var n=r[0],o=e.match(tt.parsePattern);if(!o)return null;var a=tt.valueCallback?tt.valueCallback(o[0]):o[0];a=t.valueCallback?t.valueCallback(a):a;var i=e.slice(n.length);return{value:a,rest:i}}),era:$e({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:$e({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:$e({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:$e({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:$e({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},nt={code:"en-US",formatDistance:Ye,formatLong:Ke,formatRelative:Qe,localize:Xe,match:rt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ot(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function at(e,t){He(2,arguments);var r=Be(e).getTime(),n=ot(t);return new Date(r+n)}function it(e,t){He(2,arguments);var r=ot(t);return at(e,-r)}var st=864e5;function ut(e){He(1,arguments);var t=1,r=Be(e),n=r.getUTCDay(),o=(n<t?7:0)+n-t;return r.setUTCDate(r.getUTCDate()-o),r.setUTCHours(0,0,0,0),r}function ct(e){He(1,arguments);var t=Be(e),r=t.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(r+1,0,4),n.setUTCHours(0,0,0,0);var o=ut(n),a=new Date(0);a.setUTCFullYear(r,0,4),a.setUTCHours(0,0,0,0);var i=ut(a);return t.getTime()>=o.getTime()?r+1:t.getTime()>=i.getTime()?r:r-1}function lt(e){He(1,arguments);var t=ct(e),r=new Date(0);r.setUTCFullYear(t,0,4),r.setUTCHours(0,0,0,0);var n=ut(r);return n}var ft=6048e5;function dt(e,t){He(1,arguments);var r=t||{},n=r.locale,o=n&&n.options&&n.options.weekStartsOn,a=null==o?0:ot(o),i=null==r.weekStartsOn?a:ot(r.weekStartsOn);if(!(i>=0&&i<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var s=Be(e),u=s.getUTCDay(),c=(u<i?7:0)+u-i;return s.setUTCDate(s.getUTCDate()-c),s.setUTCHours(0,0,0,0),s}function ht(e,t){He(1,arguments);var r=Be(e),n=r.getUTCFullYear(),o=t||{},a=o.locale,i=a&&a.options&&a.options.firstWeekContainsDate,s=null==i?1:ot(i),u=null==o.firstWeekContainsDate?s:ot(o.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var c=new Date(0);c.setUTCFullYear(n+1,0,u),c.setUTCHours(0,0,0,0);var l=dt(c,t),f=new Date(0);f.setUTCFullYear(n,0,u),f.setUTCHours(0,0,0,0);var d=dt(f,t);return r.getTime()>=l.getTime()?n+1:r.getTime()>=d.getTime()?n:n-1}function pt(e,t){He(1,arguments);var r=t||{},n=r.locale,o=n&&n.options&&n.options.firstWeekContainsDate,a=null==o?1:ot(o),i=null==r.firstWeekContainsDate?a:ot(r.firstWeekContainsDate),s=ht(e,t),u=new Date(0);u.setUTCFullYear(s,0,i),u.setUTCHours(0,0,0,0);var c=dt(u,t);return c}var vt=6048e5;function gt(e,t){for(var r=e<0?"-":"",n=Math.abs(e).toString();n.length<t;)n="0"+n;return r+n}var mt={y:function(e,t){var r=e.getUTCFullYear(),n=r>0?r:1-r;return gt("yy"===t?n%100:n,t.length)},M:function(e,t){var r=e.getUTCMonth();return"M"===t?String(r+1):gt(r+1,2)},d:function(e,t){return gt(e.getUTCDate(),t.length)},a:function(e,t){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return"am"===r?"a.m.":"p.m."}},h:function(e,t){return gt(e.getUTCHours()%12||12,t.length)},H:function(e,t){return gt(e.getUTCHours(),t.length)},m:function(e,t){return gt(e.getUTCMinutes(),t.length)},s:function(e,t){return gt(e.getUTCSeconds(),t.length)},S:function(e,t){var r=t.length,n=e.getUTCMilliseconds();return gt(Math.floor(n*Math.pow(10,r-3)),t.length)}},yt="midnight",bt="noon",_t="morning",wt="afternoon",Ot="evening",Pt="night",St={G:function(e,t,r){var n=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){var n=e.getUTCFullYear(),o=n>0?n:1-n;return r.ordinalNumber(o,{unit:"year"})}return mt.y(e,t)},Y:function(e,t,r,n){var o=ht(e,n),a=o>0?o:1-o;return"YY"===t?gt(a%100,2):"Yo"===t?r.ordinalNumber(a,{unit:"year"}):gt(a,t.length)},R:function(e,t){return gt(ct(e),t.length)},u:function(e,t){return gt(e.getUTCFullYear(),t.length)},Q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return gt(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){var n=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return gt(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){var n=e.getUTCMonth();switch(t){case"M":case"MM":return mt.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){var n=e.getUTCMonth();switch(t){case"L":return String(n+1);case"LL":return gt(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){var o=function(e,t){He(1,arguments);var r=Be(e),n=dt(r,t).getTime()-pt(r,t).getTime();return Math.round(n/vt)+1}(e,n);return"wo"===t?r.ordinalNumber(o,{unit:"week"}):gt(o,t.length)},I:function(e,t,r){var n=function(e){He(1,arguments);var t=Be(e),r=ut(t).getTime()-lt(t).getTime();return Math.round(r/ft)+1}(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):gt(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getUTCDate(),{unit:"date"}):mt.d(e,t)},D:function(e,t,r){var n=function(e){He(1,arguments);var t=Be(e),r=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var n=t.getTime(),o=r-n;return Math.floor(o/st)+1}(e);return"Do"===t?r.ordinalNumber(n,{unit:"dayOfYear"}):gt(n,t.length)},E:function(e,t,r){var n=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){var o=e.getUTCDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return gt(a,2);case"eo":return r.ordinalNumber(a,{unit:"day"});case"eee":return r.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(o,{width:"short",context:"formatting"});default:return r.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){var o=e.getUTCDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return gt(a,t.length);case"co":return r.ordinalNumber(a,{unit:"day"});case"ccc":return r.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(o,{width:"narrow",context:"standalone"});case"cccccc":return r.day(o,{width:"short",context:"standalone"});default:return r.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,r){var n=e.getUTCDay(),o=0===n?7:n;switch(t){case"i":return String(o);case"ii":return gt(o,t.length);case"io":return r.ordinalNumber(o,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){var n,o=e.getUTCHours();switch(n=12===o?bt:0===o?yt:o/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,r){var n,o=e.getUTCHours();switch(n=o>=17?Ot:o>=12?wt:o>=4?_t:Pt,t){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){var n=e.getUTCHours()%12;return 0===n&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return mt.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getUTCHours(),{unit:"hour"}):mt.H(e,t)},K:function(e,t,r){var n=e.getUTCHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):gt(n,t.length)},k:function(e,t,r){var n=e.getUTCHours();return 0===n&&(n=24),"ko"===t?r.ordinalNumber(n,{unit:"hour"}):gt(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):mt.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):mt.s(e,t)},S:function(e,t){return mt.S(e,t)},X:function(e,t,r,n){var o=(n._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return Dt(o);case"XXXX":case"XX":return It(o);default:return It(o,":")}},x:function(e,t,r,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"x":return Dt(o);case"xxxx":case"xx":return It(o);default:return It(o,":")}},O:function(e,t,r,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Tt(o,":");default:return"GMT"+It(o,":")}},z:function(e,t,r,n){var o=(n._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Tt(o,":");default:return"GMT"+It(o,":")}},t:function(e,t,r,n){var o=n._originalDate||e;return gt(Math.floor(o.getTime()/1e3),t.length)},T:function(e,t,r,n){return gt((n._originalDate||e).getTime(),t.length)}};function Tt(e,t){var r=e>0?"-":"+",n=Math.abs(e),o=Math.floor(n/60),a=n%60;if(0===a)return r+String(o);var i=t||"";return r+String(o)+i+gt(a,2)}function Dt(e,t){return e%60==0?(e>0?"-":"+")+gt(Math.abs(e)/60,2):It(e,t)}function It(e,t){var r=t||"",n=e>0?"-":"+",o=Math.abs(e);return n+gt(Math.floor(o/60),2)+r+gt(o%60,2)}var kt=St;function jt(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}}function Et(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}}var xt={p:Et,P:function(e,t){var r,n=e.match(/(P+)(p+)?/)||[],o=n[1],a=n[2];if(!a)return jt(e,t);switch(o){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",jt(o,t)).replace("{{time}}",Et(a,t))}},Ct=xt;function Rt(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}var Nt=["D","DD"],Mt=["YY","YYYY"];function At(e){return-1!==Nt.indexOf(e)}function Ut(e){return-1!==Mt.indexOf(e)}function qt(e,t,r){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://git.io/fxCyr"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(r,"`; see: https://git.io/fxCyr"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://git.io/fxCyr"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(r,"`; see: https://git.io/fxCyr"))}var Ft=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ht=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Wt=/^'([^]*?)'?$/,Bt=/''/g,Lt=/[a-zA-Z]/;function zt(e){return e.match(Wt)[1].replace(Bt,"'")}var Yt=Object.freeze({__proto__:null,default:function(e,t,r){He(2,arguments);var n=String(t),o=r||{},a=o.locale||nt,i=a.options&&a.options.firstWeekContainsDate,s=null==i?1:ot(i),u=null==o.firstWeekContainsDate?s:ot(o.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var c=a.options&&a.options.weekStartsOn,l=null==c?0:ot(c),f=null==o.weekStartsOn?l:ot(o.weekStartsOn);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!a.localize)throw new RangeError("locale must contain localize property");if(!a.formatLong)throw new RangeError("locale must contain formatLong property");var d=Be(e);if(!Le(d))throw new RangeError("Invalid time value");var h=Rt(d),p=it(d,h),v={firstWeekContainsDate:u,weekStartsOn:f,locale:a,_originalDate:d},g=n.match(Ht).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,Ct[t])(e,a.formatLong,v):e})).join("").match(Ft).map((function(r){if("''"===r)return"'";var n=r[0];if("'"===n)return zt(r);var i=kt[n];if(i)return!o.useAdditionalWeekYearTokens&&Ut(r)&&qt(r,t,e),!o.useAdditionalDayOfYearTokens&&At(r)&&qt(r,t,e),i(p,r,a.localize,v);if(n.match(Lt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+n+"`");return r})).join("");return g}});function Gt(e,t){He(2,arguments);var r=Be(e),n=ot(t);return isNaN(n)?new Date(NaN):n?(r.setDate(r.getDate()+n),r):r}var Kt=Object.freeze({__proto__:null,default:Gt});function Jt(e,t){He(1,arguments);var r=t||{},n=r.locale,o=n&&n.options&&n.options.weekStartsOn,a=null==o?0:ot(o),i=null==r.weekStartsOn?a:ot(r.weekStartsOn);if(!(i>=0&&i<=6))throw new RangeError("weekStartsOn must be between 0 and 6");var s=Be(e),u=s.getDay(),c=6+(u<i?-7:0)-(u-i);return s.setHours(0,0,0,0),s.setDate(s.getDate()+c),s}var Qt=Object.freeze({__proto__:null,default:function(e){return He(1,arguments),Jt(e,{weekStartsOn:1})}});var Vt=Object.freeze({__proto__:null,default:function(e,t){He(2,arguments);var r=ot(t),n=7*r;return Gt(e,n)}}),Xt=36e5;var $t={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Zt=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,er=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,tr=/^([+-])(\d{2})(?::?(\d{2}))?$/;function rr(e){var t,r={},n=e.split($t.dateTimeDelimiter);if(n.length>2)return r;if(/:/.test(n[0])?t=n[0]:(r.date=n[0],t=n[1],$t.timeZoneDelimiter.test(r.date)&&(r.date=e.split($t.timeZoneDelimiter)[0],t=e.substr(r.date.length,e.length))),t){var o=$t.timezone.exec(t);o?(r.time=t.replace(o[1],""),r.timezone=o[1]):r.time=t}return r}function nr(e,t){var r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(r);if(!n)return{year:NaN,restDateString:""};var o=n[1]?parseInt(n[1]):null,a=n[2]?parseInt(n[2]):null;return{year:null===a?o:100*a,restDateString:e.slice((n[1]||n[2]).length)}}function or(e,t){if(null===t)return new Date(NaN);var r=e.match(Zt);if(!r)return new Date(NaN);var n=!!r[4],o=ar(r[1]),a=ar(r[2])-1,i=ar(r[3]),s=ar(r[4]),u=ar(r[5])-1;if(n)return function(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}(0,s,u)?function(e,t,r){var n=new Date(0);n.setUTCFullYear(e,0,4);var o=n.getUTCDay()||7,a=7*(t-1)+r+1-o;return n.setUTCDate(n.getUTCDate()+a),n}(t,s,u):new Date(NaN);var c=new Date(0);return function(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(cr[t]||(lr(e)?29:28))}(t,a,i)&&function(e,t){return t>=1&&t<=(lr(e)?366:365)}(t,o)?(c.setUTCFullYear(t,a,Math.max(o,i)),c):new Date(NaN)}function ar(e){return e?parseInt(e):1}function ir(e){var t=e.match(er);if(!t)return NaN;var r=sr(t[1]),n=sr(t[2]),o=sr(t[3]);return function(e,t,r){if(24===e)return 0===t&&0===r;return r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}(r,n,o)?r*Xt+6e4*n+1e3*o:NaN}function sr(e){return e&&parseFloat(e.replace(",","."))||0}function ur(e){if("Z"===e)return 0;var t=e.match(tr);if(!t)return 0;var r="+"===t[1]?-1:1,n=parseInt(t[2]),o=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,o)?r*(n*Xt+6e4*o):NaN}var cr=[31,null,31,30,31,30,31,31,30,31,30,31];function lr(e){return e%400==0||e%4==0&&e%100!=0}var fr=Object.freeze({__proto__:null,default:function(e,t){He(1,arguments);var r=t||{},n=null==r.additionalDigits?2:ot(r.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var o,a=rr(e);if(a.date){var i=nr(a.date,n);o=or(i.restDateString,i.year)}if(!o||isNaN(o.getTime()))return new Date(NaN);var s,u=o.getTime(),c=0;if(a.time&&(c=ir(a.time),isNaN(c)))return new Date(NaN);if(!a.timezone){var l=new Date(u+c),f=new Date(0);return f.setFullYear(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()),f.setHours(l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()),f}return s=ur(a.timezone),isNaN(s)?new Date(NaN):new Date(u+c+s)}}),dr=r(Yt),hr=r(Kt),pr=r(Qt),vr=r(Vt),gr=r(fr),mr=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCheckInCheckOutDates=t.shouldUseClientDates=t.dateToMiddayUTC=t.DATE_FORMAT=void 0;var r=xe.__importDefault(dr),n=xe.__importDefault(hr),o=xe.__importDefault(pr),a=xe.__importDefault(vr),i=xe.__importDefault(gr);function s(e){return(0,i.default)("".concat(e," 12:00:00"))}t.DATE_FORMAT="yyyy-MM-dd",t.dateToMiddayUTC=s;var u=function(e,t){return(0,n.default)(e,t)};t.shouldUseClientDates=function(e,t){var r,n=e.checkIn,o=e.checkOut,a=e.dayDistance,i=e.nights,s=Boolean(n&&o||a&&(void 0===i?1:i)),u=!(null===(r=t.variations)||void 0===r?void 0:r.includes("sapi4eva-sid-landing-unavailability-b"));return s||u},t.getCheckInCheckOutDates=function(e,i){var c,l=e.checkIn,f=e.checkOut,d=e.dayDistance,h=e.nights,p=void 0===h?1:h,v=s((0,r.default)(new Date,t.DATE_FORMAT));c=void 0!==l?s(l):d?u(v,d):function(e){for(var i,u=e.daysFromNow,c=e.blockedDefaultDates,l=s((0,r.default)(new Date,t.DATE_FORMAT)),f=(0,o.default)((0,n.default)(l,u));i=(0,r.default)(f,t.DATE_FORMAT),c.includes(i);)f=(0,a.default)(f,1);return f}(i);var g=void 0===f?u(c,p):s(f);return{checkIn:(0,r.default)(c,t.DATE_FORMAT),checkOut:(0,r.default)(g,t.DATE_FORMAT)}}}));function yr(e){He(1,arguments);var t=Be(e);return t.setHours(0,0,0,0),t}var br=864e5;function _r(e,t){He(2,arguments);var r=yr(e),n=yr(t),o=r.getTime()-Rt(r),a=n.getTime()-Rt(n);return Math.round((o-a)/br)}function wr(e,t){var r=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return r<0?-1:r>0?1:r}var Or,Pr=Object.freeze({__proto__:null,default:function(e,t){He(2,arguments);var r=Be(e),n=Be(t),o=wr(r,n),a=Math.abs(_r(r,n));r.setDate(r.getDate()-o*a);var i=Number(wr(r,n)===-o),s=o*(a-i);return 0===s?0:s}}),Sr=r(Pr),Tr=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDealScores=t.calculateDealScores=void 0;var r=xe.__importDefault(Sr);function n(e){void 0===e&&(e=[]);for(var t={},r={},n=0,o=e;n<o.length;n++){var a=o[n],i=a[0],s=a[1],u=a[2],c=a[3];s&&(t[i]=(0,Fe.calculateDiscount)(s,u,c))}for(var l=Math.min.apply(Math,Object.values(t)),f=Math.max.apply(Math,Object.values(t)),d=0,h=e;d<h.length;d++){var p=h[d],v=(i=p[0],s=p[1],u=p[2],c=p[3],s&&c&&c>0?f===l?1:(t[i]-l)/(f-l):void 0);void 0!==v&&(r[i]=Number(v.toFixed(2)))}return r}t.calculateDealScores=n,t.getDealScores=function(e){var t=e.offset,o=e.anchorHotelId,a=e.hotelIds,i=e.hotelEntities,s=e.hotelOfferEntities,u=e.searchParameters,c=void 0===o||t>0?a:xe.__spreadArray([o],a,!0),l=(0,r.default)((0,mr.dateToMiddayUTC)(u.checkOut),(0,mr.dateToMiddayUTC)(u.checkIn)),f=c.map((function(e){var t,r,n=i[e],o=s[e],a=null!==(t=null==n?void 0:n.regularPriceRange)&&void 0!==t?t:[],u=a[0],c=a[1],f=null===(r=null==o?void 0:o.offers)||void 0===r?void 0:r[0],d=f?f.rate.base+f.rate.taxes+f.rate.hotelFees:void 0;return[e,d?d/l:void 0,u,c]}));return n(f)}})),Dr=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.omit=void 0,t.omit=function(e,t){for(var r={},n={},o=0,a=e.length;o<a;)n[e[o]]=1,o+=1;for(var i in t)Object.prototype.hasOwnProperty.call(n,i)||(r[i]=t[i]);return r}})),Ir=r(we),kr=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.createState=void 0,t.createState=function(e){var t=e;return{current:function(){return t},get:function(e){return t[e]},update:function(e){t=(0,Ir.produce)(t,e)}}}})),jr=new Uint8Array(16);function Er(){if(!Or&&!(Or="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Or(jr)}var xr=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Cr(e){return"string"==typeof e&&xr.test(e)}for(var Rr,Nr,Mr=[],Ar=0;Ar<256;++Ar)Mr.push((Ar+256).toString(16).substr(1));function Ur(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(Mr[e[t+0]]+Mr[e[t+1]]+Mr[e[t+2]]+Mr[e[t+3]]+"-"+Mr[e[t+4]]+Mr[e[t+5]]+"-"+Mr[e[t+6]]+Mr[e[t+7]]+"-"+Mr[e[t+8]]+Mr[e[t+9]]+"-"+Mr[e[t+10]]+Mr[e[t+11]]+Mr[e[t+12]]+Mr[e[t+13]]+Mr[e[t+14]]+Mr[e[t+15]]).toLowerCase();if(!Cr(r))throw TypeError("Stringified UUID is invalid");return r}var qr=0,Fr=0;function Hr(e){if(!Cr(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}function Wr(e,t,r){function n(e,n,o,a){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=Hr(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var i=new Uint8Array(16+e.length);if(i.set(n),i.set(e,n.length),(i=r(i))[6]=15&i[6]|t,i[8]=63&i[8]|128,o){a=a||0;for(var s=0;s<16;++s)o[a+s]=i[s];return o}return Ur(i)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function Br(e){return 14+(e+64>>>9<<4)+1}function Lr(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function zr(e,t,r,n,o,a){return Lr((i=Lr(Lr(t,e),Lr(n,a)))<<(s=o)|i>>>32-s,r);var i,s}function Yr(e,t,r,n,o,a,i){return zr(t&r|~t&n,e,t,o,a,i)}function Gr(e,t,r,n,o,a,i){return zr(t&n|r&~n,e,t,o,a,i)}function Kr(e,t,r,n,o,a,i){return zr(t^r^n,e,t,o,a,i)}function Jr(e,t,r,n,o,a,i){return zr(r^(t|~n),e,t,o,a,i)}var Qr=Wr("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function(e){for(var t=[],r=32*e.length,n="0123456789abcdef",o=0;o<r;o+=8){var a=e[o>>5]>>>o%32&255,i=parseInt(n.charAt(a>>>4&15)+n.charAt(15&a),16);t.push(i)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[Br(t)-1]=t;for(var r=1732584193,n=-271733879,o=-1732584194,a=271733878,i=0;i<e.length;i+=16){var s=r,u=n,c=o,l=a;r=Yr(r,n,o,a,e[i],7,-680876936),a=Yr(a,r,n,o,e[i+1],12,-389564586),o=Yr(o,a,r,n,e[i+2],17,606105819),n=Yr(n,o,a,r,e[i+3],22,-1044525330),r=Yr(r,n,o,a,e[i+4],7,-176418897),a=Yr(a,r,n,o,e[i+5],12,1200080426),o=Yr(o,a,r,n,e[i+6],17,-1473231341),n=Yr(n,o,a,r,e[i+7],22,-45705983),r=Yr(r,n,o,a,e[i+8],7,1770035416),a=Yr(a,r,n,o,e[i+9],12,-1958414417),o=Yr(o,a,r,n,e[i+10],17,-42063),n=Yr(n,o,a,r,e[i+11],22,-1990404162),r=Yr(r,n,o,a,e[i+12],7,1804603682),a=Yr(a,r,n,o,e[i+13],12,-40341101),o=Yr(o,a,r,n,e[i+14],17,-1502002290),r=Gr(r,n=Yr(n,o,a,r,e[i+15],22,1236535329),o,a,e[i+1],5,-165796510),a=Gr(a,r,n,o,e[i+6],9,-1069501632),o=Gr(o,a,r,n,e[i+11],14,643717713),n=Gr(n,o,a,r,e[i],20,-373897302),r=Gr(r,n,o,a,e[i+5],5,-701558691),a=Gr(a,r,n,o,e[i+10],9,38016083),o=Gr(o,a,r,n,e[i+15],14,-660478335),n=Gr(n,o,a,r,e[i+4],20,-405537848),r=Gr(r,n,o,a,e[i+9],5,568446438),a=Gr(a,r,n,o,e[i+14],9,-1019803690),o=Gr(o,a,r,n,e[i+3],14,-187363961),n=Gr(n,o,a,r,e[i+8],20,1163531501),r=Gr(r,n,o,a,e[i+13],5,-1444681467),a=Gr(a,r,n,o,e[i+2],9,-51403784),o=Gr(o,a,r,n,e[i+7],14,1735328473),r=Kr(r,n=Gr(n,o,a,r,e[i+12],20,-1926607734),o,a,e[i+5],4,-378558),a=Kr(a,r,n,o,e[i+8],11,-2022574463),o=Kr(o,a,r,n,e[i+11],16,1839030562),n=Kr(n,o,a,r,e[i+14],23,-35309556),r=Kr(r,n,o,a,e[i+1],4,-1530992060),a=Kr(a,r,n,o,e[i+4],11,1272893353),o=Kr(o,a,r,n,e[i+7],16,-155497632),n=Kr(n,o,a,r,e[i+10],23,-1094730640),r=Kr(r,n,o,a,e[i+13],4,681279174),a=Kr(a,r,n,o,e[i],11,-358537222),o=Kr(o,a,r,n,e[i+3],16,-722521979),n=Kr(n,o,a,r,e[i+6],23,76029189),r=Kr(r,n,o,a,e[i+9],4,-640364487),a=Kr(a,r,n,o,e[i+12],11,-421815835),o=Kr(o,a,r,n,e[i+15],16,530742520),r=Jr(r,n=Kr(n,o,a,r,e[i+2],23,-995338651),o,a,e[i],6,-198630844),a=Jr(a,r,n,o,e[i+7],10,1126891415),o=Jr(o,a,r,n,e[i+14],15,-1416354905),n=Jr(n,o,a,r,e[i+5],21,-57434055),r=Jr(r,n,o,a,e[i+12],6,1700485571),a=Jr(a,r,n,o,e[i+3],10,-1894986606),o=Jr(o,a,r,n,e[i+10],15,-1051523),n=Jr(n,o,a,r,e[i+1],21,-2054922799),r=Jr(r,n,o,a,e[i+8],6,1873313359),a=Jr(a,r,n,o,e[i+15],10,-30611744),o=Jr(o,a,r,n,e[i+6],15,-1560198380),n=Jr(n,o,a,r,e[i+13],21,1309151649),r=Jr(r,n,o,a,e[i+4],6,-145523070),a=Jr(a,r,n,o,e[i+11],10,-1120210379),o=Jr(o,a,r,n,e[i+2],15,718787259),n=Jr(n,o,a,r,e[i+9],21,-343485551),r=Lr(r,s),n=Lr(n,u),o=Lr(o,c),a=Lr(a,l)}return[r,n,o,a]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(Br(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))})),Vr=Qr;function Xr(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function $r(e,t){return e<<t|e>>>32-t}var Zr=Wr("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var o=0;o<n.length;++o)e.push(n.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var a=e.length/4+2,i=Math.ceil(a/16),s=new Array(i),u=0;u<i;++u){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=e[64*u+4*l]<<24|e[64*u+4*l+1]<<16|e[64*u+4*l+2]<<8|e[64*u+4*l+3];s[u]=c}s[i-1][14]=8*(e.length-1)/Math.pow(2,32),s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=8*(e.length-1)&4294967295;for(var f=0;f<i;++f){for(var d=new Uint32Array(80),h=0;h<16;++h)d[h]=s[f][h];for(var p=16;p<80;++p)d[p]=$r(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var v=r[0],g=r[1],m=r[2],y=r[3],b=r[4],_=0;_<80;++_){var w=Math.floor(_/20),O=$r(v,5)+Xr(w,g,m,y)+b+t[w]+d[_]>>>0;b=y,y=m,m=$r(g,30)>>>0,g=v,v=O}r[0]=r[0]+v>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+y>>>0,r[4]=r[4]+b>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]})),en=Zr;var tn=Object.freeze({__proto__:null,v1:function(e,t,r){var n=t&&r||0,o=t||new Array(16),a=(e=e||{}).node||Rr,i=void 0!==e.clockseq?e.clockseq:Nr;if(null==a||null==i){var s=e.random||(e.rng||Er)();null==a&&(a=Rr=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==i&&(i=Nr=16383&(s[6]<<8|s[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:Fr+1,l=u-qr+(c-Fr)/1e4;if(l<0&&void 0===e.clockseq&&(i=i+1&16383),(l<0||u>qr)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");qr=u,Fr=c,Nr=i;var f=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;o[n++]=f>>>24&255,o[n++]=f>>>16&255,o[n++]=f>>>8&255,o[n++]=255&f;var d=u/4294967296*1e4&268435455;o[n++]=d>>>8&255,o[n++]=255&d,o[n++]=d>>>24&15|16,o[n++]=d>>>16&255,o[n++]=i>>>8|128,o[n++]=255&i;for(var h=0;h<6;++h)o[n+h]=a[h];return t||Ur(o)},v3:Vr,v4:function(e,t,r){var n=(e=e||{}).random||(e.rng||Er)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=n[o];return t}return Ur(n)},v5:en,NIL:"00000000-0000-0000-0000-000000000000",version:function(e){if(!Cr(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)},validate:Cr,stringify:Ur,parse:Hr}),rn=r(tn),nn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.generateSearchId=void 0,t.generateSearchId=function(){return(0,rn.v4)()}})),on=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.augmentHotelWithRegularPriceRange=void 0,t.augmentHotelWithRegularPriceRange=function(e,t,r){var n;if(void 0===(null===(n=e.pricing)||void 0===n?void 0:n.medianRateBkt)||void 0===r)return e;var o=e.pricing.medianRateBkt*r*t,a=(e.pricing.medianRateBkt+1)*r*t;return xe.__assign(xe.__assign({},e),{regularPriceRange:[Math.floor(o),Math.ceil(a)]})}})),an=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.removeEmpty=void 0,t.removeEmpty=function e(t){return Object.entries(t).filter((function(e){e[0];var t=e[1];return null!=t})).reduce((function(t,r){var n,o=r[0],a=r[1];return xe.__assign(xe.__assign({},t),((n={})[o]=a===new Object(a)?e(a):a,n))}),{})}})),sn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.generateSortingBoost=void 0,t.generateSortingBoost=function(e){var t;return(null===(t=null==e?void 0:e.filters)||void 0===t?void 0:t.freeCancellation)?"freeCancellation=true:100":void 0}})),un=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.buildOffersResponse=t.applySort=t.applyPriceFilter=t.isRateInPriceRange=void 0;var r=xe.__importDefault(Sr);function n(e,t,r,n){return!(r&&e<r)&&!(n&&n<t&&e>n)}function o(e,t){var o,a=e.filters,i=void 0===a?{}:a,s=e.priceBucketWidth,u=e.priceBucketsCount,c=e.exchangeRate,l=e.getTotalRate;if(void 0===s)return t;var f=u*Math.round(s*c);if(void 0!==i.priceMin||void 0!==i.priceMax){var d=(0,r.default)((0,mr.dateToMiddayUTC)(e.checkOut),(0,mr.dateToMiddayUTC)(e.checkIn));if(!(null===(o=t.offers)||void 0===o?void 0:o.some((function(e){return n((t=l(e.rate),void 0===(r=d)&&(r=1),1===r?t:t/r),f,i.priceMin,i.priceMax);var t,r}))))return xe.__assign(xe.__assign({},t),{offers:[]})}return t}function a(e,t){var r=t.sortField,n=t.sortOrder,o=void 0===n?"ascending":n,a=t.getTotalRate;return"price"===r?function(e,t,r){return e.sort((function(e,n){var o,a,i=(null!==(o=(0,qe.getCheapestRate)(e,r))&&void 0!==o?o:0)-(null!==(a=(0,qe.getCheapestRate)(n,r))&&void 0!==a?a:0);return"ascending"===t?i:-i}))}(e,o,a):e}t.isRateInPriceRange=n,t.applyPriceFilter=o,t.applySort=a,t.buildOffersResponse=function(e,t){var r,n=e.hotelOfferEntities,i=e.anchorHotelOfferEntity;n&&(r=n.map((function(e){return o(t,e)})),void 0!==t.sortField&&(r=a(r,t)));var s=[],u={};if(r)for(var c=0,l=r;c<l.length;c++){var f=l[c];s.push(f.id),u[f.id]=f}return void 0!==i&&(u[i.id]=i),{hotelIds:s,hotelOfferEntities:u}}})),cn=t((function(e,t){function r(e){return Boolean(e&&""!==(null==e?void 0:e.trim()))}function n(e,t){for(var n=0,o=t;n<o.length;n++){var a=o[n];if(r(null==e?void 0:e[a]))return e[a]}return""}function o(e,t,o){void 0===o&&(o=", ");for(var a={},i=0,s=t;i<s.length;i++){var u=s[i],c=(null==e?void 0:e[u])||[];a[u]=c.map((function(n,o){if(r(n))return n;var a=t.find((function(t){var n;return r(null===(n=null==e?void 0:e[t])||void 0===n?void 0:n[o])}));return a?e[a][o]:""})).join("".concat(o))}return n(a,t)}function a(e,t,o){for(var a={},i=0,s=t;i<s.length;i++){var u=s[i],c=e[u]||[],l=-1===o?void 0:o+1,f=c.slice(o,l).toString();if(r(f))a[u]=f;else{var d=t.find((function(t){var n;return r(null===(n=null==e?void 0:e[t])||void 0===n?void 0:n[o])}));a[u]=d?e[d][o]:""}}return n(a,t)}function i(e,t){for(var o,a={},i=0,s=t;i<s.length;i++){var u=s[i],c=null===(o=e[u])||void 0===o?void 0:o.value;if(r(c))a[u]=c;else{var l=t.find((function(t){var n;return r(null===(n=e[t])||void 0===n?void 0:n.value)}));a[u]=l?e[l].value:""}}return n(a,t)}function s(e,t,r){var n,o=e[t];if(!o){var a=r.indexOf(t),i=null!==(n=r.slice(a).find((function(t){return e[t]})))&&void 0!==n?n:"en";o=e[i]}return void 0===o&&(o=[]),"string"==typeof o?[o]:o}function u(e,t,r){if(void 0===e)return t;try{for(var n in t)if(void 0===e[n])throw new TypeError("Hotel ".concat(e.objectID," is missing ").concat(n," field"))}catch(e){r||console.error(e)}return xe.__assign(xe.__assign({},t),e)}function c(e){if(void 0===e)return"property";switch(e){case 0:return"country";case 23:return"city";case 64:case 1010:return"airport";case 199:case 232:case 251:case 1024:return"station";default:return"area"}}Object.defineProperty(t,"__esModule",{value:!0}),t.hitToPlaceSuggest=t.hitToHotelSuggest=t.placeTypeToPlaceTypeName=t.validateHit=t.mergeTranslatedAttributes=t.attributeWithFallback=t.getValueFromTranslatedHightlightResult=t.getStringFromTranslatedArray=t.translatedArrayToString=t.toString=t.getTranslatedAttributes=t.isNotEmptyOrWhiteSpace=void 0,t.isNotEmptyOrWhiteSpace=r,t.getTranslatedAttributes=function(e,t){for(var r=[],n=function(e){var n=t.map((function(t){return"".concat(t,".").concat(e)}));r.push.apply(r,n)},o=0,a=e;o<a.length;o++){n(a[o])}return r},t.toString=n,t.translatedArrayToString=o,t.getStringFromTranslatedArray=a,t.getValueFromTranslatedHightlightResult=i,t.attributeWithFallback=s,t.mergeTranslatedAttributes=function(e,t,r){for(var n={},a=0,i=r;a<i.length;a++){var u=i[a];n[u]=xe.__spreadArray(xe.__spreadArray([],s(e,u,r),!0),s(t,u,r),!0)}return o(n,r)},t.validateHit=u,t.placeTypeToPlaceTypeName=c,t.hitToHotelSuggest=function(e,t){var o=u(e,{objectID:"",placeADN:{},placeDN:{},objectType:"",hotelName:{},_highlightResult:{}}),s=a(o.placeADN,t,-1),l=a(o.placeDN,t,1),f=r(l)?"".concat(l,", ").concat(s):s,d=i(o._highlightResult.hotelName,t);return{objectID:o.objectID.replace("".concat(o.objectType,":"),""),objectType:o.objectType,value:n(o.hotelName,t),highlightValue:d,placeDisplayName:f,placeTypeName:c()}},t.hitToPlaceSuggest=function(e,t){var o=u(e,{objectID:"",placeADN:{},placeDN:{},objectType:"",placeName:{},placeType:0,_highlightResult:{}}),s=a(o.placeADN,t,-1),l=a(o.placeDN,t,1),f=r(l)?"".concat(l,", ").concat(s):s,d=i(o._highlightResult.placeName,t);return{objectID:o.objectID.replace("".concat(o.objectType,":"),""),objectType:o.objectType,value:n(o.placeName,t),highlightValue:d,placeDisplayName:f,placeTypeName:c(o.placeType)}}})),ln=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.hasRequiredSearchParameters=void 0;t.hasRequiredSearchParameters=function(e){var t=e,r=t.checkIn,n=t.checkOut,o=t.rooms;return Boolean(r&&n&&o)}})),fn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getTotalRate=void 0,t.getTotalRate=function(e){return e.base+e.hotelFees+e.taxes}})),dn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),xe.__exportStar(qe,t),xe.__exportStar(Fe,t),xe.__exportStar(mr,t),xe.__exportStar(Tr,t),xe.__exportStar(Dr,t),xe.__exportStar(kr,t),xe.__exportStar(nn,t),xe.__exportStar(on,t),xe.__exportStar(an,t),xe.__exportStar(sn,t),xe.__exportStar(un,t),xe.__exportStar(cn,t),xe.__exportStar(ln,t),xe.__exportStar(fn,t)})),hn=t((function(e,t){function r(e,t){return void 0===e&&(e=""),void 0===t&&(t=500),{name:"ApiError",message:e,status:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.createBackendError=t.createApiError=void 0,t.createApiError=r,t.createBackendError=function(e,t){var n,o;return xe.__awaiter(this,void 0,void 0,(function(){var a,i;return xe.__generator(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,e.json()];case 1:return i=s.sent(),a=null!==(o=null!==(n=i.message)&&void 0!==n?n:e.statusText)&&void 0!==o?o:t,[3,3];case 2:return s.sent(),[3,3];case 3:return[2,r(a,e.status)]}}))}))}})),pn=r(Re),vn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.search=t.createAnchorRequestString=t.createSearchRequestString=t.prepareSearchParameters=void 0;var r=xe.__importDefault(pn),n=xe.__importDefault(Ae),o=31;function a(e,t,r){var n;e.checkIn,e.checkOut,e.dayDistance;var o=e.nights,a=xe.__rest(e,["checkIn","checkOut","dayDistance","nights"]);return xe.__assign(xe.__assign(xe.__assign({},a),(0,dn.shouldUseClientDates)(e,r)?(0,dn.getCheckInCheckOutDates)(e,t):{nights:o}),{rooms:null!==(n=e.rooms)&&void 0!==n?n:"2"})}function i(e){var t,r,o,a,i,s,u,c,l,f,d,h,p,v,g,m,y,b,_,w,O=e.profileKey,P=e.searchId,S=e.searchParameters,T=e.options,D=e.offset,I=e.attributes,k=(0,dn.removeEmpty)({offset:D,searchId:P,profileId:O,query:S.query,hotelId:S.hotelId,placeId:S.hotelId?void 0:S.placeId,checkIn:S.checkIn,checkOut:S.checkOut,rooms:S.rooms,dayDistance:S.dayDistance,nights:S.nights,sortField:S.sortField,sortOrder:S.sortOrder,boundingBox:null===(t=S.boundingBox)||void 0===t?void 0:t.join(","),currency:T.currency,language:T.language,variations:null===(r=T.variations)||void 0===r?void 0:r.join(","),starRating:null===(a=null===(o=S.filters)||void 0===o?void 0:o.starRating)||void 0===a?void 0:a.join(","),guestRating:null===(s=null===(i=S.filters)||void 0===i?void 0:i.guestRating)||void 0===s?void 0:s.join(","),propertyTypeId:null===(c=null===(u=S.filters)||void 0===u?void 0:u.propertyTypeId)||void 0===c?void 0:c.join(","),facilities:null===(f=null===(l=S.filters)||void 0===l?void 0:l.facilities)||void 0===f?void 0:f.join(","),themeIds:null===(h=null===(d=S.filters)||void 0===d?void 0:d.themeIds)||void 0===h?void 0:h.join(","),chainIds:null===(v=null===(p=S.filters)||void 0===p?void 0:p.chainIds)||void 0===v?void 0:v.join(","),noHostels:null===(g=S.filters)||void 0===g?void 0:g.noHostels,priceMin:null===(m=S.filters)||void 0===m?void 0:m.priceMin,priceMax:null===(y=S.filters)||void 0===y?void 0:y.priceMax,hotelName:null===(b=S.filters)||void 0===b?void 0:b.hotelName,freeCancellation:null===(_=S.filters)||void 0===_?void 0:_.freeCancellation,attributes:null==I?void 0:I.join(","),anonymousId:T.anonymousId,cugDeals:null===(w=S.cugDeals)||void 0===w?void 0:w.join(","),tier:S.tier,deviceType:T.deviceType,originId:S.originId,brand:T.brand,sortingBoost:(0,dn.generateSortingBoost)(S),preferredRate:S.preferredRate,label:S.trafficSource,countryCode:T.countryCode,userId:S.userId,emailDomain:S.emailDomain,screenshots:S.screenshots,pageSize:S.pageSize});return new n.default(k).toString()}function s(e,t){var n=e.baseUrl,o=e.endpoints;return xe.__awaiter(this,void 0,void 0,(function(){var e,a,s,u,c,l,f,d;return xe.__generator(this,(function(h){switch(h.label){case 0:return e=i(t),a=(0,Ue.getSapiOverrideParameter)(),s={credentials:"include"},a&&(s.method="POST",s.headers={"Content-Type":"application/json"},s.body=JSON.stringify({sapiOverride:a})),[4,(0,r.default)("https://".concat(n,"/").concat(o.search,"?").concat(e),s)];case 1:return(u=h.sent()).ok?[4,u.json()]:[3,3];case 2:return[2,h.sent()];case 3:return c=t.searchParameters,l=t.options,f=t.offset,d=t.attributes,l.logger.log({name:"SearchFailed",value:xe.__assign(xe.__assign({},c),{offset:f,attributes:d,language:l.language,currency:l.currency,deviceType:l.deviceType})}),[4,(0,hn.createBackendError)(u,"Search request failed")];case 4:throw h.sent()}}))}))}function u(e){var t,r,o,a=e.profileKey,i=e.searchId,s=e.searchParameters,u=e.options,c=e.attributes,l=(0,dn.removeEmpty)({searchId:i,profileId:a,query:s.query,hotelId:s.hotelId,placeId:s.hotelId?void 0:s.placeId,boundingBox:null===(t=s.boundingBox)||void 0===t?void 0:t.join(","),currency:u.currency,language:u.language,variations:null===(r=u.variations)||void 0===r?void 0:r.join(","),attributes:null==c?void 0:c.join(","),anonymousId:u.anonymousId,cugDeals:null===(o=s.cugDeals)||void 0===o?void 0:o.join(","),tier:s.tier,sapiOverride:(0,Ue.getSapiOverrideParameter)(!0),userId:s.userId,emailDomain:s.emailDomain,screenshots:s.screenshots});return new n.default(l).toString()}function c(e,t){var n=e.baseUrl,o=e.endpoints;return xe.__awaiter(this,void 0,void 0,(function(){var e,a,i,s,c;return xe.__generator(this,(function(l){switch(l.label){case 0:return e=u(t),[4,(0,r.default)("https://".concat(n,"/").concat(o.anchor,"?").concat(e))];case 1:return(a=l.sent()).ok?[4,a.json()]:[3,3];case 2:return[2,l.sent()];case 3:return i=t.searchParameters,s=t.options,c=t.attributes,s.logger.log({name:"AnchorSearchFailed",value:xe.__assign(xe.__assign({},i),{attributes:c,language:s.language,currency:s.currency,deviceType:s.deviceType})}),[4,(0,hn.createBackendError)(a,"Anchor request failed")];case 4:throw l.sent()}}))}))}t.prepareSearchParameters=a,t.createSearchRequestString=i,t.createAnchorRequestString=u,t.search=function(e){var t,r=this,n=e.getFeatureEnabled,i=e.profileKey,u=e.appConfig,l=e.offersClient,f=e.options,d=n("offers"),h=!1;return function(e,n){return void 0===n&&(n={}),xe.__awaiter(r,void 0,void 0,(function(){function r(){var e=p.current().searchParameters;if(!(0,dn.hasRequiredSearchParameters)(e))throw new Error("Dates must be set by client, SDK or response");return e}var p,v,g,m,y,b,_,w,O,P,S,T,D,I=this;return xe.__generator(this,(function(k){switch(k.label){case 0:return p=(0,dn.createState)({}),v=n.onStart,g=n.onAnchorReceived,m=n.onHotelsReceived,y=n.onOffersReceived,b=n.onComplete,_=0,w=a(e,u.client,f),O=(0,dn.generateSearchId)(),p.update((function(e){e.searchParameters=w,e.searchId=O})),"function"==typeof v&&v(p.current()),P=function(e,n,a){return void 0===e&&(e=0),xe.__awaiter(I,void 0,void 0,(function(){var a,c,v,_,P,S,T;return xe.__generator(this,(function(D){switch(D.label){case 0:return[4,s(u.sapiBackend,{profileKey:i,searchParameters:w,options:f,offset:e,attributes:n,searchId:O})];case 1:return a=D.sent(),h||(t=a.exchangeRates[f.currency],(null===(S=f.callbacks)||void 0===S?void 0:S.onConfigReceived)&&f.callbacks.onConfigReceived({lov:a.lov,exchangeRates:a.exchangeRates}),h=!0),(void 0===n||n.includes("anchor"))&&(p.update((function(e){e.anchor=a.anchor,e.anchorHotelId=a.anchorHotelId,e.anchorType=a.anchorType,e.hotelEntities=a.hotelEntities,e.searchParameters=xe.__assign(xe.__assign({},e.searchParameters),{checkIn:a.searchParameters.checkIn,checkOut:a.searchParameters.checkOut})})),"function"==typeof g&&g(p.current())),p.update((function(e){e.facets=a.facets,e.hotelEntities=a.hotelEntities,e.hotelIds=a.hotelIds,e.hotelsHaveStaticPosition=a.hotelsHaveStaticPosition,e.offset=a.offset,e.resultsCount=a.resultsCount,e.resultsCountTotal=a.resultsCountTotal})),"function"==typeof m&&m(p.current()),d&&void 0!==l?(c=p.get("hotelIds"),v=xe.__assign(xe.__assign({},r()),{searchId:O,hotelIds:c,anchorHotelId:p.get("anchorHotelId")}),[4,l.getOffers(v,(function(e){var r,n=(0,dn.buildOffersResponse)(e,{checkIn:v.checkIn,checkOut:v.checkOut,sortField:v.sortField,sortOrder:v.sortOrder,filters:v.filters,priceBucketWidth:null===(r=p.get("anchor"))||void 0===r?void 0:r.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate});p.update((function(e){n.hotelIds.length>0&&(e.hotelIds=n.hotelIds),e.hotelOfferEntities=xe.__assign(xe.__assign({},e.hotelOfferEntities),n.hotelOfferEntities)})),"function"==typeof y&&y(p.current())}))]):[3,3];case 2:_=D.sent(),P=(0,dn.buildOffersResponse)(_,{checkIn:v.checkIn,checkOut:v.checkOut,sortField:v.sortField,sortOrder:v.sortOrder,filters:v.filters,priceBucketWidth:null===(T=p.get("anchor"))||void 0===T?void 0:T.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate}),p.update((function(e){e.hotelIds=P.hotelIds,e.hotelOfferEntities=P.hotelOfferEntities})),p.update((function(e){if(!(0,dn.hasRequiredSearchParameters)(e.searchParameters))throw new Error("Dates must be set by client, SDK or response");e.dealScores=(0,dn.getDealScores)(xe.__assign(xe.__assign({},e),{searchParameters:e.searchParameters}))})),D.label=3;case 3:return"function"==typeof b&&b(p.current()),[2,p.current()]}}))}))},S=function(e,n,a){return void 0===e&&(e=0),void 0===a&&(a=!0),xe.__awaiter(I,void 0,void 0,(function(){var v,_,P=this;return xe.__generator(this,(function(S){switch(S.label){case 0:return v=function(){return xe.__awaiter(P,void 0,void 0,(function(){var e,n,a,s;return xe.__generator(this,(function(v){switch(v.label){case 0:return e=["anchor","anchorHotelId","anchorType","hotelEntities","searchParameters"],h||e.push("lov","exchangeRates"),[4,c(u.sapiBackend,{searchId:O,profileKey:i,searchParameters:w,options:f,attributes:e})];case 1:return n=v.sent(),h||(t=n.exchangeRates[f.currency],(null===(s=f.callbacks)||void 0===s?void 0:s.onConfigReceived)&&f.callbacks.onConfigReceived({lov:n.lov,exchangeRates:n.exchangeRates}),h=!0),p.update((function(e){e.anchor=n.anchor,e.anchorHotelId=n.anchorHotelId,e.anchorType=n.anchorType,e.hotelEntities=xe.__assign(xe.__assign({},e.hotelEntities),n.hotelEntities),e.searchParameters=xe.__assign(xe.__assign({},e.searchParameters),{checkIn:n.searchParameters.checkIn,checkOut:n.searchParameters.checkOut})})),"function"==typeof g&&g(p.current()),d&&void 0!==l&&"hotel"===n.anchorType?(a=xe.__assign(xe.__assign({},r()),{anchorHotelId:n.anchorHotelId,searchId:O}),[4,l.getOffers(a,(function(e){var r,n=(0,dn.buildOffersResponse)(e,{checkIn:a.checkIn,checkOut:a.checkOut,sortField:a.sortField,sortOrder:a.sortOrder,filters:a.filters,priceBucketWidth:null===(r=p.get("anchor"))||void 0===r?void 0:r.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate});p.update((function(e){e.hotelOfferEntities=xe.__assign(xe.__assign({},e.hotelOfferEntities),n.hotelOfferEntities)})),"function"==typeof y&&y(p.current())}))]):[3,3];case 2:v.sent(),v.label=3;case 3:return[2,p.current()]}}))}))},_=function(){return xe.__awaiter(P,void 0,void 0,(function(){var n,c,h,v,g;return xe.__generator(this,(function(b){switch(b.label){case 0:return[4,s(u.sapiBackend,{searchId:O,profileKey:i,searchParameters:w,options:f,offset:e,attributes:["facets","hotelEntities","hotelIds","hotelsHaveStaticPosition","offset","resultsCount","resultsCountTotal","searchParameters"]})];case 1:return n=b.sent(),p.update((function(e){e.facets=n.facets,e.hotelEntities=a?xe.__assign(xe.__assign({},e.hotelEntities),n.hotelEntities):n.hotelEntities,e.hotelIds=n.hotelIds,e.hotelsHaveStaticPosition=n.hotelsHaveStaticPosition,e.offset=n.offset,e.resultsCount=n.resultsCount,e.resultsCountTotal=n.resultsCountTotal,e.searchParameters=xe.__assign(xe.__assign({},e.searchParameters),{checkIn:n.searchParameters.checkIn,checkOut:n.searchParameters.checkOut})})),"function"==typeof m&&m(p.current()),d&&void 0!==l?(c=xe.__assign(xe.__assign({},r()),{searchId:O,hotelIds:p.get("hotelIds")}),[4,l.getOffers(c,(function(e){var r,n=(0,dn.buildOffersResponse)(e,{checkIn:c.checkIn,checkOut:c.checkOut,sortField:c.sortField,sortOrder:c.sortOrder,filters:c.filters,priceBucketWidth:null===(r=p.get("anchor"))||void 0===r?void 0:r.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate});p.update((function(e){n.hotelIds.length>0&&(e.hotelIds=n.hotelIds),e.hotelOfferEntities=xe.__assign(xe.__assign({},e.hotelOfferEntities),n.hotelOfferEntities)})),"function"==typeof y&&y(p.current())}))]):[3,3];case 2:h=b.sent(),v=(0,dn.buildOffersResponse)(h,{checkIn:c.checkIn,checkOut:c.checkOut,sortField:c.sortField,sortOrder:c.sortOrder,filters:c.filters,priceBucketWidth:null===(g=p.get("anchor"))||void 0===g?void 0:g.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate}),p.update((function(e){e.hotelIds=v.hotelIds,e.hotelOfferEntities=a?xe.__assign(xe.__assign({},e.hotelOfferEntities),v.hotelOfferEntities):v.hotelOfferEntities})),p.update((function(e){if(!(0,dn.hasRequiredSearchParameters)(e.searchParameters))throw new Error("Dates must be set by client, SDK or response");e.dealScores=(0,dn.getDealScores)(xe.__assign(xe.__assign({},e),{searchParameters:e.searchParameters}))})),b.label=3;case 3:return[2,p.current()]}}))}))},[4,void 0===n||n.includes("anchor")?Promise.all([v(),_()]):_()];case 1:return S.sent(),"function"==typeof b&&b(p.current()),[2,p.current()]}}))}))},T=(null===(D=f.variations)||void 0===D?void 0:D.includes("sapi4eva-magic-sort-b"))?S:P,[4,h?T(w.offset,["anchor","anchorHotelId","anchorType","facets","resultsCount","resultsCountTotal","offset","hotelIds","hotelEntities","hotelsHaveStaticPosition","searchParameters"]):T(w.offset)];case 1:return k.sent(),[2,{loadOffers:function(e){var n,a;return xe.__awaiter(this,void 0,void 0,(function(){var i,s,u,c;return xe.__generator(this,(function(h){switch(h.label){case 0:if(!e)throw new Error("Hotel id must be provided");if(!d||!l)throw new Error("Offers loading is disabled");return i=e===p.get("anchorHotelId"),s=xe.__assign(xe.__assign({},r()),{searchId:O,getAllOffers:!0,hotelIds:i?void 0:[e],anchorHotelId:i?e:void 0}),[4,l.getOffers(s)];case 1:return u=h.sent(),c=(0,dn.buildOffersResponse)(u,{checkIn:s.checkIn,checkOut:s.checkOut,sortField:s.sortField,sortOrder:s.sortOrder,filters:s.filters,priceBucketWidth:null===(n=p.get("anchor"))||void 0===n?void 0:n.priceBucketWidth,priceBucketsCount:o,exchangeRate:t,getTotalRate:f.getTotalRate}),[2,null===(a=c.hotelOfferEntities)||void 0===a?void 0:a[e]]}}))}))},loadMore:function(){return xe.__awaiter(this,void 0,void 0,(function(){return xe.__generator(this,(function(e){return _+=p.get("resultsCount"),[2,T(_,["offset","facets","resultsCount","resultsCountTotal","hotelIds","hotelEntities","hotelsHaveStaticPosition"],!1)]}))}))}}]}}))}))}}})),gn=t((function(e,t){e.exports=function(){function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}function n(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function i(e){var t,r="algoliasearch-client-js-".concat(e.key),n=function(){return void 0===t&&(t=e.localStorage||window.localStorage),t},a=function(){return JSON.parse(n().getItem(r)||"{}")};return{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){var r=JSON.stringify(e),n=a()[r];return Promise.all([n||t(),void 0!==n])})).then((function(e){var t=o(e,2),n=t[0],a=t[1];return Promise.all([n,a||r.miss(n)])})).then((function(e){return o(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var o=a();return o[JSON.stringify(e)]=t,n().setItem(r,JSON.stringify(o)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=a();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function s(e){var t=a(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return t().then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return o(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,o).catch((function(){return s({caches:t}).get(e,n,o)}))},set:function(e,n){return r.set(e,n).catch((function(){return s({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return s({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return s({caches:t}).clear()}))}}}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(r);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var i=n(),s=o&&o.miss||function(){return Promise.resolve()};return i.then((function(e){return s(e)})).then((function(){return i}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function c(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===v.WithinHeaders?n:{}},queryParameters:function(){return e===v.WithinQueryParameters?n:{}}}}function l(e){var t=0;return e((function r(){return t++,new Promise((function(n){setTimeout((function(){n(e(r))}),Math.min(100*t,1e3))}))}))}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e,t){return Promise.resolve()};return Object.assign(e,{wait:function(r){return f(e.then((function(e){return Promise.all([t(e,r),e])})).then((function(e){return e[1]})))}})}function d(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function h(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function p(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=0;return e.replace(/%s/g,(function(){return encodeURIComponent(r[o++])}))}var v={WithinQueryParameters:0,WithinHeaders:1};function g(e,t){var r=e||{},n=r.data||{};return Object.keys(r).forEach((function(e){-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(n[e]=r[e])})),{data:Object.entries(n).length>0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var m={Read:1,Write:2,Any:3},y=1,b=2,_=3;function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function O(e){return"string"==typeof e?{protocol:"https",url:e,accept:m.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||m.Any}}var P="DELETE",S="GET",T="POST",D="PUT";function I(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(w(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===y||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===_&&Date.now()-e.lastUpdate<=12e4}(e)})),o=[].concat(a(r),a(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:o.length>0?o.map((function(e){return O(e)})):t}}))}function k(e,t,n,o){var i=[],s=function(e,t){if(e.method!==S&&(void 0!==e.data||void 0!==t.data)){var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}}(n,o),u=function(e,t){var n=r(r({},e.headers),t.headers),o={};return Object.keys(n).forEach((function(e){var t=n[e];o[e.toLowerCase()]=t})),o}(e,o),c=n.method,l=n.method!==S?{}:r(r({},n.data),o.data),f=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),l),o.queryParameters),d=0,h=function t(r,a){var l=r.pop();if(void 0===l)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:R(i)};var h={data:s,headers:u,method:c,url:x(l,n.path,f),connectTimeout:a(d,e.timeouts.connect),responseTimeout:a(d,o.timeout)},p=function(e){var t={request:h,response:e,host:l,triesLeft:r.length};return i.push(t),t},v={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var o=p(n);return n.isTimedOut&&d++,Promise.all([e.logger.info("Retryable failure",N(o)),e.hostsCache.set(l,w(l,n.isTimedOut?_:b))]).then((function(){return t(r,a)}))},onFail:function(e){throw p(e),function(e,t){var r=e.content,n=e.status,o=r;try{o=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(o,n,t)}(e,R(i))}};return e.requester.send(h).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&0==~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,v)}))};return I(e.hostsCache,t).then((function(e){return h(a(e.statelessHosts).reverse(),e.getTimeout)}))}function j(e){var t=e.hostsCache,r=e.logger,n=e.requester,a=e.requestsCache,i=e.responsesCache,s=e.timeouts,u=e.userAgent,c=e.hosts,l=e.queryParameters,f={hostsCache:t,logger:r,requester:n,requestsCache:a,responsesCache:i,timeouts:s,userAgent:u,headers:e.headers,queryParameters:l,hosts:c.map((function(e){return O(e)})),read:function(e,t){var r=g(t,f.timeouts.read),n=function(){return k(f,f.hosts.filter((function(e){return 0!=(e.accept&m.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var a={request:e,mappedRequestOptions:r,transporter:{queryParameters:f.queryParameters,headers:f.headers}};return f.responsesCache.get(a,(function(){return f.requestsCache.get(a,(function(){return f.requestsCache.set(a,n()).then((function(e){return Promise.all([f.requestsCache.delete(a),e])}),(function(e){return Promise.all([f.requestsCache.delete(a),Promise.reject(e)])})).then((function(e){var t=o(e,2);return t[0],t[1]}))}))}),{miss:function(e){return f.responsesCache.set(a,e)}})},write:function(e,t){return k(f,f.hosts.filter((function(e){return 0!=(e.accept&m.Write)})),e,g(t,f.timeouts.write))}};return f}function E(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function x(e,t,r){var n=C(r),o="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(o+="?".concat(n)),o}function C(e){return Object.keys(e).map((function(t){return p("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function R(e){return e.map((function(e){return N(e)}))}function N(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var M=function(e){return function(t,r){return e.transporter.write({method:T,path:"2/abtests",data:t},r)}},A=function(e){return function(t,r){return e.transporter.write({method:P,path:p("2/abtests/%s",t)},r)}},U=function(e){return function(t,r){return e.transporter.read({method:S,path:p("2/abtests/%s",t)},r)}},q=function(e){return function(t){return e.transporter.read({method:S,path:"2/abtests"},t)}},F=function(e){return function(t,r){return e.transporter.write({method:T,path:p("2/abtests/%s/stop",t)},r)}},H=function(e){return function(t){return e.transporter.read({method:S,path:"1/strategies/personalization"},t)}},W=function(e){return function(t,r){return e.transporter.write({method:T,path:"1/strategies/personalization",data:t},r)}};function B(e){return function t(r){return e.request(r).then((function(n){if(void 0!==e.batch&&e.batch(n.hits),!e.shouldStop(n))return n.cursor?t({cursor:n.cursor}):t({page:(r.page||0)+1})}))}({})}var L=function(e){return function(t,o){var a=o||{},i=a.queryParameters,s=n(a,["queryParameters"]),u=r({acl:t},void 0!==i?{queryParameters:i}:{});return f(e.transporter.write({method:T,path:"1/keys",data:u},s),(function(t,r){return l((function(n){return ee(e)(t.key,r).catch((function(e){if(404!==e.status)throw e;return n()}))}))}))}},z=function(e){return function(t,r,n){var o=g(n);return o.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:T,path:"1/clusters/mapping",data:{cluster:r}},o)}},Y=function(e){return function(t,r,n){return e.transporter.write({method:T,path:"1/clusters/mapping/batch",data:{users:t,cluster:r}},n)}},G=function(e){return function(t,r){return f(e.transporter.write({method:T,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},r),(function(t,r){return Te(e)(t.taskID,r)}))}},K=function(e){return function(t,r,n){return f(e.transporter.write({method:T,path:p("1/indexes/%s/operation",t),data:{operation:"copy",destination:r}},n),(function(r,n){return se(e)(t,{methods:{waitTask:ft}}).waitTask(r.taskID,n)}))}},J=function(e){return function(t,n,o){return K(e)(t,n,r(r({},o),{},{scope:[ht.Rules]}))}},Q=function(e){return function(t,n,o){return K(e)(t,n,r(r({},o),{},{scope:[ht.Settings]}))}},V=function(e){return function(t,n,o){return K(e)(t,n,r(r({},o),{},{scope:[ht.Synonyms]}))}},X=function(e){return function(t,r){return t.method===S?e.transporter.read(t,r):e.transporter.write(t,r)}},$=function(e){return function(t,r){return f(e.transporter.write({method:P,path:p("1/keys/%s",t)},r),(function(r,n){return l((function(r){return ee(e)(t,n).then(r).catch((function(e){if(404!==e.status)throw e}))}))}))}},Z=function(e){return function(t,r,n){var o=r.map((function(e){return{action:"deleteEntry",body:{objectID:e}}}));return f(e.transporter.write({method:T,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!1,requests:o}},n),(function(t,r){return Te(e)(t.taskID,r)}))}},ee=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/keys/%s",t)},r)}},te=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/task/%s",t.toString())},r)}},re=function(e){return function(t){return e.transporter.read({method:S,path:"/1/dictionaries/*/settings"},t)}},ne=function(e){return function(t){return e.transporter.read({method:S,path:"1/logs"},t)}},oe=function(e){return function(t){return e.transporter.read({method:S,path:"1/clusters/mapping/top"},t)}},ae=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/clusters/mapping/%s",t)},r)}},ie=function(e){return function(t){var r=t||{},o=r.retrieveMappings,a=n(r,["retrieveMappings"]);return!0===o&&(a.getClusters=!0),e.transporter.read({method:S,path:"1/clusters/mapping/pending"},a)}},se=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return h({transporter:e.transporter,appId:e.appId,indexName:t},r.methods)}},ue=function(e){return function(t){return e.transporter.read({method:S,path:"1/keys"},t)}},ce=function(e){return function(t){return e.transporter.read({method:S,path:"1/clusters"},t)}},le=function(e){return function(t){return e.transporter.read({method:S,path:"1/indexes"},t)}},fe=function(e){return function(t){return e.transporter.read({method:S,path:"1/clusters/mapping"},t)}},de=function(e){return function(t,r,n){return f(e.transporter.write({method:T,path:p("1/indexes/%s/operation",t),data:{operation:"move",destination:r}},n),(function(r,n){return se(e)(t,{methods:{waitTask:ft}}).waitTask(r.taskID,n)}))}},he=function(e){return function(t,r){return f(e.transporter.write({method:T,path:"1/indexes/*/batch",data:{requests:t}},r),(function(t,r){return Promise.all(Object.keys(t.taskID).map((function(n){return se(e)(n,{methods:{waitTask:ft}}).waitTask(t.taskID[n],r)})))}))}},pe=function(e){return function(t,r){return e.transporter.read({method:T,path:"1/indexes/*/objects",data:{requests:t}},r)}},ve=function(e){return function(t,n){var o=t.map((function(e){return r(r({},e),{},{params:C(e.params||{})})}));return e.transporter.read({method:T,path:"1/indexes/*/queries",data:{requests:o},cacheable:!0},n)}},ge=function(e){return function(t,o){return Promise.all(t.map((function(t){var a=t.params,i=a.facetName,s=a.facetQuery,u=n(a,["facetName","facetQuery"]);return se(e)(t.indexName,{methods:{searchForFacetValues:st}}).searchForFacetValues(i,s,r(r({},o),u))})))}},me=function(e){return function(t,r){var n=g(r);return n.queryParameters["X-Algolia-User-ID"]=t,e.transporter.write({method:P,path:"1/clusters/mapping"},n)}},ye=function(e){return function(t,r,n){var o=r.map((function(e){return{action:"addEntry",body:e}}));return f(e.transporter.write({method:T,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!0,requests:o}},n),(function(t,r){return Te(e)(t.taskID,r)}))}},be=function(e){return function(t,r){return f(e.transporter.write({method:T,path:p("1/keys/%s/restore",t)},r),(function(r,n){return l((function(r){return ee(e)(t,n).catch((function(e){if(404!==e.status)throw e;return r()}))}))}))}},_e=function(e){return function(t,r,n){var o=r.map((function(e){return{action:"addEntry",body:e}}));return f(e.transporter.write({method:T,path:p("/1/dictionaries/%s/batch",t),data:{clearExistingDictionaryEntries:!1,requests:o}},n),(function(t,r){return Te(e)(t.taskID,r)}))}},we=function(e){return function(t,r,n){return e.transporter.read({method:T,path:p("/1/dictionaries/%s/search",t),data:{query:r},cacheable:!0},n)}},Oe=function(e){return function(t,r){return e.transporter.read({method:T,path:"1/clusters/mapping/search",data:{query:t}},r)}},Pe=function(e){return function(t,r){return f(e.transporter.write({method:D,path:"/1/dictionaries/*/settings",data:t},r),(function(t,r){return Te(e)(t.taskID,r)}))}},Se=function(e){return function(t,r){var o=Object.assign({},r),a=r||{},i=a.queryParameters,s=n(a,["queryParameters"]),u=i?{queryParameters:i}:{},c=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"];return f(e.transporter.write({method:D,path:p("1/keys/%s",t),data:u},s),(function(r,n){return l((function(r){return ee(e)(t,n).then((function(e){return function(e){return Object.keys(o).filter((function(e){return-1!==c.indexOf(e)})).every((function(t){return e[t]===o[t]}))}(e)?Promise.resolve():r()}))}))}))}},Te=function(e){return function(t,r){return l((function(n){return te(e)(t,r).then((function(e){return"published"!==e.status?n():void 0}))}))}},De=function(e){return function(t,r){return f(e.transporter.write({method:T,path:p("1/indexes/%s/batch",e.indexName),data:{requests:t}},r),(function(t,r){return ft(e)(t.taskID,r)}))}},Ie=function(e){return function(t){return B(r(r({shouldStop:function(e){return void 0===e.cursor}},t),{},{request:function(r){return e.transporter.read({method:T,path:p("1/indexes/%s/browse",e.indexName),data:r},t)}}))}},ke=function(e){return function(t){var n=r({hitsPerPage:1e3},t);return B(r(r({shouldStop:function(e){return e.hits.length<n.hitsPerPage}},n),{},{request:function(t){return ut(e)("",r(r({},n),t)).then((function(e){return r(r({},e),{},{hits:e.hits.map((function(e){return delete e._highlightResult,e}))})}))}}))}},je=function(e){return function(t){var n=r({hitsPerPage:1e3},t);return B(r(r({shouldStop:function(e){return e.hits.length<n.hitsPerPage}},n),{},{request:function(t){return ct(e)("",r(r({},n),t)).then((function(e){return r(r({},e),{},{hits:e.hits.map((function(e){return delete e._highlightResult,e}))})}))}}))}},Ee=function(e){return function(t,r,o){var a=o||{},i=a.batchSize,s=n(a,["batchSize"]),u={taskIDs:[],objectIDs:[]};return f(function n(){var o,a=[];for(o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;o<t.length&&(a.push(t[o]),a.length!==(i||1e3));o++);return 0===a.length?Promise.resolve(u):De(e)(a.map((function(e){return{action:r,body:e}})),s).then((function(e){return u.objectIDs=u.objectIDs.concat(e.objectIDs),u.taskIDs.push(e.taskID),o++,n(o)}))}(),(function(t,r){return Promise.all(t.taskIDs.map((function(t){return ft(e)(t,r)})))}))}},xe=function(e){return function(t){return f(e.transporter.write({method:T,path:p("1/indexes/%s/clear",e.indexName)},t),(function(t,r){return ft(e)(t.taskID,r)}))}},Ce=function(e){return function(t){var r=t||{},o=r.forwardToReplicas,a=g(n(r,["forwardToReplicas"]));return o&&(a.queryParameters.forwardToReplicas=1),f(e.transporter.write({method:T,path:p("1/indexes/%s/rules/clear",e.indexName)},a),(function(t,r){return ft(e)(t.taskID,r)}))}},Re=function(e){return function(t){var r=t||{},o=r.forwardToReplicas,a=g(n(r,["forwardToReplicas"]));return o&&(a.queryParameters.forwardToReplicas=1),f(e.transporter.write({method:T,path:p("1/indexes/%s/synonyms/clear",e.indexName)},a),(function(t,r){return ft(e)(t.taskID,r)}))}},Ne=function(e){return function(t,r){return f(e.transporter.write({method:T,path:p("1/indexes/%s/deleteByQuery",e.indexName),data:t},r),(function(t,r){return ft(e)(t.taskID,r)}))}},Me=function(e){return function(t){return f(e.transporter.write({method:P,path:p("1/indexes/%s",e.indexName)},t),(function(t,r){return ft(e)(t.taskID,r)}))}},Ae=function(e){return function(t,r){return f(Ue(e)([t],r).then((function(e){return{taskID:e.taskIDs[0]}})),(function(t,r){return ft(e)(t.taskID,r)}))}},Ue=function(e){return function(t,r){var n=t.map((function(e){return{objectID:e}}));return Ee(e)(n,dt.DeleteObject,r)}},qe=function(e){return function(t,r){var o=r||{},a=o.forwardToReplicas,i=g(n(o,["forwardToReplicas"]));return a&&(i.queryParameters.forwardToReplicas=1),f(e.transporter.write({method:P,path:p("1/indexes/%s/rules/%s",e.indexName,t)},i),(function(t,r){return ft(e)(t.taskID,r)}))}},Fe=function(e){return function(t,r){var o=r||{},a=o.forwardToReplicas,i=g(n(o,["forwardToReplicas"]));return a&&(i.queryParameters.forwardToReplicas=1),f(e.transporter.write({method:P,path:p("1/indexes/%s/synonyms/%s",e.indexName,t)},i),(function(t,r){return ft(e)(t.taskID,r)}))}},He=function(e){return function(t){return Ke(e)(t).then((function(){return!0})).catch((function(e){if(404!==e.status)throw e;return!1}))}},We=function(e){return function(t,r,n){return e.transporter.read({method:T,path:p("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},Be=function(e){return function(t,a){var i=a||{},s=i.query,u=i.paginate,c=n(i,["query","paginate"]),l=0;return function n(){return it(e)(s||"",r(r({},c),{},{page:l})).then((function(e){for(var r=0,a=Object.entries(e.hits);r<a.length;r++){var i=o(a[r],2),s=i[0],c=i[1];if(t(c))return{object:c,position:parseInt(s,10),page:l}}if(l++,!1===u||l>=e.nbPages)throw{name:"ObjectNotFoundError",message:"Object not found."};return n()}))}()}},Le=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/indexes/%s/%s",e.indexName,t)},r)}},ze=function(){return function(e,t){for(var r=0,n=Object.entries(e.hits);r<n.length;r++){var a=o(n[r],2),i=a[0];if(a[1].objectID===t)return parseInt(i,10)}return-1}},Ye=function(e){return function(t,o){var a=o||{},i=a.attributesToRetrieve,s=n(a,["attributesToRetrieve"]),u=t.map((function(t){return r({indexName:e.indexName,objectID:t},i?{attributesToRetrieve:i}:{})}));return e.transporter.read({method:T,path:"1/indexes/*/objects",data:{requests:u}},s)}},Ge=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/indexes/%s/rules/%s",e.indexName,t)},r)}},Ke=function(e){return function(t){return e.transporter.read({method:S,path:p("1/indexes/%s/settings",e.indexName),data:{getVersion:2}},t)}},Je=function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/indexes/%s/synonyms/%s",e.indexName,t)},r)}},Qe=function(e){return function(t,r){return f(Ve(e)([t],r).then((function(e){return{objectID:e.objectIDs[0],taskID:e.taskIDs[0]}})),(function(t,r){return ft(e)(t.taskID,r)}))}},Ve=function(e){return function(t,r){var o=r||{},a=o.createIfNotExists,i=n(o,["createIfNotExists"]),s=a?dt.PartialUpdateObject:dt.PartialUpdateObjectNoCreate;return Ee(e)(t,s,i)}},Xe=function(e){return function(t,i){var s=i||{},u=s.safe,c=s.autoGenerateObjectIDIfNotExist,l=s.batchSize,d=n(s,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),h=function(t,r,n,o){return f(e.transporter.write({method:T,path:p("1/indexes/%s/operation",t),data:{operation:n,destination:r}},o),(function(t,r){return ft(e)(t.taskID,r)}))},v=Math.random().toString(36).substring(7),g="".concat(e.indexName,"_tmp_").concat(v),m=tt({appId:e.appId,transporter:e.transporter,indexName:g}),y=[],b=h(e.indexName,g,"copy",r(r({},d),{},{scope:["settings","synonyms","rules"]}));return y.push(b),f((u?b.wait(d):b).then((function(){var e=m(t,r(r({},d),{},{autoGenerateObjectIDIfNotExist:c,batchSize:l}));return y.push(e),u?e.wait(d):e})).then((function(){var t=h(g,e.indexName,"move",d);return y.push(t),u?t.wait(d):t})).then((function(){return Promise.all(y)})).then((function(e){var t=o(e,3),r=t[0],n=t[1],i=t[2];return{objectIDs:n.objectIDs,taskIDs:[r.taskID].concat(a(n.taskIDs),[i.taskID])}})),(function(e,t){return Promise.all(y.map((function(e){return e.wait(t)})))}))}},$e=function(e){return function(t,n){return nt(e)(t,r(r({},n),{},{clearExistingRules:!0}))}},Ze=function(e){return function(t,n){return at(e)(t,r(r({},n),{},{clearExistingSynonyms:!0}))}},et=function(e){return function(t,r){return f(tt(e)([t],r).then((function(e){return{objectID:e.objectIDs[0],taskID:e.taskIDs[0]}})),(function(t,r){return ft(e)(t.taskID,r)}))}},tt=function(e){return function(t,r){var o=r||{},a=o.autoGenerateObjectIDIfNotExist,i=n(o,["autoGenerateObjectIDIfNotExist"]),s=a?dt.AddObject:dt.UpdateObject;if(s===dt.UpdateObject){var u=!0,c=!1,l=void 0;try{for(var d,h=t[Symbol.iterator]();!(u=(d=h.next()).done);u=!0)if(void 0===d.value.objectID)return f(Promise.reject({name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}))}catch(e){c=!0,l=e}finally{try{u||null==h.return||h.return()}finally{if(c)throw l}}}return Ee(e)(t,s,i)}},rt=function(e){return function(t,r){return nt(e)([t],r)}},nt=function(e){return function(t,r){var o=r||{},a=o.forwardToReplicas,i=o.clearExistingRules,s=g(n(o,["forwardToReplicas","clearExistingRules"]));return a&&(s.queryParameters.forwardToReplicas=1),i&&(s.queryParameters.clearExistingRules=1),f(e.transporter.write({method:T,path:p("1/indexes/%s/rules/batch",e.indexName),data:t},s),(function(t,r){return ft(e)(t.taskID,r)}))}},ot=function(e){return function(t,r){return at(e)([t],r)}},at=function(e){return function(t,r){var o=r||{},a=o.forwardToReplicas,i=o.clearExistingSynonyms,s=o.replaceExistingSynonyms,u=g(n(o,["forwardToReplicas","clearExistingSynonyms","replaceExistingSynonyms"]));return a&&(u.queryParameters.forwardToReplicas=1),(s||i)&&(u.queryParameters.replaceExistingSynonyms=1),f(e.transporter.write({method:T,path:p("1/indexes/%s/synonyms/batch",e.indexName),data:t},u),(function(t,r){return ft(e)(t.taskID,r)}))}},it=function(e){return function(t,r){return e.transporter.read({method:T,path:p("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},st=function(e){return function(t,r,n){return e.transporter.read({method:T,path:p("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},ut=function(e){return function(t,r){return e.transporter.read({method:T,path:p("1/indexes/%s/rules/search",e.indexName),data:{query:t}},r)}},ct=function(e){return function(t,r){return e.transporter.read({method:T,path:p("1/indexes/%s/synonyms/search",e.indexName),data:{query:t}},r)}},lt=function(e){return function(t,r){var o=r||{},a=o.forwardToReplicas,i=g(n(o,["forwardToReplicas"]));return a&&(i.queryParameters.forwardToReplicas=1),f(e.transporter.write({method:D,path:p("1/indexes/%s/settings",e.indexName),data:t},i),(function(t,r){return ft(e)(t.taskID,r)}))}},ft=function(e){return function(t,r){return l((function(n){return function(e){return function(t,r){return e.transporter.read({method:S,path:p("1/indexes/%s/task/%s",e.indexName,t.toString())},r)}}(e)(t,r).then((function(e){return"published"!==e.status?n():void 0}))}))}},dt={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},ht={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},pt=1,vt=2,gt=3;function mt(e,t,n){var o,a={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,o=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},a=o(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=o(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(o=gt,{debug:function(e,t){return pt>=o&&console.debug(e,t),Promise.resolve()},info:function(e,t){return vt>=o&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:s({caches:[i({key:"".concat("4.14.0","-").concat(e)}),u()]}),userAgent:E("4.14.0").add({segment:"Browser"})},l=r(r({},a),n),f=function(){return function(e){return function(e){var t=e.region||"us",n=c(v.WithinHeaders,e.appId,e.apiKey),o=j(r(r({hosts:[{url:"personalization.".concat(t,".algolia.com")}]},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/json"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({appId:e.appId,transporter:o},e.methods)}(r(r(r({},a),e),{},{methods:{getPersonalizationStrategy:H,setPersonalizationStrategy:W}}))}};return function(e){var t=e.appId,n=c(void 0!==e.authMode?e.authMode:v.WithinHeaders,t,e.apiKey),o=j(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:m.Read},{url:"".concat(t,".algolia.net"),accept:m.Write}].concat(d([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({transporter:o,appId:t,addAlgoliaAgent:function(e,t){o.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then((function(){}))}},e.methods)}(r(r({},l),{},{methods:{search:ve,searchForFacetValues:ge,multipleBatch:he,multipleGetObjects:pe,multipleQueries:ve,copyIndex:K,copySettings:Q,copySynonyms:V,copyRules:J,moveIndex:de,listIndices:le,getLogs:ne,listClusters:ce,multipleSearchForFacetValues:ge,getApiKey:ee,addApiKey:L,listApiKeys:ue,updateApiKey:Se,deleteApiKey:$,restoreApiKey:be,assignUserID:z,assignUserIDs:Y,getUserID:ae,searchUserIDs:Oe,listUserIDs:fe,getTopUserIDs:oe,removeUserID:me,hasPendingMappings:ie,clearDictionaryEntries:G,deleteDictionaryEntries:Z,getDictionarySettings:re,getAppTask:te,replaceDictionaryEntries:ye,saveDictionaryEntries:_e,searchDictionaryEntries:we,setDictionarySettings:Pe,waitAppTask:Te,customRequest:X,initIndex:function(e){return function(t){return se(e)(t,{methods:{batch:De,delete:Me,findAnswers:We,getObject:Le,getObjects:Ye,saveObject:et,saveObjects:tt,search:it,searchForFacetValues:st,waitTask:ft,setSettings:lt,getSettings:Ke,partialUpdateObject:Qe,partialUpdateObjects:Ve,deleteObject:Ae,deleteObjects:Ue,deleteBy:Ne,clearObjects:xe,browseObjects:Ie,getObjectPosition:ze,findObject:Be,exists:He,saveSynonym:ot,saveSynonyms:at,getSynonym:Je,searchSynonyms:ct,browseSynonyms:je,deleteSynonym:Fe,clearSynonyms:Re,replaceAllObjects:Xe,replaceAllSynonyms:Ze,searchRules:ut,getRule:Ge,deleteRule:qe,saveRule:rt,saveRules:nt,replaceAllRules:$e,browseRules:ke,clearRules:Ce}})}},initAnalytics:function(){return function(e){return function(e){var t=e.region||"us",n=c(v.WithinHeaders,e.appId,e.apiKey),o=j(r(r({hosts:[{url:"analytics.".concat(t,".algolia.com")}]},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/json"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({appId:e.appId,transporter:o},e.methods)}(r(r(r({},a),e),{},{methods:{addABTest:M,getABTest:U,getABTests:q,stopABTest:F,deleteABTest:A}}))}},initPersonalization:f,initRecommendation:function(){return function(e){return l.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),f()(e)}}}}))}return mt.version="4.14.0",mt}()})),mn=gn,yn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.suggest=void 0;var r=xe.__importDefault(mn);function n(e){return(0,dn.getTranslatedAttributes)(e,["placeName","hotelName"])}function o(e){var t=(0,dn.getTranslatedAttributes)(e,["placeName","placeADN","placeDN","hotelName"]);return xe.__spreadArray(["objectType","objectID","placeType"],t,!0)}function a(e){var t="isDeleted != 1";if(null==e?void 0:e.length){var r=null==e?void 0:e.map((function(e){return'objectType: "'.concat(e,'"')})).join(" OR ");t="".concat(t," AND (").concat(r,")")}return t}function i(e,t,r){var i=this,s=e.search,u=t.autocompleteIndex,c=r.languages,l=r.suggestsTypes,f=r.suggestsCount,d=void 0===f?6:f;return function(e){return xe.__awaiter(i,void 0,void 0,(function(){var t,r,i;return xe.__generator(this,(function(f){switch(f.label){case 0:return t=[{indexName:u,params:{query:e,filters:a(l),hitsPerPage:d,attributesToRetrieve:o(c),attributesToHighlight:n(c)}}],[4,s(t)];case 1:return r=f.sent().results,[2,null===(i=r[0])||void 0===i?void 0:i.hits.map((function(e){return"hotel"===e.objectType?(0,dn.hitToHotelSuggest)(e,c):(0,dn.hitToPlaceSuggest)(e,c)}))]}}))}))}}t.suggest=function(e){var t=this,n=e.appConfig,o=e.options,a=(0,r.default)(n.algolia.appId,n.algolia.apiKey,o.algoliaClientOptions);return function(e,r,s){return xe.__awaiter(t,void 0,void 0,(function(){var t;return xe.__generator(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,i(a,n.algolia,{suggestsCount:r,suggestsTypes:s,languages:o.languages})(e)];case 1:return[2,u.sent()];case 2:throw t=u.sent(),(0,hn.createApiError)(null==t?void 0:t.message,null==t?void 0:t.status);case 3:return[2]}}))}))}}})),bn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.rooms=t.createRequestString=void 0;var r=xe.__importDefault(pn),n=xe.__importDefault(Ae);function o(e,t){var r,o=e.hotelId,a=e.checkIn,i=e.checkOut,s=e.rooms,u=e.providerCode,c=e.cugDeals,l=e.tier,f=e.clickedOfferId,d=e.clickedOfferBaseRate,h=e.clickedOfferTaxes,p=e.clickedOfferHotelFees,v=e.preHeat,g=e.trafficSource,m=e.userId,y=e.emailDomain,b=(0,dn.removeEmpty)({hotelId:o,checkIn:a,checkOut:i,rooms:s,providerCode:u,cugDeals:c,tier:l,clickedOfferId:f,clickedOfferBaseRate:d,clickedOfferHotelFees:p,clickedOfferTaxes:h,deviceType:t.deviceType,language:t.language,currency:t.currency,aid:t.anonymousId,variations:null===(r=t.variations)||void 0===r?void 0:r.join(","),sapiOverride:(0,Ue.getSapiOverrideParameter)(),preHeat:v,trafficSource:g,userId:m,emailDomain:y});return new n.default(b).toString()}t.createRequestString=o,t.rooms=function(e){var t=this,n=e.appConfig,a=e.options;return function(e){return xe.__awaiter(t,void 0,void 0,(function(){var t,i,s;return xe.__generator(this,(function(u){switch(u.label){case 0:return t=o(e,a),[4,(0,r.default)("https://".concat(n.saf.baseUrl,"/").concat(n.saf.endpoints.offersRooms,"?").concat(t))];case 1:return(i=u.sent()).ok?[4,i.json()]:[3,3];case 2:return s=u.sent(),[2,xe.__assign({hotelId:e.hotelId,anonymousId:a.anonymousId},s)];case 3:return[4,(0,hn.createBackendError)(i,"Failed to get rooms offers")];case 4:throw u.sent()}}))}))}}})),_n=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.hotel=t.createRequestString=t.safToSapiHotel=void 0;var r=xe.__importDefault(pn),n=xe.__importDefault(Ae);function o(e,t){var r=e.checkInInst,n=e.checkInSpInst,o=e.feesMnd,a=e.feesOpt,i=e.policies,s=e.hotelName,u=e.placeDN,c=e.address,l=e.placeADName,f=e.propertyType,d=e.facilities,h=e.sentiments,p=e.themes,v=xe.__assign(xe.__assign({},e),{checkInInst:r&&(0,dn.toString)(r,t),checkInSpInst:n&&(0,dn.toString)(n,t),feesMnd:o&&(0,dn.toString)(o,t),feesOpt:a&&(0,dn.toString)(a,t),hotelName:(0,dn.toString)(s,t),policies:i&&(0,dn.toString)(i,t),placeDisplayName:u&&(0,dn.translatedArrayToString)(u,t),displayAddress:c&&l&&(0,dn.mergeTranslatedAttributes)(c,l,t),facilities:null==d?void 0:d.map((function(e){return xe.__assign(xe.__assign({},e),{value:(0,dn.toString)(e.value,t)})})),sentiments:null==h?void 0:h.map((function(e){return xe.__assign(xe.__assign({},e),{value:(0,dn.toString)(e.value,t)})})),themes:null==p?void 0:p.map((function(e){return xe.__assign(xe.__assign({},e),{value:(0,dn.toString)(e.value,t)})})),propertyType:f&&xe.__assign(xe.__assign({},f),{value:(0,dn.toString)(f.value,t)})});return(0,dn.omit)(["placeDN","placeADName","address"],v)}function a(e,t){var r=(0,dn.removeEmpty)({id:e,language:t.join(","),attributes:["objectID","address","country","guestRating","isDeleted","starRating","_geoloc","placeADName","checkInSpInst","checkInMinAge","checkOutTime","checkInInst","checkInTime","checkInEnd","feesOpt","policies","phone","imageURIs","placeDN","reviewCount","chainID","parentChainID","lastBooked","feesMnd","reviewCountBkt","hotelName","sentiments","facilities","placeID","guestType","themes","propertyType","pricing","currency"].join(",")});return new n.default(r).toString()}t.safToSapiHotel=o,t.createRequestString=a,t.hotel=function(e){var t=this,n=e.appConfig,i=e.options;return function(e){return xe.__awaiter(t,void 0,void 0,(function(){var t,s;return xe.__generator(this,(function(u){switch(u.label){case 0:return t=a(e,i.languages),[4,(0,r.default)("https://".concat(n.saf.baseUrl,"/").concat(n.saf.endpoints.hotel,"?").concat(t))];case 1:return(s=u.sent()).ok?[4,s.json()]:[3,3];case 2:return[2,o(u.sent(),i.languages)];case 3:return[4,(0,hn.createBackendError)(s,"Failed to fetch hotel data")];case 4:throw u.sent()}}))}))}}})),wn=t((function(e,t){function r(e,t){var r=e.hotelId,n=e.isAnchor,o=e.freeCancellation,a=e.rooms,i=void 0===a?t.client.defaultRooms:a,s=xe.__rest(e,["hotelId","isAnchor","freeCancellation","rooms"]),u=(0,dn.getCheckInCheckOutDates)(e,t.client),c=u.checkIn,l=u.checkOut,f=xe.__assign(xe.__assign({},s),{checkIn:c,checkOut:l,rooms:i});return o&&(f.filters={freeCancellation:!0}),e.searchId||(f.searchId=(0,dn.generateSearchId)()),n?f.anchorHotelId=r:f.hotelIds=[r],f}Object.defineProperty(t,"__esModule",{value:!0}),t.offers=t.getOffersParameters=void 0,t.getOffersParameters=r,t.offers=function(e){var t=this,n=e.offersClient,o=e.appConfig;return function(e,a){return void 0===a&&(a={}),xe.__awaiter(t,void 0,void 0,(function(){var t,i,s,u,c,l,f,d;return xe.__generator(this,(function(h){switch(h.label){case 0:return n?(t=e.isAnchor,i=a.onStart,s=a.onOffersReceived,u=a.onComplete,c=r(e,o),"function"==typeof i&&i(c),[4,n.getOffers(c,(function(e){var r;"function"==typeof s&&s(t?e.anchorHotelOfferEntity:null===(r=e.hotelOfferEntities)||void 0===r?void 0:r[0])}))]):[2];case 1:return l=h.sent(),"function"==typeof u&&u(t?l.anchorHotelOfferEntity:null===(f=l.hotelOfferEntities)||void 0===f?void 0:f[0]),[2,t?l.anchorHotelOfferEntity:null===(d=l.hotelOfferEntities)||void 0===d?void 0:d[0]]}}))}))}}})),On=function(e,t){return On=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},On(e,t)};function Pn(e,t){function r(){this.constructor=e}On(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function Sn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function Tn(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Sn(arguments[t]));return e}var Dn=function(e,t){this.target=t,this.type=e},In=function(e){function t(t,r){var n=e.call(this,"error",r)||this;return n.message=t.message,n.error=t,n}return Pn(t,e),t}(Dn),kn=function(e){function t(t,r,n){void 0===t&&(t=1e3),void 0===r&&(r="");var o=e.call(this,"close",n)||this;return o.wasClean=!0,o.code=t,o.reason=r,o}return Pn(t,e),t}(Dn),jn=function(){if("undefined"!=typeof WebSocket)return WebSocket},En={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+4e3*Math.random(),minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},xn=function(){function e(e,t,r){var n=this;void 0===r&&(r={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(e){n._debug("open event");var t=n._options.minUptime,r=void 0===t?En.minUptime:t;clearTimeout(n._connectTimeout),n._uptimeTimeout=setTimeout((function(){return n._acceptOpen()}),r),n._ws.binaryType=n._binaryType,n._messageQueue.forEach((function(e){return n._ws.send(e)})),n._messageQueue=[],n.onopen&&n.onopen(e),n._listeners.open.forEach((function(t){return n._callEventListener(e,t)}))},this._handleMessage=function(e){n._debug("message event"),n.onmessage&&n.onmessage(e),n._listeners.message.forEach((function(t){return n._callEventListener(e,t)}))},this._handleError=function(e){n._debug("error event",e.message),n._disconnect(void 0,"TIMEOUT"===e.message?"timeout":void 0),n.onerror&&n.onerror(e),n._debug("exec error listeners"),n._listeners.error.forEach((function(t){return n._callEventListener(e,t)})),n._connect()},this._handleClose=function(e){n._debug("close event"),n._clearTimeouts(),n._shouldReconnect&&n._connect(),n.onclose&&n.onclose(e),n._listeners.close.forEach((function(t){return n._callEventListener(e,t)}))},this._url=e,this._protocols=t,this._options=r,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){return this._messageQueue.reduce((function(e,t){return"string"==typeof t?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e}),0)+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(e,t){void 0===e&&(e=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),this._ws?this._ws.readyState!==this.CLOSED?this._ws.close(e,t):this._debug("close: already closed"):this._debug("close enqueued: no ws instance")},e.prototype.reconnect=function(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,this._ws&&this._ws.readyState!==this.CLOSED?(this._disconnect(e,t),this._connect()):this._connect()},e.prototype.send=function(e){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",e),this._ws.send(e);else{var t=this._options.maxEnqueuedMessages,r=void 0===t?En.maxEnqueuedMessages:t;this._messageQueue.length<r&&(this._debug("enqueue",e),this._messageQueue.push(e))}},e.prototype.addEventListener=function(e,t){this._listeners[e]&&this._listeners[e].push(t)},e.prototype.dispatchEvent=function(e){var t,r,n=this._listeners[e.type];if(n)try{for(var o=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(n),a=o.next();!a.done;a=o.next()){var i=a.value;this._callEventListener(e,i)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return!0},e.prototype.removeEventListener=function(e,t){this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter((function(e){return e!==t})))},e.prototype._debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._options.debug&&console.log.apply(console,Tn(["RWS>"],e))},e.prototype._getNextDelay=function(){var e=this._options,t=e.reconnectionDelayGrowFactor,r=void 0===t?En.reconnectionDelayGrowFactor:t,n=e.minReconnectionDelay,o=void 0===n?En.minReconnectionDelay:n,a=e.maxReconnectionDelay,i=void 0===a?En.maxReconnectionDelay:a,s=0;return this._retryCount>0&&(s=o*Math.pow(r,this._retryCount-1))>i&&(s=i),this._debug("next delay",s),s},e.prototype._wait=function(){var e=this;return new Promise((function(t){setTimeout(t,e._getNextDelay())}))},e.prototype._getNextUrl=function(e){if("string"==typeof e)return Promise.resolve(e);if("function"==typeof e){var t=e();if("string"==typeof t)return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")},e.prototype._connect=function(){var e=this;if(!this._connectLock&&this._shouldReconnect){this._connectLock=!0;var t=this._options,r=t.maxRetries,n=void 0===r?En.maxRetries:r,o=t.connectionTimeout,a=void 0===o?En.connectionTimeout:o,i=t.WebSocket,s=void 0===i?jn():i;if(this._retryCount>=n)this._debug("max retries reached",this._retryCount,">=",n);else{if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!function(e){return void 0!==e&&!!e&&2===e.CLOSING}(s))throw Error("No valid WebSocket class provided");this._wait().then((function(){return e._getNextUrl(e._url)})).then((function(t){e._closeCalled||(e._debug("connect",{url:t,protocols:e._protocols}),e._ws=e._protocols?new s(t,e._protocols):new s(t),e._ws.binaryType=e._binaryType,e._connectLock=!1,e._addListeners(),e._connectTimeout=setTimeout((function(){return e._handleTimeout()}),a))}))}}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new In(Error("TIMEOUT"),this))},e.prototype._disconnect=function(e,t){if(void 0===e&&(e=1e3),this._clearTimeouts(),this._ws){this._removeListeners();try{this._ws.close(e,t),this._handleClose(new kn(e,t,this))}catch(e){}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(e,t){"handleEvent"in t?t.handleEvent(e):t(e)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e}(),Cn=r(Object.freeze({__proto__:null,default:xn})),Rn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.offersClient=t.sapiResponseToHotelOfferEntity=void 0;var r,n=xe.__importDefault(Ae),o=xe.__importDefault(Cn);function a(e){var t;return{availableOffersCount:e.availableOffersCount,anchorRate:e.anchorRate,id:e.id,offers:null===(t=e.offers)||void 0===t?void 0:t.map((function(t){return function(e,t){var r;return(0,Dr.omit)(["roomID","occupancy"],xe.__assign(xe.__assign({},e),{roomName:null===(r=null==t?void 0:t[e.roomID])||void 0===r?void 0:r.name}))}(t,e.rooms)})),discount:e.discount}}!function(e){e[e.Connecting=0]="Connecting",e[e.Open=1]="Open",e[e.Closing=2]="Closing",e[e.Closed=3]="Closed"}(r||(r={})),t.sapiResponseToHotelOfferEntity=a,t.offersClient=function(e,t){if("undefined"==typeof WebSocket&&void 0===t.WebSocket)throw new TypeError("Client does not support WebSocket");var i=(0,an.removeEmpty)({sapiOverride:(0,Ue.getSapiOverrideParameter)(!0)}),s=new n.default(i).toString(),u="wss://".concat(e.baseUrl,"/").concat(e.endpoints.offers,"?").concat(s),c=new o.default(u,[],{maxRetries:15,WebSocket:t.WebSocket}),l={},f={};function d(e){t.logger.log({name:"WebsocketConnectionClosed",value:{service:"sapi",code:e.code,reason:e.reason,wasClean:e.wasClean}})}function h(e){t.logger.log({name:"WebsocketError",value:xe.__assign(xe.__assign({},e),{service:"sapi"})})}function p(){for(var e=0,t=Object.keys(l);e<t.length;e++){var r=t[e],n=l[r];void 0!==n&&c.send(n)}}function v(e){var t;try{t=JSON.parse(e.data)}catch(e){return void console.log("WEBSOCKET: error parsing message")}var r=f[t.clientRequestId];"function"==typeof r&&r(t)}return c.addEventListener("open",p),c.addEventListener("close",d),c.addEventListener("error",h),c.addEventListener("message",v),{getOffers:function(e,n){return xe.__awaiter(this,void 0,void 0,(function(){var o,i;return xe.__generator(this,(function(s){return o={},i=(0,rn.v4)(),l[i]=function(e,t,r){var n,o={checkIn:e.checkIn,checkOut:e.checkOut,anchorHotelId:e.anchorHotelId,hotelIds:e.hotelIds,rooms:e.rooms,searchId:e.searchId,cugDeals:e.cugDeals,tier:e.tier,language:t.language,deviceType:t.deviceType,anonymousId:t.anonymousId,currency:t.currency,originId:e.originId,brand:t.brand,clientRequestId:r,sortingBoost:(0,sn.generateSortingBoost)(e),getAllOffers:Boolean(e.getAllOffers),preferredRate:e.preferredRate,label:e.trafficSource,countryCode:t.countryCode,variations:t.variations};try{n=JSON.stringify(o)}catch(e){console.log("WEBSOCKET: error serialising request")}return n}(e,t,i),[2,new Promise((function(t){f[i]=function(r){var s,u;if(void 0!==r)if(r.status.complete)t(o),l[i]=void 0,f[i]=void 0;else{var c=null===(s=r.results)||void 0===s?void 0:s.find((function(t){return t.id===e.anchorHotelId}));c?o.anchorHotelOfferEntity=a(c):o.hotelOfferEntities=null===(u=r.results)||void 0===u?void 0:u.map((function(e){return a(e)})),"function"==typeof n&&n(xe.__assign({},o))}};var s=l[i];void 0!==s&&(c.readyState===r.Open?c.send(s):c.readyState===r.Closed&&(c._connectLock=!1,c.reconnect()))}))]}))}))}}}})),Nn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sapi=t.variationsToArray=void 0;var r={log:function(){}};function n(e){void 0===e&&(e={});var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push("".concat(r,"-").concat(e[r]));return t}t.variationsToArray=n,t.sapi=function(e,t){var o,a,i,s,u,c,l;return xe.__awaiter(this,void 0,void 0,(function(){function f(e){return h.client.features.includes(e)}function d(){var e,t;if(f("search")){if((null===(e=v.options.variations)||void 0===e?void 0:e.includes("sapi4eva-room-mapping-rsp-v8-1-a"))||(null===(t=v.options.variations)||void 0===t?void 0:t.includes("sapi4eva-room-mapping-rsp-v8-1-b"))){return function(e,t){return void 0===t&&(t={}),xe.__awaiter(this,void 0,void 0,(function(){return xe.__generator(this,(function(r){return[2,(0,vn.search)(v)(e,xe.__assign(xe.__assign({},t),{onComplete:function(e){var r,n=e.anchorHotelId,o=e.hotelOfferEntities,a=e.searchParameters,i=e.offset;if(!(0,dn.hasRequiredSearchParameters)(a))throw new Error("Dates must be set by client, SDK or response");if(n&&0===i){var s=o[n],u=null==s?void 0:s.offers.find((function(e){return"FHT"===e.intermediaryProvider}));if(u)try{(0,bn.rooms)(v)({hotelId:n,checkIn:a.checkIn,checkOut:a.checkOut,rooms:a.rooms,cugDeals:null===(r=a.cugDeals)||void 0===r?void 0:r.join(","),tier:a.tier,preHeat:1,trafficSource:a.trafficSource,clickedOfferId:u.id,clickedOfferBaseRate:u.rate.base,clickedOfferHotelFees:u.rate.hotelFees,clickedOfferTaxes:u.rate.taxes})}catch(e){}}"function"==typeof t.onComplete&&t.onComplete(e)}}))]}))}))}}return(0,vn.search)(v)}return function(){throw new Error("Search is not enabled for this profile key")}}var h,p,v;return xe.__generator(this,(function(g){if(!e)throw new Error("Profile key is required");return h=(0,Ce.getAppConfig)(e,t.initWithAppConfig),p=xe.__assign(xe.__assign({},t),{logger:null!==(o=t.logger)&&void 0!==o?o:r,variations:n(t.variations),currency:null!==(i=null===(a=t.currency)||void 0===a?void 0:a.toUpperCase())&&void 0!==i?i:"USD",deviceType:null!==(s=t.deviceType)&&void 0!==s?s:"desktop",countryCode:t.countryCode,pageSize:null!==(u=t.pageSize)&&void 0!==u?u:20,getTotalRate:null!==(c=t.getTotalRate)&&void 0!==c?c:dn.getTotalRate,languages:xe.__spreadArray(xe.__spreadArray([t.language],null!==(l=h.client.fallbackLanguages[t.language])&&void 0!==l?l:[],!0),["en"],!1)}),v={appConfig:h,getFeatureEnabled:f,profileKey:e,options:p,offersClient:f("offers")?(0,Rn.offersClient)(h.sapiBackend,p):void 0},[2,{rooms:f("rooms")?(0,bn.rooms)(v):function(){throw new Error("Rooms search is not enabled for this profile key")},search:d(),suggest:f("suggests")?(0,yn.suggest)(v):function(){throw new Error("Autosuggest is not enabled for this profile key")},hotel:f("get-hotel")?(0,_n.hotel)(v):function(){throw new Error("Get hotel is not alowed for this profile key")},offers:f("offers")?(0,wn.offers)(v):function(){throw new Error("Get offers is not alowed for this profile key")}}]}))}))}})),Mn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),An=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Un=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),qn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Fn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Hn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Wn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Bn=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0})})),Ln=t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),xe.__exportStar(Mn,t),xe.__exportStar(An,t),xe.__exportStar(Un,t),xe.__exportStar(qn,t),xe.__exportStar(Fn,t),xe.__exportStar(Hn,t),xe.__exportStar(Wn,t),xe.__exportStar(Bn,t)}));return e(t((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,(0,Ir.enableES5)(),xe.__exportStar(Nn,t),xe.__exportStar(Ce,t),xe.__exportStar(Ln,t);var r=Nn;Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r.sapi}})})))}));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Suggestion, Options as ClientOptions } from './types';
|
|
1
|
+
import { Suggestion, SuggestType, Options as ClientOptions } from './types';
|
|
2
2
|
import { AppConfig } from './app-config';
|
|
3
3
|
interface Parameters {
|
|
4
4
|
appConfig: AppConfig;
|
|
5
5
|
options: ClientOptions;
|
|
6
6
|
}
|
|
7
|
-
export declare type SuggestHandler = (query: string, suggestsCount?: number) => Promise<Suggestion[]>;
|
|
7
|
+
export declare type SuggestHandler = (query: string, suggestsCount?: number, suggestsTypes?: SuggestType[]) => Promise<Suggestion[]>;
|
|
8
8
|
export declare function suggest({ appConfig, options }: Parameters): SuggestHandler;
|
|
9
9
|
export {};
|
|
@@ -77,6 +77,7 @@ export interface OptionalSearchParameters {
|
|
|
77
77
|
userId?: string;
|
|
78
78
|
emailDomain?: string;
|
|
79
79
|
screenshots?: number;
|
|
80
|
+
pageSize?: number;
|
|
80
81
|
}
|
|
81
82
|
export interface PlaceSearchParameters extends OptionalSearchParameters {
|
|
82
83
|
placeId: string;
|
|
@@ -263,10 +264,11 @@ export interface PlaceAnchor extends Omit<PlaceAnchorHit, 'placeName' | 'placeAD
|
|
|
263
264
|
}
|
|
264
265
|
export declare type Anchor = HotelAnchor | PlaceAnchor;
|
|
265
266
|
export declare type PlaceTypeName = 'property' | 'country' | 'city' | 'airport' | 'station' | 'area';
|
|
267
|
+
export declare type SuggestType = 'hotel' | 'place';
|
|
266
268
|
export interface Suggestion {
|
|
267
269
|
highlightValue: string;
|
|
268
270
|
objectID: string;
|
|
269
|
-
objectType:
|
|
271
|
+
objectType: SuggestType;
|
|
270
272
|
placeDisplayName: string;
|
|
271
273
|
placeTypeName: PlaceTypeName;
|
|
272
274
|
value: string;
|