@sabstravtech/obtservices 0.0.22041208 → 0.0.22042501
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/angular/fetchers.d.ts +1 -0
- package/angular/lib/vendor/fetchers/email-basket.fetcher.d.ts +7 -0
- package/angular/lib/vendor/services/search.service.d.ts +4 -3
- package/angular/lib/vendor/services/user.service.d.ts +4 -3
- package/angular/lib/vendor/types/graphql.angular.types.d.ts +507 -9
- package/angular/sabstravtech-obtservices-angular.metadata.json +1 -1
- package/base/fetchers.d.ts +1 -0
- package/base/lib/vendor/classes/eurostar-enterprise-search.d.ts +2 -1
- package/base/lib/vendor/classes/hotel-enterprise-search.d.ts +1 -1
- package/base/lib/vendor/classes/modal-types.enum.d.ts +1 -0
- package/base/lib/vendor/classes/rail-enterprise-search.d.ts +2 -0
- package/base/lib/vendor/classes/supplementary-booking-info-impl.d.ts +1 -1
- package/base/lib/vendor/classes/user-favourite.enum.d.ts +1 -0
- package/base/lib/vendor/fetchers/email-basket.fetcher.d.ts +20 -0
- package/base/lib/vendor/interfaces/Ieurostar-enterprise-search.d.ts +1 -0
- package/base/lib/vendor/interfaces/Ihotel-enterprise-search.d.ts +1 -1
- package/base/lib/vendor/interfaces/Isearch.service.d.ts +3 -3
- package/base/lib/vendor/interfaces/Isupplementary-booking-info-impl.d.ts +1 -1
- package/base/lib/vendor/services/search.service.d.ts +7 -5
- package/base/lib/vendor/services/url.service.d.ts +2 -1
- package/base/lib/vendor/services/user.service.d.ts +8 -2
- package/base/lib/vendor/types/graphql.types.d.ts +502 -9
- package/base/lib/vendor/types/types.d.ts +2 -2
- package/base/sabstravtech-obtservices-base.metadata.json +1 -1
- package/bundles/sabstravtech-obtservices-angular.umd.js +136 -84
- package/bundles/sabstravtech-obtservices-angular.umd.js.map +1 -1
- package/bundles/sabstravtech-obtservices-angular.umd.min.js +1 -1
- package/bundles/sabstravtech-obtservices-angular.umd.min.js.map +1 -1
- package/bundles/sabstravtech-obtservices-base.umd.js +206 -49
- package/bundles/sabstravtech-obtservices-base.umd.js.map +1 -1
- package/bundles/sabstravtech-obtservices-base.umd.min.js +2 -2
- package/bundles/sabstravtech-obtservices-base.umd.min.js.map +1 -1
- package/esm2015/angular/fetchers.js +2 -1
- package/esm2015/angular/lib/vendor/fetchers/email-basket.fetcher.js +25 -0
- package/esm2015/angular/lib/vendor/services/search.service.js +8 -5
- package/esm2015/angular/lib/vendor/services/user.service.js +13 -10
- package/esm2015/angular/lib/vendor/types/graphql.angular.types.js +1006 -2
- package/esm2015/base/fetchers.js +2 -1
- package/esm2015/base/lib/vendor/classes/carhire-enterprise-search.js +34 -8
- package/esm2015/base/lib/vendor/classes/eurostar-enterprise-search.js +15 -12
- package/esm2015/base/lib/vendor/classes/flight-enterprise-search.js +6 -1
- package/esm2015/base/lib/vendor/classes/hotel-enterprise-search.js +31 -4
- package/esm2015/base/lib/vendor/classes/lounges-enterprise-search.js +10 -2
- package/esm2015/base/lib/vendor/classes/modal-types.enum.js +2 -1
- package/esm2015/base/lib/vendor/classes/parking-enterprise-search.js +12 -2
- package/esm2015/base/lib/vendor/classes/rail-enterprise-search.js +35 -19
- package/esm2015/base/lib/vendor/classes/supplementary-booking-info-impl.js +3 -3
- package/esm2015/base/lib/vendor/classes/user-favourite.enum.js +2 -1
- package/esm2015/base/lib/vendor/data/euro-stations.json +8 -0
- package/esm2015/base/lib/vendor/fetchers/email-basket.fetcher.js +11 -0
- package/esm2015/base/lib/vendor/interfaces/Ieurostar-enterprise-search.js +1 -1
- package/esm2015/base/lib/vendor/interfaces/Ihotel-enterprise-search.js +1 -1
- package/esm2015/base/lib/vendor/interfaces/Isearch.service.js +1 -1
- package/esm2015/base/lib/vendor/interfaces/Isupplementary-booking-info-impl.js +1 -1
- package/esm2015/base/lib/vendor/services/hotel-avallibility.service.js +2 -1
- package/esm2015/base/lib/vendor/services/search.service.js +8 -3
- package/esm2015/base/lib/vendor/services/url.service.js +2 -1
- package/esm2015/base/lib/vendor/services/user.service.js +19 -2
- package/esm2015/base/lib/vendor/types/graphql.types.js +11 -1
- package/esm2015/base/lib/vendor/types/types.js +3 -3
- package/fesm2015/sabstravtech-obtservices-angular.js +1048 -26
- package/fesm2015/sabstravtech-obtservices-angular.js.map +1 -1
- package/fesm2015/sabstravtech-obtservices-base.js +199 -50
- package/fesm2015/sabstravtech-obtservices-base.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("rxjs"),require("rxjs/operators"),require("lodash"),require("moment"),require("ajv")):"function"==typeof define&&define.amd?define("@sabstravtech/obtservices/base",["exports","rxjs","rxjs/operators","lodash","moment","ajv"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).sabstravtech=e.sabstravtech||{},e.sabstravtech.obtservices=e.sabstravtech.obtservices||{},e.sabstravtech.obtservices.base={}),e.rxjs,e.rxjs.operators,e._,e.moment,e.Ajv)}(this,(function(e,t,r,i,n,a){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(i),u=o(n),l=o(a),c=function(){function e(e,r){this.storageService=e,this.helpers=r,this._cheapestResultPrice={amount:null,currencyCode:null},this.isValid=new t.BehaviorSubject(!1),this.results=new t.BehaviorSubject([]),this.multiResults=new t.BehaviorSubject([]),this.messages=new t.BehaviorSubject([]),this.messagesInfo=new t.BehaviorSubject([]),this.validationMessages=[],this.infoMessages=[],this.isLoading=new t.BehaviorSubject(!1),this.tempParams={},this.doChecks=!0,this.fullResults=[],this.fullMultiResults=[]}return Object.defineProperty(e.prototype,"cheapestPrice",{get:function(){return this._cheapestResultPrice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"originalUserSearch",{get:function(){return this._originalUserSearch},enumerable:!1,configurable:!0}),e.prototype.processResults=function(e){return e},e.prototype.updateTempParams=function(e){this.doChecks=!1,Object.assign(this,e),this._cheapestResultPrice=null,this.doChecks=!0},e.prototype._startSearch=function(e){var t=this;return this.isLoading.next(!0),this.fullResults=[],new Promise((function(n,a){try{e.pipe(r.take(1)).subscribe((function(e){console.log("Got results",i.cloneDeep(e)),t.fullResults=Object.freeze(t.processResults(e)),t._cheapestResultPrice=t.updateLowestPrice(t.fullResults),t.storageService.setSessionItem(t.resultsSessionName,t.makeSessionResults(t.fullResults)),t._applyFilter()}),(function(e){t.results.next([]),n(!1),t.isLoading.next(!1)}),(function(){t.isLoading.next(!1),n(0!==t.fullResults.length)}))}catch(e){t.storageService.setSessionItem(t.resultsSessionName,[]),t.isLoading.next(!1),t.results.next([]),a(e)}}))},e.prototype._startMultiSearch=function(e){var t=this;this.isLoading.next(!0),this.fullMultiResults=[];var n=[];return e.forEach((function(e,a){n.push(new Promise((function(n,o){try{e.pipe(r.take(1)).subscribe((function(e){console.log("Got results",i.cloneDeep(e));var r=t.processResults(e);t.fullMultiResults[a]=r,n(0!==r.length)}),(function(e){t.multiResults.next([]),n(!1)}))}catch(e){t.storageService.setSessionItem(t.resultsSessionName,[]),t.multiResults.next([]),o(e)}})))})),Promise.all(n).then((function(e){return t.isLoading.next(!1),console.log("+++ Multiloading Complete +++"),console.log("+++ Multi Results: ",t.fullMultiResults," +++"),t.storageService.setSessionItem(t.multiResultsSessionName,t.fullMultiResults),t.multiResults.next(t.fullMultiResults),!0}))},e.prototype.reset=function(){this.storageService.removeSessionItem(this.resultsSessionName);try{this.storageService.removeSessionItem(this.multiResultsSessionName)}catch(e){}this.fullResults=[],this.fullMultiResults=[],this.results.next([]),this.multiResults.next([]),this.resetQuery()},e.prototype.makeSessionResults=function(e){return e},e.prototype._applyFilter=function(){this.results.next(this.helpers.clone(this.fullResults))},e}(),d=function(){function e(t){this.value=t,this._component=null,e[t]=this}return Object.defineProperty(e.prototype,"component",{get:function(){return this._component},set:function(e){this._component&&console.warn("Compnent already set for "+this.value,this._component,e),this._component=e},enumerable:!1,configurable:!0}),e}();d.ModalErrorComponent=new d("ModalErrorComponent"),d.ModalNetWorkErrorComponent=new d("ModalNetworkErrorComponent"),d.BaseModalComponent=new d("BaseModalComponent"),d.AutoLogout=new d("AutoLogout"),d.RiskAlertDetail=new d("RiskAlertDetailModalComponent"),d.AlternativeRailModalComponent=new d("AlternativeRailModalComponent"),d.WarningRemoveModalComponent=new d("WarningRemoveModalComponent"),d.RailTicketsDialogComponent=new d("RailTicketsDialogComponent"),d.ModalFlightFareComponent=new d("ModalFlightFareComponent");var p=function(){function e(e){this.modelService=e}return e.prototype.checkError=function(e){if(e)throw this.modelService.open(d.ModalNetWorkErrorComponent,{},{error:e}),e},e.prototype.processCall=function(e){var i=this;return e.pipe(r.take(1),r.map((function(e){return i.checkError(e.error),i.getDataFromResult(e)})),r.catchError((function(e){return i.checkError(e),t.of({})})))},e}(),h=function(e,t){return(h=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])})(e,t)};
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("rxjs"),require("rxjs/operators"),require("lodash"),require("moment"),require("ajv")):"function"==typeof define&&define.amd?define("@sabstravtech/obtservices/base",["exports","rxjs","rxjs/operators","lodash","moment","ajv"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).sabstravtech=e.sabstravtech||{},e.sabstravtech.obtservices=e.sabstravtech.obtservices||{},e.sabstravtech.obtservices.base={}),e.rxjs,e.rxjs.operators,e._,e.moment,e.Ajv)}(this,(function(e,t,r,i,n,a){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(i),u=o(n),l=o(a),c=function(){function e(e,r){this.storageService=e,this.helpers=r,this._cheapestResultPrice={amount:null,currencyCode:null},this.isValid=new t.BehaviorSubject(!1),this.results=new t.BehaviorSubject([]),this.multiResults=new t.BehaviorSubject([]),this.messages=new t.BehaviorSubject([]),this.messagesInfo=new t.BehaviorSubject([]),this.validationMessages=[],this.infoMessages=[],this.isLoading=new t.BehaviorSubject(!1),this.tempParams={},this.doChecks=!0,this.fullResults=[],this.fullMultiResults=[]}return Object.defineProperty(e.prototype,"cheapestPrice",{get:function(){return this._cheapestResultPrice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"originalUserSearch",{get:function(){return this._originalUserSearch},enumerable:!1,configurable:!0}),e.prototype.processResults=function(e){return e},e.prototype.updateTempParams=function(e){this.doChecks=!1,Object.assign(this,e),this._cheapestResultPrice=null,this.doChecks=!0},e.prototype._startSearch=function(e){var t=this;return this.isLoading.next(!0),this.fullResults=[],new Promise((function(n,a){try{e.pipe(r.take(1)).subscribe((function(e){console.log("Got results",i.cloneDeep(e)),t.fullResults=Object.freeze(t.processResults(e)),t._cheapestResultPrice=t.updateLowestPrice(t.fullResults),t.storageService.setSessionItem(t.resultsSessionName,t.makeSessionResults(t.fullResults)),t._applyFilter()}),(function(e){t.results.next([]),n(!1),t.isLoading.next(!1)}),(function(){t.isLoading.next(!1),n(0!==t.fullResults.length)}))}catch(e){t.storageService.setSessionItem(t.resultsSessionName,[]),t.isLoading.next(!1),t.results.next([]),a(e)}}))},e.prototype._startMultiSearch=function(e){var t=this;this.isLoading.next(!0),this.fullMultiResults=[];var n=[];return e.forEach((function(e,a){n.push(new Promise((function(n,o){try{e.pipe(r.take(1)).subscribe((function(e){console.log("Got results",i.cloneDeep(e));var r=t.processResults(e);t.fullMultiResults[a]=r,n(0!==r.length)}),(function(e){t.multiResults.next([]),n(!1)}))}catch(e){t.storageService.setSessionItem(t.resultsSessionName,[]),t.multiResults.next([]),o(e)}})))})),Promise.all(n).then((function(e){return t.isLoading.next(!1),console.log("+++ Multiloading Complete +++"),console.log("+++ Multi Results: ",t.fullMultiResults," +++"),t.storageService.setSessionItem(t.multiResultsSessionName,t.fullMultiResults),t.multiResults.next(t.fullMultiResults),!0}))},e.prototype.reset=function(){this.storageService.removeSessionItem(this.resultsSessionName);try{this.storageService.removeSessionItem(this.multiResultsSessionName)}catch(e){}this.fullResults=[],this.fullMultiResults=[],this.results.next([]),this.multiResults.next([]),this.resetQuery()},e.prototype.makeSessionResults=function(e){return e},e.prototype._applyFilter=function(){this.results.next(this.helpers.clone(this.fullResults))},e}(),d=function(){function e(t){this.value=t,this._component=null,e[t]=this}return Object.defineProperty(e.prototype,"component",{get:function(){return this._component},set:function(e){this._component&&console.warn("Compnent already set for "+this.value,this._component,e),this._component=e},enumerable:!1,configurable:!0}),e}();d.ModalErrorComponent=new d("ModalErrorComponent"),d.ModalNetWorkErrorComponent=new d("ModalNetworkErrorComponent"),d.BaseModalComponent=new d("BaseModalComponent"),d.AutoLogout=new d("AutoLogout"),d.RiskAlertDetail=new d("RiskAlertDetailModalComponent"),d.AlternativeRailModalComponent=new d("AlternativeRailModalComponent"),d.WarningRemoveModalComponent=new d("WarningRemoveModalComponent"),d.RailTicketsDialogComponent=new d("RailTicketsDialogComponent"),d.ModalFlightFareComponent=new d("ModalFlightFareComponent"),d.FlightExtrasDialogComponent=new d("FlightExtrasDialogComponent");var p=function(){function e(e){this.modelService=e}return e.prototype.checkError=function(e){if(e)throw this.modelService.open(d.ModalNetWorkErrorComponent,{},{error:e}),e},e.prototype.processCall=function(e){var i=this;return e.pipe(r.take(1),r.map((function(e){return i.checkError(e.error),i.getDataFromResult(e)})),r.catchError((function(e){return i.checkError(e),t.of({})})))},e}(),h=function(e,t){return(h=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])})(e,t)};
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function m(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}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function f(e,t,r,i){var n,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,r,o):n(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function y(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function g(e,t,r,i){return new(r||(r=Promise))((function(n,a){function o(e){try{u(i.next(e))}catch(e){a(e)}}function s(e){try{u(i.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))}function v(e,t){var r,i,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[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(;o;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}Object.create;function b(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],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 i,n,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o}function T(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(S(arguments[t]));return e}Object.create;var C,D,P,_,A,k,F,O,R,I,E,N,B,M,L,j,w,x,U,V,G,H,Q,J,W,Y,K,z,X,q,Z,$,ee,te,re,ie=function(){};!function(e){e.BeforeSearch="BEFORE_SEARCH",e.AfterSearch="AFTER_SEARCH"}(C||(C={})),function(e){e.CheckIn="CheckIn",e.HandCarry="HandCarry"}(D||(D={})),function(e){e.Open="OPEN",e.Booked="BOOKED",e.BookingFailed="BOOKING_FAILED"}(P||(P={})),function(e){e.Open="OPEN",e.Booked="BOOKED",e.AwaitingApproval="AWAITING_APPROVAL",e.Approved="APPROVED",e.Disapproved="DISAPPROVED",e.PartiallyBooked="PARTIALLY_BOOKED",e.BookingFailed="BOOKING_FAILED"}(_||(_={})),function(e){e.Name="NAME",e.Email="EMAIL"}(A||(A={})),function(e){e.Root="ROOT",e.Tmc="TMC",e.Company="COMPANY",e.Office="OFFICE",e.CompanyGroup="COMPANY_GROUP",e.SelfBook="SELF_BOOK",e.Booker="BOOKER",e.Traveller="TRAVELLER",e.BookerWithSelf="BOOKER_WITH_SELF"}(k||(k={})),function(e){e.Any="Any",e.DdaCar="DDACar",e.CoachLarge="CoachLarge",e.CoachSmall="CoachSmall",e.Economy="Economy",e.EconomyCoach="EconomyCoach",e.EconomyMpvSmall="EconomyMPVSmall",e.EconomyMpvLarge="EconomyMPVLarge",e.EconomySuv="EconomySUV",e.ExecutiveCar="ExecutiveCar",e.ExecutiveSuv="ExecutiveSUV",e.GreenCar="GreenCar",e.GreenExecutive="GreenExecutive",e.GreenSuv="GreenSUV",e.SmallMpv="SmallMPV",e.MediumMpv="MediumMPV",e.LargeMpv="LargeMPV",e.StandardCar="StandardCar",e.Suv="SUV",e.BlackCab="BlackCab",e.TaxiSuv="TaxiSUV"}(F||(F={})),function(e){e.Mini="Mini",e.MiniElite="MiniElite",e.Economy="Economy",e.EconomyElite="EconomyElite",e.Compact="Compact",e.CompactElite="CompactElite",e.Intermediate="Intermediate",e.IntermediateElite="IntermediateElite",e.Standard="Standard",e.StandardElite="StandardElite",e.Fullsize="Fullsize",e.FullsizeElite="FullsizeElite",e.Premium="Premium",e.PremiumElite="PremiumElite",e.Luxury="Luxury",e.LuxuryElite="LuxuryElite",e.Oversize="Oversize",e.Special="Special"}(O||(O={})),function(e){e.Manual="Manual",e.Auto="Auto"}(R||(R={})),function(e){e.TwoToThreeDoor="TwoToThreeDoor",e.TwoOrFourDoor="TwoOrFourDoor",e.FourToFiveDoor="FourToFiveDoor",e.WagonOrEstate="WagonOrEstate",e.PassengerVan="PassengerVan",e.Limousine="Limousine",e.Sport="Sport",e.Convertible="Convertible",e.Suv="SUV",e.OpenAirAllTerrain="OpenAirAllTerrain",e.Special="Special",e.PickUpRegularCab="PickUpRegularCab",e.PickUpExtendedCab="PickUpExtendedCab",e.SpecialOfferCar="SpecialOfferCar",e.Coupe="Coupe",e.MonospaceEuropeanUse="MonospaceEuropeanUse",e.MotorHome="MotorHome",e.TwoWheelVehicle="TwoWheelVehicle",e.Roadster="Roadster"}(I||(I={})),function(e){e.Company="COMPANY",e.Office="OFFICE",e.User="USER"}(E||(E={})),function(e){e.Aed="AED",e.Afn="AFN",e.All="ALL",e.Amd="AMD",e.Ang="ANG",e.Aoa="AOA",e.Ars="ARS",e.Aud="AUD",e.Awg="AWG",e.Azn="AZN",e.Bam="BAM",e.Bbd="BBD",e.Bdt="BDT",e.Bgn="BGN",e.Bhd="BHD",e.Bif="BIF",e.Bmd="BMD",e.Bnd="BND",e.Bob="BOB",e.Bov="BOV",e.Brl="BRL",e.Bsd="BSD",e.Btn="BTN",e.Bwp="BWP",e.Byn="BYN",e.Bzd="BZD",e.Cad="CAD",e.Cdf="CDF",e.Che="CHE",e.Chf="CHF",e.Chw="CHW",e.Clf="CLF",e.Clp="CLP",e.Cny="CNY",e.Cop="COP",e.Cou="COU",e.Crc="CRC",e.Cuc="CUC",e.Cup="CUP",e.Cve="CVE",e.Czk="CZK",e.Djf="DJF",e.Dkk="DKK",e.Dop="DOP",e.Dzd="DZD",e.Egp="EGP",e.Ern="ERN",e.Etb="ETB",e.Eur="EUR",e.Fjd="FJD",e.Fkp="FKP",e.Gbp="GBP",e.Gel="GEL",e.Ghs="GHS",e.Gip="GIP",e.Gmd="GMD",e.Gnf="GNF",e.Gtq="GTQ",e.Gyd="GYD",e.Hkd="HKD",e.Hnl="HNL",e.Hrk="HRK",e.Htg="HTG",e.Huf="HUF",e.Idr="IDR",e.Ils="ILS",e.Inr="INR",e.Iqd="IQD",e.Irr="IRR",e.Isk="ISK",e.Jmd="JMD",e.Jod="JOD",e.Jpy="JPY",e.Kes="KES",e.Kgs="KGS",e.Khr="KHR",e.Kmf="KMF",e.Kpw="KPW",e.Krw="KRW",e.Kwd="KWD",e.Kyd="KYD",e.Kzt="KZT",e.Lak="LAK",e.Lbp="LBP",e.Lkr="LKR",e.Lrd="LRD",e.Lsl="LSL",e.Lyd="LYD",e.Mad="MAD",e.Mdl="MDL",e.Mga="MGA",e.Mkd="MKD",e.Mmk="MMK",e.Mnt="MNT",e.Mop="MOP",e.Mru="MRU",e.Mur="MUR",e.Mvr="MVR",e.Mwk="MWK",e.Mxn="MXN",e.Mxv="MXV",e.Myr="MYR",e.Mzn="MZN",e.Nad="NAD",e.Ngn="NGN",e.Nio="NIO",e.Nok="NOK",e.Npr="NPR",e.Nzd="NZD",e.Omr="OMR",e.Pab="PAB",e.Pen="PEN",e.Pgk="PGK",e.Php="PHP",e.Pkr="PKR",e.Pln="PLN",e.Pyg="PYG",e.Qar="QAR",e.Ron="RON",e.Rsd="RSD",e.Rub="RUB",e.Rwf="RWF",e.Sar="SAR",e.Sbd="SBD",e.Scr="SCR",e.Sdg="SDG",e.Sek="SEK",e.Sgd="SGD",e.Shp="SHP",e.Sll="SLL",e.Sos="SOS",e.Srd="SRD",e.Ssp="SSP",e.Stn="STN",e.Svc="SVC",e.Syp="SYP",e.Szl="SZL",e.Thb="THB",e.Tjs="TJS",e.Tmt="TMT",e.Tnd="TND",e.Top="TOP",e.Try="TRY",e.Ttd="TTD",e.Twd="TWD",e.Tzs="TZS",e.Uah="UAH",e.Ugx="UGX",e.Usd="USD",e.Usn="USN",e.Uyi="UYI",e.Uyu="UYU",e.Uzs="UZS",e.Vef="VEF",e.Vnd="VND",e.Vuv="VUV",e.Wst="WST",e.Xaf="XAF",e.Xag="XAG",e.Xau="XAU",e.Xba="XBA",e.Xbb="XBB",e.Xbc="XBC",e.Xbd="XBD",e.Xcd="XCD",e.Xdr="XDR",e.Xof="XOF",e.Xpd="XPD",e.Xpf="XPF",e.Xpt="XPT",e.Xsu="XSU",e.Xts="XTS",e.Xua="XUA",e.Xxx="XXX",e.Yer="YER",e.Zar="ZAR",e.Zmw="ZMW",e.Zwl="ZWL"}(N||(N={})),function(e){e.K="K",e.M="M"}(B||(B={})),function(e){e.M="M",e.F="F"}(M||(M={})),function(e){e.Passport="PASSPORT",e.Visa="VISA",e.IdCard="ID_CARD"}(L||(L={})),function(e){e.Cancellation="Cancellation",e.Change="Change",e.NoShow="NoShow",e.Upgrade="Upgrade",e.Other="Other"}(j||(j={})),function(e){e.Flexible="Flexible",e.Lowest="Lowest",e.Negotiated="Negotiated",e.NonNegotiated="NonNegotiated",e.Leisure="Leisure",e.RequestFareRules="RequestFareRules",e.SelectAndPro="SelectAndPro"}(w||(w={})),function(e){e.Any="Any",e.LiteEconomy="LiteEconomy",e.Economy="Economy",e.EconomyRestricted="EconomyRestricted",e.EconomyNoBags="EconomyNoBags",e.EconomyFlexi="EconomyFlexi",e.PremiumEconomy="PremiumEconomy",e.Business="Business",e.PremiumBusiness="PremiumBusiness",e.First="First",e.PremiumFirst="PremiumFirst"}(x||(x={})),function(e){e.Adult="ADULT",e.Child="CHILD",e.Infant="INFANT"}(U||(U={})),function(e){e.All="All",e.First="First",e.Standard="Standard"}(V||(V={})),function(e){e.ReturnJourney="ReturnJourney",e.SingleJourney="SingleJourney"}(G||(G={})),function(e){e.Renfe="Renfe",e.BeNe="BeNe",e.Ntv="Ntv"}(H||(H={})),function(e){e.Placeholder="placeholder",e.Complete="complete"}(Q||(Q={})),function(e){e.Login="LOGIN",e.SearchForm="SEARCH_FORM",e.Results="RESULTS",e.MiForm="MI_FORM",e.BasketBeforeConfirm="BASKET_BEFORE_CONFIRM",e.Dashboard="DASHBOARD"}(J||(J={})),function(e){e.Adult="ADULT",e.Child="CHILD",e.Infant="INFANT"}(W||(W={})),function(e){e.Mobile="MOBILE",e.Landline="LANDLINE",e.Fax="FAX",e.Other="OTHER"}(Y||(Y={})),function(e){e.MealRequest="MEAL_REQUEST",e.SeatingPreference="SEATING_PREFERENCE",e.SpeacialNeed="SPEACIAL_NEED",e.SeatLocation="SEAT_LOCATION",e.SeatPosition="SEAT_POSITION",e.SeatDirection="SEAT_DIRECTION"}(K||(K={})),function(e){e.All="All",e.First="First",e.Standard="Standard"}(z||(z={})),function(e){e.SingleJourney="SingleJourney",e.ReturnJourney="ReturnJourney",e.OpenReturnJourney="OpenReturnJourney"}(X||(X={})),function(e){e.Origin="Origin",e.Intermediate="Intermediate",e.Destination="Destination",e.Unknown="Unknown"}(q||(q={})),function(e){e.RequestStop="RequestStop",e.PickUpOnly="PickUpOnly",e.SetDownOnly="SetDownOnly",e.Normal="Normal",e.Passing="Passing",e.Unknown="Unknown"}(Z||(Z={})),function(e){e.Low="Low",e.Moderate="Moderate",e.Medium="Medium",e.High="High",e.Extreme="Extreme"}($||($={})),function(e){e.Flight="FLIGHT",e.Eurostar="EUROSTAR",e.InternationalRail="INTERNATIONAL_RAIL",e.Rail="RAIL",e.Hotel="HOTEL",e.Car="CAR",e.Lounge="LOUNGE",e.FastTrack="FAST_TRACK",e.Parking="PARKING",e.Cab="CAB",e.Coach="COACH"}(ee||(ee={})),function(e){e.All="ALL",e.Mock="MOCK",e.Lightning="LIGHTNING",e.App="APP"}(te||(te={})),function(e){e.FreeText="FREE_TEXT",e.AutoSuggest="AUTO_SUGGEST",e.Dropdown="DROPDOWN",e.Hidden="HIDDEN"}(re||(re={}));var ne,ae,oe,se,ue,le,ce,de,pe,he,me=function(e){function r(r){var i=e.call(this)||this;return i.isLoading=new t.BehaviorSubject(!1),i.search=function(e){return t.of([])},Object.assign(i,r),i}return m(r,e),Object.defineProperty(r.prototype,"selectedValues",{get:function(){return this._selectedValues},set:function(e){Object.is(this._selectedValues,e)||(this._selectedValues=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},set:function(e){this.setValue(e)},enumerable:!1,configurable:!0}),r.prototype.isValid=function(){return!this.mandatory||0!==this.selectedValues.length},r.prototype.hasErrors=function(e){var t=this;return new Promise((function(r,i){r(!t.mandatory||e&&0!==e.length?null:{hasErrors:!0})}))},r}(ie),fe=function(e){function t(t,r){var i,n=this;return(n=e.call(this,t)||this).basketService=r,n.tempValue=n.selectedValues&&(null===(i=n.selectedValues[0])||void 0===i?void 0:i.freeValue)||"",n}return m(t,e),t.prototype.getValue=function(){return this.tempValue},t.prototype.setValue=function(e){this.tempValue!==e&&(this.tempValue=e,this.selectedValues=[{freeValue:e,basketLevelValue:this.perBooking,userLevelValue:this.perPassenger}])},t.prototype.save=function(e,t){this.basketService.setMiFreeValue(e,this,this.selectedValues[0]?this.selectedValues[0].freeValue:"",t)},t.prototype.hasErrors=function(t){var r=this;return new Promise((function(i,n){if(!r.mandatory||t&&0!==t.length||i({hasErrors:!0}),r.valueMask&&t)return r.basketService.validateFreeValeMi(r,t).then((function(e){i(e?null:{hasErrors:!0})}));r.values.length>0?i(r.values.find((function(e){return e.value===t}))?null:{hasErrors:!0}):i(e.prototype.hasErrors.call(r,t))}))},t}(me),ye=function(e){function i(i,n){var a,o=this;return(o=e.call(this,i)||this).basketService=n,o.search=function(e){return e.pipe(r.debounceTime(300),r.distinctUntilChanged(),r.switchMap((function(e){return e.length>2?o.basketService.getMiAutoSugestions(o.id,e,o.isLoading):t.of(o.avaliableItems)})),r.tap((function(e){o.avaliableItems=e})))},(null===(a=o.values)||void 0===a?void 0:a.length)>0&&(o.avaliableItems=o.values),o}return m(i,e),i.prototype.getValue=function(){return this.selectedValues[0]?this.selectedValues[0].value.id:"__NONE"},i.prototype.hasErrors=function(e){return g(this,void 0,void 0,(function(){return v(this,(function(t){try{return[2,this.avaliableItems.find((function(t){return t.id===e}))?null:{hasErrors:!0}]}catch(e){return[2,null]}return[2]}))}))},i.prototype.setValue=function(e){try{var t=this.avaliableItems.find((function(t){return t.id===e}));this.selectedValues=t?[{value:{id:t.id,label:t.label,value:t.value,default:t.default,fixed:t.fixed,agentOnly:t.agentOnly},basketLevelValue:this.perBooking,userLevelValue:this.perPassenger}]:[]}catch(e){this.selectedValues=[]}},i.prototype.save=function(e,t){this.basketService.setMiSelectedValue(e,this,this.selectedValues[0].value.id,t)},i}(me),ge=function(e){function t(t){return e.call(this,t)||this}return m(t,e),t.prototype.getValue=function(){return""},t.prototype.setValue=function(e){},t.prototype.save=function(e,t){},t}(me),ve=function(e){function t(t,r){var i,n=this;return(n=e.call(this,t)||this).basketService=r,(null===(i=n.values)||void 0===i?void 0:i.length)>0?n.avaliableItems=n.values:console.error("No values for Dropdown MI field "),n.defaultValue&&!n.selectedValues.length&&(n.value=n.defaultValue.id,n.selectedValues[0].value=n.defaultValue),n}return m(t,e),t.prototype.getValue=function(){return this.selectedValues[0]?this.selectedValues[0].value.id:"__NONE"},t.prototype.hasErrors=function(e){return g(this,void 0,void 0,(function(){return v(this,(function(t){try{return[2,this.avaliableItems.find((function(t){return t.id===e}))?null:{hasErrors:!0}]}catch(e){return[2,null]}return[2]}))}))},t.prototype.setValue=function(e){var t=this.avaliableItems.find((function(t){return t.id===e}));this.selectedValues=t?[{value:{id:t.id,label:t.label,value:t.value,default:t.default,fixed:t.fixed,agentOnly:t.agentOnly},basketLevelValue:this.perBooking,userLevelValue:this.perPassenger}]:[]},t.prototype.save=function(e,t){this.basketService.setMiSelectedValue(e,this,this.selectedValues[0].value.id,t)},t}(me),be=function(e,t){switch(e.uiPresentation){case re.FreeText:return new fe(e,t);case re.AutoSuggest:return new ye(e,t);case re.Hidden:return new ge(e);case re.Dropdown:return new ve(e,t);default:var r=e.uiPresentation;console.log(r)}return null},Se=function(e,t,r){var i=this;this.basketService=t,this.helpers=r,this.isValidObservers=[],this.basketItem=e;var n=e.managementInfo.reduce((function(e,t){var r=be(t,i.basketService);return i.isValidObservers.push(r),t.perBooking?e.perItem.push(r):e.perUser.push(r),e}),{perItem:[],perUser:[]}),a=n.perItem,o=n.perUser;this.miPerItem=a,this.miPerUser=e.users.reduce((function(e,t){return e[t.id]={managementInfo:i.helpers.clone(o).map((function(e){var t=be(e,i.basketService);return i.isValidObservers.push(t),t}))},e}),{}),this.users=Object.keys(this.miPerUser)};(ne=e.LogoutEnum||(e.LogoutEnum={}))[ne.LOGOUT=0]="LOGOUT",ne[ne.STAYIN=1]="STAYIN",(ae=e.LocationTypes||(e.LocationTypes={})).City="City",ae.Office="Office",ae.Airport="Airport",ae.TrainStation="Train Station",ae.Postcode="Postcode",ae.Shortlist="Shortlist",(oe=e.BreatfastTypes||(e.BreatfastTypes={})).BreakfastIncluded="BreakfastIncluded",oe.BreakfastNotIncluded="BreakfastNotIncluded",(se=e.HotelPolicyEnum||(e.HotelPolicyEnum={})).cancellation="cancellation",se.deposit="deposit",se.disabledAccess="disabledAccess",se.general="general",se.guarantee="guarantee",se.refundAvailable="refundAvailable",(ue=e.BookingStatus||(e.BookingStatus={}))[ue.Loading=0]="Loading",ue[ue.AddingItems=1]="AddingItems",ue[ue.AddingTravellers=2]="AddingTravellers",ue[ue.AddingLeadPassenger=3]="AddingLeadPassenger",ue[ue.Failed=4]="Failed",ue[ue.Revalidate=5]="Revalidate",ue[ue.RevalidatingError=6]="RevalidatingError",ue[ue.ChooseMIGroup=7]="ChooseMIGroup",ue[ue.ProvideMi=8]="ProvideMi",ue[ue.SendForApproval=9]="SendForApproval",ue[ue.AwaitingApproval=10]="AwaitingApproval",ue[ue.ApprovedPaymentOption=11]="ApprovedPaymentOption",ue[ue.ApprovedSupplemtal=12]="ApprovedSupplemtal",ue[ue.ApprovedBook=13]="ApprovedBook",ue[ue.PartiallyBooked=14]="PartiallyBooked",ue[ue.Complete=15]="Complete",(le=e.SchemaFormat||(e.SchemaFormat={})).array="array",le.datetime="date-time",le.integer="integer",le.object="object",le.select="select",le.string="string",le.boolean="boolean",le.countryCode="countryCode",le.additionalSeatPreference="additionalSeatPreference",le.seatPrefGroups="seatPrefGroups",le.railSeating="railSeating",(e.Widgets||(e.Widgets={})).COUNTRY_CODE="COUNTRY_CODE",(ce=e.PreferredFlags||(e.PreferredFlags={}))[ce.none=0]="none",ce[ce.officePreferred=1]="officePreferred",ce[ce.companyPreferred=2]="companyPreferred",ce[ce.tmcPreferred=4]="tmcPreferred",ce[ce.all=7]="all",(de=e.FlightDirectionEnum||(e.FlightDirectionEnum={}))[de.Outbound=1]="Outbound",de[de.Inbound=0]="Inbound",de[de.DualSingleOutbound=2]="DualSingleOutbound",de[de.DualSingleInbound=3]="DualSingleInbound",(pe=e.OBTFlightCabinClass||(e.OBTFlightCabinClass={})).Business="Business",pe.BusinessBranded="BrandedBusiness",pe.EconomyFlexi="EconomyFlexi",pe.EconomyFlexiBranded="BrandedEconomyFlexi",pe.EconomyNoBags="EconomyNoBags",pe.EconomyNoBagsBranded="BrandedEconomyNoBags",pe.EconomyRestricted="EconomyRestricted",pe.EconomyRestrictedBranded="BrandedEconomyRestricted",pe.First="First",pe.FirstBranded="BrandedFirst",pe.PremiumEconomy="PremiumEconomy",pe.PremiumEconomyBranded="BrandedPremiumEconomy",(he=e.EurostarClassEnum||(e.EurostarClassEnum={})).ANY="Any",he.BUSINESS_PREMIER="BusinessPremier",he.STANDARD_PREMIER="StandardPremier",he.STANDARD="Standard";var Te,Ce,De,Pe="("+["breakfast not included","breakfast is not included","Breakfast isn't included","Does not include breakfast","EXCL","exel Breakfast","Breakfast Costs","no breakfast"].join(")|(")+")",_e="("+["BREAKFAST INCLUDED","breakfast","BB","B&B","Bead and breakfast","Bed and breakfast","Bed&Break","INCLUDES BREAK","INCL BED AND BRE","BRKFST","BED AND BRKFST"].join(")|(")+")",Ae=new RegExp(_e,"i"),ke=new RegExp(Pe,"i");(Te=e.SearchHandler||(e.SearchHandler={})).AVAILABILITY="Availability",Te.FEMALE_FRIENDLY="SOLO Female Friendly",Te.CTM_GREEN_CHOICE="CTM Greener Choice",Te.BREAKFAST_INCLUDED="BreakfastIncluded",Te.BREAKFAST_NOT_INCLUDED="BreakfastNotIncluded",Te.CLIENT="Client",Te.AGENCY="Agency",Te.ANY="Any",(Ce=e.MenuSlideEnum||(e.MenuSlideEnum={})).IN="in",Ce.OUT="out",Ce.FLAT="flat",(De=e.RiskLevelRanking||(e.RiskLevelRanking={})).Low="1",De.Moderate="2",De.Medium="3",De.High="4",De.Extreme="5";var Fe;(Fe=e.ServiceProvider||(e.ServiceProvider={})).Confirma="Conferma",Fe.Evolvi="Evolvi",Fe.SabreCarHire="Sabre Car Hire",Fe.Lounges="Holiday Extras Lounges",Fe.FastTrack="Holiday Extras Fast Track",Fe.Parking="Holiday Extras Parking",Fe.CMAC="CMAC",Fe.FarelogixLFGNDC="Farelogix LFG NDC",Fe.BaNdc="BA NDC",Fe.EurostarSabre="Eurostar (Sabre)",Fe.Trainline="Trainline",(e.WellbeingEnum||(e.WellbeingEnum={})).WELLBEING="/results/wellbeing";var Oe=function(){function r(r,i){this.basketService=r,this.helpers=i,this.status=new t.BehaviorSubject(e.BookingStatus.Loading),this.basket=new t.BehaviorSubject({}),this.needsToViewMi=!0,this.isUpdating=new t.BehaviorSubject(!1),this.id=null}return r.prototype.loadBasket=function(r){this.id=r,this.basket=new t.BehaviorSubject({}),this.status.next(e.BookingStatus.Loading),this.isUpdating.next(!0),this._loadBasket(r)},r.prototype._loadBasket=function(e){var t=this;this.basketService.loadBasket(e),this.basketService.subsribeToBasket(e,{next:function(e){t.basket.next(e),t.updateBasket(e)},error:function(e){t.basket.error(e),console.error(e)},complete:function(){t.basket.complete(),console.log("Basket completed")}})},r.prototype.updateBasket=function(t){switch(this.isUpdating.next(!1),t.status){case _.Open:this.workoutOpenState(t);break;case _.AwaitingApproval:this.status.next(this.workoutState(t,e.BookingStatus.AwaitingApproval));break;case _.Approved:this.status.next(this.workoutApprovedState(t));break;case _.Booked:this.status.next(this.workoutState(t,e.BookingStatus.Complete));break;case _.BookingFailed:this.status.next(this.workoutState(t,e.BookingStatus.Failed));break;case _.Disapproved:case _.PartiallyBooked:this.status.next(e.BookingStatus.Failed);break;default:var r=t.status;console.log(r)}},r.prototype.sendBasketForApproval=function(){return this.basketService.sendBasketForApproval(this.id)},r.prototype.workoutApprovedState=function(t){var r=e.BookingStatus.ApprovedBook;if(t.basketItems.find((function(e){var t;return(null===(t=e.availablePaymentMethods)||void 0===t?void 0:t.length)>0&&!e.selectedPaymentMethod})))return this.workoutState(t,e.BookingStatus.ApprovedPaymentOption);console.log(t.suppInfo);var i=t.suppInfo.find((function(e){return e.hasDetails}));return console.log(i),i&&(r=e.BookingStatus.ApprovedSupplemtal),this.workoutState(t,r)},r.prototype.workoutState=function(t,r){return t.validated?r:(this._hasInvalidPrice(t),e.BookingStatus.Revalidate)},r.prototype.workoutOpenState=function(t){if(0!==t.basketItems.length)if(this._needsCorrectTravellers(t))this.status.next(e.BookingStatus.AddingTravellers);else{if(!this._needLeadPassengers(t))return t.validated?void(this._needsMiGroups(t)?this.status.next(e.BookingStatus.ChooseMIGroup):this.helpers.needsMi(t,this.needsToViewMi)?this.status.next(e.BookingStatus.ProvideMi):this.status.next(e.BookingStatus.SendForApproval)):(this._hasInvalidPrice(t),void this.status.next(e.BookingStatus.Revalidate));this.status.next(e.BookingStatus.AddingLeadPassenger)}else this.status.next(e.BookingStatus.AddingItems)},r.prototype.revalidate=function(){this.basketService.revalidate(this.id)},r.prototype.addTravellers=function(e,t,r,i){void 0===i&&(i=0),this.isUpdating.next(!0),this.basketService.addTravellers(e.id,t,r,i)},r.prototype.setLeadPassenger=function(e,t,r,i){void 0===i&&(i=0),this.isUpdating.next(!0),this.basketService.setLeadPassenger(e.id,t,r,i)},r.prototype.setBasketItemMiGroup=function(e,t){this.isUpdating.next(!0),this.basketService.setBasketItemMiGroup(e,t.basketItem.id,t.value)},r.prototype.saveMiGroup=function(e){var t=this;this.isUpdating.next(!0),e.forEach((function(e){t.setBasketItemMiGroup(t.id,e)}))},r.prototype.saveMi=function(e){this.needsToViewMi=!1,this.isUpdating.next(!0),e&&this.basketService.saveMiData(this.id,e)},r.prototype.removeExpiredItems=function(){this.isUpdating.next(!0),this.basketService.removeExpiredItems(this.id)},r.prototype.setBasketItemPaymentOption=function(e,t){return this.isUpdating.next(!0),this.basketService.setBasketItemPaymentOption(this.basket.value,e,t)},r.prototype.bookBasket=function(e){if(this.isUpdating.next(!0),e)return this.basketService.bookBasket(this.id,e)},r.prototype._needsMiGroups=function(e){return!!e.basketItems.find((function(e){return e.miGroupsAvailable.length>0&&!e.miGroupSelected}))},r.prototype._needsCorrectTravellers=function(e){var t=this;return!!e.basketItems.find((function(e){var r=t._splitTravellers(e);return e.service.type===ee.Parking?!(1===e.adults):!(r.adults.length===e.adults&&r.children.length===e.children&&r.infants.length===e.infants)}))},r.prototype._hasInvalidPrice=function(e){return!!e.basketItems.find((function(e){return!e.latestValidationPriceDifference||e.expired}))},r.prototype._needLeadPassengers=function(e){return!!e.basketItems.find((function(e){return!e.leadPassenger}))},r.prototype._splitTravellers=function(e){var t=this;return(e.userPassengerTypes||[]).reduce((function(r,i,n){switch(i.passengerType){case W.Adult:r.adults.push(t._findUser(e.users,Number(i.id)));break;case W.Child:r.children.push(t._findUser(e.users,Number(i.id)));break;case W.Infant:r.infants.push(t._findUser(e.users,Number(i.id)))}return r}),{adults:[],children:[],infants:[]})},r.prototype._findUser=function(e,t){return e.find((function(e){return Number(e.id)===t}))},r.prototype.getId=function(){return this.id},r}(),Re=function(e,t){this.key=e,this.value=t,this.next=null,this.pre=null},Ie=function(){function e(e){void 0===e&&(e=10),this.size=e,this.cache={},this.count=0,this.head=new Re("",null);var t=new Re("",null);this.head.next=t,t.pre=this.head}return e.prototype.get=function(e){return this.cache[e]?this.cache[e].value:null},e.prototype.set=function(e,t){var r=this.cache[e];r?(r.value=t,this.deleteItem(r),this.addToHead(r)):(this.cache[e]=new Re(e,t),this.addToHead(this.cache[e]))},e.prototype.hasKey=function(e){return this.cache.hasOwnProperty(e)},e.prototype.deleteItem=function(e){e.pre.next=e.next,e.next.pre=e.pre},e.prototype.addToHead=function(e){e.next=this.head.next,e.next.pre=e,e.pre=this.head,this.head.next=e},e}();function Ee(){return function(e,t,r){var i=new Ie,n=r.value;r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=JSON.stringify(e);return i.hasKey(r)||i.set(r,n.apply(this,e)),i.get(r)}}}var Ne,Be,Me,Le=function(){function t(){}return t.prototype.minToHour=function(e){return Math.floor(e/60)+"h "+e%60+"m"},t.prototype.makeColonTime=function(e){return e.substring(0,2)+":"+e.substring(2,4)},t.prototype.nonNullMin=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(t,r){return r&&r[e]&&t.min>Number(r[e])?{item:r,min:Number(r[e])}:t}),{min:Number.MAX_SAFE_INTEGER,item:null}).item},t.prototype.joinByComma=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return s.default.isEmpty(t)&&(e+=t+","),e}),"").slice(0,-1)},t.prototype.mutuallyInclude=function(e,t){try{return e.includes(t)||t.includes(e)}catch(e){return console.warn("Trying to mutually compare undefined variable."),!1}},t.prototype.findByKey=function(e,t,r){return e.filter((function(e){return e[t]===r})).pop()},t.prototype.dateToNgDate=function(e){return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},t.prototype.convertToYYMMDD=function(e){return e.length>6?this.formatDate(this.yyyymmddTimeToMoment(e)):e},t.prototype.formatDateToMMDDYYY=function(e){return u.default(e).format(t.MMDDYY_DATE)},t.prototype.formatDate=function(e){return(e=u.default(e)).format(t.DATE_FORMAT)},t.prototype.formatTime=function(e){try{return e.format(t.TIME_FORMAT)}catch(e){console.error(e)}},t.prototype.formatTimeColon=function(e){return(e=u.default(e)).format(t.TIME_FORMAT_COLON)},t.prototype.formatIsoDate=function(e){return(e=u.default(e)).format(t.ISO_DATA_FORMAT)},t.prototype.formatIsoDateTime=function(e){return(e=u.default(e)).format(t.ISO_DATA_FORMAT_TIME)},t.prototype.formatGraphQLDateTime=function(e){return(e=u.default(e)).format(t.GRAPHQL_DATA_FORMAT_TIME)},t.prototype.formatIsoDateNoHyphans=function(e){return(e=u.default(e)).format(t.ISO_DATA_FORMAT_NO_HYPHANS)},t.prototype.generateTimesList=function(e,t,r){void 0===e&&(e=0),void 0===t&&(t=24),void 0===r&&(r=15);for(var i=[],n=0;n<t-e;n++)for(var a=0;a<60;a+=r)i.push(u.default({hour:n,minute:a}).format("HH:mm"));return i},t.prototype.momentToNgDate=function(e){return e=u.default(e),this.dateToNgDate(e.toDate())},t.prototype.ngDateToDate=function(e){return new Date(e.year,e.month-1,e.day)},t.prototype.ngDateToMoment=function(e,t){var r=u.default(this.ngDateToDate(e));if(t){var i=t.split(":");2===i.length?r.set("hours",Number(i[0])).set("minutes",Number(i[1])):r.set("hours",Number(t.substr(0,2))).set("minutes",Number(t.substr(2,2)))}return r},t.prototype.todayToNgbDateStruct=function(){var e=u.default();return{year:e.year(),month:e.month()+1,day:e.date()}},t.prototype.objectToArray=function(e){return Object.keys(e).map((function(t){return e[t]}))},t.prototype.yyyymmddToDate=function(e){return new Date(Number(e.substring(0,4)),Number(e.substring(4,6))-1,Number(e.substring(6,8)))},t.prototype.yyyymmddToMoment=function(e){return u.default(this.yyyymmddToDate(e))},t.prototype.yymmddToMoment=function(e){return u.default(e,"YYMMDD")},t.prototype.yymmddToNgbDate=function(e){return this.momentToNgDate(this.yymmddToMoment(e))},t.prototype.yymmdd_hhmmToMoment=function(e,t){return u.default(e+" "+t,"YYMMDD HHmm")},t.prototype.yyyymmdd_hhmmToMoment=function(e,t){return u.default(e+" "+t,"YYYYMMDD HHmm")},t.prototype.yyyymmddToNgDate=function(e){return this.dateToNgDate(this.yyyymmddToDate(e))},t.prototype.yyyymmddTimeToNgDate=function(e,t){var r=this.yyyymmddToMoment(e).add(Number(t.substring(0,2)),"hours").add(Number(t.substring(2,4)),"minutes");return this.momentToNgDate(r)},t.prototype.yyyymmddTimeToMoment=function(e){return 6===e.length?u.default(""+e,"YYMMDD"):u.default(""+e,"YYYYMMDD")},t.prototype.hhmmToTime=function(e){return e.substring(0,2)+":"+e.substring(2,4)},t.prototype.dateStringToyyyymmdd=function(e){if("string"!=typeof e)return null;var t=/(\d{4})[-\/]?(\d{2})[-\/]?(\d{2})/.exec(e);return t?""+t[1]+t[2]+t[3]:null},t.prototype.timeStringTohh_mm=function(e){if("string"!=typeof e)return null;var t=/(\d{2})[:-]?(\d{2})/.exec(e);return t?t[1]+":"+t[2]:null},t.prototype.stringToBool=function(e){return e&&"false"!==e&&"0"!==e&&"no"!==e&&"n"!==e},t.prototype.clone=function(e){return s.default.cloneDeep(e)},t.prototype.replaceKeysInText=function(e,t){return Object.keys(t).reduce((function(e,r){return e.replace("%"+r,t[r])}),e)},t.prototype.getNextMinuets=function(e,t){return void 0===e&&(e=u.default()),void 0===t&&(t=15),e.minute(Math.ceil(e.minute()/t)*t),e.format("HH:mm")},t.prototype.getNumberOnceValue=function(e){var t=this.guid();return t+"_"+hex_hmac_md5(e,t)},t.prototype.guid=function(){for(var e="",t=0;t<32;t++)e+=this.s4();return e},t.prototype.s4=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)},t.prototype.capitaliseFirstLetter=function(e){return e.length>0?e[0].toUpperCase()+e.slice(1).toLowerCase():""},t.prototype.fromObject=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=e.shift(),i=0;r&&i<e.length;i+=1)r=r[e[i]];return r},t.prototype.momentRoundMinutes=function(e,t){var r=(e=u.default(e).startOf("minutes")).minutes()%t;return 0!==r&&(r=t-r),e.add(r,"minute")},t.prototype.round=function(e,t){return u.default(Math.ceil(+e/+t)*+t)},t.prototype.icsFold=function(e){return e.split(/\r\n/g).map((function(e){var t="";for(e=e.trim();e.length>72;)t+=e.slice(0,72)+"\r\n",e=" "+e.slice(72).trim();return e.trim()&&(t+=e),t})).join("\r\n")},t.prototype.splitAddressLine=function(e,t){var r={line:e.replace(/\s+/g," ").trim(),residue:""};if(r.line.length>t){var i=r.line.slice(0,t).lastIndexOf(",");i>0?(r.residue=r.line.slice(i+1).trim(),r.line=r.line.slice(0,i).trim()):(i=r.line.slice(0,t).lastIndexOf(" "))>0?(r.residue=r.line.slice(i+1).trim(),r.line=r.line.slice(0,i)):(r.residue=r.line.slice(t),r.line=r.line.slice(0,t))}return r},t.prototype.daysBetween=function(e,t){return t.diff(e,"days")},t.prototype.mapPromise=function(e,t,r){for(var i=e[Symbol.iterator](),n=[],a=[],o=0,s=function(){var e=i.next();if(!e.done){var r=o++;return Promise.resolve(t(e.value,r)).then((function(e){return n[r]=e,s()}))}};!r||a.length<=r;){var u=s();if(!u)break;a.push(u)}return Promise.all(a).then((function(){return n}))},t.prototype.mapSeriesPromise=function(e,t){return this.mapPromise(e,t,1)},t.prototype.obj2queryString=function(e){return s.default.reduce(e,(function(e,t,r){return""!==e&&(e+="&"),""+e+encodeURIComponent(r)+"="+encodeURIComponent(t)}),"")},t.prototype.stripPunctuation=function(e){return e.replace(/[^a-zA-Z0-9\s]/g,"")},t.prototype.replaceAll=function(e,t,r){return e?e.replace(new RegExp(t,"g"),r):null},t.prototype.dateTime=function(e,t){var r=e.match(/.{1,2}/g),i=t.match(/.{1,2}/g);return"20"+r[0]+"-"+r[1]+"-"+r[2]+"T"+i[0]+":"+i[1]+":00"},t.prototype.alternateJSONStringify=function(e){var t=JSON.stringify(e);return t=t.replace(/"/g,"`")},t.prototype.ConvertObjectToArray=function(e){var t=s.default.values(e);return t=s.default.flatten(t)},t.prototype.addDay=function(e){var t=new Date(e.year,e.month-1,e.day+1);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}},t.prototype.hashCode=function(e){for(var t=0,r=0;r<e.length;r+=1){t=(t<<5)-t+e.charCodeAt(r),t&=t}return t.toString()},t.prototype.MMddyyToNgb=function(e){return this.momentToNgDate(u.default(e,t.MMDDYY_DATE))},t.prototype.selectedChildrenTravellers=function(e,t){switch(t){case ee.Hotel:case ee.Cab:return[]}return e.filter((function(e){return e.isChild}))},t.prototype.selectedTravellers=function(e,t){switch(t){case ee.Hotel:case ee.Cab:return{adults:e,children:[],infants:[]};default:return e.reduce((function(e,t){return t.isChild?t.isInfant?e.infants.push(t):e.children.push(t):e.adults.push(t),e}),{adults:[],children:[],infants:[]})}},t.prototype.selectedAdultTravellers=function(e,t){switch(t){case ee.Hotel:case ee.Cab:return e}return e.filter((function(e){return!e.isChild&&!e.isInfant}))},t.prototype._isChild=function(e,r){return e instanceof Date?u.default().add(-r,"years").isBefore(u.default(e,t.ISO_DATA_FORMAT),"day"):e.isChild},t.prototype.isChildFlight=function(e){return this._isChild(e,16)},t.prototype.isChildRail=function(e){return this._isChild(e,12)},t.prototype.isChildEurostar=function(e){return this._isChild(e,12)},t.prototype.uniqBy=function(e,t){return s.default.uniqBy(e,t)},t.prototype.isChild=function(e,t){switch(t){case ee.Flight:return this._isChild(e,16);case ee.Rail:return this._isChild(e,12);case ee.Coach:return this._isChild(e,15);case ee.Lounge:return this._isChild(e,12);case ee.Hotel:case ee.Cab:default:return!1}},t.prototype.isInfant=function(e,t){switch(t){case ee.Flight:case ee.Rail:case ee.Coach:case ee.Lounge:return this._isChild(e,0);case ee.Hotel:case ee.Cab:default:return!1}},t.prototype.getAgeType=function(e,t){return this.isChild(e,t)?"C":"A"},t.prototype.getMaxChildAge=function(e){switch(e){case ee.Flight:return u.default().add(-15,"years").format(t.MMDDYY_DATE);case ee.Rail:return u.default().add(-11,"years").format(t.MMDDYY_DATE);case ee.Coach:return u.default().add(-14,"years").format(t.MMDDYY_DATE);case ee.Lounge:return u.default().add(-11,"years").format(t.MMDDYY_DATE)}},t.prototype.getDefaultAdultAge=function(e){switch(e){case ee.Flight:return u.default().add(-26,"years").format(t.MMDDYY_DATE);case ee.Rail:return u.default().add(-22,"years").format(t.MMDDYY_DATE);case ee.Coach:return u.default().add(-25,"years").format(t.MMDDYY_DATE);case ee.Lounge:return u.default().add(-22,"years").format(t.MMDDYY_DATE);case ee.Hotel:case ee.Cab:return u.default().add(-18,"years").format(t.MMDDYY_DATE)}return u.default().add(-18,"years").format(t.MMDDYY_DATE)},t.prototype.transform=function(e,t,r){return s.default.transform(e,t,r)},t.prototype.arrayToObject=function(e,t){return e.filter((function(e){return!!e})).reduce((function(e,r){return r&&r[t]&&(e[r[t]]=r),e}),{})},t.prototype.setFieldInObject=function(e,t,r){if(0===t.length)throw new Error("Invalid field");if(e||(e={}),1===t.length)e[t[0]]=e[t[0]]||[],e[t[0]].push(r);else{var i=t[0];e[i]=this.setFieldInObject(e[i],t.slice(1),r)}return e},t.prototype.arrayToObjectArray=function(e,t){var r=this;return e.filter((function(e){return!!e})).reduce((function(e,i){var n=t.reduce((function(e,t){var n=Array.isArray(t)?t.map((function(e){return r.fieldFromObject(i,e)})).join("_"):r.fieldFromObject(i,t);return e&&n?(e.push(n),e):null}),[]);if(i&&n)return r.setFieldInObject(e,n,i)}),{})},t.prototype.getTerminals=function(e){return e.terminals},t.prototype.fieldFromObject=function(e,t){return(Array.isArray(t)?t:(t||"").split(".")).reduce((function(e,t){return e&&e[t]?e[t]:null}),e)},t.prototype.mapFieldFromObject=function(e){return function(t){return t[e]}},t.prototype.removeNulls=function(e){var t=this;return e?u.default.isMoment(e)?e:Array.isArray(e)?e.map((function(e){return t.removeNulls(e)})).filter((function(e){return!!e}))||null:"object"==typeof e?Object.keys(e).reduce((function(r,i){if("_"!==i[0]){var n=e[i],a=t.removeNulls(n);(null!=a&&"null"!==a||Array.isArray(a)&&a.length>0)&&(r[i]=a)}return r}),{}):e:e},t.prototype.getTravellersId=function(e){if(e)return e.reduce((function(e,t,r){return 0===r?[t.id]:T(e,[t.id])}),[])},t.prototype.sanitizeMomentDates=function(e,t){var r,i;void 0===t&&(t=!1);var n=Object.assign({},e);try{for(var a=b(Object.entries(n)),o=a.next();!o.done;o=a.next()){var s=S(o.value,2),l=s[0],c=s[1];u.default.isMoment(c)&&(n[l]=n[l].toISOString())}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return t&&(console.log("-- sanitizeMomentDates() called --"),console.log("original query: ",e),console.log("sanitized query: ",n)),n},t.prototype.toStrings=function(e,t){var r=this;return Object.entries(t.properties||{}).reduce((function(i,n){var a=S(n,2),o=a[0],s=a[1],u=r._formatValue(e[o],s,(t.required||[]).includes(o));return null!==u&&(i[o]=u),i}),{})},t.prototype._formatValue=function(e,t,r){switch(t.type){case"integer":var i=Number.parseInt(e,10);return Number.isNaN(i)?r?0:null:i;case"string":var n=e?e.toString():null;return n&&n.length>0?n:r?"":null;case"object":return e?this.toStrings(e,t):r?{}:null;case"array":default:return e}},t.prototype.makeTimeWindow=function(e,t,r){var i=e.clone().add(t,"hour"),n=e.clone().add(r,"hour");return this.formatTime(i)+"-"+this.formatTime(n)},t.prototype.inRange=function(e,t){return e>=t.min&&e<=t.max},t.prototype.makeUsers=function(e){return e.map((function(e){return{id:e.id,passengerType:e.isChild?W.Child:e.isInfant?W.Infant:W.Adult}}))},t.prototype.makeMomentDayTime=function(e,t,r){var i=u.default();return void 0!==e&&i.add(e,"day"),void 0!==t&&i.set("hours",t),void 0!==r&&i.set("minutes",r),i},t.prototype.sanatizeReturns=function(e,t,r){var i=Object.assign({},e,t);return(r||[]).reduce((function(e,t){var r=e[t];return e[t]=r?"string"==typeof r?u.default(r):r:u.default(),e}),i)},t.prototype.miIsValid=function(e){return 0===e.length||!!e.find((function(e){return e.isValid()}))},t.prototype.isMiValid=function(e,t){var r=this,i=Object.values(t||{});return this.miIsValid(e)&&(0===i.length||!!i.find((function(e){return r.miIsValid(e.managementInfo)})))},t.prototype.needsMi=function(e,t){var r=this;return e.basketInfoMiDetails.length>0&&(t||!e.basketInfoMiDetails.find((function(e){return r.isMiValid(e.miPerItem,e.miPerUser)})))},t.prototype.findService=function(e,t){return Object.values(e).reduce((function(e,r){return e||r.find((function(e){return e.id===t}))}),null)},t.prototype.allTrue=function(e,t){return e.filter(t).length===e.length},t.prototype.joinFromAttribute=function(e,t,r){return r.map((function(e){return e[t]})).join(e)},t.prototype.splitUpArray=function(e,t,r){void 0===r&&(r=!0);var i=s.default.cloneDeep(e),n=[];if(i.length>t){for(;i.length>=t;)n.push(i.splice(0,t));i.length&&r&&n.push(i)}else n=i;return n},t.prototype.getTimeDifference=function(e,t){return u.default(e).diff(u.default(t),"minutes")},t.prototype.dayDifference=function(e,t){var r=u.default(t).startOf("day").diff(u.default(e).startOf("day"),"day");return r>0?r.toString():""},t.prototype.makeFareRules=function(t,r){var i=r===e.FlightDirectionEnum.Outbound?t.outboundFlights:t.inboundFlights;return{rules:i.reduce((function(e,t){var r,i,n,a,o;return e.cancellation=e.cancellation.concat((null===(r=t.fareConditions)||void 0===r?void 0:r.cancellation)||[]),e.change=e.change.concat((null===(i=t.fareConditions)||void 0===i?void 0:i.change)||[]),e.noShow=e.noShow.concat((null===(n=t.fareConditions)||void 0===n?void 0:n.noShow)||[]),e.upgrade=e.upgrade.concat((null===(a=t.fareConditions)||void 0===a?void 0:a.upgrade)||[]),e.other=e.other.concat((null===(o=t.fareConditions)||void 0===o?void 0:o.other)||[]),e}),{cancellation:[],change:[],noShow:[],upgrade:[],other:[]}),flights:i}},t.prototype.generateIcsFileContents=function(e){return["BEGIN:VCALENDAR\r\n","PRODID:-//Micros Travel//SABS Corporate - MMXIII//EN\r\n","VERSION:2.0\r\n","METHOD:REQUEST\r\n",this.generateIcsFileBodyContent(e),"END:VCALENDAR\r\n"].join("")},t.prototype.generateIcsFileBodyContent=function(e){var t=[];return e.map((function(e,r){var i={dStart:"",dEnd:"",locationFrom:"",locationTo:"",basketId:"",description:"",serviceType:"",summary:""},n="DD MMMM YYYY HH:mm",a=e.service.type,o=e.adults,s=e.children,l=e.bookingThirdPartyReference,c=e.detail,d=e.service;switch(a){case ee.Lounge:i.basketId=e.id,i.dStart=null==c?void 0:c.arrivalDatetime,i.dEnd="",i.summary="Airport Lounge - "+c.name,i.serviceType=d.type.toLowerCase(),i.description=["Lounge: "+c.name+"\r\n","Starts: "+u.default(c.arrivalDatetime).format(n)+"\r\n","Adults: "+o+"\r\n","Children: "+s+"\r\n","Booking Ref: "+l].join("");break;case ee.Cab:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.departs,i.dEnd="",i.summary="Taxi booking - from "+c.fromLocation.address+" to "+c.toLocation.address,i.description=["Pickup Point: "+c.fromLocation.address+"\r\n","Time: "+u.default(c.departs).format(n)+"\r\n","Booking Ref: "+l].join("");break;case ee.Car:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.pickUpDatetime,i.dEnd=null==c?void 0:c.dropOffDatetime,i.summary="Car booking - from "+c.pickUpLocation.address+" to "+c.dropOffLocation.address,i.description=["Pickup Point: "+c.pickUpLocation.address+"\r\n","Time: "+u.default(c.pickUpDatetime).format(n)+"\r\n","Arrival Point: "+c.dropOffLocation.address+"\r\n","Booking Ref: "+l].join(""),i.locationFrom=c.pickUpLocation.address,i.locationTo=c.dropOffLocation.address;break;case ee.Coach:case ee.FastTrack:case ee.Flight:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.outboundFlights[0].dateTimeDeparting,i.dEnd=null==c?void 0:c.outboundFlights[0].dateTimeArriving,i.summary="Flight Booking - From "+c.outboundFlights[0].originAirport+" to "+c.outboundFlights[0].destinationAirport,i.description=["From: "+c.outboundFlights[0].originAirport+"\r\n","Depart: "+u.default(c.outboundFlights[0].dateTimeDeparting).format(n)+"\r\n","To: "+c.outboundFlights[0].destinationAirport+"\r\n","Arrive: "+u.default(c.outboundFlights[0].dateTimeArriving).format(n)+"\r\n","Booking Ref: "+l].join("");break;case ee.Hotel:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.checkIn,i.dEnd=null==c?void 0:c.checkOut,i.summary="Hotel booking - "+c.hotelName,i.description=["Hotel: "+c.hotelName+"\r\n","Arrival: "+u.default(c.checkIn).format(n)+"\r\n","Departure: "+u.default(c.checkOut).format(n)+"\r\n","Booking Ref: "+l].join("");break;case ee.InternationalRail:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.outwardDetail.departureDateTime,i.dEnd=null==c?void 0:c.outwardDetail.arrivalDateTime,i.locationFrom=c.outwardDetail.departureStationName,i.locationTo=c.outwardDetail.arrivalDateTime,i.summary="Train Booking - From "+c.outwardDetail.departureStationName+" to "+c.outwardDetail.arrivalStationName,i.description=["From "+c.outwardDetail.departureStationName+"\r\n","To "+c.outwardDetail.arrivalStationName+"\r\n","Departure "+u.default(c.outwardDetail.departureDateTime).format(n)+"\r\n","Arrival "+u.default(c.outwardDetail.arrivalDateTime).format(n)+"\r\n","Booking Ref: "+l].join("");break;case ee.Parking:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.arrivalDatetime,i.dEnd=null==c?void 0:c.departDatetime,i.summary="Airport parking - "+c.name,i.description=["Airport Parking: "+c.name+"\r\n","Booking Ref: "+l].join("");break;case ee.Rail:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.outwardDetail.departureDateTime,i.dEnd=null==c?void 0:c.outwardDetail.arrivalDateTime,i.locationFrom=c.outwardDetail.departureStationName,i.locationTo=c.outwardDetail.arrivalDateTime,i.summary="Train Booking - From "+c.outwardDetail.departureStationName+" to "+c.outwardDetail.arrivalStationName,i.description=["From "+c.outwardDetail.departureStationName+"\r\n","To "+c.outwardDetail.arrivalStationName+"\r\n","Departure "+u.default(c.outwardDetail.departureDateTime).format(n)+"\r\n","Arrival "+u.default(c.outwardDetail.arrivalDateTime).format(n)+"\r\n","Booking Ref: "+l].join("")}t.push(["BEGIN:VEVENT\r\n",i.dStart?"DTSTART:"+u.default(i.dStart).format("YYYYMMDDTHHmmss")+"\r\n":"",i.dEnd?"DTEND:"+u.default(i.dEnd).format("YYYYMMDDTHHmmss")+"\r\n":"",'ORGANIZER;CN="Do not reply to this email":mailto:do_not_reply@sabscorp.com\r\n',i.locationTo&&i.locationFrom?"LOCATION: "+i.locationTo+" to "+i.locationFrom+" \r\n":"","TRANSP:OPAQUE\r\n","SEQUENCE:0\r\n","UID:"+i.serviceType+"_"+r+"_"+i.basketId+"@sabscorp.com\r\n","DTSTAMP:"+u.default().format("YYYYMMDDTHHmmss")+"\r\n","DESCRIPTION:"+i.description+"\r\n","SUMMARY:"+i.summary+"\r\n","END:VEVENT\r\n"].join(""))})),t.join("")},t.prototype.downloadIcs=function(e,t){var r=document.createElement("a");r.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),r.setAttribute("download",e),r.setAttribute("target","_blank"),r.style.display="none",r.click()},t.prototype.splitStringOnCapitals=function(e,t){void 0===t&&(t=!1);var r=e.split(/(?=[A-Z])/);return t?r.join(" "):r},t.prototype.createFlightFilters=function(e,t){return e.reduce((function(e,t){var r=t.outboundFlights.length-1;e.stops[r]=e.stops[r]||{display:0===r?"Direct":r+" stop"+(1!==r?"s":""),selected:!1,value:r+1};var i=t.inboundFlights?t.inboundFlights.length-1:0,n=i>r?i:r;e.totalStops[n]=e.totalStops[n]||{display:0===n?"Direct":n+" stop"+(1!==n?"s":""),selected:!1,value:n+1};var a=function(t){e.classes[t.cabinClass]=e.classes[t.cabinClass]||{display:t.cabinClass,selected:!1,value:t.cabinClass},e.airlines[t.marketingCarrier]=e.airlines[t.marketingCarrier]||{display:t.marketingCarrierName,selected:!1,value:t.marketingCarrier}};t.outboundFlights.forEach(a);var o=t.baggageAllowance.map((function(e){return e.qty})),s=o.length?Math.min.apply(Math,T(o)):0;e.baggage[s]=e.baggage[s]||{selected:!1,display:s+" bag"+(s>1?"s":""),value:s};var l=function(t,r,i,n,a){var o=t&&t[a]?t[a][i]:void 0;void 0!==o&&(e[r][o]=e[r][o]||{value:t[a][i],display:t[a][n],selected:!1})};l(t.outboundFlights,"depatureAirport","originAirport","originAirportName",0),l(t.outboundFlights,"arrivalAirport","destinationAirport","destinationAirportName",t.outboundFlights.length-1),e.price.min=e.price.min<t.total.price?e.price.min:t.total.price,e.price.max=e.price.max>t.total.price?e.price.max:t.total.price,e.duration.min=e.duration.min<t.outboundTotalDuration?e.duration.min:t.outboundTotalDuration,e.duration.max=e.duration.max>t.outboundTotalDuration?e.duration.max:t.outboundTotalDuration;var c=u.default(t.outboundFlights[0].dateTimeDeparting).get("hour");e.departureTime.min=e.departureTime.min<c?e.departureTime.min:c,e.departureTime.max=e.departureTime.max>c?e.departureTime.max:c;var d=u.default(t.outboundFlights[t.outboundFlights.length-1].dateTimeArriving).get("hour");if(e.arrivalTime.min=e.arrivalTime.min<d?e.arrivalTime.min:d,e.arrivalTime.max=e.arrivalTime.max>d?e.arrivalTime.max:d,t.inboundFlights&&t.inboundFlights.length>0){e.returnDuration.min=e.returnDuration.min<t.inboundTotalDuration?e.returnDuration.min:t.inboundTotalDuration,e.returnDuration.max=e.returnDuration.max>t.inboundTotalDuration?e.returnDuration.max:t.inboundTotalDuration;var p=t&&t.inboundFlights&&t.inboundFlights[0]?u.default(t.inboundFlights[0].dateTimeDeparting).get("hour"):-1;e.returnDepartureTime.min=e.returnDepartureTime.min<p?e.returnDepartureTime.min:p,e.returnDepartureTime.max=e.returnDepartureTime.max>p?e.returnDepartureTime.max:p;var h=u.default(t.outboundFlights[t.outboundFlights.length-1].dateTimeArriving).get("hour");e.returnArrivalTime.min=e.returnArrivalTime.min<h?e.returnArrivalTime.min:h,e.returnArrivalTime.max=e.returnArrivalTime.max>h?e.returnArrivalTime.max:h,(t.inboundFlights||[]).forEach(a),l(t.inboundFlights,"depatureReturnAirport","originAirport","originAirportName",0),l(t.inboundFlights,"arrivalReturnAirport","destinationAirport","destinationAirportName",t.outboundFlights.length-1)}return e}),this.clone(t))},t.prototype.mapOverObject=function(e,t){return Object.entries(e).reduce((function(e,r){return e[r[0]]=t(r[1],r[0]),e}),{})},t.prototype.normaliseMinuteToBase10=function(e){return Math.round(100*e/60)},t.prototype.OBTFlightCabinClassToFlightCabinClass=function(t){var r;return((r={})[e.OBTFlightCabinClass.Business]=x.Business,r[e.OBTFlightCabinClass.BusinessBranded]=x.Business,r[e.OBTFlightCabinClass.EconomyFlexi]=x.EconomyFlexi,r[e.OBTFlightCabinClass.EconomyFlexiBranded]=x.EconomyFlexi,r[e.OBTFlightCabinClass.EconomyNoBags]=x.EconomyNoBags,r[e.OBTFlightCabinClass.EconomyNoBagsBranded]=x.EconomyNoBags,r[e.OBTFlightCabinClass.EconomyRestricted]=x.EconomyRestricted,r[e.OBTFlightCabinClass.EconomyRestrictedBranded]=x.EconomyRestricted,r[e.OBTFlightCabinClass.First]=x.First,r[e.OBTFlightCabinClass.FirstBranded]=x.First,r[e.OBTFlightCabinClass.PremiumEconomy]=x.PremiumEconomy,r[e.OBTFlightCabinClass.PremiumEconomyBranded]=x.PremiumEconomy,r)[t]},t.prototype.FlightCabinClassToBrandedOBTFlightCabinClass=function(t,r){var i,n;return(r?((i={})[x.PremiumEconomy]=e.OBTFlightCabinClass.PremiumEconomyBranded,i[x.PremiumBusiness]=e.OBTFlightCabinClass.BusinessBranded,i[x.LiteEconomy]=e.OBTFlightCabinClass.EconomyRestrictedBranded,i[x.Economy]=e.OBTFlightCabinClass.EconomyRestrictedBranded,i[x.PremiumFirst]=e.OBTFlightCabinClass.FirstBranded,i[x.EconomyRestricted]=e.OBTFlightCabinClass.EconomyRestrictedBranded,i[x.PremiumEconomy]=e.OBTFlightCabinClass.PremiumEconomyBranded,i[x.EconomyFlexi]=e.OBTFlightCabinClass.EconomyFlexiBranded,i[x.EconomyNoBags]=e.OBTFlightCabinClass.EconomyNoBagsBranded,i[x.Business]=e.OBTFlightCabinClass.BusinessBranded,i[x.First]=e.OBTFlightCabinClass.FirstBranded,i):((n={})[x.PremiumEconomy]=e.OBTFlightCabinClass.PremiumEconomy,n[x.PremiumBusiness]=e.OBTFlightCabinClass.Business,n[x.LiteEconomy]=e.OBTFlightCabinClass.EconomyRestricted,n[x.Economy]=e.OBTFlightCabinClass.EconomyRestricted,n[x.PremiumFirst]=e.OBTFlightCabinClass.First,n[x.EconomyRestricted]=e.OBTFlightCabinClass.EconomyRestricted,n[x.PremiumEconomy]=e.OBTFlightCabinClass.PremiumEconomy,n[x.EconomyFlexi]=e.OBTFlightCabinClass.EconomyFlexi,n[x.EconomyNoBags]=e.OBTFlightCabinClass.EconomyNoBags,n[x.Business]=e.OBTFlightCabinClass.Business,n[x.First]=e.OBTFlightCabinClass.First,n))[t]},t.prototype.convertMetresToMiles=function(e,t){void 0===t&&(t=-1);var r=e/1609;return t>=0?Number(r.toFixed(t)):r},t.prototype.convertSecondsToHours=function(e,t){void 0===t&&(t=-1);var r=e/60/60;return t>=0?Number(r.toFixed(t)):r},t.prototype.convertSecondsToMins=function(e,t){void 0===t&&(t=-1);var r=e/60;return t>=0?Number(r.toFixed(t)):r},t.prototype.addRailActionRules=function(e,t){return t.reduce((function(e,t){return null!=(null==t?void 0:t.unavailable)&&(e.unavailable=t.unavailable,e.unavailableMessage=t.unavailableMessage),e}),e)},t.prototype.map=function(e,t){return Object.assign.apply(Object,T([{}],Object.entries(e).map((function(e){var r,i=S(e,2),n=i[0],a=i[1];return(r={})[n]=t(a),r}))))},t.prototype.mergeObjects=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return s.default.merge(e,t)}),{})},t.prototype.interceptMethodCalls=function(e,t){return new Proxy(e,{get:function(e,r){return"function"==typeof e[r]?new Proxy(e[r],{apply:function(e,i,n){return t(r,n),Reflect.apply(e,i,n)}}):Reflect.get(e,r)}})},t.prototype.getRoundedDownQuarterHour=function(e){var t=e.minutes();return t<=15?e.set("minutes",0):t<=30?e.set("minutes",15):t<=45?e.set("minutes",30):e.set("minutes",45),e},t.prototype.getRoundedUpQuarterHour=function(e){var t=e.minutes();return t<=15?e.set("minutes",15):t<=30?e.set("minutes",30):t<=45?e.set("minutes",45):(e.set("minutes",0),e.add(1,"hour")),e},t}();Le.READ_DATE_FORMAT="dd, D MMM YYYY",Le.READ_TIME_FORMAT="HH:mm",Le.DATE_FORMAT="YYMMDD",Le.GRAPHQL_DATA_FORMAT_TIME="YYYY-MM-DD HH:mm:ss",Le.ISO_DATA_FORMAT="YYYY-MM-DD",Le.ISO_DATA_FORMAT_TIME="YYYY-MM-DD HH:mm",Le.ISO_DATA_FORMAT_NO_HYPHANS="YYYYMMDD",Le.TIME_FORMAT="HHmm",Le.TIME_FORMAT_COLON="HH:mm",Le.MMDDYY_DATE="DDMMYYYY",f([Ee(),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",Number)],Le.prototype,"getTimeDifference",null),f([Ee(),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",String)],Le.prototype,"dayDifference",null),f([Ee(),y("design:type",Function),y("design:paramtypes",[Object,Number]),y("design:returntype",void 0)],Le.prototype,"makeFareRules",null),(Ne=e.TaxiFormMode||(e.TaxiFormMode={})).ADDRESS="location",Ne.STATION="station",(Be=e.AirportSearchMode||(e.AirportSearchMode={})).PICKUP="Airport Pick Up",Be.DROPOFF="Airport drop off",(Me=e.ActionType||(e.ActionType={})).GET="get",Me.SAVE="save",Me.DELETE="delete";var je,we=function(r){function i(n,a,o,s,l){var c=r.call(this,o,a)||this;c.cabfetcher=n,c.searchService=s,c.basketService=l,c.type=ee.Cab,c.airportChange=new t.Subject,c.transTypes=[{key:F.Any,value:"Any (1-8 Passengers)",id:8},{key:F.StandardCar,value:"Saloon Car (1-4 Passengers)",id:4},{key:F.BlackCab,value:"Hackney Carriage (1-4 Passengers)",id:4},{key:F.DdaCar,value:"Dda - wheelchair accessible (1-4 Passengers)",id:4},{key:F.MediumMpv,value:"People Carrier (1-7 Passengers)",id:7},{key:F.ExecutiveCar,value:"Executive (1-4 Passengers)",id:4}],c.attributes=[{enabled:!1,key:"wheelchair",value:"Wheelchair (On Request)"},{enabled:!1,key:"call_on_arrival",value:"Call On Arrival"},{enabled:!1,key:"meet_and_greet",value:"Meet And Greet (Charge Applies)"},{enabled:!1,key:"wait_and_return",value:"Wait And Return"}],c.searchTypes=["One-way","Return"],c.airportSearchTypes=["Airport drop off","Airport Pick Up"],c.criteria=["Pick Up Time"],c.mode=e.TaxiFormMode.ADDRESS,c.minSelectDate=u.default(),c.minReturnSelectDate={day:u.default().date(),month:u.default().month()+1,year:u.default().year()},c._date=null,c.selectedPlaces=[],c._vias=[null,null,null,null],c._searchType=c.searchTypes[0],c._airportSearchType=e.AirportSearchMode.DROPOFF,c._searchCriteria=c.criteria[0],c._outboundDateTime=c.helpers.round(u.default(),u.default.duration(15,"minutes")),c._returnDateTime=c.helpers.round(u.default(),u.default.duration(15,"minutes")),c._flightNumber="",c._terminal=null,c._time=null,c.resultsSessionName=i.STORAGE_SESSION_RESULTS,c.multiResultsSessionName=i.MULTI_STORAGE_SESSION_RESULTS,c.getPassengers=function(){var e=c.adults,t=c.children,r=e+" Adult";return 1!==Number(e)&&(r+="s"),1===Number(t)&&(r+=", "+t+" Child"),Number(t)>1&&(r+=", "+t+" Children"),r};var d=o.getSessionItem(i.STORAGE_SESSION_PARAMS)||{tempParams:{}};c.updateTempParams(s.makeCabHireQuery(d.tempParams));try{var p=o.getSessionItem(i.SECONDARY_STORAGE_SESSION_PARAMS);p&&(c.returnDateTime=u.default(p.tempParams.departs),c.searchType=c.searchTypes[1])}catch(e){console.error("+++ Error recovering return data: ",e," +++")}d.tempParams.fromAddress&&(c.fromAddress=d.tempParams.fromAddress),d.tempParams.toAddress&&(c.toAddress=d.tempParams.toAddress),s.shouldAddTravellerSubscription()&&s.travellerInformation.subscribe((function(e){c.travellers=e;var t=c.helpers.selectedTravellers(e,ee.Cab);c.tempParams.adults=t.adults.length,c.tempParams.children=t.children.length,c._isValid()}));var h=o.getSessionItemAsList(c.resultsSessionName)||[];c.fullResults=h,c._cheapestResultPrice=c.updateLowestPrice(h),c.results.next(h||[]);var m=o.getSessionItemAsList(c.multiResultsSessionName)||[];return c.fullMultiResults=m,c.multiResults.next(m),c._isValid(),c.outboundVisibility=new t.BehaviorSubject(!1),c.inboundVisibility=new t.BehaviorSubject(!1),c}return m(i,r),Object.defineProperty(i.prototype,"fromLocation",{get:function(){return this._fromLocation},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"toLocation",{get:function(){return this._toLocation},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"date",{get:function(){return this._date},set:function(e){this._date=e,this._updateDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"searchType",{get:function(){return this._searchType},set:function(e){this._searchType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"airportSearchType",{get:function(){return this._airportSearchType},set:function(e){this._airportSearchType=e,(this.fromAddress||this.toAddress)&&this.switchFromAndToLocation()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fromLocationType",{get:function(){return this.tempParams.fromLocationType},set:function(e){this.tempParams.fromLocationType=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"toLocationType",{get:function(){return this.tempParams.toLocationType},set:function(e){this.tempParams.toLocationType=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"searchCriteria",{get:function(){return this._searchCriteria},set:function(e){this._searchCriteria=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outboundDateTime",{get:function(){return this._outboundDateTime},set:function(e){this._outboundDateTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"returnDateTime",{get:function(){return this._returnDateTime},set:function(e){this._returnDateTime=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"flightNumber",{get:function(){return this._flightNumber},set:function(e){this._flightNumber=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"airport",{get:function(){return this.tempParams.airport},set:function(e){this.tempParams.airport=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"terminal",{get:function(){return this._terminal},set:function(e){this._terminal=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"time",{get:function(){return this._time},set:function(e){this._time=e,this._updateDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"departs",{get:function(){return this.tempParams.departs},set:function(e){this.tempParams.departs=e.isValid?e:null,e&&e.isValid()&&(this._date=this.helpers.momentToNgDate(e),this._time=this.helpers.formatTimeColon(e)),this.minReturnSelectDate={day:u.default(e).date(),month:u.default(e).month()+1,year:u.default(e).year()},e.isAfter(this.returnDateTime)&&this.returnDateTime.set("date",e.date()),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"adults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"children",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"infants",{get:function(){return this.tempParams.infants},set:function(e){this.tempParams.infants=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"countryCode",{get:function(){return this.tempParams.countryCode},set:function(e){this.tempParams.countryCode=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"vias",{get:function(){return this._vias},set:function(e){this._vias=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viasFrom",{get:function(){return this.tempParams.viasFrom},set:function(e){this.tempParams.viasFrom=e,this._vias[0]=e?this.createCabHireLocation(e):null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viasTo",{get:function(){return this.tempParams.viasTo},set:function(e){this.tempParams.viasTo=e,this._vias[1]=e?this.createCabHireLocation(e):null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"vehicleType",{get:function(){return this.tempParams.vehicleType},set:function(e){this.tempParams.vehicleType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fromAddress",{get:function(){return this.tempParams.fromAddress},set:function(e){this.tempParams.fromAddress=e,this._fromLocation=e?this.createCabHireLocation(e):null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fromStation",{get:function(){return this.tempParams.fromStation},set:function(e){this.tempParams.fromStation=e,this._fromLocation=e?{address:e.destination,postcode:e.postcode}:null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"toAddress",{get:function(){return this.tempParams.toAddress},set:function(e){this.tempParams.toAddress=e,this._toLocation=e?this.createCabHireLocation(e):null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"toStation",{get:function(){return this.tempParams.toStation},set:function(e){this.tempParams.toStation=e,this._toLocation=e?{address:e.destination,postcode:e.postcode}:null,this._isValid()},enumerable:!1,configurable:!0}),i.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeCabHireQuery());try{this.storageService.removeSessionItem(i.SECONDARY_STORAGE_SESSION_PARAMS)}catch(e){}this._searchType=this.searchTypes[0],this._isValid()},i.prototype.resetParams=function(){this.reset(),this.resetQuery(),this.results.next([]),this.multiResults.next([])},i.prototype._isValid=function(){this.doChecks&&(this.storageService.setSessionItem(i.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams}),this.validationMessages=[],this.tempParams.fromAddress||this.validationMessages.push("From - Enter a location or postcode."),this.tempParams.toAddress||this.validationMessages.push("To - Enter a location or postcode."),this.tempParams.departs.unix()<u.default().unix()&&this.validationMessages.push("Taxi journey cannot be in the past."),this.tempParams.adults+this.tempParams.children<1&&this.validationMessages.push("There must be at least 1 traveller"),this.searchType===this.searchTypes[1]&&this.returnDateTime.isSameOrBefore(this.departs)&&this.validationMessages.push("Return Date/Time must be after outbound date/time"),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages))},i.prototype._updateDateTime=function(){this._date&&this._time&&(this.departs=this.helpers.ngDateToMoment(this._date,this._time))},i.prototype.startSearch=function(){if(this.results.next([]),this.multiResults.next([]),this.isValid.value){if(this.searchType===this.searchTypes[1]){var e=this.getSearchQuery(),t=this.getReturnSearchQuery();return console.log("+++ Search Query: ",e," +++"),console.log("+++ Search Return Query: ",t," +++"),this.storageService.setSessionItem(i.SECONDARY_STORAGE_SESSION_PARAMS,{tempParams:t}),this._startMultiSearch([this.cabfetcher.fetchList(this.helpers.removeNulls(e)),this.cabfetcher.fetchList(this.helpers.removeNulls(t))])}e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(this.getSearchQuery())),this._startSearch(this.cabfetcher.fetchList(this.helpers.removeNulls(e)))}return Promise.resolve(!1)},i.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:ee.Cab,searchArgs:t,travelDate:this.departs.format(),travellers:this.helpers.getTravellersId(this.travellers)}},i.prototype.updateSerchQuery=function(e){var t=e;return t.fromAddress=this.tempParams.fromAddress,t.toAddress=this.tempParams.toAddress,t.fromStation=this.tempParams.fromStation,t.toStation=this.tempParams.toStation,t.viasFrom=this.viasFrom,t.viasTo=this.viasTo,t},i.prototype.startRecentSearch=function(e){this.departs=u.default(e.searchArgs.departs),this.vehicleType=e.searchArgs.vehicleType,this.fromAddress=e.searchArgs.fromAddress,this.toAddress=e.searchArgs.toAddress,this.fromStation=e.searchArgs.fromStation,this.toStation=e.searchArgs.toStation,this._fromLocation=this.createCabHireLocation(this.fromAddress),this._toLocation=this.createCabHireLocation(this.toAddress),this.viasFrom=e.searchArgs.viasFrom,this.viasTo=e.searchArgs.viasTo,this.searchService.startSearches()},i.prototype.getSearchQuery=function(){var e={adults:this.tempParams.adults,children:this.tempParams.children,departs:this.tempParams.departs,fromLocation:this.createCabHireLocation(this.tempParams.fromAddress),toLocation:this.createCabHireLocation(this.tempParams.toAddress),infants:0,vehicleType:this.vehicleType,vias:this._vias};return this.helpers.removeNulls(e)},i.prototype.getReturnSearchQuery=function(){var e={adults:this.tempParams.adults,children:this.tempParams.children,departs:this._returnDateTime,fromLocation:this.createCabHireLocation(this.tempParams.toAddress),toLocation:this.createCabHireLocation(this.tempParams.fromAddress),infants:0,vehicleType:this.vehicleType,vias:this._vias};return this.helpers.removeNulls(e)},i.prototype.updateOutboundAddress=function(e,t){this.tempParams.fromAddress=this.getAddressFormat(e,t)},i.prototype.updateInboundAddress=function(e,t){this.tempParams.toAddress=this.getAddressFormat(e,t)},i.prototype.createCabHireLocation=function(e){return{address:[null==e?void 0:e.Terminal,null==e?void 0:e.House,null==e?void 0:e.Street,null==e?void 0:e.Town,null==e?void 0:e.Country].filter((function(e){return!!e})).join(","),postcode:null==e?void 0:e.PostCode}},i.prototype.matchAddresses=function(){this._toLocation=this.createCabHireLocation(this.tempParams.toAddress),this._fromLocation=this.createCabHireLocation(this.tempParams.fromAddress),this._isValid()},i.prototype.sortBy=function(e,t){if(t>=0){console.log("here");var r=this.helpers.clone(this.fullMultiResults[t]);r=e?r.sort((function(e,t){return t.price-e.price})):r.sort((function(e,t){return e.price-t.price})),this.fullMultiResults[t]=r,this.multiResults.next(this.fullMultiResults)}else{r=this.helpers.clone(this.fullResults);r=e?r.sort((function(e,t){return t.price-e.price})):r.sort((function(e,t){return e.price-t.price})),this.results.next(r)}},i.prototype.getAddressFormat=function(e,t){return{House:this.getAddressFromPlaceDetails(e,["floor","street_number","premise"]),Street:this.getAddressFromPlaceDetails(e,["route","street_name","establishment"]),Town:this.getAddressFromPlaceDetails(e,["postal_town","administrative_area_level_2","locality"]),PostCode:this.getAddressFromPlaceDetails(e,["postal_code"]),Country:this.getAddressFromPlaceDetails(e,["country"]),placeDescription:t}},i.prototype.getAddressFromPlaceDetails=function(e,t){var r,i,n=null;if(e&&Array.isArray(e)){var a=function(t){var r=e.filter((function(e){return Array.isArray(e.types)&&e.types.includes(t)}))[0];if(r)return n=r.long_name,"break"};try{for(var o=b(t),s=o.next();!s.done;s=o.next()){if("break"===a(s.value))break}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}}return n},i.prototype.getAddressFromAirportDetails=function(e,t){console.log(e);var r=null;return e&&(r={Country:e.country,Street:e.road,PostCode:e.postcode,Town:e.city,placeDescription:t,House:t}),r},i.prototype.setLocationFromAirport=function(t,r){var i=this.getAddressFromAirportDetails(t,r);this.mode===e.TaxiFormMode.STATION&&(this.airportSearchType===e.AirportSearchMode.PICKUP?this.fromAddress=i:this.toAddress=i)},i.prototype.addToSelectedPlaces=function(e){this.selectedPlaces.push(e)},i.prototype.setOutboundFormVisibility=function(e){this.outboundVisibility.next(e)},i.prototype.setInboundFormVisibility=function(e){this.inboundVisibility.next(e)},i.prototype.getOutboundFormVisibility=function(){return this.outboundVisibility},i.prototype.getInboundFormVisibility=function(){return this.inboundVisibility},i.prototype.updateFromPreviousSearches=function(e){var t;null===(t=e[ee.Flight])||void 0===t||t.searchQuery},i.prototype.getTransType=function(){var e,t=this.tempParams.vehicleType;return(null===(e=this.transTypes.find((function(e){return e.key===t})))||void 0===e?void 0:e.value)||""},i.prototype.addCabHireToBasket=function(e,t){return g(this,void 0,void 0,(function(){var r,i,n;return v(this,(function(a){switch(a.label){case 0:return e.unavailable?[2,Promise.resolve(!1)]:[4,this.basketService.getDefaultBasket()];case 1:return r=a.sent(),i=null==r?void 0:r.subject.value,n=this.getTermsAndCond(e),i?[2,this.basketService.addToBasket({adults:t.adults,basket:i.id,service:e.sourceId.toString(),detail:{id:e.id,departs:e.departs,supplierName:e.supplierName,estimatedCO2:e.estimatedCO2,fromLocation:{address:t.fromLocation.address,postcode:t.fromLocation.postcode,latitude:e.fromLocation.latitude,longitude:e.fromLocation.longitude},toLocation:{address:t.toLocation.address,postcode:t.toLocation.postcode,latitude:e.toLocation.latitude,longitude:e.toLocation.longitude},vehicleType:t.vehicleType,tripDistanceMetres:e.tripDistanceMetres,tripDurationSeconds:e.tripDurationSeconds,termsAndCond:n},price:e.price,currency:e.currency,searchQuery:t,co2PerItem:e.co2PerItem,co2PerPassenger:e.co2PerPassenger,outboundDate:t.departs.format()},r,this.searchService,this.travellers)]:[2,Promise.resolve(!1)]}}))}))},i.prototype.switchFromAndToLocation=function(){var e=Object.assign({},this.toAddress),t=Object.assign({},this.fromAddress);this.fromAddress=e,this.toAddress=t},i.prototype.updateLowestPrice=function(e){if(!e.length)return null;var t=e[0].currency;return e.reduce((function(e,t){var r=t.price;return e.amount>r&&(e.amount=r),e}),{amount:Number.MAX_SAFE_INTEGER,currencyCode:t})},i.prototype.getTermsAndCond=function(e){var t=u.default(e.departs).format(Le.ISO_DATA_FORMAT_TIME);return[{name:"Lowest Price",value:e.price.toString()+" "+e.currency},{name:"Pickup Time",value:t},{name:"Terms and Conditions",value:'<a target="_blank" href="https://www.cmacgroup.com/">www.cmacgroup.com</a>'}]},i.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:ee.Cab,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},i}(c);we.STORAGE_SESSION_PARAMS="search_cab",we.SECONDARY_STORAGE_SESSION_PARAMS="secondary_search_cab",we.STORAGE_SESSION_RESULTS="results_cab",we.MULTI_STORAGE_SESSION_RESULTS="multi_results_cab",(je=e.SortTypesCar||(e.SortTypesCar={})).price="price",je.brand="brand",je.size="size",je.preferred="preferred",je.expensive="expensive";var xe=function(i){function n(t,r,a,o,s,l){var c=i.call(this,s,a)||this;c.carhirefetcher=t,c.carHireAvailabilityDetailFetcher=r,c.basketService=o,c.searchService=l,c._carTypeCodes=[["B","2-3 Door",I.TwoToThreeDoor],["C","2/4 Door",I.TwoOrFourDoor],["D","4-5 Door",I.FourToFiveDoor],["W","Wagon / Estate",I.WagonOrEstate],["V","Passenger Van",I.PassengerVan],["L","Limousine",I.Limousine],["S","Sport",I.Sport],["T","Convertible",I.Convertible],["F","SUV",I.Suv],["J","Open Air All Terrain",I.OpenAirAllTerrain],["X","Special",I.Special],["P","Pickup Regular Cab",I.PickUpRegularCab],["Q","Pickup Extended Cab",I.PickUpExtendedCab],["Z","Special Offer Car",I.SpecialOfferCar],["E","Coupe",I.Coupe],["M","Monospace (Europe)",I.MonospaceEuropeanUse],["R","Recreational Vehicle",I.Suv],["H","Motor Home",I.MotorHome],["Y","2-Wheel Vehicle",I.TwoWheelVehicle],["N","Roadster",I.Roadster],["G","Crossover",I.Suv],["K","Commercial Van / Truck",I.PassengerVan]],c._carAirConditionTypes=[["Any","Any",null],["Y","Yes",!0],["N","No",!1]],c._withinDistance=[{name:"1 mile",value:"1"},{name:"2 miles",value:"2"},{name:"5 miles",value:"5"},{name:"10 miles",value:"10"},{name:"20 miles",value:"20"}],c._carTransmissionCodes=[["M","Manual",R.Manual],["N","Manual 4-Wheel Drive",R.Manual],["C","Manual All-Wheel Drive",R.Manual],["A","Automatic",R.Auto],["B","Automatic 4-Wheel Drive",R.Auto],["D","Automatic All- Wheel Drive",R.Auto]],c._vendors=[{code:"-",name:"Any"},{code:"AC",name:"Ace Rent A Car"},{code:"AD",name:"Advantage Rent A Car"},{code:"AL",name:"Alamo"},{code:"ZI",name:"Avis"},{code:"AT",name:"Atesa"},{code:"ZD",name:"Budget Rent A Car"},{code:"CI",name:"Citer Rent A Car"},{code:"ZR",name:"Dollar Rent A Car"},{code:"DF",name:"Driving Force"},{code:"EY",name:"Economy Rent A Car"},{code:"ET",name:"Enterprise"},{code:"EP",name:"Europcar"},{code:"IM",name:"Europcar Southafrica"},{code:"EZ",name:"Ez Rent A Car"},{code:"FF",name:"Firefly"},{code:"FX",name:"Fox Rent A Car"},{code:"GN",name:"Guerin Car Rental"},{code:"ZE",name:"Hertz"},{code:"LM",name:"L & M Car Rental"},{code:"LL",name:"Localiza"},{code:"MW",name:"Midway Car Rental"},{code:"ZL",name:"National Car Rental System"},{code:"NC",name:"Nextcar"},{code:"NU",name:"Nu Car Rentals"},{code:"ZA",name:"Payless Car Rental"},{code:"PR",name:"Priceless"},{code:"RW",name:"Rent A Wreck"},{code:"SX",name:"Sixt"},{code:"TE",name:"Tempest"},{code:"XF",name:"Test-S Cross Galileo"},{code:"XG",name:"Test-S Cross Trng"},{code:"ZT",name:"Thrifty Car Rental"},{code:"PM",name:"Travelport Test Code"},{code:"SV",name:"U-Save Auto Rental"},{code:"WF",name:"Woodford"}],c._car_classes=[{code:"M",name:"Mini",key:O.Mini,value:"10"},{code:"N",name:"Mini Elite",key:O.MiniElite,value:"20"},{code:"E",name:"Economy",key:O.Economy,value:"30"},{code:"H",name:"Economy Elite",key:O.EconomyElite,value:"40"},{code:"C",name:"Compact",key:O.Compact,value:"50"},{code:"D",name:"Compact Elite",key:O.CompactElite,value:"60"},{code:"I",name:"Intermediate",key:O.Intermediate,value:"70"},{code:"J",name:"Intermediate Elite",key:O.IntermediateElite,value:"80"},{code:"S",name:"Standard",key:O.Standard,value:"90"},{code:"R",name:"Standard Elite",key:O.StandardElite,value:"100"},{code:"F",name:"Full Size",key:O.Fullsize,value:"110"},{code:"G",name:"Full Size Elite",key:O.FullsizeElite,value:"120"},{code:"P",name:"Premium",key:O.Premium,value:"130"},{code:"U",name:"Premium Elite",key:O.PremiumElite,value:"140"},{code:"L",name:"Luxury",key:O.Luxury,value:"150"},{code:"W",name:"Luxury Elite",key:O.LuxuryElite,value:"160"},{code:"O",name:"Oversize",key:O.Oversize,value:"170"},{code:"X",name:"Special",key:O.Special,value:"180"}],c._location_types=[e.LocationTypes.City,e.LocationTypes.Airport,e.LocationTypes.Postcode],c.carClassMap={mini:0,"mini elite":1,economy:2,"economy elite":3,compact:4,"compact special":5,"compact elite":6,intermediate:7,"intermediate elite":8,standard:9,"standard elite":10,"full size":11,"full size elite":12,premium:13,"premium elite":14,luxury:15,"luxury elite":16,oversize:17,special:18},c.type=ee.Car,c._sorting_options=[{value:0,display:"Cheapest First"},{value:1,display:"Most Expensive First"},{value:2,display:"Preferred First"}],c._minDate={day:u.default().date(),month:u.default().month()+1,year:u.default().year()},c._minInDate={day:u.default().date(),month:u.default().month()+1,year:u.default().year()},c._pickup_date=null,c._pickup_time=null,c._dropoff_date=null,c._dropoff_time=null,c.resultsSessionName=n.STORAGE_SESSION_RESULTS,c.multiResultsSessionName=n.STORAGE_SESSION_RESULTS;var d=s.getSessionItem(n.STORAGE_SESSION_PARAMS)||{tempParams:{}};c.updateTempParams(l.makeCarHireQuery(d.tempParams)),l.shouldAddTravellerSubscription()&&l.travellerInformation.subscribe((function(e){var t=c.helpers.selectedTravellers(e,ee.Car);c.adults=t.adults.length,c.children=t.children.length,c.travellers=e,c._isValid()}));var p=s.getSessionItemAsList(c.resultsSessionName)||[];return c.fullResults=a.clone(p||[]),c._cheapestResultPrice=c.updateLowestPrice(p),c.results.next(p),c}return m(n,i),Object.defineProperty(n.prototype,"adults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"children",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"estimatedMileage",{get:function(){return this.tempParams.estimatedMileage},set:function(e){this.tempParams.estimatedMileage=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickupTime",{get:function(){return this._pickupTime},set:function(e){this._pickupTime=e,this._updateNgbPickupDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoffTime",{get:function(){return this._dropoffTime},set:function(e){this._dropoffTime=e,this._updateNgbDropoffDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"postcodePickupRaw",{get:function(){return this.tempParams.postcodePickupRaw},set:function(e){this.tempParams.postcodePickupRaw=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"postcodeDropoffRaw",{get:function(){return this.tempParams.postcodeDropoffRaw},set:function(e){this.tempParams.postcodeDropoffRaw=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cityPickupDepot",{get:function(){return this.tempParams.cityPickupDepot},set:function(e){this.tempParams.cityPickupDepot=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cityDropoffDepot",{get:function(){return this.tempParams.cityDropoffDepot},set:function(e){this.tempParams.cityDropoffDepot=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"postcodePickup",{get:function(){return this.tempParams.postcodePickup},set:function(t){this.tempParams.postcodePickup=t,this.tempParams.postcodePickup&&(this.tempParams.locationType=e.LocationTypes.Postcode),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"postcodeDropoff",{get:function(){return this.tempParams.postcodeDropoff},set:function(e){this.tempParams.postcodeDropoff=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cityPickup",{get:function(){return this.tempParams.cityPickup},set:function(t){this.tempParams.cityPickup=t,this.tempParams.cityPickup&&(this.tempParams.locationType=e.LocationTypes.City,console.log(this.tempParams.locationType)),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cityDropoff",{get:function(){return this.tempParams.cityDropoff},set:function(e){this.tempParams.cityDropoff=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"minDate",{get:function(){return this._minDate},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"minInDate",{get:function(){return this._minInDate},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickup_country",{get:function(){return this.tempParams.pickup_country},set:function(e){this.tempParams.pickup_country=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoff_country",{get:function(){return this.tempParams.dropoff_country},set:function(e){this.tempParams.dropoff_country=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickup_location",{get:function(){return this.tempParams.pickup_location},set:function(t){this.tempParams.pickup_location=t,this.tempParams.pickup_location&&(this.tempParams.locationType=e.LocationTypes.Airport),this.return_to_pickup&&(this.dropoff_location=t),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoff_location",{get:function(){return this.tempParams.dropoff_location},set:function(e){this.tempParams.dropoff_location=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ngbPickupDate",{get:function(){return this._ngbPickupDate},set:function(e){this._ngbPickupDate=e,this._updateNgbPickupDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ngbDropoffDate",{get:function(){return this._ngbDropoffDate},set:function(e){this._ngbDropoffDate=e,this._updateNgbDropoffDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickup_datetime",{get:function(){return this.tempParams.pickup_datetime},set:function(e){this.tempParams.pickup_datetime=e;try{e&&e.isValid()&&(this._ngbPickupDate=this.helpers.momentToNgDate(e),this._pickupTime=u.default(e).format("HH:mm")?u.default(e).format("HH:mm"):"07:30"),this._minInDate={day:e.date(),month:e.month()+1,year:e.year()},e.isSameOrAfter(this.tempParams.dropoff_datetime)&&(this.dropoff_datetime=this.dropoff_datetime.set("date",e.date()).set("month",e.month()).set("year",e.year()))}catch(e){}this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoff_datetime",{get:function(){return this.tempParams.dropoff_datetime},set:function(e){this.tempParams.dropoff_datetime=e,e&&e.isValid()&&(this._ngbDropoffDate=this.helpers.momentToNgDate(e),this._dropoffTime=u.default(e).format("HH:mm")?u.default(e).format("HH:mm"):"08:30"),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickup_date",{get:function(){return this._pickup_date},set:function(e){this._pickup_date=e,this._updatePickupDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickup_time",{get:function(){return this._pickup_time},set:function(e){this._pickup_time=e,this._updatePickupDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoff_date",{get:function(){return this._dropoff_date},set:function(e){this._dropoff_date=e,this._updateDropoffDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoff_time",{get:function(){return this._dropoff_time},set:function(e){this._dropoff_time=e,this._updateDropoffDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"return_to_pickup",{get:function(){return this.tempParams.return_to_pickup},set:function(e){this.tempParams.return_to_pickup=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenVendor",{get:function(){return this.tempParams.chosenVendor},set:function(e){this.tempParams.chosenVendor=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenDistance",{get:function(){return this.tempParams.chosenDistance},set:function(e){this.tempParams.chosenDistance=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carClass",{get:function(){return this.tempParams.carClass},set:function(e){this.tempParams.carClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carType",{get:function(){return this.tempParams.carType},set:function(e){this.tempParams.carType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"transmission",{get:function(){return this.tempParams.transmission},set:function(e){this.tempParams.transmission=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"airCon",{get:function(){return this.tempParams.airCon},set:function(e){this.tempParams.airCon=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"locationType",{get:function(){return this.tempParams.locationType},set:function(e){this.tempParams.locationType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"timeArray",{get:function(){return this._timeArray=this._timeArray||Array(96).fill(0).map((function(e,t){return{value:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0"),display:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0")}})),this._timeArray},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carAirConditionTypes",{get:function(){return this._carAirConditionTypes},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"withinDistance",{get:function(){return this._withinDistance},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carTransmissionCodes",{get:function(){return this._carTransmissionCodes},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carTypeCodes",{get:function(){return this._carTypeCodes},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"vendors",{get:function(){return this._vendors},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sortingOptions",{get:function(){return this._sorting_options},enumerable:!1,configurable:!0}),n.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeCarHireQuery()),this.estimatedMileage=null,this._isValid()},n.prototype._isValid=function(){var t,r,i;if(this.doChecks){switch(this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams}),this.validationMessages=[],this.locationType){case e.LocationTypes.Airport:this.pickup_location&&this.pickup_location.destination||this.validationMessages.push("Please supply a pickup location"),this.dropoff_location&&this.dropoff_location.destination||this.validationMessages.push("Please supply a dropoff location");break;case e.LocationTypes.City:this.cityPickup||this.validationMessages.push("Please supply a pickup city"),this.cityDropoff||this.validationMessages.push("Please supply a dropoff city");break;case e.LocationTypes.Postcode:this.postcodePickup||this.validationMessages.push("Please supply a pickup depot"),this.postcodeDropoff||this.validationMessages.push("Please supply a dropoff depot")}this.estimatedMileage&&this.estimatedMileage<=0&&this.validationMessages.push("Estimated Milage must be a positive number.");try{this.pickup_datetime||this.validationMessages.push("Please supply a pickup time and date"),this.dropoff_datetime||this.validationMessages.push("Please supply a drop off time and date"),(null===(t=this.dropoff_datetime)||void 0===t?void 0:t.isSameOrBefore(this.pickup_datetime,"minute"))&&this.validationMessages.push("Dropoff date/time cannot be before or the same as pickup date/time"),(null===(r=this.pickup_datetime)||void 0===r?void 0:r.isBefore(u.default()))&&this.validationMessages.push("Pickup date/time must be after present date/time"),(null===(i=this.dropoff_datetime)||void 0===i?void 0:i.isBefore(u.default()))&&this.validationMessages.push("Dropoff date/time must be after present date/time")}catch(e){}this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages)}},n.prototype.startSearch=function(){if(this.results.next([]),this.isValid.value){var e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(this.getSearchQuery())),this._startSearch(this.carhirefetcher.fetchList(this.helpers.removeNulls(e)))}return Promise.resolve(!1)},n.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:ee.Car,searchArgs:t,travelDate:this.pickup_datetime.format(),travellers:this.helpers.getTravellersId(this.travellers)}},n.prototype.updateSerchQuery=function(t){var r=t;switch(this.locationType){case e.LocationTypes.City:r.city={pickupName:this.cityPickup.name,pickupCountryCode:this.cityPickup.countryCode,pickupCity:this.cityPickup.id.toString(),pickupLatitude:this.cityPickup.latitude,pickupLongitude:this.cityPickup.longitude,dropOffName:this.cityDropoff.name,dropoffCountryCode:this.cityDropoff.countryCode,dropoffCity:this.cityDropoff.id.toString(),dropOffLatitude:this.cityDropoff.latitude,dropOffLongitude:this.cityDropoff.longitude,pickupAddressLines:this.cityPickupDepot.addressLines[0],pickupCityName:this.cityPickupDepot.cityName,pickupExtendedLocationCode:this.cityPickupDepot.extendedLocationCode,pickupLocationCode:this.cityPickupDepot.locationCode,pickupVendor:this.cityPickupDepot.vendor,pickupVendorCode:this.cityPickupDepot.vendorCode,chosenDistance:this.chosenDistance,dropOffAddressLines:this.cityDropoffDepot.addressLines[0],dropOffCityName:this.cityDropoffDepot.cityName,dropOffExtendedLocationCode:this.cityDropoffDepot.extendedLocationCode,dropOffLocationCode:this.cityDropoffDepot.locationCode,dropOffVendor:this.cityDropoffDepot.vendor,dropOffVendorCode:this.cityDropoffDepot.vendorCode};break;case e.LocationTypes.Postcode:r.depot={vendorCode:this.postcodePickup.vendorCode,pickupLocationCode:this.postcodePickup.locationCode,pickupExtendedLocationCode:this.postcodePickup.extendedLocationCode,pickupAddressLines:this.postcodePickup.addressLines[0],pickupCityName:this.postcodePickup.cityName,pickupVendor:this.postcodePickup.vendor,dropOffLocationCode:this.postcodeDropoff.locationCode,dropOffExtendedLocationCode:this.postcodeDropoff.extendedLocationCode,dropoffAddressLines:this.postcodeDropoff.addressLines[0],dropoffCityName:this.postcodeDropoff.cityName,dropoffVendor:this.postcodeDropoff.vendor,chosenDistance:this.chosenDistance,pickupPostCode:this.postcodePickupRaw.name,pickupLatitude:this.postcodePickupRaw.latitude,pickupLongitude:this.postcodePickupRaw.longitude,dropoffPostCode:this.postcodeDropoffRaw.name,dropoffLatitude:this.postcodeDropoffRaw.latitude,dropoffLongitude:this.postcodeDropoffRaw.longitude}}return r},n.prototype.startRecentSearch=function(e){this.chosenVendor=e.searchArgs.vendor,this.carClass=e.searchArgs.class,this.carType=e.searchArgs.type,this.transmission=e.searchArgs.transmission,this.airCon=e.searchArgs.aircon,this.estimatedMileage=e.searchArgs.estimatedDailyDistance,this.dropoff_datetime=u.default(e.searchArgs.dropoffDateTime),this.pickup_datetime=u.default(e.searchArgs.pickupDateTime),e.searchArgs.city?this.getParamsForCarbyCity(e):e.searchArgs.airport?this.getParamsForCarbyAirport(e):e.searchArgs.depot&&this.getParamsForCarbyPostCode(e)},n.prototype.getParamsForCarbyAirport=function(r){var i=this;this.locationType=e.LocationTypes.Airport,t.combineLatest([this.searchService.getAirportByCode(r.searchArgs.airport.pickupCode),this.searchService.getAirportByCode(r.searchArgs.airport.dropoffCode)]).subscribe((function(e){var t,r,n,a,o,s,u,l,c,d,p,h,m=S(e,2),f=m[0],y=m[1];f&&y&&(i.dropoff_location={destination:f.iataMatch.name,gateway:f.iataMatch.iata,terminals:i.searchService.processTerminals(y.iataMatch.terminals),country:null===(r=null===(t=f.iataMatch)||void 0===t?void 0:t.locationDetails)||void 0===r?void 0:r.country,postcode:null===(a=null===(n=f.iataMatch)||void 0===n?void 0:n.locationDetails)||void 0===a?void 0:a.postcode,countryCode:null===(s=null===(o=f.iataMatch)||void 0===o?void 0:o.locationDetails)||void 0===s?void 0:s.countryCode},i.pickup_location={destination:y.iataMatch.name,gateway:y.iataMatch.iata,terminals:i.searchService.processTerminals(y.iataMatch.terminals),country:null===(l=null===(u=y.iataMatch)||void 0===u?void 0:u.locationDetails)||void 0===l?void 0:l.country,postcode:null===(d=null===(c=y.iataMatch)||void 0===c?void 0:c.locationDetails)||void 0===d?void 0:d.postcode,countryCode:null===(h=null===(p=y.iataMatch)||void 0===p?void 0:p.locationDetails)||void 0===h?void 0:h.countryCode},i.dropoff_country=i.dropoff_location.countryCode,i.pickup_country=i.pickup_location.countryCode,i.searchService.startSearches())}))},n.prototype.getParamsForCarbyCity=function(t){this.locationType=e.LocationTypes.City,this.chosenDistance=t.searchArgs.city.chosenDistance,this.cityPickup={countryCode:t.searchArgs.city.pickupCountryCode,id:t.searchArgs.city.pickupCity,name:t.searchArgs.city.pickupName,type:e.LocationTypes.City,latitude:t.searchArgs.city.pickupLatitude,longitude:t.searchArgs.city.pickupLongitude},this.cityDropoff={countryCode:t.searchArgs.city.dropoffCountryCode,id:t.searchArgs.city.dropoffCity,name:t.searchArgs.city.dropOffName,type:e.LocationTypes.City,latitude:t.searchArgs.city.dropOffLatitude,longitude:t.searchArgs.city.dropOffLongitude},this.cityDropoffDepot={addressLines:[t.searchArgs.city.dropOffAddressLines],cityName:t.searchArgs.city.dropOffCityName,extendedLocationCode:t.searchArgs.city.dropOffExtendedLocationCode,locationCode:t.searchArgs.city.dropOffLocationCode,vendor:t.searchArgs.city.dropOffVendor,vendorCode:t.searchArgs.city.dropOffVendorCode},this.cityPickupDepot={addressLines:[t.searchArgs.city.pickupAddressLines],cityName:t.searchArgs.city.pickupCityName,extendedLocationCode:t.searchArgs.city.pickupExtendedLocationCode,locationCode:t.searchArgs.city.pickupLocationCode,vendor:t.searchArgs.city.pickupVendor,vendorCode:t.searchArgs.city.pickupVendorCode},this.searchService.startSearches()},n.prototype.getParamsForCarbyPostCode=function(t){this.locationType=e.LocationTypes.Postcode,this.chosenDistance=t.searchArgs.depot.chosenDistance,this.postcodeDropoff={addressLines:[t.searchArgs.depot.dropoffAddressLines],vendorCode:t.searchArgs.depot.vendorCode,locationCode:t.searchArgs.depot.dropOffLocationCode,extendedLocationCode:t.searchArgs.depot.dropOffExtendedLocationCode,cityName:t.searchArgs.depot.dropoffCityName,vendor:t.searchArgs.depot.dropoffVendor},this.postcodeDropoffRaw={name:t.searchArgs.depot.dropoffPostCode,type:e.LocationTypes.Postcode,latitude:t.searchArgs.depot.dropoffLatitude,longitude:t.searchArgs.depot.dropoffLongitude},this.postcodePickup={addressLines:[t.searchArgs.depot.pickupAddressLines],vendorCode:t.searchArgs.depot.vendorCode,locationCode:t.searchArgs.depot.pickupLocationCode,extendedLocationCode:t.searchArgs.depot.pickupExtendedLocationCode,cityName:t.searchArgs.depot.pickupCityName,vendor:t.searchArgs.depot.pickupVendor},this.postcodePickupRaw={name:t.searchArgs.depot.pickupPostCode,type:e.LocationTypes.Postcode,latitude:t.searchArgs.depot.pickupLatitude,longitude:t.searchArgs.depot.pickupLongitude},this.searchService.startSearches()},n.prototype.getSearchQuery=function(){var t={};switch(this.locationType){case e.LocationTypes.Airport:t.airport={pickupCode:"",dropoffCode:""},t.airport.pickupCode=this.pickup_location.gateway,t.airport.dropoffCode=this.return_to_pickup?this.pickup_location.gateway:this.dropoff_location.gateway;break;case e.LocationTypes.City:t.city={pickupCountryCode:this.cityPickup.countryCode,pickupCity:this.cityPickup.id.toString(),dropoffCountryCode:this.cityDropoff.countryCode,dropoffCity:this.cityDropoff.id.toString()};break;case e.LocationTypes.Postcode:t.depot={vendorCode:this.postcodePickup.vendorCode,pickupLocationCode:this.postcodePickup.locationCode,pickupExtendedLocationCode:this.postcodePickup.extendedLocationCode,dropOffLocationCode:this.postcodeDropoff.locationCode,dropOffExtendedLocationCode:this.postcodeDropoff.extendedLocationCode}}return t.dropoffDateTime=this.helpers.formatGraphQLDateTime(this.dropoff_datetime),t.pickupDateTime=this.helpers.formatGraphQLDateTime(this.pickup_datetime),t.aircon=this.airCon,t.vendor="-"===this.chosenVendor?null:this.chosenVendor,t.transmission=this.transmission||null,t.class=this.carClass||null,t.type=this.carType||null,t.estimatedDailyDistance=this.estimatedMileage||null,t.estimatedDailyDistanceUnits=this.estimatedMileage?B.M:null,this.helpers.removeNulls(t)},n.prototype.getCarClasses=function(){return t.of(this._car_classes)},n.prototype.getLocationTypes=function(){return t.of(this._location_types)},n.prototype.filterResults=function(e,t){var r=this,i=this.helpers.clone(this.fullResults);i=i.filter((function(t){var i=r.getPrice(t);return i>=e.minPrice&&i<=e.maxPrice})),i=this.filterByTransmissionType(e.transmissions,i),i=this.filterByAirconType(e.airConditioning,i),i=this.filterByCarType(e.types,i),i=this.filterByCompany(e.companies,i),i=this.sortResults(t,i),this.results.next(i)},n.prototype.filterByCompany=function(e,t){var r=e.filter((function(e){return e.selected}));return r.length&&(t=t.filter((function(e){return r.find((function(t){return t.value.toString().toLowerCase()===e.identifiers.vendor.toLowerCase()}))}))),t},n.prototype.filterByCarType=function(e,t){var r=e.filter((function(e){return e.selected}));return r.length&&(t=t.filter((function(e){return r.find((function(t){return t.value.toString().toLowerCase()===e.displayRecord.vehicle.class.toLowerCase()}))}))),t},n.prototype.filterByTransmissionType=function(e,t){var r=e.find((function(e){return e.selected}));if(r&&"Y"!==r.value)try{t=t.filter((function(e){return e.identifiers.vehType[2].toLowerCase()===r.value.toString().toLowerCase()}))}catch(e){console.error("+++ Error filtering transmissions: "+e+" +++")}return t},n.prototype.filterByAirconType=function(e,t){var r=e.find((function(e){return e.selected}));if(r&&"A"!==r.value)try{t=t.filter((function(e){return e.identifiers.vehType[3].toLowerCase()===r.value.toString().toLowerCase()}))}catch(e){console.error("+++ Error filtering aircons: "+e+" +++")}return t},n.prototype.sortResults=function(e,t){var r=this,i=this.helpers.clone(t||this.results.value);switch(e){case 0:i=i.sort((function(e,t){return r.getPrice(e)-r.getPrice(t)}));break;case 1:i=i.sort((function(e,t){return r.getPrice(t)-r.getPrice(e)}));break;case 2:break;case 3:i=this.sortByBrand(i);break;case 4:i=this.sortBySize(i)}return this.results.next(i),i},n.prototype.sortExpensive=function(e){var t=this,r=this.helpers.clone(e||this.results.value).sort((function(e,r){return t.getPrice(r)-t.getPrice(e)}));return this.results.next(r),r},n.prototype.sortCheapest=function(e){var t=this,r=this.helpers.clone(e||this.results.value).sort((function(e,r){return t.getPrice(e)-t.getPrice(r)}));return this.results.next(r),r},n.prototype.sortBySize=function(e){var t=this,r=this.helpers.clone(e||this.results.value).sort((function(e,r){var i,n;return i=t.carClassMap[e.displayRecord.vehicle.class.toLowerCase()],n=t.carClassMap[r.displayRecord.vehicle.class.toLowerCase()],i>=0&&n>=0?i-n:-1}));return this.results.next(r),r},n.prototype.sortByBrand=function(e){var t=this.helpers.clone(e||this.results.value).sort((function(e,t){var r=e.identifiers.vendor,i=t.identifiers.vendor;switch(r){case"ZE":r="HE";break;case"ZI":r="AV"}switch(i){case"ZE":i="HE";break;case"ZI":i="AV"}return r<i?-1:r>i?1:0}));return this.results.next(t),t},n.prototype.getPrice=function(e){try{return Number(e.displayRecord.charges[0].amount)}catch(e){}return 0},n.prototype.getMinPrice=function(e){var t=this;return e.reduce((function(e,r){var i=t.getPrice(r);return i<e&&(e=i),e}),Number.MAX_SAFE_INTEGER)},n.prototype.getMaxPrice=function(e){var t=this;return e.reduce((function(e,r){var i=t.getPrice(r);return i>e&&(e=i),e}),Number.MIN_SAFE_INTEGER)},n.prototype.updateFromPreviousSearches=function(e){var t;null===(t=e[ee.Flight])||void 0===t||t.searchQuery},n.prototype._updatePickupDateTime=function(){if(this._pickup_date&&this._pickup_time){var e=this.helpers.ngDateToMoment(this._pickup_date,this._pickup_time);this.pickup_datetime=e.isValid()?e:null,this._isValid()}},n.prototype._updateDropoffDateTime=function(){if(this._dropoff_date&&this._dropoff_time){var e=this.helpers.ngDateToMoment(this._dropoff_date,this._dropoff_time);this.dropoff_datetime=e.isValid()?e:null,this._isValid()}},n.prototype._updateNgbPickupDateTime=function(){if(this._ngbPickupDate&&this._pickupTime){var e=this.helpers.ngDateToMoment(this._ngbPickupDate,this._pickupTime);this.pickup_datetime=e.isValid()?e:null,this._isValid()}},n.prototype._updateNgbDropoffDateTime=function(){if(this._ngbDropoffDate&&this._dropoffTime){var e=this.helpers.ngDateToMoment(this._ngbDropoffDate,this._dropoffTime);this.dropoff_datetime=e.isValid()?e:null,this._isValid()}},n.prototype.isOverNight=function(){var e=this.pickup_datetime.date();return this.dropoff_datetime.date()-e>=1},n.prototype.updateLowestPrice=function(e){return e.length?{amount:this.getMinPrice(e),currencyCode:e[0].displayRecord.charges[0].currencyCode}:null},n.prototype.getCarHireAvailabilityDetail=function(e,t){return t.value||t.next(!0),this.carHireAvailabilityDetailFetcher.fetchList({locationDetails:e}).pipe(r.take(1),r.map((function(e){return t.value&&t.next(!1),e})))},n.prototype.addCarHireToBasket=function(t,r){var i,n;return g(this,void 0,void 0,(function(){var a,o,s,u,l,c,d,p,h;return v(this,(function(m){switch(m.label){case 0:return t.unavailable?[2,Promise.resolve(!1)]:[4,this.basketService.getDefaultBasket()];case 1:return a=m.sent(),(o=null==a?void 0:a.subject.value)?(s=t.co2PerItem,u=t.co2PerPassenger,l=t.displayRecord,c=t.identifiers,d=t.sourceId,p=parseFloat(null!==(n=null===(i=null==l?void 0:l.charges[0])||void 0===i?void 0:i.amount)&&void 0!==n?n:"0"),h=this.getTermsAndCond(t,r),[2,this.basketService.addToBasket({adults:this.adults,basket:o.id,service:d.toString(),detail:{pickUpDatetime:l.pickup,dropOffDatetime:l.dropoff,pickUpLocation:{iata:this.locationType===e.LocationTypes.Airport?c.locationCode:"",name:l.pickupLocation.name,address:l.pickupLocation.topLine+", "+l.pickupLocation.city,postcode:l.pickupLocation.postCode},dropOffLocation:{iata:this.locationType===e.LocationTypes.Airport?c.dropOffLocation:"",name:l.returnLocation.name,address:l.returnLocation.topLine+", "+l.returnLocation.city,postcode:l.returnLocation.postCode},car:{type:l.vehicle.type,manualTransmission:l.vehicle.transmission.includes(R.Manual)},vendorName:l.vendor.name,identifiers:{dropOffLocation:c.dropOffLocation,locationCode:c.locationCode,locationName:c.locationName,vehType:c.vehType,vendor:c.vendor},termsAndCond:h},price:p,currency:"GBP",searchQuery:r,co2PerItem:s,co2PerPassenger:u,outboundDate:new Date(l.pickup).toISOString()},a,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},n.prototype.getTermsAndCond=function(e,t){return[{name:"Additional Driver",value:""},{name:"Age Requirements",value:""},{name:"Cross Border Policy",value:""},{name:"Damage Waiver",value:""},{name:"Debit Card Policy",value:""},{name:"One Way Drop Policy",value:""},{name:"Extended Protection",value:""},{name:"Excess Protection",value:""},{name:"Inclusive Policy",value:""},{name:"Mileage Policy",value:""},{name:"Miscellaneous Policy",value:""},{name:"Forms of Payment",value:""},{name:"Roadside Protection",value:""},{name:"Renter Requirements",value:""},{name:"Third Party Liability",value:""}]},n.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:ee.Car,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},n}(c);xe.STORAGE_SESSION_PARAMS="carhire_params",xe.STORAGE_SESSION_RESULTS="carhire_results";var Ue,Ve=function(){this.numberHotelToPreload=Number.MAX_SAFE_INTEGER,this.numberOfHotelsToFetch=5,this.autoFetchHotelTimeout=50,this.autoLogoutTime=60,this.hotelAvalibilityTimeout=2e3,this.maxBasketNumber=5,this.searchTimeout=3e4,this.groupMax=0},Ge=function(e){},He={next:Ge},Qe=function(){function e(){this.events={}}return e.prototype.getEmmitter=function(e){return this.events[e]=this.events[e]||new t.Subject,this.events[e]},e.prototype.emit=function(e,t){(this.events[e]||He).next(t)},e}();(Ue=e.FlightDisplayTypes||(e.FlightDisplayTypes={}))[Ue.returns=1]="returns",Ue[Ue.dualSingles=2]="dualSingles";var Je,We=Object.freeze({stops:{},totalStops:{},mustInclude:{},classes:{},airlines:{},travelPolicy:{},depatureAirport:{},depatureReturnAirport:{},arrivalAirport:{},arrivalReturnAirport:{},baggage:{},fareTypes:{},price:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},duration:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},returnDuration:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},departureTime:{min:0,max:24},arrivalTime:{min:0,max:24},returnDepartureTime:{min:0,max:24},returnArrivalTime:{min:0,max:24},flightNumber:""});(Je=e.FlightSearchType||(e.FlightSearchType={})).return="return",Je.oneWay="oneWay",Je.multiCity="multiCity";var Ye=function(e){this.value=e};Ye.MaxFlightClass=new Ye("MaxFlightClass"),Ye.SSO_no_password=new Ye("SSO_no_password"),Ye.HideFlightCabinClasses=new Ye("hideFlightCabinClasses"),Ye.AlternativeRailItineraryEnabled=new Ye("alternativeRailItineraryEnabled"),Ye.riskMinimumLevel=new Ye("riskMinimumLevel");var Ke=function(e){this.value=e};Ke.non=new Ke("non"),Ke.EVI=new Ke("evi");var ze,Xe;(ze=e.TimeWindow||(e.TimeWindow={})).Anytime="Anytime",ze.Depart="Depart By",ze.Arrive="Arrive By",(Xe=e.FlightSortTypes||(e.FlightSortTypes={})).Cheapest="Cheapest",Xe.MostExpensive="Most Expensive",Xe.Fastest="Fastest",Xe.Preferred="Preferred",Xe.LowestEmissions="Lowest Emissions",Xe.DepartureTime="Departure Time",Xe.ArrivalTime="Arrival Time",Xe.Quickest="Quickest",Xe.MostDirect="Most Direct";var qe,Ze=function(i){function n(r,a,o,s,l,c,d,p){var h,m,f=i.call(this,l,a)||this;f.flightfetcher=r,f.userService=o,f.basketService=s,f.searchService=c,f.applyFlightRules=d,f.modalService=p,f.type=ee.Flight,f.avaliableClasses=new t.BehaviorSubject([]),f.timeCriteriaOptions=new t.BehaviorSubject([]),f.flightOperators=new t.BehaviorSubject([]),f._negotiated=!1,f._nearby_airports=!1,f._sortArray=[{display:"Cheapest First",value:e.FlightSortTypes.Cheapest},{display:"Most Expensive First",value:e.FlightSortTypes.MostExpensive},{display:"Fastest First",value:e.FlightSortTypes.Fastest},{display:"Preferred Fares First",value:e.FlightSortTypes.Preferred},{display:"Lowest Co2 Emissions First",value:e.FlightSortTypes.LowestEmissions}],f._sortItinaryRoutines=((h={})[e.FlightSortTypes.Cheapest]=function(e,t){return e.total.price-t.total.price},h[e.FlightSortTypes.MostExpensive]=function(e,t){return t.total.price-e.total.price},h[e.FlightSortTypes.Fastest]=function(e,t){return e.outboundTotalDuration+(e.inboundTotalDuration?e.inboundTotalDuration:0)-(t.outboundTotalDuration+(t.inboundTotalDuration?t.inboundTotalDuration:0))},h[e.FlightSortTypes.Preferred]=function(e,t){return e.preferred-t.preferred},h[e.FlightSortTypes.LowestEmissions]=function(e,t){return e.co2PerItem-t.co2PerItem},h[e.FlightSortTypes.DepartureTime]=function(e,t){var r=u.default(e.outboundFlights[0].dateTimeDeparting),i=u.default(t.outboundFlights[0].dateTimeDeparting);return r.isBefore(i)?-1:r.isSame(i)?0:1},h[e.FlightSortTypes.ArrivalTime]=function(e,t){var r=u.default(e.outboundFlights[0].dateTimeArriving),i=u.default(t.outboundFlights[0].dateTimeArriving);return r.isBefore(i)?-1:r.isSame(i)?0:1},h[e.FlightSortTypes.Quickest]=function(e,t){return e.outboundTotalDuration+(e.inboundTotalDuration?e.inboundTotalDuration:0)-(t.outboundTotalDuration+(t.inboundTotalDuration?t.inboundTotalDuration:0))},h[e.FlightSortTypes.MostDirect]=function(e,t){return e.outboundFlights.length+(e.outboundFlights?e.outboundFlights.length:0)-(t.outboundFlights.length+(t.outboundFlights?t.outboundFlights.length:0))},h),f._sortGroupedRoutines=((m={})[e.FlightSortTypes.Cheapest]=function(e,t){return e.direction!==t.direction?e.direction-t.direction:e.minPrice-t.minPrice},m[e.FlightSortTypes.MostExpensive]=function(e,t){return e.direction!==t.direction?e.direction-t.direction:t.minPrice-e.maxPrice},m[e.FlightSortTypes.Fastest]=function(t,r){return t.direction!==r.direction?t.direction-r.direction:t.direction===e.FlightDirectionEnum.Outbound?t.outboundTotalDuration-r.outboundTotalDuration:t.inboundTotalDuration-r.inboundTotalDuration},m[e.FlightSortTypes.Preferred]=function(e,t){return e.direction!==t.direction?e.direction-t.direction:(e.preferred?1:0)-(t.preferred?1:0)},m[e.FlightSortTypes.LowestEmissions]=function(e,t){return e.direction!==t.direction?e.direction-t.direction:e.co2PerItem-t.co2PerItem},m[e.FlightSortTypes.DepartureTime]=function(e,t){if(e.direction!==t.direction)return e.direction-t.direction;var r=u.default(e.departDateTime),i=u.default(t.departDateTime);return r.isBefore(i)?-1:r.isSame(i)?0:1},m[e.FlightSortTypes.ArrivalTime]=function(e,t){if(e.direction!==t.direction)return e.direction-t.direction;var r=u.default(e.arrivalDateTime),i=u.default(t.arrivalDateTime);return r.isBefore(i)?-1:r.isSame(i)?0:1},m[e.FlightSortTypes.Quickest]=function(t,r){return t.direction!==r.direction?t.direction-r.direction:t.direction===e.FlightDirectionEnum.Outbound?t.outboundTotalDuration-r.outboundTotalDuration:(t.inboundTotalDuration?t.inboundTotalDuration:0)-(r.inboundTotalDuration?r.inboundTotalDuration:0)},m[e.FlightSortTypes.MostDirect]=function(t,r){return t.direction!==r.direction?t.direction-r.direction:t.direction===e.FlightDirectionEnum.Outbound?t.outlegs.length-r.outlegs.length:(t.inlegs||[]).length-(r.inlegs||[]).length},m),f._fareTypeArray=[{value:w.Flexible,display:"Flexible"},{value:w.Leisure,display:"Leisure"},{value:w.Lowest,display:"Lowest"},{value:w.Negotiated,display:"Negotiated"},{value:w.NonNegotiated,display:"Non-Negotiated"},{value:w.RequestFareRules,display:"Request Fare Rules"},{value:w.SelectAndPro,display:"Select & Pro"}],f.minimumOutBoundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},f.minimumInBoundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},f._grouped=null,f.travellers=null,f.resultsSessionName=n.STORAGE_SESSION_RESULTS,f.multiResultsSessionName=n.STORAGE_SESSION_RESULTS,f._showHotelForm=!1,f._hotelSearchRequested=!1,f.filters=new t.BehaviorSubject(We),f.duralSingleFilter=new t.BehaviorSubject(We),f.choosenDisplayType=new t.BehaviorSubject(e.FlightDisplayTypes.returns),f._multiDestination=[];var y=l.getSessionItem(n.STORAGE_SESSION_PARAMS)||{tempParams:{},originalUserSearch:{}},g=c.makeFlightQuery(y.tempParams);return f.updateTempParams(g),f._originalUserSearch=y.originalUserSearch,c.shouldAddTravellerSubscription()&&c.travellerInformation.subscribe((function(e){f.travellers=e;var t=f.helpers.selectedTravellers(e,ee.Flight);f.tempParams.adults=t.adults.length,f.tempParams.children=t.children.length,f.updateTravellers(),f._isValid()})),o.changeUser.subscribe((function(t){f.timeCriteriaOptions.next([e.TimeWindow.Anytime,e.TimeWindow.Arrive,e.TimeWindow.Depart]),f.flightOperators.next([{code:"BA",name:"British Airways"}]),f.updateAvaliableClasses()})),f.updateTravellers(),f.negotiated=f.tempParams.fareType===w.Negotiated,f}return m(n,i),Object.defineProperty(n.prototype,"timeArray",{get:function(){return this._timeArray=this._timeArray||Array(96).fill(0).map((function(e,t){return{value:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0"),display:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0")}})),this._timeArray},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"preferredCarriers",{get:function(){return this.tempParams.preferredCarriers},set:function(e){this.tempParams.preferredCarriers=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"operator1",{get:function(){return this.tempParams.preferredCarriers[0]},set:function(e){this.tempParams.preferredCarriers[0]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"operator2",{get:function(){return this.tempParams.preferredCarriers[1]},set:function(e){this.tempParams.preferredCarriers[1]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"operator3",{get:function(){return this.tempParams.preferredCarriers[2]},set:function(e){this.tempParams.preferredCarriers[2]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"operator4",{get:function(){return this.tempParams.preferredCarriers[3]},set:function(e){this.tempParams.preferredCarriers[3]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"minDate",{get:function(){return this._minDate=this._minDate||this.helpers.momentToNgDate(u.default()),this._minDate},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"adults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=Number(e),this.updateTravellers()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"children",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=Number(e),this.updateTravellers()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"departLocation",{get:function(){return this.tempParams.departLocation},set:function(e){this.tempParams.departLocation=e,"string"==typeof e?this._originAirport="":e&&e.gateway?this._originAirport=e.gateway:this._originAirport=null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"queryOriginAiport",{get:function(){return this._originAirport},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"queryDestinationAiport",{get:function(){return this._destinationAirport},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"departDate",{get:function(){return this._outDate},set:function(e){this._outDate=e,this.outBoundDate=this.helpers.ngDateToMoment(this._outDate,this._outTime)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"departTime",{get:function(){return this._outTime},set:function(e){this._outTime=e,this.outBoundDate=this.helpers.ngDateToMoment(this._outDate,this._outTime)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outBoundDate",{get:function(){return this.tempParams.outBoundDate},set:function(e){this.tempParams.outBoundDate=e.isValid()?e:null,this.minimumInBoundDate={year:e.year(),month:e.month()+1,day:e.date()},this.tempParams.outBoundDate&&this.tempParams.inboundDate&&this.tempParams.outBoundDate.isAfter(this.tempParams.inboundDate)&&(this.inboundDate=u.default(this.tempParams.outBoundDate).add(1,"day")),this._outDate=this.helpers.momentToNgDate(e),this._outTime=this.helpers.formatTimeColon(e),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"returnDate",{get:function(){return this._inDate},set:function(e){this._inDate=e,this.inboundDate=this.helpers.ngDateToMoment(this._inDate,this._inTime)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"arriveTime",{get:function(){return this._inTime},set:function(e){this._inTime=e,this.inboundDate=this.helpers.ngDateToMoment(this._inDate,this._inTime)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"inboundDate",{get:function(){return this.tempParams.inboundDate},set:function(e){this.tempParams.inboundDate=e.isValid()?e:null,this._inDate=this.helpers.momentToNgDate(e),this._inTime=this.helpers.formatTimeColon(e),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"arriveLocation",{get:function(){return this.tempParams.arriveLocation},set:function(e){this.tempParams.arriveLocation=e,"string"==typeof e?this._destinationAirport="":e&&e.gateway?this._destinationAirport=e.gateway:this._destinationAirport=null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cabinClass",{get:function(){return this.tempParams.cabinClass},set:function(e){this.tempParams.cabinClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"returnCabinClass",{get:function(){return this.tempParams.returnCabinClass},set:function(e){this.tempParams.returnCabinClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenSearchType",{get:function(){return this.tempParams.chosenSearchType},set:function(e){this.tempParams.chosenSearchType=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isReturn",{get:function(){return this.tempParams.chosenSearchType===e.FlightSearchType.return},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outTimeCriteria",{get:function(){return this.tempParams.outTimeCriteria},set:function(e){this.tempParams.outTimeCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"inTimeCriteria",{get:function(){return this.tempParams.inTimeCriteria},set:function(e){this.tempParams.inTimeCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxConnections",{get:function(){return this.tempParams.maxConnections},set:function(e){this.tempParams.maxConnections=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"multiDestination",{get:function(){return this.tempParams.multiDestination},set:function(e){this.tempParams.multiDestination=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"showHotelForm",{get:function(){return this._showHotelForm},set:function(e){this._showHotelForm=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hotelSearchRequested",{get:function(){return this._hotelSearchRequested},set:function(e){this._hotelSearchRequested=e},enumerable:!1,configurable:!0}),n.prototype.setMultiDestinationQuery=function(e){var t=this;return this.helpers.clone(e).reduce((function(e,r){var i={};return i.orig=r.orig.gateway,i.dest=r.dest.gateway,i.date=t.helpers.formatIsoDate(r.date),e.push(i),e}),[])},Object.defineProperty(n.prototype,"sortDropdownValues",{get:function(){return this._sortArray},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fareTypesValues",{get:function(){return this._fareTypeArray},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fareType",{get:function(){return this.tempParams.fareType},set:function(e){this.tempParams.fareType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"negotiated",{get:function(){return this._negotiated},set:function(e){this._negotiated=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"includeNearbyAirports",{get:function(){return this.tempParams.includeNearbyAirports},set:function(e){this.tempParams.includeNearbyAirports=e},enumerable:!1,configurable:!0}),n.prototype.processResults=function(t){if(!t)return this._grouped=[],this.multi=[],this.resultQuery=null,[];this._grouped=t.grouped||[],this._ruleActionSummary=Object.assign({},{journeyWhenSelected:{},dualSingleWhenSelected:{},whenSelectedAlone:{}},t.ruleActionSummary),this.resultQuery=this.getSearchQuery(),this.multi=t.multi,this.setFlightDisplayType(e.FlightDisplayTypes.returns),this.currentFilters=this.helpers.createFlightFilters(t.journeys,We),this.filters.next(this.currentFilters),delete this.resultQuery.withGrouped;var r=t.multi.reduce((function(e,t){return e[0===t.order?"outbound":"inbound"]=t.results.reduce((function(e,t){return e[t.uid]=Object.assign({selected:!1,canSelect:!0},t),e}),e[0===t.order?"outbound":"inbound"]),e}),{outbound:{},inbound:{}}),i=this.helpers.createFlightFilters(Object.values(r.inbound),We);if(this.duralSingleFilter.next(this.helpers.createFlightFilters(Object.values(r.outbound),Object.assign(Object.assign({},We),{arrivalReturnAirport:i.arrivalAirport,depatureReturnAirport:i.depatureAirport,returnArrivalTime:i.arrivalTime,returnDuration:i.duration,returnDepartureTime:i.departureTime}))),t&&this.searchService.isFlightsGrouped()){var n=(t.journeys||[]).reduce((function(e,t){return e[t.uid]=Object.assign({selected:!1,canSelect:!0},t),e}),{}),a=T((t.grouped||[]).reduce(this.makeGroupedObjects(n),[]),(t.grouped||[]).reduce(this.makeGroupedObjects(r.outbound),[]).map((function(t){return t.direction=e.FlightDirectionEnum.DualSingleOutbound,t})),(t.grouped||[]).reduce(this.makeGroupedObjects(r.inbound,!0),[]).map((function(t){return t.direction=e.FlightDirectionEnum.DualSingleInbound,t})));return console.log("Processed Grouped data",a),a}return t?[t]:[]},n.prototype.makeGroupedObjects=function(t,r){var i=this;return void 0===r&&(r=!1),function(n,a){var o,s=a.boundIndicator===e.FlightDirectionEnum.Outbound,u={type:"FlightGroupedQuoteResult",direction:a.boundIndicator,classes:(o={},o[e.OBTFlightCabinClass.Business]=null,o[e.OBTFlightCabinClass.BusinessBranded]=null,o[e.OBTFlightCabinClass.EconomyFlexi]=null,o[e.OBTFlightCabinClass.EconomyFlexiBranded]=null,o[e.OBTFlightCabinClass.EconomyNoBags]=null,o[e.OBTFlightCabinClass.EconomyNoBagsBranded]=null,o[e.OBTFlightCabinClass.EconomyRestricted]=null,o[e.OBTFlightCabinClass.EconomyRestrictedBranded]=null,o[e.OBTFlightCabinClass.First]=null,o[e.OBTFlightCabinClass.FirstBranded]=null,o[e.OBTFlightCabinClass.PremiumEconomy]=null,o[e.OBTFlightCabinClass.PremiumEconomyBranded]=null,o),originAirport:"",originAirportName:"",destinationAirport:"",destinationAirportName:"",departDateTime:"",arrivalDateTime:"",outboundTotalDuration:0,inboundTotalDuration:0,outlegs:null,inlegs:null,outlegsCount:0,inlegsCount:0,dataSource:"",preferred:!1,outboundFlightNumber:"",operator:"",operatorFull:"",inboundFlightNumber:"",isReturn:!1,minPrice:Number.MAX_SAFE_INTEGER,maxPrice:0,co2PerItem:0,co2PerPassenger:0,gid:a.referenceID},l=a.flights;return Object.keys(l).filter((function(e){return"_"!==e[0]})).forEach((function(e){l[e].length&&l[e].forEach((function(n){var a,o,l=t[n];if(l){s||r?i.createGroupedItem(u,l.source,l.outboundFlights,l.outboundTotalDuration,l.inboundFlights,l.inboundTotalDuration,l.co2PerItem,l.co2PerPassenger):i.createGroupedItem(u,l.source,l.inboundFlights,l.inboundTotalDuration,l.outboundFlights,l.outboundTotalDuration,l.co2PerItem,l.co2PerPassenger);var c=i.helpers.FlightCabinClassToBrandedOBTFlightCabinClass(e,!!l.baseFareId&&l.baseFareId!==l.uid),d=Math.floor(l.total.price),p=Math.ceil(l.total.price);u.minPrice=u.minPrice<d?u.minPrice:d,u.maxPrice=u.maxPrice>p?u.maxPrice:p,(null===(o=null===(a=u.classes[c])||void 0===a?void 0:a.flights)||void 0===o?void 0:o.length)?(u.classes[c].flights.push(l),u.classes[c].minprice=Math.min(u.classes[c].minprice,d),u.classes[c].maxprice=Math.max(u.classes[c].maxprice,p)):u.classes[c]={flights:[l],minprice:d,maxprice:p,currency:l.total.currency}}}))})),u&&Object.values(u.classes).find((function(e){var t;return(null===(t=null==e?void 0:e.flights)||void 0===t?void 0:t.length)>0}))&&n.push(u),n.filter((function(e){return!!e}))}},n.prototype.createGroupedItem=function(e,t,r,i,n,a,o,s){if((null==r?void 0:r.length)&&!e.departDateTime){var u=r[0],l=r[r.length-1];e.originAirport=u.originAirport,e.originAirportName=u.originAirportName,e.destinationAirport=l.destinationAirport,e.destinationAirportName=l.destinationAirportName,e.departDateTime=u.dateTimeDeparting,e.arrivalDateTime=l.dateTimeArriving,e.outboundTotalDuration=i,e.dataSource=t,e.operator=u.marketingCarrier,e.operatorFull=u.marketingCarrierName,e.outlegsCount=r.length,e.outlegs=r,e.outboundFlightNumber=this.helpers.joinFromAttribute("-","marketingFlightNumber",r),e.isReturn=!1,e.co2PerItem=o,e.co2PerPassenger=s}(null==n?void 0:n.length)&&!e.inboundTotalDuration&&(e.inboundTotalDuration=a,e.inlegsCount=n.length,e.inlegs=n,e.inboundFlightNumber=this.helpers.joinFromAttribute("-","operatingFlightNumber",n),e.isReturn=!0)},n.prototype.makeSessionResults=function(e){return{results:e,grouped:this._grouped,query:this.resultQuery}},n.prototype.getMaxFlightPriceForBrand=function(e){var t=0;return e.forEach((function(e){var r;t<(null===(r=null==e?void 0:e.total)||void 0===r?void 0:r.price)&&(t=e.total.price)})),t},n.prototype.getMinFlightPriceForBrand=function(e){var t=Number.MAX_SAFE_INTEGER;return e.forEach((function(e){var r;t>(null===(r=null==e?void 0:e.total)||void 0===r?void 0:r.price)&&(t=e.total.price)})),t},n.prototype.resetQuery=function(e){void 0===e&&(e=!0),this.updateTempParams(this.searchService.makeFlightQuery()),e&&this._isValid()},n.prototype.resetParams=function(){this.reset(),this.resetQuery()},n.prototype._isValid=function(){this.doChecks&&(this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.validationMessages=[],this.tempParams.chosenSearchType===e.FlightSearchType.multiCity?this.multiCityValidation():(this._originAirport||this.validationMessages.push("Please add in a departure location"),this._destinationAirport||this.validationMessages.push("Please add in an arrival destination"),this.tempParams.outBoundDate.isAfter(u.default())||this.validationMessages.push("Departure date can not be in the past"),this._originAirport&&this._destinationAirport&&this._destinationAirport===this._originAirport&&this.validationMessages.push("Origin and destination airport cannot be the same"),this.isReturn&&this.tempParams.outBoundDate.isSameOrAfter(this.tempParams.inTimeCriteria)&&this.validationMessages.push("Return date must be after the departure date"),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages)))},n.prototype.multiCityValidation=function(){var e=!1,t=!1,r=!1;this.tempParams.multiDestination.map((function(i,n){i.orig||(e=!0,n<2&&(t=!0)),i.orig===i.dest&&(r=!0)})),u.default(this.tempParams.multiDestination[0].date).isAfter(u.default())||this.validationMessages.push("Departure date can not be in the past"),t&&this.validationMessages.push("Please select landing airport(s)"),e&&this.validationMessages.push("Please select take off airport(s)"),r&&this.validationMessages.push("Take off and landing location(s) cannot be the same")},n.prototype.startSearch=function(){if(this.results.next([]),this._isValid(),this.isValid.value){this._originalUserSearch=Object.freeze(this.helpers.clone(this.tempParams)),this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch});var e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.flightfetcher.fetchList(e))}return Promise.resolve(!1)},n.prototype.getRecentSearchQuery=function(e){return{serviceType:ee.Flight,searchArgs:e,travelDate:this.outBoundDate.format(),travellers:this.helpers.getTravellersId(this.travellers)}},n.prototype.startRecentSearch=function(r){var i=this;if(r.searchArgs.outboundDate){var n=r.searchArgs.outboundDepartureTimeWindow?r.searchArgs.outboundDepartureTimeWindow:r.searchArgs.outboundArrivalTimeWindow;this.outBoundDate=this.convertRecentSearchDateTime(r.searchArgs.outboundDate,n)}if(r.searchArgs.returnDate){var a=r.searchArgs.returnDepartureTimeWindow?r.searchArgs.returnDepartureTimeWindow:r.searchArgs.returnArrivalTimeWindow;this.inboundDate=this.convertRecentSearchDateTime(r.searchArgs.returnDate,a)}this.fareType=r.searchArgs.fareType,this.maxConnections=r.searchArgs.maxConnections,r.searchArgs.outboundCabinClass&&(this.cabinClass=r.searchArgs.outboundCabinClass[0]),r.searchArgs.returnCabinClass&&(this.returnCabinClass=r.searchArgs.returnCabinClass[0]),this.includeNearbyAirports=!!r.searchArgs.includeNearbyAirports,this.chosenSearchType=r.searchArgs.returnTrip?e.FlightSearchType.return:e.FlightSearchType.oneWay,r.searchArgs.outboundDepartureTimeWindow?this.outTimeCriteria=e.TimeWindow.Depart:r.searchArgs.outboundArrivalTimeWindow?this.outTimeCriteria=e.TimeWindow.Arrive:this.outTimeCriteria=e.TimeWindow.Anytime,r.searchArgs.returnDepartureTimeWindow?this.inTimeCriteria=e.TimeWindow.Depart:r.searchArgs.returnArrivalTimeWindow?this.inTimeCriteria=e.TimeWindow.Arrive:this.inTimeCriteria=e.TimeWindow.Anytime,t.combineLatest([this.searchService.getAirportByCode(r.searchArgs.originAirport),this.searchService.getAirportByCode(r.searchArgs.destinationAirport)]).subscribe((function(e){var t,n,a,o,s,u,l,c,d,p,h,m,f=S(e,2),y=f[0],g=f[1];if(y&&g){if(i.departLocation={destination:y.iataMatch.name,gateway:y.iataMatch.iata,terminals:i.searchService.processTerminals(y.iataMatch.terminals),country:null===(n=null===(t=y.iataMatch)||void 0===t?void 0:t.locationDetails)||void 0===n?void 0:n.country,postcode:null===(o=null===(a=y.iataMatch)||void 0===a?void 0:a.locationDetails)||void 0===o?void 0:o.postcode,countryCode:null===(u=null===(s=y.iataMatch)||void 0===s?void 0:s.locationDetails)||void 0===u?void 0:u.countryCode},i.arriveLocation={destination:g.iataMatch.name,gateway:g.iataMatch.iata,terminals:i.searchService.processTerminals(g.iataMatch.terminals),country:null===(c=null===(l=g.iataMatch)||void 0===l?void 0:l.locationDetails)||void 0===c?void 0:c.country,postcode:null===(p=null===(d=g.iataMatch)||void 0===d?void 0:d.locationDetails)||void 0===p?void 0:p.postcode,countryCode:null===(m=null===(h=g.iataMatch)||void 0===h?void 0:h.locationDetails)||void 0===m?void 0:m.countryCode},r.searchArgs.preferredCarriers){var v=[];r.searchArgs.preferredCarriers.map((function(e){i.searchService.getAirlinesList(e).subscribe((function(t){t.map((function(t){t.code===e&&v.push(t)})),i.preferredCarriers=v,i.searchService.startSearches()}))}))}i.searchService.startSearches()}})),this.searchService.startSearches()},n.prototype.makeDepartureTimeWindow=function(t,r,i){return r===e.TimeWindow.Depart?i?this.helpers.makeTimeWindow(t,-2,2):this.helpers.makeTimeWindow(t,0,4):null},n.prototype.makeArrivalTimeWindow=function(t,r,i){return r!==e.TimeWindow.Arrive?null:i?this.helpers.makeTimeWindow(t,-2,2):this.helpers.makeTimeWindow(t,0,4)},n.prototype.convertRecentSearchDateTime=function(e,t){if(t){var r=t.split("-");return u.default(e).add(u.default.duration(this.helpers.hhmmToTime(r[0]))).clone().add(2,"hour")}return u.default(e)},n.prototype.getSearchQuery=function(){var t=this.tempParams.chosenSearchType===e.FlightSearchType.multiCity;this._multiDestination=t?this.setMultiDestinationQuery(this.tempParams.multiDestination):null,this._multiDestination=this.tempParams.chosenSearchType===e.FlightSearchType.multiCity?this.setMultiDestinationQuery(this.tempParams.multiDestination):[];var r=this.searchService.isFlightsGrouped();return this.helpers.removeNulls(Object.assign({},t?{multiDestination:this._multiDestination}:{originAirport:this._originAirport,destinationAirport:this._destinationAirport,outboundDate:this.helpers.formatIsoDate(this.tempParams.outBoundDate),outboundDepartureTimeWindow:this.makeDepartureTimeWindow(this.tempParams.outBoundDate,this.tempParams.outTimeCriteria,r),outboundArrivalTimeWindow:this.makeArrivalTimeWindow(this.tempParams.outBoundDate,this.tempParams.outTimeCriteria,r)},{passengers:this._passengers,returnTrip:this.isReturn,outboundCabinClass:this.tempParams.cabinClass?[this.tempParams.cabinClass]:null,requireFreeBag:null,maxConnections:this.tempParams.maxConnections,includeNearbyAirports:this.tempParams.includeNearbyAirports,preferredCarriers:this.tempParams.preferredCarriers.map((function(e){return(null==e?void 0:e.code)?e.code:null})),fareType:this.tempParams.fareType,withGrouped:r},this.isReturn?{returnDate:this.helpers.formatIsoDate(this.tempParams.inboundDate),returnDepartureTimeWindow:this.makeDepartureTimeWindow(this.tempParams.inboundDate,this.tempParams.inTimeCriteria,r),returnArrivalTimeWindow:this.makeArrivalTimeWindow(this.tempParams.inboundDate,this.tempParams.inTimeCriteria,r),returnCabinClass:this.tempParams.returnCabinClass?[this.tempParams.returnCabinClass]:null}:{}))},n.prototype.updateTravellers=function(){for(var e=[],t=0;t<this.tempParams.adults;t+=1)e.push({type:U.Adult});for(t=0;t<this.tempParams.children;t+=1)e.push({type:U.Child});this._passengers=e,this._isValid()},n.prototype.updateAvaliableClasses=function(){var e=this.userService.getUserFavoriteObject(Ye.HideFlightCabinClasses)||{any:!1,business:!1,economy:!1,first:!1,premiumEconomy:!1},t=[];e.any||t.push({name:"Any",type:x.Any}),e.economy||t.push({name:"Economy",type:x.Economy}),e.premiumEconomy||t.push({name:"Premium",type:x.PremiumEconomy}),e.business||t.push({name:"Business",type:x.Business}),e.first||t.push({name:"First",type:x.First}),this.cabinClass=this.getUpdatedCabinClass(this.cabinClass,e,t),this.returnCabinClass=this.getUpdatedCabinClass(this.returnCabinClass,e,t),this.avaliableClasses.next(t)},n.prototype.getUpdatedCabinClass=function(e,t,r){switch(e){case x.Any:return t.any?r[0].type:e;case x.Business:return t.business?r[0].type:e;case x.Economy:return t.economy?r[0].type:e;case x.First:return t.first?r[0].type:e;case x.PremiumEconomy:return t.premiumEconomy?r[0].type:e}return e},n.prototype.updateFromPreviousSearches=function(e){},n.prototype.getTotalBaggage=function(e){var t=0,r=JSON.parse(e.additional);return r&&r.outboundFlights?r.outboundFlights.forEach((function(e){e.baggage.forEach((function(e){e.allowance&&e.allowance>t&&(t=e.allowance)}))})):r&&r.baggageAllowance&&r.baggageAllowance.forEach((function(e){e.baggage.qty&&Number(e.baggage.qty)>t&&(t=Number(e.baggage.qty))})),t},n.prototype.isGroupedFlights=function(e){var t;return"FlightGroupedQuoteResult"===(null===(t=e[0])||void 0===t?void 0:t.type)},n.prototype.applyFilters=function(t,r){var i,n,a=this;this.currentFilters=t,this.currentSort=r,0===this.fullResults.length&&this.results.next([]);var o=this.selectedGroupFlight?(null===(i=this.selectedGroupFlight.inboundFlights)||void 0===i||i.length,function(t,r){return function(i){return r===e.FlightDirectionEnum.DualSingleInbound||t.includes(i.uid)}}):function(e,t){return function(e){return!0}},s=function(e,t){var r=Object.values(e).filter((function(e){return e.selected}));return r.length?function(e){return!!r.find((function(r){return t(e,r.value)}))}:function(e){return!0}},l=function(e,t){return e.replace("OUTBOUND_DEPARTURE","outboundFlights.0").replace("OUTBOUND_ARRIVAL","outboundFlights."+(t.outboundFlights.length-1)).replace("INBOUND_DEPARTURE","inboundFlights.0").replace("INBOUND_ARRIVAL","inboundFlights."+((t.inboundFlights||[]).length-1))},c=function(e,t){return function(r){var i,n=(i=a.helpers).fromObject.apply(i,T([r],l(t,r).split(".")));return n>=e.min&&n<=e.max}},d=function(e,t){return function(r){var i,n,o=u.default((i=a.helpers).fromObject.apply(i,T([r],l(t,r).split(".")))).get("hour"),s=u.default((n=a.helpers).fromObject.apply(n,T([r],l(t,r).split(".")))).get("minute"),c=Number(o+"."+a.helpers.normaliseMinuteToBase10(s));return c>=e.min&&c<=e.max}},p=function(e){return function(t,r){return t[e]===r}},h=[],m=[],f=[];h.push(d(t.arrivalTime,"OUTBOUND_ARRIVAL.dateTimeArriving")),h.push(d(t.departureTime,"OUTBOUND_DEPARTURE.dateTimeDeparting")),f.push(c(t.returnDuration,"outboundTotalDuration")),h.push(c(t.duration,"outboundTotalDuration")),h.push(c(t.price,"total.price")),h.push(s(t.stops,(function(e,t){return e.outboundFlights.length===t}))),m.push(s(t.totalStops,(function(e,t){return e.outboundFlights.length+(e.inboundFlights||[]).length===t}))),f.push(s(t.totalStops,(function(e,t){return e.outboundFlights.length===t}))),h.push(s(t.baggage,(function(e,t){var r=e.baggageAllowance.map((function(e){return e.qty}));return(r.length?Math.min.apply(Math,T(r)):0)===t}))),h.push(s(t.depatureAirport,(function(e,t){var r;return(null===(r=e.outboundFlights[0])||void 0===r?void 0:r.originAirport)===t}))),h.push(s(t.arrivalAirport,(function(e,t){var r;return(null===(r=e.outboundFlights[e.outboundFlights.length-1])||void 0===r?void 0:r.destinationAirport)===t}))),m.push(c(t.duration,"outboundTotalDuration")),m.push(c(t.price,"total.price")),f.push(c(t.price,"total.price")),m.push(d(t.returnArrivalTime,"INBOUND_ARRIVAL.dateTimeArriving")),f.push(d(t.returnArrivalTime,"OUTBOUND_ARRIVAL.dateTimeArriving")),m.push(d(t.returnDepartureTime,"INBOUND_DEPARTURE.dateTimeDeparting")),m.push(c(t.returnDuration,"inboundTotalDuration")),f.push(c(t.returnDuration,"outboundTotalDuration")),m.push(s(t.stops,(function(e,t){return e.inboundFlights.length===t}))),f.push(s(t.stops,(function(e,t){return e.outboundFlights.length===t}))),m.push(s(t.totalStops,(function(e,t){return e.outboundFlights.length+(e.inboundFlights||[]).length===t}))),m.push(s(t.baggage,(function(e,t){var r=e.baggageAllowance.map((function(e){return e.qty}));return(r.length?Math.min.apply(Math,T(r)):0)===t}))),f.push(s(t.baggage,(function(e,t){var r=e.baggageAllowance.map((function(e){return e.qty}));return(r.length?Math.min.apply(Math,T(r)):0)===t}))),m.push(s(t.depatureReturnAirport,(function(e,t){var r;return(null===(r=e.inboundFlights[0])||void 0===r?void 0:r.originAirport)===t}))),f.push(s(t.depatureReturnAirport,(function(e,t){var r;return(null===(r=e.outboundFlights[0])||void 0===r?void 0:r.originAirport)===t}))),m.push(s(t.arrivalReturnAirport,(function(e,t){var r;return(null===(r=e.inboundFlights[e.inboundFlights.length-1])||void 0===r?void 0:r.destinationAirport)===t}))),f.push(s(t.arrivalReturnAirport,(function(e,t){var r;return(null===(r=e.outboundFlights[e.outboundFlights.length-1])||void 0===r?void 0:r.destinationAirport)===t})));var y=[];y.push(s(t.classes,p("cabinClass"))),y.push(s(t.airlines,p("marketingCarrier")));var g=[];g.push(s(t.classes,p("cabinClass"))),g.push(s(t.airlines,p("marketingCarrier")));var v=function(e,t){return h.reduce((function(t,r){return t=t&&r(e)}),!0)&&(!e.outboundFlights||!!(e.outboundFlights||[]).find((function(e){return!!y.reduce((function(t,r){return t&&r(e)}),!0)})))},b=function(e){var t;return m.reduce((function(t,r){return t&&r(e)}),!0)&&(!(null===(t=e.inboundFlights)||void 0===t?void 0:t.length)||!!(e.inboundFlights||[]).find((function(e){return!!g.reduce((function(t,r){return t&&r(e)}),!0)})))},C=function(e){var t;return f.reduce((function(t,r){return t&&r(e)}),!0)&&(!(null===(t=e.outboundFlights)||void 0===t?void 0:t.length)||!!(e.outboundFlights||[]).find((function(e){return!!g.reduce((function(t,r){return t&&r(e)}),!0)})))},D=this._ruleActionSummary.dualSingleWhenSelected[null===(n=this.selectedGroupFlight)||void 0===n?void 0:n.journeyHash]||{},P=function(e){var t,r,i,n,o,s;return e.selected=e.uid===(null===(t=a.selectedGroupFlight)||void 0===t?void 0:t.uid),e.unavailable=(null===(r=a._ruleActionSummary.journeyWhenSelected[e.journeyHash])||void 0===r?void 0:r.unavailable)||(null===(i=a._ruleActionSummary.whenSelectedAlone[e.journeyHash])||void 0===i?void 0:i.unavailable)||(null===(n=D[e.journeyHash])||void 0===n?void 0:n.unavailable)||!1,e.unavailableMessage=(null===(o=a._ruleActionSummary.journeyWhenSelected[e.journeyHash])||void 0===o?void 0:o.unavailableMessage)||(null===(s=a._ruleActionSummary.whenSelectedAlone[e.journeyHash])||void 0===s?void 0:s.unavailableMessage)||"",e};if(this.isGroupedFlights(this.fullResults)){var _=this._grouped.find((function(e){return e.referenceID===a.selectedGroupId}));this.results.next(this.helpers.clone(this.fullResults).filter((function(e){return!!e})).map((function(t){var r=t.direction===e.FlightDirectionEnum.Outbound||t.direction===e.FlightDirectionEnum.DualSingleOutbound?v:t.direction===e.FlightDirectionEnum.DualSingleInbound?C:b;return t.classes=Object.entries(t.classes).reduce((function(e,i){var n=S(i,2),s=n[0],u=n[1];if(u&&u.flights){var l=u.flights.filter((function(e){return!!e})).filter(o((null==_?void 0:_.flights[a.helpers.OBTFlightCabinClassToFlightCabinClass(s)])||[],t.direction)).filter(r).map(P);l.length>0&&(e[s]=Object.assign(Object.assign({},u),{flights:l}))}return e}),{}),t})).filter((function(e){return e&&Object.keys(e.classes).length>0})).sort(this._sortGroupedRoutines[r]))}else this.results.next(Object.freeze(this.helpers.clone(this.fullResults).map((function(e){var i=a.helpers.clone(e.journeys);if(t.flightNumber&&(i=i.filter((function(e){var r=e.outboundFlights.find((function(e){return e.marketingFlightNumber===t.flightNumber})),i=e.inboundFlights.find((function(e){return e.marketingFlightNumber===t.flightNumber}));if(r||i)return e}))),i=i.filter(v),a.isReturn){var n=a.helpers.clone(e.journeys);n=n.filter(b),i=a.mergeOutInBound(i,n)}return i.sort(a._sortItinaryRoutines[r]),{type:"FlightAllQuoteResult",journeys:i}}))))},n.prototype.mergeOutInBound=function(e,t){return Object.values(T(e,t).reduce((function(e,t){var r=t.uid,i=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(t,["uid"]);return e[r]||(e[r]=Object.assign(Object.assign(Object.assign({},e[r]||{}),{uid:r}),i)),e}),[]))},n.prototype.updateLowestPrice=function(e){if(e.length&&!this.searchService.isFlightsGrouped()){var t=e[0].journeys;if(t.length){var r=t[0].total.currency;return t.reduce((function(e,t){var r=t.total.price;return e.amount>r&&(e.amount=r),e}),{amount:Number.MAX_SAFE_INTEGER,currencyCode:r})}}},n.prototype.selectGroupedFlight=function(t,r,i){return g(this,void 0,void 0,(function(){var n,a,o=this;return v(this,(function(s){switch(s.label){case 0:return[4,this.basketService.getDefaultBasket()];case 1:return n=s.sent(),(a=null==n?void 0:n.subject.value)&&this.originalUserSearch.chosenSearchType===e.FlightSearchType.oneWay&&r===e.FlightDirectionEnum.Outbound?(this.bookSingleFlight(n,t),[2]):(!a||this.originalUserSearch.chosenSearchType!==e.FlightSearchType.return||r!==e.FlightDirectionEnum.Outbound&&r!==e.FlightDirectionEnum.DualSingleOutbound||(t.selected?(this.selectedGroupFlight=null,this.selectedGroupId=-1,this.applyFilters(this.currentFilters,this.currentSort)):(this.selectedGroupFlight=t,this.selectedGroupId=i,this.applyFilters(this.currentFilters,this.currentSort),this._updateTravelPolicies()),t.selected=!t.selected),a&&this.originalUserSearch.chosenSearchType===e.FlightSearchType.return&&r===e.FlightDirectionEnum.Inbound&&this.selectedGroupFlight?(this.doBooking(n,t,{outboundFlights:T(t.outboundFlights.map((function(e,t){return o.makeSchemaFlights(e,"outbound",0,t)}))),inboundFlights:T(t.inboundFlights.map((function(e,t){return o.makeSchemaFlights(e,"inbound",0,t)}))),journeyType:"roundtrip"},t.outboundFlights[0].dateTimeDepartingUTC,t.inboundFlights[0].dateTimeDepartingUTC),this.selectedGroupFlight.selected=!1,this.selectedGroupFlight=null,this.applyFilters(this.currentFilters,this.currentSort),[2]):(a&&this.originalUserSearch.chosenSearchType===e.FlightSearchType.return&&r===e.FlightDirectionEnum.DualSingleInbound&&this.selectedGroupFlight&&(this.bookSingleFlight(n,this.selectedGroupFlight),this.bookSingleFlight(n,t),this.selectedGroupFlight.selected=!1,this.selectedGroupFlight=null,this.applyFilters(this.currentFilters,this.currentSort)),[2]))}}))}))},n.prototype._updateTravelPolicies=function(){var e=this;if(this.selectedGroupFlight&&!this._ruleActionSummary.dualSingleWhenSelected[this.selectedGroupFlight.journeyHash]&&this.multi&&0!==this.multi.length){var t=(this.multi||[]).reduce((function(e,t){return 1===t.order&&t.results&&t.results.length>0&&(e=e.concat(t.results)),e}),[]);t.length>0&&this.applyFlightRules.fetchOne({selectedOutboundFlight:this.selectedGroupFlight,availableInboundFlights:t}).pipe(r.take(1)).subscribe((function(t){t&&(e._ruleActionSummary=e.helpers.mergeObjects(e._ruleActionSummary,t),e._applyFilter())}))}},n.prototype.bookSingleFlight=function(e,t){var r=this;this.doBooking(e,t,{outboundFlights:t.outboundFlights.map((function(e,t){return r.makeSchemaFlights(e,"outbound",0,t)})),inboundFlights:[],journeyType:"single"},t.outboundFlights[0].dateTimeDeparting)},n.prototype.doBooking=function(e,t,r,i,n){var a=t.sourceId,o=t.co2PerItem,s=t.co2PerPassenger,u=t.total,l={adults:this.adults,basket:e.id,children:this.children,co2PerItem:o,co2PerPassenger:s,currency:u.currency,detail:r,price:u.price,searchQuery:this.resultQuery,service:a.toString(),outboundDate:i};n&&(l.inboundDate=n),this.basketService.addToBasket(l,e,this.searchService,this.travellers)},n.prototype.makeSchemaFlights=function(e,t,r,i){return Object.assign(Object.assign({},e),{journeyInfo:{flightGroup:t,groupIndex:r,segmentIndex:i}})},n.prototype.addFlightJourneysToBasket=function(e){return g(this,void 0,void 0,(function(){var t,r,i,n,a,o,s,l,c,d;return v(this,(function(p){switch(p.label){case 0:return e.unavailable?[2,Promise.resolve(!1)]:[4,this.basketService.getDefaultBasket()];case 1:return t=p.sent(),(null==t?void 0:t.subject.value)?(r=e.sourceId,i=e.co2PerItem,n=e.co2PerPassenger,a=e.total,o=u.default(e.outboundFlights[0].dateTimeDeparting),s=e.inboundFlights.length?u.default(e.inboundFlights[0].dateTimeDeparting):null,l=this.getTermsAndCond(e),c={outboundFlights:T(e.outboundFlights.map((function(e,t){return Object.assign({},e)}))),inboundFlights:T(e.inboundFlights.map((function(e,t){return Object.assign({},e)}))),termsAndCond:l,journeyType:"single"},d={adults:this.adults,basket:t.id,children:this.children,co2PerItem:i,co2PerPassenger:n,currency:a.currency,detail:c,price:a.price,searchQuery:this.resultQuery,service:r.toString(),outboundDate:o.format()},s&&(d.inboundDate=s.format(),c.journeyType="roundtrip"),[2,this.basketService.addToBasket(d,t,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},n.prototype.setFlightDisplayType=function(e){this.selectedGroupFlight=null,this.choosenDisplayType.next(e)},n.prototype._applyFilter=function(){this.applyFilters(this.currentFilters,this.currentSort)},n.prototype.openFlightFareRules=function(e,t){var r=this;Object.values(e).find((function(e){return e.length}))?this.modalService.open(d.ModalFlightFareComponent,null,{rules:e,from:t[0].originAirport,to:t[t.length-1].destinationAirport}):this.searchService.getFlightFareRules(t[0]).subscribe((function(e){r.modalService.open(d.ModalFlightFareComponent,null,{rules:e.results[0],from:t[0].originAirport,to:t[t.length-1].destinationAirport})}),(function(e){console.log(e)}))},n.prototype.getTermsAndCond=function(e){return[{name:"Penalties",value:""},{name:"Eligibility",value:""},,{name:"Day/time",value:""},{name:"Seasonality",value:""},{name:"Flight Application",value:""},{name:"Advance Reservations/ticketing",value:""},{name:"Maximum Stay",value:""},{name:"Minimum Stay",value:""},{name:"Stopovers",value:""},{name:"Transfers",value:""},{name:"Combinations",value:""},{name:"Blackout Dates",value:""},{name:"Surcharges",value:""},{name:"Accompanied Travel",value:""},{name:"Travel Restrictions",value:""},{name:"Sales Restrictions",value:""},{name:"Hip/mileage Exceptions",value:""},{name:"Ticket Endorsements",value:""},{name:"Children Discounts",value:""},{name:"Tour Conductor Discounts",value:""},{name:"Agent Discounts",value:""},{name:"All Other Discounts",value:""},{name:"Miscellaneous Provisions",value:""},{name:"Fare By Rule",value:""},{name:"Groups",value:""},{name:"Tours",value:""},{name:"Visit Another Country",value:""},{name:"Deposits",value:""},{name:"Voluntary Changes",value:""},{name:"Voluntary Refunds",value:""},{name:"Negotiated Fares",value:""},{name:"Rule Application And Other Conditions",value:""}]},n.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:ee.Flight,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},n.prototype.updateSerchQuery=function(t){var r=t;switch(this.chosenSearchType){case e.FlightSearchType.multiCity:r.multiDestinationDetail=this.multiDestination;break;case e.FlightSearchType.return:case e.FlightSearchType.oneWay:r.departLocationDetail=this.departLocation,r.arriveLocationDetail=this.arriveLocation}return r},n}(c);Ze.STORAGE_SESSION_PARAMS="search_flight",Ze.STORAGE_SESSION_RESULTS="results_flight",(qe=e.URLS||(e.URLS={})).AccessToken="accessToken",qe.LOGOUT_URL="logout",qe.Refresh="refreshToken",qe.CONFERMA_THUMBNAIL_URL="https://ssl.conferma.com/Images/PropertyThumbnails/",qe.CONFIRMA_PHOTO_URL="/confermainfo/Info.aspx?mode=media&key=MICROSSABS&id=",qe.CONFIRMA_INFO_URL="/confermainfo/Info.aspx?mode=hotel&key=MICROSSABS&id=",qe.RECOVER_PASSWORD_URL="password/getResetToken",qe.RESET_PASSWORD="password/resetByToken";var $e,et,tt=function(){this.priceRange={min:0,max:0},this.distanceRange={min:0,max:0},this.chain=[],this.amenitytype=[],this.preferred=[],this.extra=[],this.hotelName="",this.breakfastType=[]};($e=e.HotelView||(e.HotelView={})).LIST="list",$e.MAP="map",(et=e.SortTypesHotel||(e.SortTypesHotel={})).distance="distance",et.name="name",et.price="price";var rt=function(i){function n(r,a,o,s,l,c,d,p,h,m,f,y){var g=i.call(this,d,a)||this;g.hotelFetcher=r,g.userService=o,g.environment=s,g.avaliabilityService=l,g.basketService=c,g.searchService=p,g.httpCallService=h,g.quickListFetcher=m,g.getRailStationFetcher=f,g.applyHotelRulesFetcher=y,g.type=ee.Hotel,g.location_types=new t.BehaviorSubject([]),g.offices=new t.BehaviorSubject([]),g.lastActivePage=new t.BehaviorSubject(null),g.galleries={},g.occupied=0,g.results_details={chains:new Set,amenities:[],maxDistance:0},g._bookedTravellers=[],g.filterChange=new t.Subject,g.selectItemMapView=new t.Subject,g.display={minprice:Number.NEGATIVE_INFINITY,maxprice:Number.POSITIVE_INFINITY,filters:{breakfastType:[]}},g.min_date={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},g.min_return_date={year:u.default().year(),month:u.default().month()+1,day:u.default().date()+1},g.localFilters=new tt,g.currentView=e.HotelView.LIST,g._max_no_of_rooms=4,g._max_rooms_array=new Array(g._max_no_of_rooms).fill(0),g._max_no_of_occupants=8,g._max_occupant_array=new Array(g._max_no_of_occupants).fill(0),g._distance_list=[1,2,5,10,20,25],g._default_currency=null,g.resultsSessionName=n.STORAGE_SESSION_RESULTS,g.multiResultsSessionName=n.STORAGE_SESSION_RESULTS,g.query={},g.filterResults=function(){g.results.next(g.fullResults.filter((function(e){return g.inPriceRange(e)&&g.inDistanceRange(e)&&g.containsHotelname(e)&&g.hasChain(e)&&g.breakfastTypeFilter(e)})))},g.filterLighteningResults=function(){g.results.next(g.fullResults.filter((function(e){return g.inLighteningPriceRange(e)&&g.containsHotelname(e)&&g.hasChain(e)&&g.hasPreferred(e)&&g.breakfastTypeFilter(e)&&g.getExtraFilter(e)&&g.getAmenitiesFilter(e)})))},g.results_details.chains=new Set;var v=d.getSessionItem(n.STORAGE_SESSION_PARAMS)||{tempParams:{}};g.default_currency=g.tempParams.currency?g.tempParams.currency:g._default_currency,g.updateTempParams(p.makeHotelQuery(v.tempParams)),p.shouldAddTravellerSubscription()&&p.travellerInformation.subscribe((function(e){g.travellers=e;var t=g.helpers.selectedTravellers(e,ee.Hotel);g.tempParams.no_of_occupants=t.adults.length,g.travellers=e,g._isValid()}));var b=d.getSessionItemAsList(g.resultsSessionName)||[];return b.slice(0,g.environment.numberHotelToPreload).forEach((function(e){g.searchService.canBook(ee.Hotel)&&g.avaliabilityService.getAvailabilityForId(g.makeHotelAvalilityObject(e),e)})),b.forEach((function(e){g.results_details.chains.add(e.group)})),g.fullResults=b,g.results.next(b),g._isValid(),g.userService.changeUser.subscribe((function(t){g.location_types.next([e.LocationTypes.Airport,e.LocationTypes.City,e.LocationTypes.Office,e.LocationTypes.Shortlist,e.LocationTypes.TrainStation]),p.shouldFetchAllOffices()&&g.offices.next([])})),g.localFilters=new tt,g.avaliabilityService.fetching.subscribe((function(e){if(!e){var t=g.avaliabilityService.maxPriceForCurrency("GBP");t>0&&(g.filters.priceRange.max=t,g.localFilters.priceRange.max=t),g._cheapestResultPrice=g.updateLowestPrice(b),g.searchService.canBook(ee.Hotel)&&g._applyTravelRules()}})),g}return m(n,i),Object.defineProperty(n.prototype,"chains",{get:function(){return T(this.results_details.chains)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"amenities",{get:function(){return T(this.results_details.amenities)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxDistance",{get:function(){return this.filters.distanceRange.max=Math.ceil(Math.max.apply(Math,this.results.value.map((function(e){return e.location.distance})))),this.results_details.maxDistance=this.filters.distanceRange.max,this.results_details.maxDistance},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxPrice",{get:function(){return Math.ceil(this.filters.priceRange.max)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"currency",{get:function(){return this.tempParams.currency},set:function(e){this.tempParams.currency=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"checkin_date_ngb",{get:function(){return this._checkin_date_ngb},set:function(e){this._checkin_date_ngb=e,this.tempParams.checkin_date=this.helpers.ngDateToMoment(e),this.checkin_date=this.helpers.ngDateToMoment(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"checkout_date_ngb",{get:function(){return this._checkout_date_ngb},set:function(e){this._checkout_date_ngb=e,this.tempParams.checkout_date=this.helpers.ngDateToMoment(e),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"checkin_date",{get:function(){return this.tempParams.checkin_date},set:function(e){e&&e.isValid()&&(this.tempParams.checkin_date=u.default(e),this._checkin_date_ngb=this.helpers.momentToNgDate(e),e.isSameOrBefore(this.tempParams.checkout_date)&&(this.checkout_date=u.default(e).add(1,"day")),this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"checkout_date",{get:function(){return this.tempParams.checkout_date},set:function(e){e&&e.isValid()&&(this.tempParams.checkout_date=e,this.checkout_date_ngb=this.helpers.momentToNgDate(e),this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"no_of_rooms",{get:function(){return this.tempParams.no_of_rooms},set:function(e){e>4||e<1||(this.tempParams.no_of_rooms=e,this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"no_of_occupants",{get:function(){return this.tempParams.no_of_occupants},set:function(e){e<1||(this.tempParams.no_of_occupants=e,this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"default_currency",{get:function(){return this.tempParams.currency},set:function(e){this.tempParams.currency=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"location",{get:function(){return this.tempParams.location},set:function(e){this.tempParams.location=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"formatted_location",{get:function(){return this.tempParams.location?this.tempParams.location.destination:"No Location Set"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"distance",{get:function(){return this.tempParams.distance},set:function(e){this.tempParams.distance=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"prefered_hotels_only",{get:function(){return this.tempParams.prefered_hotels_only},set:function(e){this.tempParams.prefered_hotels_only=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"country",{get:function(){return this.tempParams.country},set:function(e){this.tempParams.country=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"postcode",{get:function(){return this.tempParams.postcode},set:function(e){this.tempParams.postcode=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"trainsStation",{get:function(){return this.tempParams.trainsStation},set:function(e){this.tempParams.trainsStation=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"office",{get:function(){return this.tempParams.office},set:function(e){this.tempParams.office=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hotel_name",{get:function(){return this.tempParams.hotel_name},set:function(e){this.tempParams.hotel_name=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hotel_chain",{get:function(){return this.tempParams.hotel_chain},set:function(e){this.tempParams.hotel_chain=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"max_rooms_array",{get:function(){return this._max_rooms_array},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"max_occupant_array",{get:function(){return this._max_occupant_array},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"distance_list",{get:function(){return this._distance_list},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"location_type_select",{get:function(){return this.tempParams.location_type_select},set:function(e){this.tempParams.location_type_select=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"filters",{get:function(){return this.localFilters},enumerable:!1,configurable:!0}),n.prototype.processResults=function(e){var t=this;return this.results_details.maxDistance=0,this.results_details.chains=new Set,e.map((function(e,r){return t.results_details.maxDistance=Math.max(t.results_details.maxDistance,e.location.distance),t.filters.distanceRange.max=t.results_details.maxDistance,t.results_details.chains.add(e.group),r<t.environment.numberHotelToPreload&&t.avaliabilityService.getAvailabilityForId(t.makeHotelAvalilityObject(e),e),Object.assign({sortedTags:t.sortTags(e.tags),Details:{distance_airport:0,distance_metro:0,distance_rail:0,airport_details:{name:"Not returned"},metro_details:{name:"Not returned"},rail_details:{name:"Not returned"}}},e)}))},n.prototype._applyTravelRules=function(){var e=this,t=this.helpers.clone(this.fullResults||[]).map((function(t){return e.avaliabilityService.updateHotel(t)})).filter((function(e){return Object.keys(e.availableRates||{}).length>0}));0!==t.length&&this.applyHotelRulesFetcher.fetchKeyedObject("id",{data:t}).pipe(r.take(1)).subscribe((function(t){e.results.next(e.fullResults.map((function(r){return t[r.id]?e.avaliabilityService.setHotelAvalability(t[r.id]):r})))}))},n.prototype.makeLocations=function(e){return this.helpers.arrayToObjectArray(e,["distanceType"])},n.prototype.sortTags=function(e){var t=this;return e?T(e).sort((function(e,t){return e.name<t.name?-1:e.name>t.name?1:0})).map((function(e){return Object.assign(Object.assign({},e),{icon:t.environment.tagMap[e.name]||e.icon})})):[]},n.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeHotelQuery()),this.localFilters=new tt,this.results_details={chains:new Set,amenities:[],maxDistance:0},this._isValid()},n.prototype._isValid=function(){var t,r,i,a,o,s;if(this.doChecks){switch(this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams}),this.min_return_date=this.helpers.momentToNgDate(this.tempParams.checkin_date),this.tempParams.checkin_date.isSameOrAfter(this.tempParams.checkout_date)&&(this.checkout_date=u.default(this.tempParams.checkin_date).add(1,"day")),this.validationMessages=[],this.tempParams.location_type_select){case e.LocationTypes.City:this.country||this.validationMessages.push("Please select country"),this.location||this.postcode||this.validationMessages.push("Please select a hotel location or enter a postcode.");break;case e.LocationTypes.Office:"Office"===(null===(t=this.tempParams.location)||void 0===t?void 0:t.type)||this.office||this.validationMessages.push("Please select an office.");break;case e.LocationTypes.Airport:if(null===(r=this.tempParams)||void 0===r?void 0:r.location){(null===(i=this.tempParams.location.airport)||void 0===i?void 0:i.gateway)||this.validationMessages.push("Please select a airport.");break}this.validationMessages.push("Please select a airport.");break;case e.LocationTypes.TrainStation:(null===(o=null===(a=this.tempParams.location)||void 0===a?void 0:a.railstation)||void 0===o?void 0:o.stationCode)||(null===(s=this.trainsStation)||void 0===s?void 0:s.stationCode)||this.validationMessages.push("Please select a train station.");break;case e.LocationTypes.Shortlist:this.country||this.validationMessages.push("Please select country")}this.checkout_date&&this.checkout_date.isSameOrBefore(this.checkin_date)&&this.validationMessages.push("Checkout date must be after checkin date"),this.checkout_date&&this.checkout_date.isBefore(u.default())&&this.validationMessages.push("Checkout date must not be in the past"),this.checkin_date&&this.checkin_date.isBefore(u.default())&&this.validationMessages.push("Checkin date must not be in the past"),this.checkout_date&&this.checkin_date&&this.checkin_date.isAfter(this.checkout_date)&&this.validationMessages.push("Checkout data must be after the checkin date");var l=this.no_of_occupants/this.no_of_rooms;1!==l&&2!==l&&this.validationMessages.push("Occupants per room must be 1 or 2, if you have an odd number of travellers (greater than one), the no of rooms must be equal"),console.log(this.validationMessages),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages)}},n.prototype.startSearch=function(){if(this.results.next([]),this.avaliabilityService.reset(),this.isValid.value){this._originalUserSearch=Object.freeze(this.helpers.clone(this.tempParams)),this.buildQuery();var t=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(this.getSearchQuery())),this._startSearch(this.tempParams.location_type_select===e.LocationTypes.Shortlist?this.quickListFetcher.fetchList({countryCode:this.country.cCode}):this.hotelFetcher.fetchList(t))}return Promise.resolve(!1)},n.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:ee.Hotel,searchArgs:t,travelDate:this.checkin_date.format(),travellers:this.helpers.getTravellersId(this.travellers)}},n.prototype.updateSerchQuery=function(t){var r,i=t;switch(i.location_type_select=this.location_type_select,(null===(r=this.location)||void 0===r?void 0:r.name)&&(i.cityName=this.location.name),i.location_type_select){case e.LocationTypes.Office:i.officeName=this.office.name;break;case e.LocationTypes.TrainStation:i.trainsStationDetail=this.trainsStation;break;case e.LocationTypes.Airport:i.airportDetail=this.location.airport}return i},n.prototype.startRecentSearch=function(t){var i=this;switch(this.location_type_select=t.searchArgs.location_type_select,this.currency=t.searchArgs.currency,this.distance=t.searchArgs.distance,this.no_of_rooms=t.searchArgs.rooms,this.checkin_date=u.default(t.searchArgs.startDate),this.checkout_date=u.default(t.searchArgs.endDate),this.hotel_name=t.searchArgs.hotelName,t.searchArgs.groupName&&(this.hotel_chain={name:t.searchArgs.groupName}),this.location_type_select){case e.LocationTypes.Airport:this.searchService.getAirportByCode(t.searchArgs.iata).subscribe((function(e){var t={airport:{gateway:e.iataMatch.iata}};i.location=Object.assign(Object.assign({},t),e.iataMatch),i.searchService.startSearches()}));break;case e.LocationTypes.City:this.country={cCode:t.searchArgs.countryCode,cName:""},t.searchArgs.latitude&&t.searchArgs.longitude?this.location={name:t.searchArgs.cityName,latitude:t.searchArgs.latitude,longitude:t.searchArgs.longitude}:t.searchArgs.postOrZipCode&&(this.postcode={name:t.searchArgs.postOrZipCode,type:e.LocationTypes.Postcode}),this.searchService.startSearches();break;case e.LocationTypes.Office:this.searchService.getOffice(t.searchArgs.officeId).pipe(r.take(1)).subscribe((function(e){i.office={id:e.id,name:e.name},i.searchService.startSearches()}));break;case e.LocationTypes.TrainStation:this.getRailStationByCode(t.searchArgs.trainStationCode).subscribe((function(e){i.trainsStation=e,i.searchService.startSearches()}));break;case e.LocationTypes.Shortlist:this.country={cCode:t.searchArgs.countryCode,cName:""},this.searchService.startSearches()}},n.prototype.getRailStationByCode=function(e){return e?this.getRailStationFetcher.fetchList({id:null,code:e}).pipe(r.take(1)):t.of()},n.prototype.getSearchQuery=function(e){return void 0===e&&(e=!1),this.buildQuery(e),this.helpers.removeNulls(this.query)},n.prototype.buildQuery=function(t){var r,i,n,a,o,s;void 0===t&&(t=!1);var u=t?this.originalUserSearch:this.tempParams,l={startDate:u.checkin_date.format("YYYY-MM-DD"),endDate:u.checkout_date.format("YYYY-MM-DD"),rooms:u.no_of_rooms,adults:u.no_of_occupants,currency:u.currency?u.currency:null,distance:u.distance,distanceType:B.M,maxResults:100};switch(this.getRoomNumber(),u.location_type_select){case e.LocationTypes.Airport:l.iata=u.location.airport.gateway;break;case e.LocationTypes.City:l.countryCode=u.country.cCode,this.location?(l.latitude=u.location.latitude,l.longitude=u.location.longitude):u.postcode&&(l.postOrZipCode=u.postcode.name);break;case e.LocationTypes.TrainStation:(null===(i=null===(r=u.location)||void 0===r?void 0:r.railstation)||void 0===i?void 0:i.stationCode)?l.trainStationCode=u.location.railstation.stationCode:(null===(n=u.trainsStation)||void 0===n?void 0:n.stationCode)&&(l.trainStationCode=u.trainsStation.stationCode);break;case e.LocationTypes.Office:(null===(a=u.location)||void 0===a?void 0:a.id)?l.officeId=+u.location.id:(null===(o=u.office)||void 0===o?void 0:o.id)&&(l.officeId=+u.office.id);break;case e.LocationTypes.Shortlist:l.countryCode=u.country.cCode;break;case e.LocationTypes.Postcode:l.countryCode=u.country.cCode,l.postOrZipCode=u.location.name}u.hotel_name&&(l.hotelName=u.hotel_name),u.hotel_chain&&(l.groupName=null===(s=u.hotel_chain)||void 0===s?void 0:s.name),this.query=l},n.prototype.makeHotelAvalilityObject=function(e){return{hotel:e.id,startDate:this.helpers.formatIsoDate(this.checkin_date),endDate:this.helpers.formatIsoDate(this.checkout_date),rooms:this.no_of_rooms,occupants:this.no_of_occupants,currency:"GBP"}},n.prototype.resultsHaveTag=function(e){var t=this,r=this.fullResults.filter((function(r){var i=r.tags.filter((function(r){if(r.name)return!!t.convertToOneString(r.name).toLowerCase().includes(t.convertToOneString(e).toLowerCase())}));return!!(i&&i.length>0)}));return!!(r&&r.length>0)},n.prototype.inPriceRange=function(e){var t=this.avaliabilityService.getAvailabilityValue(e);return!!t&&(this.helpers.inRange(t.maxprice,this.filters.priceRange)&&this.helpers.inRange(t.minprice,this.filters.priceRange))},n.prototype.inDistanceRange=function(e){return 0===this.filters.distanceRange.max||this.helpers.inRange(e.location.distance,this.filters.distanceRange)},n.prototype.containsHotelname=function(e){var t=this.filters.hotelName.toLowerCase();return!(t&&t.length>0)||e.name.toLowerCase().includes(t)},n.prototype.inLighteningPriceRange=function(e){var t=this.avaliabilityService.getAvailabilityValue(e);if(t&&0!==Object.keys(t).length){var r,i=0,n=this.helpers.inRange(t.prpn,this.filters.priceRange);return i=(null==t?void 0:t.maxprice)?t.maxprice:null==t?void 0:t.rooms.reduce((function(e,t){return e>t.total?e:t.total}),0),r=this.helpers.inRange(i,this.filters.priceRange),n&&r}return!0},n.prototype.hasChain=function(e){var t=(this.filters.chain||[]).map((function(e){return e.toLowerCase()}));return!t||!t.length||!!t.find((function(t){return e.group.toLowerCase().includes(t)}))},n.prototype.breakfastTypeFilter=function(t){if(!this.filters.breakfastType.length)return!0;var r=this.avaliabilityService.getAvailabilityForId(this.makeHotelAvalilityObject(t),t);if(!r&&!r.value)return!1;var i=r.value,n=this.filters.breakfastType.includes(e.SearchHandler.BREAKFAST_INCLUDED),a=this.filters.breakfastType.includes(e.SearchHandler.BREAKFAST_NOT_INCLUDED);return!!(null==i?void 0:i.rooms)&&!!i.rooms.filter((function(e){return n&&a?e:n?e.rateDescription.match(Ae)&&!e.rateDescription.match(ke):a?!e.rateDescription.match(Ae)||e.rateDescription.match(ke):void 0})).length},n.prototype.byMostExpensive=function(){this.sortByPrice(!1)},n.prototype.sortByPrice=function(e,t){var r=this;void 0===e&&(e=!0),void 0===t&&(t=!1);var i=this.fullResults,n=[],a=[];i.map((function(e){var t;(null===(t=r.avaliabilityService.getAvailabilityValue(e))||void 0===t?void 0:t.prpn)?n.push(e):a.push(e)})),n.sort((function(t,i){var n,a,o=null===(n=r.avaliabilityService.getAvailabilityValue(t))||void 0===n?void 0:n.prpn,s=null===(a=r.avaliabilityService.getAvailabilityValue(i))||void 0===a?void 0:a.prpn;return e?o>s?1:s>o?-1:0:o<s?1:s<o?-1:0}));var o=T(n,a);this.results.next(o),t&&(console.log("++ sortByPrice() called ++"),console.log("++ hotel ++",i),console.log("++ hotelsWithPrices ++",n),console.log("++ hotelsWithoutPrices ++",a),console.log("++ sortedHotels ++",o))},n.prototype.sortByName=function(){this.results.next(this.helpers.clone(this.fullResults).sort((function(e,t){return e.name.toLowerCase().localeCompare(t.name.toLowerCase())})))},n.prototype.sortByDistance=function(){this.results.next(this.helpers.clone(this.fullResults).sort((function(e,t){return Number(e.location.distance)-Number(t.location.distance)})))},n.prototype.byPreferred=function(){var e=this,t=this.results.value||[];try{t=t.sort((function(t,r){return e.preferredToInt(r)-e.preferredToInt(t)}))}catch(e){console.error("+++ Error sorting by preferred: ",e," +++")}this.results.next(t)},n.prototype.preferredToInt=function(e){return(e.preferred.client?1:0)+(e.preferred.consumer?2:0)},n.prototype.intToPreferred=function(e){return{client:1==(1&e),consumer:2==(2&e)}},n.prototype.addFilter=function(e,t){this.localFilters[t].push(e)},n.prototype.removeFilter=function(e,t){var r=this.localFilters;Array.isArray(r[t])&&(r[t]=r[t].filter((function(t){return e!==t})))},n.prototype.resetFilters=function(){this.localFilters.chain=[],this.localFilters.amenitytype=[],this.localFilters.preferred=[],this.localFilters.extra=[],this.localFilters.hotelName="",this.localFilters.breakfastType=[]},n.prototype.updateFromPreviousSearches=function(e){var t;null===(t=e[ee.Flight])||void 0===t||t.searchQuery},n.prototype.hasPreferred=function(t){var r=this.filters.preferred;return!(r.length&&!r.includes(e.SearchHandler.ANY))||(r.includes(e.SearchHandler.AGENCY)&&r.includes(e.SearchHandler.CLIENT)?!0===t.preferred.consumer&&!0===t.preferred.client:r.includes(e.SearchHandler.AGENCY)?!0===t.preferred.consumer:r.includes(e.SearchHandler.CLIENT)?!0===t.preferred.client:void 0)},n.prototype.getmaxPriceForCurrency=function(e){return this.avaliabilityService.maxPriceForCurrency(e)},n.prototype.getExtraFilter=function(t){var r=this;return this.filters.extra.includes(e.SearchHandler.AVAILABILITY)?!0===t.unavailable:!this.filters.extra.includes(e.SearchHandler.FEMALE_FRIENDLY)||t.tags.filter((function(t){return!t.name||r.convertToOneString(t.name).toLowerCase().includes(r.convertToOneString(e.SearchHandler.FEMALE_FRIENDLY).toLowerCase())})).length>0},n.prototype.getAmenitiesFilter=function(e){var t=this,r=!0;return this.filters.amenitytype.forEach((function(i){var n=e.tags.filter((function(e){if(e.name)return!!t.convertToOneString(e.name).toLowerCase().includes(t.convertToOneString(i).toLowerCase())}));return r=!!(n&&n.length>0)})),r},n.prototype.convertToOneString=function(e){return e.replace(/[^a-zA-Z]/g,"")},n.prototype.getImages=function(i){var n=this,a=this.environment.hostBaseUrl+e.URLS.CONFIRMA_PHOTO_URL+i.split(",")[0];return this.galleries[i]?t.of(this.galleries[i]):this.httpCallService.get(a,{responseType:"text"}).pipe(r.map((function(e){if(!e)throw Error("Gallery for "+i+" can not be loaded.");var t=document.createElement("div");t.innerHTML=e;var r=Array.from(t.getElementsByTagName("img")).reduce((function(e,t){return t.src.includes("https://www.vfmii.com/")&&e.push(t.src),e}),[]);if(!r.length)throw Error("There is no media content provided for this hotel "+i);return n.galleries[i]=r})))},n.prototype.addPaginationPage=function(e){var t="PaginationPageCount";return this.storageService.setSessionItem(t,e),this.storageService.getSessionItem(t)},n.prototype.toggleView=function(){this.currentView===e.HotelView.LIST?this.currentView=e.HotelView.MAP:this.currentView=e.HotelView.LIST},n.prototype.calcDayDiff=function(){var e=u.default(this.checkout_date),t=u.default(this.checkin_date);return e.startOf("day").diff(t.startOf("day"),"days")},n.prototype.updateLowestPrice=function(e){var t=Object.keys(this.avaliabilityService.currencies);if(!e.length&&!t.length||!t.length)return null;var r=t[0];return{amount:this.avaliabilityService.currencies[r].minprice,currencyCode:r}},n.prototype.getRoomNumber=function(){for(var e=[],t=0;t<Number(this.tempParams.no_of_rooms);t++){var r={Adults:this.calcRoomOccupancy(this.tempParams.no_of_rooms,this.tempParams.no_of_occupants),Children:0,Infants:0};e.push(r)}for(var i=[],n=0;n<e.length;n++)for(var a=0;a<e[n].Adults;a++)i.push(n+1)},n.prototype.calcRoomOccupancy=function(e,t){console.log("No of Travellers: "+t+"| No of rooms: "+e+" | Assigned: "+this.occupied);var r=Math.ceil(t/e);return t-this.occupied<r&&(console.log("We have run out of occupiers!"),r=t-this.occupied),r<=0&&(r=1),this.occupied+=r,r},n.prototype.addHotelRoomToBasket=function(e,t,r,i){return g(this,void 0,void 0,(function(){var i,n,a,o,u,l,c,d,p,h,m=this;return v(this,(function(f){switch(f.label){case 0:return console.log(e),console.log(t),console.log(r),e.unavailable?[2,Promise.resolve(!1)]:(r.startDate=new Date(r.startDate).toISOString(),r.endDate=new Date(r.endDate).toISOString(),delete(i=Object.assign({},r)).adults,(n=[]).push({rateDescription:t.rateDescription,roomDescription:t.roomDescription,roomId:t.roomId,roomType:t.roomType,rateCode:t.rateCode,checkIn:r.startDate,checkOut:r.endDate}),[4,this.basketService.getDefaultBasket()]);case 1:return a=f.sent(),(o=null==a?void 0:a.subject.value)&&(u=this.tempParams.no_of_occupants,l=new Array(this.tempParams.no_of_rooms).fill("TEST"),c=this.tempParams.no_of_rooms===u?1:2,d=s.default.chunk(this.travellers,c),p=e.address,h=this.getTermsAndCond(t,r),l.forEach((function(s,u){if(m.basketService.addToBasket({adults:c,basket:o.id,service:e.sourceId.toString(),detail:{hotelAddress:{streetName:p.addressLine1,town:p.addressLine2,county:p.addressLine3,postcode:p.postOrZipCode,countryCode:p.countryCode},hotelDescription:e.group,hotelId:e.id,hotelName:e.name,numberOfRooms:1,rooms:n,termsAndCond:h},price:t.total,currency:t.currencyCode,searchQuery:i,outboundDate:r.startDate},a,m.searchService,d[u]||[]),u===l.length-1)return Promise.resolve(!0)}))),[2,Promise.resolve(!1)]}}))}))},n.prototype.getTermsAndCond=function(e,t){return[{name:"Rate Information",value:e.rateDescription},{name:"Cancellation Policy",value:e.policies.cancellation},{name:"Rate Code",value:e.rateCode},{name:"Room Information",value:e.roomDescription},{name:"Deposit Amount",value:(e.total*t.rooms).toString()+t.currency}]},n.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:ee.Hotel,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},n}(c);rt.MAX_HOTEL_ROOMS=4,rt.STORAGE_SESSION_PARAMS="search_hotel",rt.STORAGE_SESSION_RESULTS="results_hotel";var it=function(e){function r(i,n,a,o,s){var l=e.call(this,o,n)||this;l.loungefetcher=i,l.basketService=a,l.searchService=s,l.type=ee.Lounge,l.terminals=new t.BehaviorSubject([]),l._flightNumber=null,l._selectedTerminal="",l.min_date={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},l._date=null,l._time=null,l.resultsSessionName=r.STORAGE_SESSION_RESULTS,l.multiResultsSessionName=r.STORAGE_SESSION_RESULTS;var c=o.getSessionItem(r.STORAGE_SESSION_PARAMS)||{tempParams:{}};l.updateTempParams(s.makeLoungesQuery(c.tempParams)),s.shouldAddTravellerSubscription()&&s.travellerInformation.subscribe((function(e){var t=l.helpers.selectedTravellers(e,ee.Lounge);l.tempParams.adults=t.adults.length,l.tempParams.children=t.children.length,l.travellers=e,l._isValid()}));var d=o.getSessionItemAsList(l.resultsSessionName)||[];return l._cheapestResultPrice=l.updateLowestPrice(d),l.results.next(d||[]),l}return m(r,e),Object.defineProperty(r.prototype,"adults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"children",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"infants",{get:function(){return this.tempParams.infants},set:function(e){this.tempParams.infants=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"flightNumber",{get:function(){return this._flightNumber},set:function(e){this._flightNumber=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"locationCode",{get:function(){return this.tempParams.locationCode},set:function(e){var t;this.tempParams.locationCode=e;var r=null===(t=this.terminals)||void 0===t?void 0:t.value;"string"==typeof e?(this._locationCode="",this.terminal=null,this.terminals.next([]),this.selectedTerminal=null,this._isValid()):e&&e.gateway?(this._locationCode=e.gateway,this.terminal=null,this.terminals.next(e.terminals),1===r.length&&(this.selectedTerminal=r[0].key),this._isValid()):(this._locationCode=null,this.terminal=null,this.selectedTerminal=null,this.terminals.next([]),this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"terminal",{get:function(){return this.tempParams.terminal?this.tempParams.terminal.toString():null},set:function(e){this.tempParams.terminal=e;var t=this.terminals.value.find((function(t,r){if(t.value===e)return!0}));t?this.selectedTerminal=t.key:this.terminals.value&&this.terminals.value.length>0?this.selectedTerminal=this.terminals.value[0].key:this.selectedTerminal="Any Terminal",this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"selectedTerminal",{get:function(){return this._selectedTerminal},set:function(e){this._selectedTerminal=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"date",{get:function(){return this._date},set:function(e){this._date=e,this._updateDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"time",{get:function(){return this._time},set:function(e){this._time=e,this._updateDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"arrivalDatetime",{get:function(){return this.tempParams.arrivalDatetime},set:function(e){e.isValid()?(this.tempParams.arrivalDatetime=e,this._date=this.helpers.momentToNgDate(e),this._time=this.helpers.formatTimeColon(e)):this.tempParams.arrivalDatetime=null,this._isValid()},enumerable:!1,configurable:!0}),r.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeLoungesQuery()),this._isValid()},r.prototype.getSearchQuery=function(){var e={adults:this.tempParams.adults,children:this.tempParams.children,infants:this.tempParams.infants,locationCode:this._locationCode,terminal:"Any"===this.tempParams.terminal?null:this.tempParams.terminal,arrivalDatetime:this.tempParams.arrivalDatetime};return this.helpers.removeNulls(e)},r.prototype._isValid=function(){this.doChecks&&(this.storageService.setSessionItem(r.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,travellers:this.travellers}),this.validationMessages=[],this._locationCode&&""!==this._locationCode||this.validationMessages.push("You must select airport first."),this.tempParams.arrivalDatetime.unix()<u.default().unix()&&this.validationMessages.push("Outward journey cannot be in the past."),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages))},r.prototype._updateDateTime=function(){if(this._date&&this._time){var e=this.helpers.ngDateToMoment(this._date,this._time);this.tempParams.arrivalDatetime=e.isValid()?e:null,this._isValid()}},r.prototype.startSearch=function(){if(this.results.next([]),this.isValid.value){var e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.loungefetcher.fetchList(this.helpers.removeNulls(e)))}return Promise.resolve(!1)},r.prototype.getRecentSearchQuery=function(e){return{serviceType:ee.Lounge,searchArgs:e,travelDate:this.arrivalDatetime.format(),travellers:this.helpers.getTravellersId(this.travellers)}},r.prototype.startRecentSearch=function(e){var t=this;this.arrivalDatetime=u.default(e.searchArgs.arrivalDatetime),this.terminal=e.searchArgs.terminal,this.searchService.getAirportByCode(e.searchArgs.locationCode).subscribe((function(r){var i,n,a,o,s,u;r&&(t.locationCode={country:null===(n=null===(i=r.iataMatch)||void 0===i?void 0:i.locationDetails)||void 0===n?void 0:n.country,countryCode:null===(o=null===(a=r.iataMatch)||void 0===a?void 0:a.locationDetails)||void 0===o?void 0:o.countryCode,destination:r.iataMatch.name,gateway:r.iataMatch.iata,postcode:null===(u=null===(s=r.iataMatch)||void 0===s?void 0:s.locationDetails)||void 0===u?void 0:u.postcode,terminals:t.searchService.processTerminals(r.iataMatch.terminals)},t.terminal=e.searchArgs.terminal,t.searchService.startSearches())})),this.searchService.startSearches()},r.prototype.sortByPrice=function(e,t){void 0===t&&(t=[]);var r=T(this.fullResults);r.length||(r=t),r=this.sortResultsPrice(r,e),this.results.next(r)},r.prototype.sortResultsPrice=function(e,t){var r=T(e);return r=t?r.sort((function(e,t){return t.price-e.price})):r.sort((function(e,t){return e.price-t.price}))},r.prototype.sortByTerminal=function(e){void 0===e&&(e=[]);var t=T(this.fullResults);t.length||(t=e);this.results.next(t.sort((function(e,t){return-1})))},r.prototype.updateFromPreviousSearches=function(e){var t;null===(t=e[ee.Flight])||void 0===t||t.searchQuery},r.prototype.addLoungeToBasket=function(e,t){var r;return g(this,void 0,void 0,(function(){var i,n,a;return v(this,(function(o){switch(o.label){case 0:return e.unavailable?[2,Promise.resolve(!1)]:[4,this.basketService.getDefaultBasket()];case 1:return i=o.sent(),n=null==i?void 0:i.subject.value,a=this.getTermsAndCond(e),n?[2,this.basketService.addToBasket({adults:t.adults,children:t.children,infants:t.infants,basket:n.id,service:e.sourceId.toString(),detail:{arrivalDatetime:t.arrivalDatetime.format(),locationCode:e.code,name:e.name,airportIata:null==t?void 0:t.locationCode,logo:e.lounge.logo,introduction:e.lounge.introduction,covidCopy:e.lounge.misc.covidCopy,cancellationInfo:e.lounge.cancellationInfo,admendmentsInfo:e.lounge.amendmentsInfo,checkInInfo:e.lounge.checkInInfo,dressCode:e.lounge.dressCode,foodAndBeverage:e.lounge.foodAndBeverage,whatsIncludedFood:e.lounge.whatsIncludedFood,whatsIncludedDrinks:e.lounge.whatsIncludedDrinks,whatsIncludedExtras:e.lounge.whatsIncludedExtras,groupInfo:e.lounge.groupInfo,terminal:null===(r=e.lounge.terminal)||void 0===r?void 0:r.toString(),termsAndCond:a},price:e.price,currency:e.currency,searchQuery:t,outboundDate:t.arrivalDatetime.format()},i,this.searchService,this.travellers)]:[2,Promise.resolve(!1)]}}))}))},r.prototype.getTermsAndCond=function(e){return[{name:"Name",value:e.lounge.name},{name:"Telephone",value:e.lounge.telephone},{name:"Important Information",value:e.lounge.misc.importantInformation},{name:"Introduction",value:e.lounge.introduction},{name:"Dress Code",value:e.lounge.dressCode},{name:"Business Facilities",value:e.lounge.misc.businessfacilities},{name:"Entertainment Facilities",value:e.lounge.misc.entertainmentFacilities},{name:"Disabled Facilities",value:e.lounge.misc.facilitiesdisabled},{name:"Facilities",value:e.lounge.facilities.toString()},{name:"Times",value:"Opens "+e.lounge.openTime+"; Closes "+e.lounge.closeTime},{name:"Directions",value:e.lounge.directions},{name:"Groups",value:e.lounge.groupInfo},{name:"Check-In Time",value:e.lounge.checkInInfo},{name:"Amend Info",value:e.lounge.amendmentsInfo},{name:"Cancel Info",value:e.lounge.cancellationInfo}]},r.prototype.updateLowestPrice=function(e){if(!e.length)return null;var t=e[0].currency;return e.reduce((function(e,t){var r=t.price;return e.amount>r&&(e.amount=r),e}),{amount:Number.MAX_SAFE_INTEGER,currencyCode:t})},r.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t={name:""+u.default(),serviceType:ee.Lounge,searchArgs:e};return this.searchService.saveFavouriteSearch(t)}},r}(c);it.STORAGE_SESSION_PARAMS="search_lounge",it.STORAGE_SESSION_RESULTS="results_lounge";var nt,at,ot={AirportFirst:"You must select airport first.",InvardJourney:"Inward journey cannot be in the past.",OutwardJourney:"Outward journey cannot be in the past.",DateOverlapped:"Inward Journey can not be before outward journey"},st=function(e){function r(i,n,a,o,s){var l=e.call(this,o,n)||this;l.parkingfetcher=i,l.basketService=a,l.searchService=s,l.type=ee.Parking,l.terminals=new t.BehaviorSubject([]),l.listViewToggle=new t.BehaviorSubject(null),l.parkingFiltersText={onAirport:"On Airport",meetAndGreet:"Meet and greet",parkAndRide:"Park and ride",parkAndStroll:"Park and stroll",carParkedForYou:"Car parked for you"},l._selectedTerminal="",l.min_date={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},l.min_return_date={year:u.default().year(),month:u.default().month()+1,day:u.default().date()+1},l.resultsSessionName=r.STORAGE_SESSION_RESULTS,l.multiResultsSessionName=r.STORAGE_SESSION_RESULTS,l._outdate=null,l._outtime=null,l._indate=null,l._intime=null;var c=o.getSessionItem(r.STORAGE_SESSION_PARAMS)||{tempParams:{}};l.updateTempParams(s.makeParkingQuery(c.tempParams));var d=o.getSessionItemAsList(l.resultsSessionName)||[];return l.results.next(d),l._cheapestResultPrice=l.updateLowestPrice(d),s.shouldAddTravellerSubscription()&&s.travellerInformation.subscribe((function(e){l.travellers=(null==e?void 0:e.slice(0,1))||[],l._isValid()})),l}return m(r,e),Object.defineProperty(r.prototype,"outdate",{get:function(){return this._outdate},set:function(e){this._outdate=e,this._outdate&&this._outdate&&(this.arrivalDatetime=this.helpers.ngDateToMoment(this._outdate,this._outtime))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"outtime",{get:function(){return this._outtime},set:function(e){this._outtime=e,this._outdate&&this._outtime&&(this.arrivalDatetime=this.helpers.ngDateToMoment(this._outdate,this._outtime))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"departDatetime",{get:function(){return this.tempParams.departDatetime},set:function(e){this.tempParams.departDatetime=e.isValid()?e:null,e&&e.isValid()&&(this._indate=this.helpers.momentToNgDate(e),this._intime=this.helpers.formatTimeColon(e)),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"indate",{get:function(){return this._indate},set:function(e){this._indate=e,this._indate&&this._intime&&(this.departDatetime=this.helpers.ngDateToMoment(this._indate,this._intime))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"intime",{get:function(){return this._intime},set:function(e){this._intime=e,this.departDatetime=this.helpers.ngDateToMoment(this._indate,this._intime)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"arrivalDatetime",{get:function(){var e;return null===(e=this.tempParams)||void 0===e?void 0:e.arrivalDatetime},set:function(e){if(this.tempParams.arrivalDatetime=e.isValid?e:null,e&&e.isValid()&&(this._outdate=this.helpers.momentToNgDate(e),this._outtime=this.helpers.formatTimeColon(e),this.departDatetime&&this.departDatetime.isSameOrBefore(this.arrivalDatetime))){var t=this.arrivalDatetime.clone();this.departDatetime=t}this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"outFlightNumber",{get:function(){var e;return null===(e=this.tempParams)||void 0===e?void 0:e.outFlightNumber},set:function(e){this.tempParams.outFlightNumber=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"recommended",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.recommended)},set:function(e){this.tempParams.recommended=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onAirport",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.onAirport)},set:function(e){this.tempParams.onAirport=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"meetAndGreet",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.meetAndGreet)},set:function(e){this.tempParams.meetAndGreet=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parkAndRide",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.parkAndRide)},set:function(e){this.tempParams.parkAndRide=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parkAndStroll",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.parkAndStroll)},set:function(e){this.tempParams.parkAndStroll=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"carParkedForYou",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.carParkedForYou)},set:function(e){this.tempParams.carParkedForYou=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"terminal",{get:function(){return this.tempParams.terminal?this.tempParams.terminal.toString():null},set:function(e){this.tempParams.terminal=e;var t=this.terminals.value.find((function(t,r){if(t.value===e)return!0}));t?this.selectedTerminal=t.key:this.terminals.value&&this.terminals.value.length>0?this.selectedTerminal=this.terminals.value[0].key:this.selectedTerminal="Any Terminal",this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"locationCode",{get:function(){return this.tempParams.locationCode},set:function(e){this.tempParams.locationCode=e,"string"==typeof e?(this._locationCode=null,this.terminal=null,this.terminals.next([]),this.selectedTerminal=null,this._isValid()):e&&e.gateway?(this._locationCode=e.gateway,this.terminal=null,this.terminals.next(e.terminals),1===e.terminals.length&&(this.selectedTerminal=e.terminals[0].key),this._isValid()):(this._locationCode=null,this.terminal=null,this.terminals.next([]),this.selectedTerminal=null,this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"selectedTerminal",{get:function(){return this._selectedTerminal},set:function(e){this._selectedTerminal=e},enumerable:!1,configurable:!0}),r.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeParkingQuery()),this._isValid()},r.prototype._isValid=function(){var e,t,i;this.doChecks&&(this.storageService.setSessionItem(r.STORAGE_SESSION_PARAMS,{location:this._locationCode,travellers:this.travellers,tempParams:this.tempParams}),this.validationMessages=[],this._locationCode&&""!==this._locationCode||this.validationMessages.push(ot.AirportFirst),(null===(e=this.tempParams)||void 0===e?void 0:e.arrivalDatetime.unix())<u.default().unix()&&this.validationMessages.push(ot.InvardJourney),(null===(t=this.tempParams)||void 0===t?void 0:t.departDatetime.unix())<u.default().unix()&&this.validationMessages.push(ot.OutwardJourney),(null===(i=this.tempParams.departDatetime)||void 0===i?void 0:i.isBefore(this.tempParams.arrivalDatetime))&&this.validationMessages.push(ot.DateOverlapped),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages))},r.prototype.startSearch=function(){if(this.results.next([]),this.isValid.value){var e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.parkingfetcher.fetchList(this.helpers.removeNulls(e)))}return Promise.resolve(!1)},r.prototype.getRecentSearchQuery=function(e){return{serviceType:ee.Parking,searchArgs:e,travelDate:this.arrivalDatetime.format(),travellers:this.helpers.getTravellersId(this.travellers)}},r.prototype.startRecentSearch=function(e){var t=this;this.arrivalDatetime=u.default(e.searchArgs.arrivalDatetime),this.departDatetime=u.default(e.searchArgs.departDatetime),this.outFlightNumber=e.searchArgs.outFlightNumber,this.terminal=e.searchArgs.terminal,this.searchService.getAirportByCode(e.searchArgs.locationCode).subscribe((function(e){var r,i,n,a,o,s;e&&(t.locationCode={country:null===(i=null===(r=e.iataMatch)||void 0===r?void 0:r.locationDetails)||void 0===i?void 0:i.country,countryCode:null===(a=null===(n=e.iataMatch)||void 0===n?void 0:n.locationDetails)||void 0===a?void 0:a.countryCode,destination:e.iataMatch.name,gateway:e.iataMatch.iata,postcode:null===(s=null===(o=e.iataMatch)||void 0===o?void 0:o.locationDetails)||void 0===s?void 0:s.postcode,terminals:t.searchService.processTerminals(e.iataMatch.terminals)},t.searchService.startSearches())})),this.searchService.startSearches()},r.prototype.getSearchQuery=function(){var e={arrivalDatetime:this.tempParams.arrivalDatetime,departDatetime:this.tempParams.departDatetime,locationCode:this._locationCode,outFlightNumber:this.tempParams.outFlightNumber,recommended:this.tempParams.recommended,onAirport:this.tempParams.onAirport,meetAndGreet:this.tempParams.meetAndGreet,parkAndRide:this.tempParams.parkAndRide,parkAndStroll:this.tempParams.parkAndStroll,carParkedForYou:this.tempParams.carParkedForYou,terminal:"Any"===this.tempParams.terminal?null:this.tempParams.terminal};return this.helpers.removeNulls(e)},r.prototype.sortByPrice=function(e){var t=this.helpers.clone(this.results.value)||[];t=e?t.sort((function(e,t){return t.price-e.price})):t.sort((function(e,t){return e.price-t.price})),this.results.next(t)},r.prototype.updateFromPreviousSearches=function(e){var t;null===(t=e[ee.Flight])||void 0===t||t.searchQuery},r.prototype.addParkingToBasket=function(e,t){return g(this,void 0,void 0,(function(){var r,i,n;return v(this,(function(a){switch(a.label){case 0:return[4,this.basketService.getDefaultBasket()];case 1:return r=a.sent(),i=null==r?void 0:r.subject.value,n=this.getTermsAndCond(e),i?[2,this.basketService.addToBasket({adults:1,basket:i.id,service:e.sourceId.toString(),detail:{arrivalDatetime:t.arrivalDatetime.format(),departDatetime:t.departDatetime.format(),locationCode:e.carPark.code,name:e.carPark.name,requiredInfo:e.requiredInfo,airportIata:t.locationCode,termsAndCond:n},price:e.price,currency:e.currency,searchQuery:t,outboundDate:t.arrivalDatetime.format(),inboundDate:t.departDatetime.format()},r,this.searchService,this.travellers)]:[2,Promise.resolve(!1)]}}))}))},r.prototype.getTermsAndCond=function(e){return[{name:"Name",value:e.carPark.name},{name:"Telephone",value:e.carPark.telephone},{name:"Important Information",value:e.carPark.misc.importantInformation},{name:"Geo-Position",value:"Latitude "+e.carPark.latitude+"; Longitude "+e.carPark.latitude},{name:"Introduction",value:e.carPark.introduction},{name:"Arrival Procedures",value:e.carPark.arrivalProcedure},{name:"Departure Procedure",value:e.carPark.departureProcedure},{name:"Information",value:e.carPark.information},{name:"Maximum Car Size",value:e.carPark.maximumCarSize},{name:"Directions",value:e.carPark.directions}]},r.prototype.updateLowestPrice=function(e){if(!e.length)return null;var t=e[0].currency;return e.reduce((function(e,t){var r=t.price;return e.amount>r&&(e.amount=r),e}),{amount:Number.MAX_SAFE_INTEGER,currencyCode:t})},r.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t={name:""+u.default(),serviceType:ee.Parking,searchArgs:e};return this.searchService.saveFavouriteSearch(t)}},r}(c);st.STORAGE_SESSION_PARAMS="search_parking",st.STORAGE_SESSION_RESULTS="results_parking",(nt=e.RailDirection||(e.RailDirection={})).Outbound="outbound",nt.Inbound="inbound",(at=e.EurostarSearchType||(e.EurostarSearchType={})).return="return",at.oneWay="oneWay";var ut,lt,ct=Object.freeze({stops:{},totalStops:{},mustInclude:{},classes:{},airlines:{},travelPolicy:{},depatureAirport:{},depatureReturnAirport:{},arrivalAirport:{},arrivalReturnAirport:{},baggage:{},fareTypes:{},price:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},duration:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},returnDuration:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},departureTime:{min:0,max:2359},arrivalTime:{min:0,max:2359},returnDepartureTime:{min:0,max:2359},returnArrivalTime:{min:0,max:2359},flightNumber:""});(ut=e.SortTypesEurostar||(e.SortTypesEurostar={})).CheapestFirst="C",ut.EarliestFirst="E",ut.LatestFirst="L",(lt=e.SortMethod||(e.SortMethod={})).sortByPrice="sortByPrice",lt.sortByDate="sortByDate";var dt=function(r){function i(n,a,o,s,l,c){var d=r.call(this,l,a)||this;d.eurostarFetcher=n,d.basketService=s,d.searchService=c,d.type=ee.Eurostar,d.avaliableClasses=new t.BehaviorSubject([]),d.timeCriteriaOptions=new t.BehaviorSubject([]),d.flightOperators=new t.BehaviorSubject([]),d._negotiated=!1,d._nearby_airports=!1,d._sortArray=[{title:"Price",method:e.SortMethod.sortByPrice,icon:"ico-dollar",dir:!0,code:e.SortTypesEurostar.CheapestFirst},{title:"Time",method:e.SortMethod.sortByDate,icon:"ico-calendar",dir:!0,code:e.SortTypesEurostar.EarliestFirst},{title:"Time (Descending)",method:e.SortMethod.sortByDate,icon:"ico-calendar",dir:!0,code:e.SortTypesEurostar.LatestFirst}],d._sortArrayLu=[{title:"Price",method:e.SortMethod.sortByPrice,icon:"ico-dollar",dir:!0,code:e.SortTypesEurostar.CheapestFirst},{title:"Time",method:e.SortMethod.sortByDate,icon:"ico-calendar",dir:!0,code:e.SortTypesEurostar.EarliestFirst}],d._fareTypeArray=[{value:w.Flexible,display:"Flexible"},{value:w.Leisure,display:"Leisure"},{value:w.Lowest,display:"Lowest"},{value:w.Negotiated,display:"Negotiated"},{value:w.NonNegotiated,display:"Non-Negotiated"},{value:w.RequestFareRules,display:"Request Fare Rules"},{value:w.SelectAndPro,display:"Select & Pro"}],d.minimumOutBoundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},d.minimumInBoundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},d.searchTypes=[{value:e.EurostarSearchType.return,display:"Return"},{value:e.EurostarSearchType.oneWay,display:"One-way"}],d.flightsToGroup={},d.grouped=null,d.travellers=null,d.resultsSessionName=i.STORAGE_SESSION_RESULTS,d.multiResultsSessionName=i.STORAGE_SESSION_RESULTS,d._displayAddHotel=!1,d.filters=new t.BehaviorSubject(ct),d.selectedGroupEurostar={item:null,direction:null},d.selectedEurostarFare={item:null,direction:null},d._multiDestination=[],d.minToHour=function(e){return Math.floor(e/60)+"h "+e%60+"m"};var p=l.getSessionItem(i.STORAGE_SESSION_PARAMS)||{tempParams:{},originalUserSearch:{}},h=c.makeEurostarQuery(p.tempParams);d.updateTempParams(h),d._originalUserSearch=p.originalUserSearch,c.shouldAddTravellerSubscription()&&c.travellerInformation.subscribe((function(e){d.travellers=e;var t=d.helpers.selectedTravellers(e,ee.Eurostar);d.tempParams.adults=t.adults.length,d.tempParams.children=t.children.length,d.updateTravellers(),d._isValid()})),o.changeUser.subscribe((function(t){d.timeCriteriaOptions.next([e.TimeWindow.Anytime,e.TimeWindow.Arrive,e.TimeWindow.Depart]),d.updateAvaliableClasses()})),d.updateTravellers();var m=l.getSessionItem(d.resultsSessionName)||{results:[],groupData:{},grouped:[],query:{}};d.fullResults=d.helpers.clone(m.results),d.flightsToGroup=m.groupData||{},d.resultQuery=m.query;d.searchService.isFlightsGrouped();d.results.next(m.results||[]);var f=d.helpers.clone(m.results);return f.length&&d.filters.next(d.helpers.createFlightFilters(f[0].journeys,ct)),d._isValid(),d.negotiated=d.tempParams.fareType===w.Negotiated,d}return m(i,r),Object.defineProperty(i.prototype,"displayAddHotel",{get:function(){return this._displayAddHotel},set:function(e){this._displayAddHotel=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"selectedFareClass",{get:function(){var e,t;return null===(t=null===(e=this.selectedEurostarFare)||void 0===e?void 0:e.item)||void 0===t?void 0:t.class},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"timeArray",{get:function(){return this._timeArray=this._timeArray||Array(96).fill(0).map((function(e,t){return{value:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0"),display:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0")}})),this._timeArray},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"preferredCarriers",{get:function(){return this.tempParams.preferredCarriers},set:function(e){this.tempParams.preferredCarriers=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"operator1",{get:function(){return this.tempParams.preferredCarriers[0]},set:function(e){this.tempParams.preferredCarriers[0]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"operator2",{get:function(){return this.tempParams.preferredCarriers[1]},set:function(e){this.tempParams.preferredCarriers[1]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"operator3",{get:function(){return this.tempParams.preferredCarriers[2]},set:function(e){this.tempParams.preferredCarriers[2]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"operator4",{get:function(){return this.tempParams.preferredCarriers[3]},set:function(e){this.tempParams.preferredCarriers[3]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"minDate",{get:function(){return this._minDate=this._minDate||this.helpers.momentToNgDate(u.default()),this._minDate},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"adults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=Number(e),this.updateTravellers()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"children",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=Number(e),this.updateTravellers()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"departLocation",{get:function(){return this.tempParams.departLocation},set:function(e){this.tempParams.departLocation=e,"string"==typeof e?this._originAirport="":e&&e.gateway?this._originAirport=e.gateway:this._originAirport=null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"queryOriginAiport",{get:function(){return this._originAirport},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"queryDestinationAiport",{get:function(){return this._destinationAirport},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"departDate",{get:function(){return this._outDate},set:function(e){this._outDate=e,this.outBoundDate=this.helpers.ngDateToMoment(this._outDate,this._outTime)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"departTime",{get:function(){return this._outTime},set:function(e){this._outTime=e,this.outBoundDate=this.helpers.ngDateToMoment(this._outDate,this._outTime)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outBoundDate",{get:function(){return this.tempParams.outBoundDate},set:function(e){e=u.default(e),this.tempParams.outBoundDate=e.isValid()?e:null,this.minimumInBoundDate={year:e.year(),month:e.month()+1,day:e.date()},this.tempParams.outBoundDate&&this.tempParams.inboundDate&&this.tempParams.outBoundDate.isAfter(this.tempParams.inboundDate)&&(this.inboundDate=u.default(this.tempParams.outBoundDate).add(1,"day")),this._outDate=this.helpers.momentToNgDate(e),this._outTime=this.helpers.formatTimeColon(e),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"returnDate",{get:function(){return this._inDate},set:function(e){this._inDate=e,this.inboundDate=this.helpers.ngDateToMoment(this._inDate,this._inTime)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"arriveTime",{get:function(){return this._inTime},set:function(e){this._inTime=e,this.inboundDate=this.helpers.ngDateToMoment(this._inDate,this._inTime)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"inboundDate",{get:function(){return this.tempParams.inboundDate},set:function(e){e=u.default(e),this.tempParams.inboundDate=e.isValid()?e:null,this._inDate=this.helpers.momentToNgDate(e),this._inTime=this.helpers.formatTimeColon(e),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"arriveLocation",{get:function(){return this.tempParams.arriveLocation},set:function(e){this.tempParams.arriveLocation=e,"string"==typeof e?this._destinationAirport="":e&&e.gateway?this._destinationAirport=e.gateway:this._destinationAirport=null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cabinClass",{get:function(){return this.tempParams.cabinClass},set:function(e){this.tempParams.cabinClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"returnCabinClass",{get:function(){return this.tempParams.returnCabinClass},set:function(e){this.tempParams.returnCabinClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"chosenSearchType",{get:function(){return this.tempParams.chosenSearchType},set:function(e){this.tempParams.chosenSearchType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isReturn",{get:function(){return this.tempParams.chosenSearchType===e.EurostarSearchType.return},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outTimeCriteria",{get:function(){return this.tempParams.outTimeCriteria},set:function(e){this.tempParams.outTimeCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"inTimeCriteria",{get:function(){return this.tempParams.inTimeCriteria},set:function(e){this.tempParams.inTimeCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"maxConnections",{get:function(){return this.tempParams.maxConnections},set:function(e){this.tempParams.maxConnections=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"multiDestination",{get:function(){return this.tempParams.multiDestination},set:function(e){this.tempParams.multiDestination=e,this._isValid()},enumerable:!1,configurable:!0}),i.prototype.setMultiDestinationQuery=function(e){var t=this;return this.helpers.clone(e).reduce((function(e,r){var i={};return i.orig=r.orig.gateway,i.dest=r.dest.gateway,i.date=t.helpers.formatIsoDate(r.date),e.push(i),e}),[])},Object.defineProperty(i.prototype,"sortDropdownValues",{get:function(){return this._sortArray},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"sortDropdownValuesLu",{get:function(){return this._sortArrayLu},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fareTypesValues",{get:function(){return this._fareTypeArray},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fareType",{get:function(){return this.tempParams.fareType},set:function(e){this.tempParams.fareType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"negotiated",{get:function(){return this._negotiated},set:function(e){this._negotiated=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"includeNearbyAirports",{get:function(){return this.tempParams.includeNearbyAirports},set:function(e){this.tempParams.includeNearbyAirports=e},enumerable:!1,configurable:!0}),i.prototype.processResults=function(e){var t=this;if(this.resultQuery=this.getSearchQuery(),delete this.resultQuery.withGrouped,this.filters.next(this.helpers.createFlightFilters(e.journeys,ct)),e&&this.searchService.isFlightsGrouped()){var r=(e.journeys||[]).reduce((function(e,r,i){if(r.outboundFlights.length){var n=t.formatEurostarResults(r.outboundFlights,r.total,i);n.co2PerPassenger=r.co2PerPassenger,n.co2PerItem=r.co2PerItem,n.sourceId=r.sourceId,n.total=r.total,n.duration=t.minToHour(r.outboundTotalDuration),e.outbound.find((function(e){return e.dateDeparture===n.dateDeparture&&e.cabinClass===n.cabinClass}))||e.outbound.push(n)}if(r.inboundFlights.length){var a=t.formatEurostarResults(r.inboundFlights,r.total,i);a.co2PerPassenger=r.co2PerPassenger,a.co2PerItem=r.co2PerItem,a.sourceId=r.sourceId,a.total=r.total,a.duration=t.minToHour(r.inboundTotalDuration),e.inbound.find((function(e){return e.dateDeparture===a.dateDeparture&&e.cabinClass===a.cabinClass}))||e.inbound.push(a)}return e}),{outbound:[],inbound:[]});return r.outbound=r.outbound.reduce(this.matchFares.bind(this),[]),r.inbound=r.inbound.reduce(this.matchFares.bind(this),[]),[r]}return e?[e]:[]},i.prototype.matchFares=function(e,t){var r=e.find((function(e){return e.dateDeparture===t.dateDeparture}));if(r)switch(t.cabinClass){case x.Economy:case x.EconomyNoBags:case x.EconomyRestricted:r.standardFare=t.standardFare;break;case"Premium":r.standardPremierFare=t.standardPremierFare;break;case x.Business:r.businessPremierFare=t.businessPremierFare;break;default:console.log("how did I get here",t.cabinClass)}else e.push(t);return e},i.prototype.formatEurostarResults=function(e,t,r){var i=this,n={dateArrival:null,dateDeparture:null,duration:null,timeArrival:null,timeDeparture:null,co2PerItem:0,co2PerPassenger:0,sourceId:null,total:null,uid:null,cabinClass:null,businessPremierFare:{class:null,fare:null,isDisabled:!0,price:NaN,currency:"GBP",selected:!1},standardFare:{class:null,fare:null,isDisabled:!0,price:NaN,currency:"GBP",selected:!1},standardPremierFare:{class:null,fare:null,isDisabled:!0,price:NaN,currency:"GBP",selected:!1}};return e.forEach((function(e){switch(n.dateArrival=e.dateTimeArriving,n.dateDeparture=e.dateTimeDeparting,n.duration=i.minToHour(e.totalDuration),n.timeArrival=u.default(e.dateTimeArriving).format("HH:mm"),n.timeDeparture=u.default(e.dateTimeDeparting).format("HH:mm"),n.cabinClass=e.cabinClass,n.uid=r,e.cabinClass){case x.EconomyFlexi:case x.EconomyNoBags:case x.EconomyRestricted:case x.Economy:n.standardFare.isDisabled=!1,n.standardFare.fare=e,n.standardFare.price=t.price,n.standardFare.currency=t.currency,n.standardFare.class=e.cabinClass,n.standardFare.selected=!1;break;case"Premium":n.standardPremierFare.isDisabled=!1,n.standardPremierFare.fare=e,n.standardPremierFare.price=t.price,n.standardPremierFare.currency=t.currency,n.standardPremierFare.class=e.cabinClass,n.standardPremierFare.selected=!1;break;case x.Business:n.businessPremierFare.isDisabled=!1,n.businessPremierFare.fare=e,n.businessPremierFare.price=t.price,n.businessPremierFare.currency=t.currency,n.businessPremierFare.class=e.cabinClass,n.businessPremierFare.selected=!1;break;default:console.warn("new class to be implemented: ",e.cabinClass)}})),n},i.prototype.resetQuery=function(e){void 0===e&&(e=!0),this.updateTempParams(this.searchService.makeEurostarQuery()),e&&this._isValid()},i.prototype.resetParams=function(){this.reset(),this.resetQuery()},i.prototype._isValid=function(){this.doChecks&&(this.storageService.setSessionItem(i.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.validationMessages=[],this._originAirport||this.validationMessages.push("Please add in a departutre location"),this._destinationAirport||this.validationMessages.push("Please add in a arrival destination"),this.tempParams.outBoundDate.isAfter(u.default())||this.validationMessages.push("Departure date can not be in the past"),this._originAirport&&this._destinationAirport&&this._destinationAirport===this._originAirport&&this.validationMessages.push("Origin and destination station cannot be the same"),this.isReturn&&this.tempParams.outBoundDate.isSameOrAfter(this.tempParams.inTimeCriteria)&&this.validationMessages.push("Return date must be after the departure date"),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages))},i.prototype.startSearch=function(){if(this.results.next([]),this._isValid(),this.isValid.value){this._originalUserSearch=Object.freeze(this.helpers.clone(this.tempParams)),this.storageService.setSessionItem(i.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch});var e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.eurostarFetcher.fetchList(this.getSearchQuery()))}return Promise.resolve(!1)},i.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:ee.Eurostar,searchArgs:t,travelDate:this.outBoundDate.format(),travellers:this.helpers.getTravellersId(this.travellers)}},i.prototype.updateSerchQuery=function(e){var t=e;return this.departLocation&&(t.departLocation=this.departLocation),this.arriveLocation&&(t.arriveLocation=this.arriveLocation),t},i.prototype.startRecentSearch=function(t){if(t.searchArgs.outboundDate){var r=t.searchArgs.outboundDepartureTimeWindow?t.searchArgs.outboundDepartureTimeWindow:t.searchArgs.outboundArrivalTimeWindow;this.outBoundDate=this.convertRecentSearchDateTime(t.searchArgs.outboundDate,r)}if(t.searchArgs.returnDate){var i=t.searchArgs.returnDepartureTimeWindow?t.searchArgs.returnDepartureTimeWindow:t.searchArgs.returnArrivalTimeWindow;this.inboundDate=this.convertRecentSearchDateTime(t.searchArgs.returnDate,i)}this.fareType=t.searchArgs.fareType,this.maxConnections=t.searchArgs.maxConnections,t.searchArgs.outboundCabinClass&&(this.cabinClass=t.searchArgs.outboundCabinClass[0]),t.searchArgs.returnCabinClass&&(this.returnCabinClass=t.searchArgs.returnCabinClass[0]),this.includeNearbyAirports=t.searchArgs.includeNearbyAirports,this.chosenSearchType=t.searchArgs.returnTrip?e.EurostarSearchType.return:e.EurostarSearchType.oneWay,t.searchArgs.outboundDepartureTimeWindow?this.outTimeCriteria=e.TimeWindow.Depart:t.searchArgs.outboundArrivalTimeWindow?this.outTimeCriteria=e.TimeWindow.Arrive:this.outTimeCriteria=e.TimeWindow.Anytime,t.searchArgs.returnDepartureTimeWindow?this.inTimeCriteria=e.TimeWindow.Depart:t.searchArgs.returnArrivalTimeWindow?this.inTimeCriteria=e.TimeWindow.Arrive:this.inTimeCriteria=e.TimeWindow.Anytime,this._originAirport=t.searchArgs.originAirport,this._destinationAirport=t.searchArgs.destinationAirport,this.arriveLocation=t.searchArgs.arriveLocation,this.departLocation=t.searchArgs.departLocation,this.searchService.startSearches()},i.prototype.makeDepartureTimeWindow=function(t,r){return r===e.TimeWindow.Depart?this.helpers.makeTimeWindow(t,-2,2):null},i.prototype.makeArrivalTimeWindow=function(t,r){return r!==e.TimeWindow.Arrive?null:this.helpers.makeTimeWindow(t,-2,2)},i.prototype.convertRecentSearchDateTime=function(e,t){if(t){var r=t.split("-");return u.default(e).add(u.default.duration(this.helpers.hhmmToTime(r[0]))).clone().add(2,"hour")}return u.default(e)},i.prototype.getSearchQuery=function(){return this.helpers.removeNulls(Object.assign({},{originAirport:this._originAirport,destinationAirport:this._destinationAirport,outboundDate:this.helpers.formatIsoDate(this.tempParams.outBoundDate),outboundDepartureTimeWindow:this.makeDepartureTimeWindow(this.tempParams.outBoundDate,this.tempParams.outTimeCriteria),outboundArrivalTimeWindow:this.makeArrivalTimeWindow(this.tempParams.outBoundDate,this.tempParams.outTimeCriteria)},{passengers:this._passengers,returnTrip:this.isReturn,outboundCabinClass:this.tempParams.cabinClass?[this.tempParams.cabinClass]:null,requireFreeBag:null,maxConnections:this.tempParams.maxConnections,includeNearbyAirports:this.tempParams.includeNearbyAirports,preferredCarriers:this.tempParams.preferredCarriers.map((function(e){return(null==e?void 0:e.code)?e.code:null})),fareType:this.tempParams.fareType,withGrouped:null},this.isReturn?{returnDate:this.helpers.formatIsoDate(this.tempParams.inboundDate),returnDepartureTimeWindow:this.makeDepartureTimeWindow(this.tempParams.inboundDate,this.tempParams.inTimeCriteria),returnArrivalTimeWindow:this.makeArrivalTimeWindow(this.tempParams.inboundDate,this.tempParams.inTimeCriteria),returnCabinClass:this.tempParams.returnCabinClass?[this.tempParams.returnCabinClass]:null}:{}))},i.prototype.updateTravellers=function(){for(var e=[],t=0;t<this.tempParams.adults;t+=1)e.push({type:U.Adult});for(t=0;t<this.tempParams.children;t+=1)e.push({type:U.Child});this._passengers=e,this._isValid()},i.prototype.updateAvaliableClasses=function(){this.avaliableClasses.next([{name:"Any",type:x.Any},{name:"Standard (semi flexible)",type:x.Economy},{name:"Standard premier (semi flexible)",type:x.PremiumEconomy},{name:"Business premier (fully flexible)",type:x.Business}])},i.prototype.sortResults=function(t,r,i){var n=this.helpers.clone(i||this.fullResults);switch(t){case e.SortTypesEurostar.CheapestFirst:n=this.sortByPrice(n,r);break;case e.SortTypesEurostar.EarliestFirst:n=this.sortByDate(n,r);break;default:console.error("+++ Unknown sorting method: "+t+" +++")}this.results.next(n)},i.prototype.sortResultsFlightJourneys=function(t,r,i){void 0===r&&(r=!1);var n=this.helpers.clone(i);switch(t){case e.SortTypesEurostar.CheapestFirst:n=this.sortByPriceFlight(n);break;case e.SortTypesEurostar.EarliestFirst:n=this.sortByDateFlight(n,r);break;case e.SortTypesEurostar.LatestFirst:n=this.sortByDateFlightDecending(n,r);break;default:console.error("+++ Unknown sorting method: "+t+" +++")}return n},i.prototype.sortByPriceFlight=function(e){return e.sort((function(e,t){return Number(e.total.price)-Number(t.total.price)}))},i.prototype.sortByDateFlight=function(e,t){return e.sort((function(e,r){return t?u.default(e.inboundFlights[0].dateTimeDeparting).unix()-u.default(r.inboundFlights[0].dateTimeDeparting).unix():u.default(e.outboundFlights[0].dateTimeDeparting).unix()-u.default(r.outboundFlights[0].dateTimeDeparting).unix()}))},i.prototype.sortByDateFlightDecending=function(e,t){return e.sort((function(e,r){return t?u.default(r.inboundFlights[0].dateTimeDeparting).unix()-u.default(e.inboundFlights[0].dateTimeDeparting).unix():u.default(r.outboundFlights[0].dateTimeDeparting).unix()-u.default(e.outboundFlights[0].dateTimeDeparting).unix()}))},i.prototype.sortByDate=function(e,t){var r=function(e,r){return t?u.default(e.dateDeparture).unix()-u.default(r.dateDeparture).unix():u.default(r.dateDeparture).unix()-u.default(e.dateDeparture).unix()};return[{outbound:e[0].outbound.sort(r),inbound:e[0].inbound.sort(r)}]},i.prototype.sortByPrice=function(e,t){var r=function(e,r){var i=+e.standardFare.price||+e.standardPremierFare.price||+e.businessPremierFare.price,n=+r.standardFare.price||+r.standardPremierFare.price||+r.businessPremierFare.price;return t?i-n:n-i};return[{outbound:e[0].outbound.sort(r),inbound:e[0].inbound.sort(r)}]},i.prototype.updateFromPreviousSearches=function(e){var t;null===(t=e[ee.Flight])||void 0===t||t.searchQuery},i.prototype.getTotalBaggage=function(e){var t=0,r=JSON.parse(e.additional);return r&&r.outboundFlights?r.outboundFlights.forEach((function(e){e.baggage.forEach((function(e){e.allowance&&e.allowance>t&&(t=e.allowance)}))})):r&&r.baggageAllowance&&r.baggageAllowance.forEach((function(e){e.baggage.qty&&Number(e.baggage.qty)>t&&(t=Number(e.baggage.qty))})),t},i.prototype.transformMin=function(e){var t=60*Number(e)/100;return(t=t%1<.5?Math.floor(t):Math.ceil(t)).toString().padStart(2,"0")},i.prototype.applyFilters=function(e){var t=this;0===this.fullResults.length&&this.results.next([]);var r,i,n=function(e,t){var r=Object.values(e).filter((function(e){return e.selected}));return r.length?function(e){return!!r.find((function(r){return t(e,r.value)}))}:function(e){return!0}},a=function(e,r){return function(i){var n,a,s=u.default((n=t.helpers).fromObject.apply(n,T([i],o(r,i).split(".")))).get("hour"),l=u.default((a=t.helpers).fromObject.apply(a,T([i],o(r,i).split(".")))).get("minute"),c=Number(""+s.toString().padStart(2,"0")+l.toString().padStart(2,"0"));return c>=e.min&&c<=e.max}},o=function(e,t){return e.replace("OUTBOUND_DEPARTURE","outboundFlights.0").replace("OUTBOUND_ARRIVAL","outboundFlights."+(t.outboundFlights.length-1)).replace("INBOUND_DEPARTURE","inboundFlights.0").replace("INBOUND_ARRIVAL","inboundFlights."+((t.inboundFlights||[]).length-1))},s=function(e){return function(t,r){return t[e]===r}},l=[],c=[];l.push(a(e.arrivalTime,"OUTBOUND_ARRIVAL.dateTimeArriving")),l.push(a(e.departureTime,"OUTBOUND_DEPARTURE.dateTimeDeparting")),l.push((r=e.price,i="total.price",function(e){var n,a=(n=t.helpers).fromObject.apply(n,T([e],o(i,e).split(".")));return a>=r.min&&a<=r.max})),c.push(a(e.returnArrivalTime,"INBOUND_ARRIVAL.dateTimeArriving")),c.push(a(e.returnDepartureTime,"INBOUND_DEPARTURE.dateTimeDeparting"));var d=[];d.push(n(e.classes,s("cabinClass")));var p=[];p.push(n(e.classes,s("cabinClass")));for(var h=function(e,t){return l.reduce((function(t,r){return t=t&&r(e)}),!0)&&(!e.outboundFlights||!!(e.outboundFlights||[]).find((function(e){return!!d.reduce((function(t,r){return t&&r(e)}),!0)})))},m=function(e,t){var r;return c.reduce((function(t,r){return t&&r(e)}),!0)&&(!(null===(r=e.inboundFlights)||void 0===r?void 0:r.length)||!!(e.inboundFlights||[]).find((function(e){return!!p.reduce((function(t,r){return t&&r(e)}),!0)})))},f=this.helpers.clone(this.fullResults),y=0;y<f.length;y++){var g=f[y];g.journeys=g.journeys.filter(h),this.isReturn&&(g.journeys=g.journeys.filter(m)),g.journeys=g.journeys}this.results.next(f)},i.prototype.selectGroupedEurostar=function(t,r,i){var n,a,o,s;return g(this,void 0,void 0,(function(){var u,l,c,d,p;return v(this,(function(h){switch(h.label){case 0:return[4,this.basketService.getDefaultBasket()];case 1:return u=h.sent(),(l=null==u?void 0:u.subject.value)&&this.originalUserSearch.chosenSearchType===e.EurostarSearchType.oneWay&&i===e.FlightDirectionEnum.Outbound?(this.doBooking(u,t,{outboundFlights:[this.makeSchemaFlights(r.fare,"outbound",0)],inboundFlights:[],journeyType:"single"},t.dateDeparture,null,r.price),[2]):(l&&this.originalUserSearch.chosenSearchType===e.EurostarSearchType.return&&(i===e.FlightDirectionEnum.Outbound?(null===(n=this.selectedGroupEurostar)||void 0===n?void 0:n.direction)===e.FlightDirectionEnum.Inbound?(d=this.selectedEurostarFare.item.price>r.price?this.selectedEurostarFare.item.price:r.price,this.doBooking(u,t,{inboundFlights:[this.makeSchemaFlights(this.selectedEurostarFare.item.fare,"inbound",0)],outboundFlights:[this.makeSchemaFlights(r.fare,"outbound",0)],journeyType:"roundtrip"},t.dateDeparture,this.selectedGroupEurostar.item.dateArrival,d),this.resetSelectedFares(),this.basketService.toggleMenu(),this.results.next(this.fullResults.map(this.removeSelectedFlags))):(null===(a=this.selectedGroupEurostar)||void 0===a?void 0:a.direction)===e.FlightDirectionEnum.Outbound?(this.resetSelectedFares(),this.results.next(this.fullResults)):(this.selectedGroupEurostar={item:t,direction:i},this.selectedEurostarFare={item:r,direction:i},c=t.uid,this.results.next(this.fullResults.map((function(e){var t=e.outbound.filter((function(e){return c===e.uid}));return{inbound:e.inbound,outbound:t}})))):i===e.FlightDirectionEnum.Inbound&&((null===(o=this.selectedGroupEurostar)||void 0===o?void 0:o.direction)===e.FlightDirectionEnum.Outbound?(d=this.selectedEurostarFare.item.price>r.price?this.selectedEurostarFare.item.price:r.price,this.doBooking(u,t,{outboundFlights:[this.makeSchemaFlights(this.selectedEurostarFare.item.fare,"outbound",0)],inboundFlights:[this.makeSchemaFlights(r.fare,"inbound",0)],journeyType:"roundtrip"},t.dateDeparture,this.selectedGroupEurostar.item.dateArrival,d),this.resetSelectedFares(),this.basketService.toggleMenu(),this.results.next(this.fullResults.map(this.removeSelectedFlags))):(null===(s=this.selectedGroupEurostar)||void 0===s?void 0:s.direction)===e.FlightDirectionEnum.Inbound?(this.resetSelectedFares(),this.results.next(this.fullResults)):(this.selectedGroupEurostar={item:t,direction:i},this.selectedEurostarFare={item:r,direction:i},p=t.uid,this.results.next(this.fullResults.map((function(e){return{inbound:e.inbound.filter((function(e){return p===e.uid})),outbound:e.outbound}})))))),[2])}}))}))},i.prototype.resetSelectedFares=function(){this.selectedGroupEurostar={direction:null,item:null},this.selectedEurostarFare={direction:null,item:null}},i.prototype.removeSelectedFlags=function(e){return{inbound:e.inbound.map((function(e){return e.standardPremierFare.selected=!1,e.standardFare.selected=!1,e.businessPremierFare.selected=!1,e})),outbound:e.outbound.map((function(e){return e.standardPremierFare.selected=!1,e.standardFare.selected=!1,e.businessPremierFare.selected=!1,e}))}},i.prototype.updateLowestPrice=function(e){if(e.length&&!this.searchService.isFlightsGrouped()){var t=e[0].journeys;if(t.length){var r=t[0].total.currency;return t.reduce((function(e,t){var r=t.total.price;return e.amount>r&&(e.amount=r),e}),{amount:Number.MAX_SAFE_INTEGER,currencyCode:r})}}},i.prototype.doBooking=function(e,t,r,i,n,a){var o=t.sourceId,s=t.co2PerItem,u=t.co2PerPassenger,l=t.total,c={adults:this.adults,basket:e.id,children:this.children,co2PerItem:s,co2PerPassenger:u,currency:l.currency,detail:r,price:a,searchQuery:this.resultQuery,service:o.toString(),outboundDate:i};n&&(c.inboundDate=n),this.basketService.addToBasket(c,e,this.searchService,this.travellers)},i.prototype.makeSchemaFlights=function(e,t,r,i){return Object.assign(Object.assign({},e),{journeyInfo:{flightGroup:t,groupIndex:r,segmentIndex:i}})},i.prototype.createGroupedItem=function(e,t,r,i,n,a){if((null==r?void 0:r.length)&&!e.departDateTime){var o=r[0],s=r[r.length-1];e.originAirport=o.originAirport,e.originAirportName=o.originAirportName,e.destinationAirport=s.destinationAirport,e.destinationAirportName=s.destinationAirportName,e.departDateTime=o.dateTimeDeparting,e.arrivalDateTime=s.dateTimeArriving,e.outboundTotalDuration=i,e.dataSource=t,e.operator=o.operatingCarrier,e.operatorFull=o.operatingCarrierName,e.outlegsCount=r.length,e.outlegs=r,e.outboundFlightNumber=this.helpers.joinFromAttribute("-","operatingFlightNumber",r),e.isReturn=!1}(null==n?void 0:n.length)&&!e.inboundTotalDuration&&(e.inboundTotalDuration=a,e.inlegsCount=n.length,e.inlegs=n,e.inboundFlightNumber=this.helpers.joinFromAttribute("-","operatingFlightNumber",n),e.isReturn=!0)},i.prototype.makeSessionResults=function(e){return{results:[],groupData:[],grouped:[],query:this.resultQuery}},i.prototype.getMinFlightPriceForBrand=function(e){var t=Number.MAX_SAFE_INTEGER;return e.forEach((function(e){var r;t>(null===(r=null==e?void 0:e.total)||void 0===r?void 0:r.price)&&(t=e.total.price)})),t},i.prototype.getMaxFlightPriceForBrand=function(e){var t=0;return e.forEach((function(e){var r;t<(null===(r=null==e?void 0:e.total)||void 0===r?void 0:r.price)&&(t=e.total.price)})),t},i.prototype.isOverNight=function(){var e=this.outBoundDate.date();return this.inboundDate.date()-e>=1},i.prototype.addEurostarJourneysToBasket=function(e){return g(this,void 0,void 0,(function(){var t,r,i,n,a,o,s,l,c,d,p=this;return v(this,(function(h){switch(h.label){case 0:return e.unavailable?[2,Promise.resolve(!1)]:[4,this.basketService.getDefaultBasket()];case 1:return t=h.sent(),(null==t?void 0:t.subject.value)?(r=e.sourceId,i=e.co2PerItem,n=e.co2PerPassenger,a=e.total,o=u.default(e.outboundFlights[0].dateTimeDeparting),s=e.inboundFlights.length?u.default(e.inboundFlights[0].dateTimeDeparting):null,l=this.getTermsAndCond(e),c={outboundFlights:T(e.outboundFlights.map((function(e,t){return p.makeSchemaFlights(e,"outbound",0,t)}))),inboundFlights:T(e.inboundFlights.map((function(e,t){return p.makeSchemaFlights(e,"inbound",0,t)}))),termsAndCond:l,journeyType:"single"},d={adults:this.adults,basket:t.id,children:this.children,co2PerItem:i,co2PerPassenger:n,currency:a.currency,detail:c,price:a.price,searchQuery:this.resultQuery,service:r.toString(),outboundDate:o.format()},s&&(d.inboundDate=s.format(),c.journeyType="roundtrip"),[2,this.basketService.addToBasket(d,t,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},i.prototype.getTermsAndCond=function(e){return[{name:"Penalties",value:""},{name:"Eligibility",value:""},,{name:"Day/time",value:""},{name:"Seasonality",value:""},{name:"Flight Application",value:""},{name:"Advance Reservations/ticketing",value:""},{name:"Maximum Stay",value:""},{name:"Minimum Stay",value:""},{name:"Stopovers",value:""},{name:"Transfers",value:""},{name:"Combinations",value:""},{name:"Blackout Dates",value:""},{name:"Surcharges",value:""},{name:"Accompanied Travel",value:""},{name:"Travel Restrictions",value:""},{name:"Sales Restrictions",value:""},{name:"Hip/mileage Exceptions",value:""},{name:"Ticket Endorsements",value:""},{name:"Children Discounts",value:""},{name:"Tour Conductor Discounts",value:""},{name:"Agent Discounts",value:""},{name:"All Other Discounts",value:""},{name:"Miscellaneous Provisions",value:""},{name:"Fare By Rule",value:""},{name:"Groups",value:""},{name:"Tours",value:""},{name:"Visit Another Country",value:""},{name:"Deposits",value:""},{name:"Voluntary Changes",value:""},{name:"Voluntary Refunds",value:""},{name:"Negotiated Fares",value:""},{name:"Rule Application And Other Conditions",value:""}]},i.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:ee.Eurostar,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},i}(c);dt.STORAGE_SESSION_PARAMS="search_eurostar",dt.STORAGE_SESSION_RESULTS="results_eurostar";var pt,ht,mt=function(){function e(){this.data={},this.current={}}return e.prototype.nextJourney=function(){this.data=Object.entries(this.current).reduce((function(e,t){var r=S(t,2),i=r[0],n=r[1];return e[i]=e[i]||{total:0,types:{}},e[i].types=Object.entries(n.types).reduce((function(e,t){var r=S(t,2),i=r[0],n=r[1];return e[i]=Math.max(e[i]||0,n),e}),e[i].types),e[i].total=Object.values(e[i].types).reduce((function(e,t){return e+t}),0),e}),this.data),this.current={}},e.prototype.addFares=function(e,t,r){this.current[e]=this.current[e]||{total:0,types:{}},this.current[e].total+=r.length,this.current[e].types[t]=r.length},e.prototype.getTicketTypes=function(){return Object.entries(this.data).reduce((function(e,t){var r=S(t,2),i=r[0],n=r[1];return e[i]=n.total,e}),{})},e.prototype.workoutIndexes=function(e){return Object.entries(this.data[e].types).sort((function(e,t){var r=S(e,2),i=r[0],n=(r[1],S(t,2)),a=n[0];n[1];return Number(i.split("_")[1])-Number(a.split("_")[1])})).reduce((function(t,r){for(var i=S(r,2),n=i[0],a=i[1],o=0;o<a;o++)t.push([e,n,o.toString()]);return t}),[])},e}();(pt=e.RailSearchCriteria||(e.RailSearchCriteria={})).Depart="Depart After",pt.Arrive="Arrive Before",(ht=e.RailJourneyFareType||(e.RailJourneyFareType={})).Return="Return",ht.Single="Single";var ft,yt=function(i){function n(r,a,o,s,l,c,d,p){var h=i.call(this,l,o)||this;h.Railfetcher=r,h.getRailStationFetcher=a,h.basketService=s,h.searchService=c,h.userService=d,h.modalService=p,h.resultsSessionName=n.STORAGE_SESSION_RESULTS,h.multiResultsSessionName=n.STORAGE_SESSION_RESULTS,h.searchTypes=[{display:"Return",value:X.ReturnJourney},{display:"One-Way",value:X.SingleJourney}],h.classTypes=[{display:"Any",value:z.All},{display:"Standard",value:z.Standard},{display:"First",value:z.First}],h.airportExpressStations=[{code:"HP1-3",name:"Heathrow T1-3 - Paddington"},{code:"HP4",name:"Heathrow T4 - Paddington"},{code:"HP5",name:"Heathrow T5 - Paddington"},{code:"PH1-3",name:"Paddington - Heathrow T1-3"},{code:"PH4",name:"Paddington - Heathrow T4"},{code:"PH5",name:"Paddington - Heathrow T5"},{code:"GV",name:"Gatwick - Victoria"},{code:"VG",name:"Victoria - Gatwick"},{code:"SL",name:"Stansted - Liverpool Street"},{code:"LS",name:"Liverpool Street - Stansted"}],h.airportExpressStationsCodes={"HP1-3":{dep:"HXX",arr:"PAD"},"PH1-3":{dep:"PAD",arr:"HXX"},HP4:{dep:"HAF",arr:"PAD"},PH4:{dep:"PAD",arr:"HAF"},HP5:{dep:"HWV",arr:"PAD"},PH5:{dep:"PAD",arr:"HWV"},GV:{dep:"GTW",arr:"VIC"},VG:{dep:"VIC",arr:"GTW"},SL:{dep:"SSD",arr:"LST"},LS:{dep:"LST",arr:"SSD"}},h.railCriteria=[e.RailSearchCriteria.Depart,e.RailSearchCriteria.Arrive],h.travelCards=[{display:"Young persons railcard",value:"YNG"},{display:"Disability railcard",value:"DIS"},{display:"Family railcard",value:"FAM"},{display:"Forces railcard",value:"HMF"},{display:"Travel agency discount",value:"TAD"}],h.removePassingPointsFromResults=!0,h.type=ee.Rail,h._bookRailFromLive=!1,h.cheapest=new t.BehaviorSubject({outboundCheapest:{dualSingleJourneyFares:{price:0,journey:null,fare:null},openReturnJourneyFares:{price:0,journey:null,fare:null},returnJourneyFares:{price:0,journey:null,fare:null},singleJourneyFares:{price:0,journey:null,fare:null}},inboundCheapest:{dualSingleJourneyFares:{price:0,journey:null,fare:null},openReturnJourneyFares:{price:0,journey:null,fare:null},returnJourneyFares:{price:0,journey:null,fare:null},singleJourneyFares:{price:0,journey:null,fare:null}},cheapestClassTicket:{standardClassFare:{price:0,journey:null,fare:null},firstClassFare:{price:0,journey:null,fare:null},inboundStandardClassFare:{price:0,journey:null,fare:null},inboundFirstClassFare:{price:0,journey:null,fare:null}}}),h.minOutboundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},h.minInboundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},h.maxDate={year:u.default().add("month",6).year(),month:u.default().add("month",6).month(),day:u.default().add("month",6).date()},h.summary={},h._outbound_date=null,h._outbound_time=null,h._return_date=null,h._return_time=null;var m=l.getSessionItem(n.STORAGE_SESSION_PARAMS)||{query:{},tempParams:{},originalUserSearch:{}};return h.updateTempParams(h.searchService.makeRailQuery(m.tempParams)),h._originalUserSearch=m.originalUserSearch,c.shouldAddTravellerSubscription()&&c.travellerInformation.subscribe((function(e){h.travellers=e;var t=h.helpers.selectedTravellers(e,ee.Rail);h.tempParams.noOfAdults=t.adults.length,h.tempParams.noOfChildren=t.children.length,h.travellers=e,h._isValid()})),h._isValid(),h}return m(n,i),Object.defineProperty(n.prototype,"selectedSection",{get:function(){return this._selectedSection},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"selectedTicket",{get:function(){return this._selectedTicket},set:function(e){this._selectedTicket=e,this._selectedTicket?this._selectedSummary=this._findSummary(this._selectedTicket.journey,this.summary.outbound||[]):this._selectedSummary=null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"selectedInboundTicket",{get:function(){return this._selectedInboundTicket},set:function(e){var t=this;this._selectedInboundTicket=e,this._selectedInboundTicket?this._selectedInboundSummary=this.summary.return.find((function(e){return e.journeyHash===t._selectedTicket.journey.journeyHash})):this._selectedSummary=null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"bookRailFromLive",{get:function(){return this._bookRailFromLive},set:function(e){this._bookRailFromLive=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"openReturn",{get:function(){return this.tempParams.chosenSearchType===X.OpenReturnJourney},set:function(e){this.tempParams.chosenSearchType=e?X.OpenReturnJourney:X.ReturnJourney,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenSearchType",{get:function(){return this.tempParams.chosenSearchType},set:function(e){this.tempParams.chosenSearchType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"noOfAdults",{get:function(){return this.tempParams.noOfAdults},set:function(e){this.tempParams.noOfAdults=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"noOfChildren",{get:function(){return this.tempParams.noOfChildren},set:function(e){this.tempParams.noOfChildren=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"travellingTo",{get:function(){return this.tempParams.travellingTo},set:function(e){var t;this.tempParams.travellingTo=e,this._travellingTo="",(null===(t=null==e?void 0:e.railstation)||void 0===t?void 0:t.id)&&(this._travellingTo=e.railstation.id),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"travellingFrom",{get:function(){return this.tempParams.travellingFrom},set:function(e){var t;this.tempParams.travellingFrom=e,this._travellingFrom="",(null===(t=null==e?void 0:e.railstation)||void 0===t?void 0:t.id)&&(this._travellingFrom=e.railstation.id),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenRailClass",{get:function(){return this.tempParams.chosenSearchClass},set:function(e){this.tempParams.chosenSearchClass=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenSearchClass",{get:function(){return this.tempParams.chosenSearchClass},set:function(e){this.tempParams.chosenSearchClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"extraTime",{get:function(){return this.tempParams.extraTime},set:function(e){this.tempParams.extraTime=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"via",{get:function(){return this.tempParams.via},set:function(e){this.tempParams.via=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viaLocation",{get:function(){return this.tempParams.viaLocation},set:function(e){var t;this.tempParams.viaLocation=e,this._viaLocation="",(null===(t=null==e?void 0:e.railstation)||void 0===t?void 0:t.id)&&(this._viaLocation=e.railstation.id),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outBoundDateTime",{get:function(){return this.tempParams.outBoundDateTime},set:function(e){this.tempParams.outBoundDateTime=e,e&&e.isValid()&&(this._outbound_date=this.helpers.momentToNgDate(e),this._outbound_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"0700"),this.minInboundDate={year:e.year(),month:e.month()+1,day:e.date()},this.outBoundDateTime&&this.inBoundDateTime&&this.outBoundDateTime.isAfter(this.inBoundDateTime)&&(this.inBoundDateTime=this.inBoundDateTime.set("date",e.date()).set("month",e.month()).set("year",e.year())),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outboundCriteria",{get:function(){return this.tempParams.outboundCriteria},set:function(e){this.tempParams.outboundCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"inBoundDateTime",{get:function(){return this.tempParams.inBoundDateTime},set:function(e){this.tempParams.inBoundDateTime=e,e&&e.isValid()&&(this._return_date=this.helpers.momentToNgDate(e),this._return_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"1600"),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outbound_date",{get:function(){return this._outbound_date},set:function(e){this._outbound_date=e,this._updateOutboundDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outbound_time",{get:function(){return this._outbound_time},set:function(e){this._outbound_time=e,this._updateOutboundDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"return_date",{get:function(){return this._return_date},set:function(e){this._return_date=e,this._updateReturnDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"return_time",{get:function(){return this._return_time},set:function(e){this._return_time=e,this._updateReturnDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"returnCriteria",{get:function(){return this.tempParams.returnCriteria},set:function(e){this.tempParams.returnCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carnetTicket",{get:function(){return this.tempParams.carnetTicket},set:function(e){this.tempParams.carnetTicket=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"disableAutoDiscounts",{get:function(){return this.tempParams.disableAutoDiscounts},set:function(e){this.tempParams.disableAutoDiscounts=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"prioritiseByPrice",{get:function(){return this.tempParams.prioritiseByPrice},set:function(e){this.tempParams.prioritiseByPrice=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"applyRailcards",{get:function(){return this.tempParams.applyRailcards},set:function(e){this.tempParams.applyRailcards=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"railCards",{get:function(){return this.tempParams.railCards},set:function(e){this.tempParams.railCards=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"timeArray",{get:function(){return this._timeArray=this._timeArray||Array(48).fill(0).map((function(e,t){return{value:Math.floor(t/2).toString().padStart(2,"0")+(t%2*30).toString().padStart(2,"0"),display:Math.floor(t/2).toString().padStart(2,"0")+":"+(t%2*30).toString().padStart(2,"0")}})),this._timeArray},enumerable:!1,configurable:!0}),n.prototype.getAirportExpressStations=function(){return this.airportExpressStations},Object.defineProperty(n.prototype,"airportExpressStation",{get:function(){return this.tempParams.airportExpressStation},set:function(e){this.tempParams.airportExpressStation=e,this._setAirportExpressStations(),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isAirportExpress",{get:function(){return this.tempParams.isAirportExpress},set:function(e){this.tempParams.isAirportExpress=e,this._isValid()},enumerable:!1,configurable:!0}),n.prototype.setAirportExpressStationIds=function(e){var t=e.departureLocationId,r=e.arrivalLocationId;t&&r&&(this._travellingFrom=t,this._travellingTo=r,this._isValid())},n.prototype._findSummary=function(e,t){return t.find((function(t){return t.journeyHash===e.journeyHash}))},n.prototype.updateLowestPrice=function(e){return null},n.prototype.processResults=function(e){var t=this,r=function(e){var t;return Object.assign(Object.assign({},e),{type:null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.toLowerCase(),selected:!1,selectable:!0})},i=function(e){return t.helpers.clone(e).sort((function(e,t){var r=u.default(e.departDateTime),i=u.default(t.departDateTime);return r.isBefore(i)?-1:r.isAfter(i)?1:0})).map((function(e){var i=function(e,t){return e.price-t.price},n=(e.dualSingleJourneyFares||[]).sort(i).map(r),a=(e.openReturnJourneyFares||[]).sort(i).map(r),o=(e.returnJourneyFares||[]).sort(i).map(r),s=(e.singleJourneyFares||[]).sort(i).map(r),u=n.map(r),l=a.map(r),c=o.map(r),d=s.map(r);return Object.assign(Object.assign({},e),{dualSingleJourneyFares:t.helpers.arrayToObjectArray(u,["type",["terms.ticketTypeCode","price"]]),openReturnJourneyFares:t.helpers.arrayToObjectArray(l,["type",["terms.ticketTypeCode","price"]]),returnJourneyFares:t.helpers.arrayToObjectArray(c,["type",["terms.ticketTypeCode","price"]]),singleJourneyFares:t.helpers.arrayToObjectArray(d,["type",["terms.ticketTypeCode","price"]])})}))};return e.map((function(e){t.summary=e.summary;var r=i(e.outbound||[]),n=i(e.return||[]),a=t.makeFareNames([r||[],n||[]]),o=function(e,r){var i=a[r],n=i.getTicketTypes();return Object.entries(n).reduce((function(r,n){var a=S(n,2),o=a[0];a[1];return r[o]=i.workoutIndexes(o).map((function(r){return t.helpers.fieldFromObject(e,r)})),r}),{})},s=function(e){return Object.assign(Object.assign({},e),{returnJourneyFares:o(e.returnJourneyFares,"returnJourneyFares"),openReturnJourneyFares:o(e.openReturnJourneyFares,"openReturnJourneyFares"),dualSingleJourneyFares:o(e.dualSingleJourneyFares,"dualSingleJourneyFares"),singleJourneyFares:o(e.singleJourneyFares,"singleJourneyFares")})},u=r.map(s),l=n.map(s),c=t.updatePrices(u,{cheapestTickets:{dualSingleJourneyFares:{price:0,journey:null,fare:null},openReturnJourneyFares:{price:0,journey:null,fare:null},returnJourneyFares:{price:0,journey:null,fare:null},singleJourneyFares:{price:0,journey:null,fare:null}},cheapestClassTicket:{standardClassFare:{price:0,journey:null,fare:null},firstClassFare:{price:0,journey:null,fare:null},inboundStandardClassFare:{price:0,journey:null,fare:null},inboundFirstClassFare:{price:0,journey:null,fare:null}},outboundClassTicket:{standardClassFare:{price:0,journey:null,fare:null},firstClassFare:{price:0,journey:null,fare:null},inboundStandardClassFare:{price:0,journey:null,fare:null},inboundFirstClassFare:{price:0,journey:null,fare:null}}},!1),d=t.updatePrices(l,{cheapestTickets:{dualSingleJourneyFares:{price:0,journey:null,fare:null},openReturnJourneyFares:{price:0,journey:null,fare:null},returnJourneyFares:{price:0,journey:null,fare:null},singleJourneyFares:{price:0,journey:null,fare:null}},cheapestClassTicket:c.cheapestClassTicket,outboundClassTicket:c.cheapestClassTicket},!0);return t.cheapest.next({outboundCheapest:c.cheapestTickets,inboundCheapest:d.cheapestTickets,cheapestClassTicket:d.cheapestClassTicket}),Object.assign(Object.assign({},e),{outbound:u,return:l})}))},n.prototype.makeFareNames=function(e){var t=this;return["returnJourneyFares","openReturnJourneyFares","dualSingleJourneyFares","singleJourneyFares"].reduce((function(r,i){return r[i]=t._makeFareNames(e,i),r}),{returnJourneyFares:new mt,openReturnJourneyFares:new mt,dualSingleJourneyFares:new mt,singleJourneyFares:new mt})},n.prototype._makeFareNames=function(e,t){return s.default.flatten(e||[]).reduce((function(e,r){return r?(Object.entries(r[t]||{}).forEach((function(t){var r=S(t,2),i=r[0],n=r[1];Object.entries(n).forEach((function(t){var r=S(t,2),n=r[0],a=r[1];e.addFares(i,n,a)}))})),e.nextJourney(),e):e}),new mt)},n.prototype.updatePrices=function(t,r,i){var n=function(e,t,r){if(!t||0===t.length)return e;var i=t[0].price;return e.price>0&&e.price<i?e:{price:i,journey:r,fare:t[0]}};return t.reduce((function(t,r){var a,o,u,l,c=function(e,t){return e.price-t.price},d=s.default.flatten(Object.values(r.dualSingleJourneyFares)).filter((function(e){return e&&e.class===z.Standard})),p=s.default.flatten(Object.values(r.dualSingleJourneyFares)).filter((function(e){return e&&e.class===z.First})),h=s.default.flatten(Object.values(r.openReturnJourneyFares)).filter((function(e){return e&&e.class===z.Standard})),m=s.default.flatten(Object.values(r.openReturnJourneyFares)).filter((function(e){return e&&e.class===z.First})),f=s.default.flatten(Object.values(r.returnJourneyFares)).filter((function(e){return e&&e.class===z.Standard})),y=s.default.flatten(Object.values(r.returnJourneyFares)).filter((function(e){return e&&e.class===z.First})),g=s.default.flatten(Object.values(r.singleJourneyFares)).filter((function(e){return e&&e.class===z.Standard})),v=s.default.flatten(Object.values(r.singleJourneyFares)).filter((function(e){return e&&e.class===z.First})),b=T(h,f,g),S=T(d,b).sort(c),C=T(m,y,v),D=T(p,C).sort(c);if(i||(b.sort(c),D.sort(c)),t.cheapestTickets.dualSingleJourneyFares=n(t.cheapestTickets.dualSingleJourneyFares,s.default.flatten(Object.values(r.dualSingleJourneyFares)).filter((function(e){return!!e})),r),t.cheapestTickets.openReturnJourneyFares=n(t.cheapestTickets.openReturnJourneyFares,s.default.flatten(Object.values(r.openReturnJourneyFares)).filter((function(e){return!!e})),r),t.cheapestTickets.returnJourneyFares=n(t.cheapestTickets.returnJourneyFares,s.default.flatten(Object.values(r.returnJourneyFares)).filter((function(e){return!!e})),r),i){if((null===(o=null===(a=t.cheapestClassTicket.standardClassFare)||void 0===a?void 0:a.fare)||void 0===o?void 0:o.singleOrReturn)===e.RailJourneyFareType.Single){var P=n(t.cheapestClassTicket.inboundStandardClassFare,d,r);t.cheapestClassTicket.standardClassFare.price+P.price>t.outboundClassTicket.standardClassFare.price?(t.cheapestClassTicket.standardClassFare=t.outboundClassTicket.standardClassFare,t.cheapestClassTicket.inboundStandardClassFare={price:0,journey:null,fare:null}):t.cheapestClassTicket.inboundStandardClassFare=P}if((null===(l=null===(u=t.cheapestClassTicket.firstClassFare)||void 0===u?void 0:u.fare)||void 0===l?void 0:l.singleOrReturn)===e.RailJourneyFareType.Single){P=n(t.cheapestClassTicket.inboundFirstClassFare,p,r);t.cheapestClassTicket.firstClassFare.price+P.price>t.outboundClassTicket.firstClassFare.price?(t.cheapestClassTicket.firstClassFare=t.outboundClassTicket.firstClassFare,t.cheapestClassTicket.inboundFirstClassFare={price:0,journey:null,fare:null}):t.cheapestClassTicket.inboundFirstClassFare=P}}else t.cheapestClassTicket.standardClassFare=n(t.cheapestClassTicket.standardClassFare,S,r),t.cheapestClassTicket.firstClassFare=n(t.cheapestClassTicket.firstClassFare,D,r),t.outboundClassTicket.standardClassFare=n(t.outboundClassTicket.standardClassFare,b,r),t.outboundClassTicket.firstClassFare=n(t.outboundClassTicket.firstClassFare,C,r);return t}),r)},n.prototype.selectTicket=function(t,r,i,n,a,o){var s,l,c,p,h,m;return void 0===o&&(o=!1),g(this,void 0,void 0,(function(){var f,y,g,b,S,T,C,D;return v(this,(function(v){switch(v.label){case 0:return i.selectable?this.selectedTicket&&this.selectedTicket.journey.journeyHash===r.journeyHash&&this.selectedTicket.fare.fareHash===i.fareHash?(this.selectedTicket=null,this._applyFilter(),[2]):(f=this.selectedTicket,this.alternativeWellbeing=this.userService.getUserFavoriteObject(Ye.AlternativeRailItineraryEnabled),f&&!o&&this.alternativeWellbeing?(y=f.journey,g=r,b=u.default(y.arriveDateTime).diff(u.default(y.departDateTime),"hours",!0),S=u.default(g.arriveDateTime).diff(u.default(g.departDateTime),"hours",!0),T=u.default(g.departDateTime).diff(u.default(y.departDateTime),"day"),[4,this.checkAlternativeHours(b+S,T)]):[3,2]):[2];case 1:return v.sent()&&this.selectTicket(t,r,i,n,a,!0),[3,25];case 2:switch(C=this.originalUserSearch,a){case"singleJourneyFares":return[3,3];case"returnJourneyFares":return[3,7];case"dualSingleJourneyFares":return[3,13];case"openReturnJourneyFares":return[3,19]}return[3,23];case 3:return(null===(s=null==r?void 0:r.ticketExtras)||void 0===s?void 0:s.length)>1?[4,this.modalService.open(d.RailTicketsDialogComponent,{centered:!0},{outboundRailJourneyOption:r})]:[3,5];case 4:D=v.sent(),r.ticketExtras=D||[],v.label=5;case 5:return[4,this.addSingleJourneyToBasket(n,C,r,i)];case 6:return v.sent(),this.selectedTicket=null,[3,24];case 7:return t!==e.RailDirection.Outbound?[3,8]:(this.selectedTicket={journey:r,fare:i},[3,12]);case 8:return this.selectedTicket?(null===(c=null===(l=this.selectedTicket.journey)||void 0===l?void 0:l.ticketExtras)||void 0===c?void 0:c.length)>1?[4,this.modalService.open(d.RailTicketsDialogComponent,{centered:!0},{outboundRailJourneyOption:this.selectedTicket.journey})]:[3,10]:[3,12];case 9:D=v.sent(),f.journey.ticketExtras=D||[],v.label=10;case 10:return[4,this.addReturnJourneyToBasket(n,C,this.selectedTicket.journey,r,this.selectedTicket.fare,i)];case 11:v.sent(),this.selectedTicket=null,v.label=12;case 12:return[3,24];case 13:return t!==e.RailDirection.Outbound?[3,14]:(this.selectedTicket={journey:r,fare:i},[3,18]);case 14:return this.selectedTicket?(null===(h=null===(p=this.selectedTicket.journey)||void 0===p?void 0:p.ticketExtras)||void 0===h?void 0:h.length)>1?[4,this.modalService.open(d.RailTicketsDialogComponent,{centered:!0},{outboundRailJourneyOption:this.selectedTicket.journey})]:[3,16]:[3,18];case 15:D=v.sent(),console.log(D),f.journey.ticketExtras=D||[],v.label=16;case 16:return[4,this.addDualSingleToBasket(n,C,this.selectedTicket.journey,r,this.selectedTicket.fare,i)];case 17:v.sent(),this.selectedTicket=null,v.label=18;case 18:return[3,24];case 19:return(null===(m=null==r?void 0:r.ticketExtras)||void 0===m?void 0:m.length)>1?[4,this.modalService.open(d.RailTicketsDialogComponent,{centered:!0},{outboundRailJourneyOption:r})]:[3,21];case 20:D=v.sent(),console.log(D),r.ticketExtras=D||[],v.label=21;case 21:return[4,this.addOpenReturnToBasket(n,C,r,i)];case 22:return v.sent(),this.selectedTicket=null,[3,24];case 23:a,v.label=24;case 24:this._applyFilter(),v.label=25;case 25:return[2]}}))}))},n.prototype.checkAlternativeHours=function(e,t){return g(this,void 0,void 0,(function(){var r;return v(this,(function(i){switch(i.label){case 0:return r=this.searchService.searches[ee.Rail],this.alternativeWellbeing.enable&&Number(this.alternativeWellbeing.hours)>0&&r.chosenSearchType===X.ReturnJourney&&e>=Number(this.alternativeWellbeing.hours)&&0===t&&this.noOfAdults+this.noOfChildren<=4?[4,this.modalService.open(d.AlternativeRailModalComponent)]:[3,2];case 1:return i.sent()?(this.selectedTicket=null,this._applyFilter(),this.performAlternativeRailAndHotelSearch(),[2,!1]):[2,!0];case 2:return[2,!0];case 3:return[2]}}))}))},n.prototype.performAlternativeRailAndHotelSearch=function(){console.log("+++ Creating the Alternative Search Params +++");var t=this.searchService.search_objects[ee.Hotel],r=this.searchService.search_objects[ee.Rail];t.chosen=!0,r.chosen=!0,t.priority=r.priority;var i=this.searchService.searches[ee.Hotel],n=this.searchService.searches[ee.Rail];n.inBoundDateTime=this.searchService.searches[ee.Rail].inBoundDateTime.add(1,"day"),i.location_type_select=e.LocationTypes.TrainStation,i.location=n.travellingTo,i.trainsStation=n.travellingTo.railstation,i.checkin_date=n.outBoundDateTime,i.checkout_date=n.inBoundDateTime,i.no_of_occupants=n.noOfAdults+n.noOfChildren,i.no_of_rooms=1,i.distance=10,this.searchService.startSearches(e.WellbeingEnum.WELLBEING)},n.prototype.selectTicketNoAdd=function(t,r,i,n,a){var o;return g(this,void 0,void 0,(function(){var n,s;return v(this,(function(u){if(!i.selectable)return console.warn("+++ Rail fare is not selectable +++"),[2];if(n=this.selectedTicket&&this.selectedTicket.journey.journeyHash===r.journeyHash&&this.selectedTicket.fare.fareHash===i.fareHash,s=t===e.RailDirection.Inbound&&(this.selectedInboundTicket&&this.selectedInboundTicket.journey.journeyHash===r.journeyHash&&this.selectedInboundTicket.fare.fareHash===i.fareHash),n||t===e.RailDirection.Inbound&&s)return console.warn("+++ Journey and fare are already selected - breaking out +++"),this._selectedInboundTicket=null,n&&(this.selectedTicket=null,this.applyFilter()),[2];switch((this._selectedSection&&this._selectedSection!==a||"returnJourneyFares"===this._selectedSection&&(null===(o=this.selectedTicket)||void 0===o?void 0:o.fare.identifiers.fareIdentifier)!==i.identifiers.fareIdentifier)&&(this.selectedTicket=null,this._selectedInboundTicket=null),this._selectedSection=a,this.originalUserSearch,a){case"singleJourneyFares":this.selectedTicket={journey:r,fare:i};break;case"returnJourneyFares":case"dualSingleJourneyFares":t===e.RailDirection.Outbound?this.selectedTicket={journey:r,fare:i}:this.selectedTicket&&(this.selectedInboundTicket={journey:r,fare:i});break;case"openReturnJourneyFares":this.selectedTicket={journey:r,fare:i};break;default:a}return this.applyFilter(),[2]}))}))},n.prototype.addToBasket=function(e,t,r,i,n,a){return g(this,void 0,void 0,(function(){return v(this,(function(o){switch(o.label){case 0:return t.chosenSearchType!==X.SingleJourney?[3,2]:[4,this.addSingleJourneyToBasket(e,t,r,i)];case 1:return o.sent(),[3,7];case 2:return"openReturnJourneyFares"!==this.selectedSection?[3,4]:[4,this.addOpenReturnToBasket(e,t,r,i)];case 3:return o.sent(),[3,7];case 4:return"Return"!==i.singleOrReturn?[3,5]:[2,this.addReturnJourneyToBasket(e,t,r,a,i,n)];case 5:return[4,this.addDualSingleToBasket(e,t,r,a,i,n)];case 6:o.sent(),o.label=7;case 7:return[2,!1]}}))}))},n.prototype.addOpenReturnToBasket=function(e,t,r,i){return g(this,void 0,void 0,(function(){return v(this,(function(n){return[2,this.addSingleJourneyToBasket(e,t,r,i)]}))}))},n.prototype.addDualSingleToBasket=function(e,t,r,i,n,a){var o,s;return g(this,void 0,void 0,(function(){var u,l,c,d,p,h,m,f,y;return v(this,(function(g){switch(g.label){case 0:return u=this.getSearchQuery(t),(null===(o=null==i?void 0:i.ticketExtras)||void 0===o?void 0:o.length)&&(l=this.createTicketExtrasObject(i.ticketExtras[0])),(null===(s=null==r?void 0:r.ticketExtras)||void 0===s?void 0:s.length)&&(c=this.createTicketExtrasObject(r.ticketExtras[0])),[4,this.basketService.getDefaultBasket()];case 1:return d=g.sent(),p=null==d?void 0:d.subject.value,h=this.getTermsAndCond(n,r,i),p?(m=this.getLegsFromRailJourneyOption(r),f=this.getLegsFromRailJourneyOption(i),y={basket:p.id,service:e,detail:{ticketQueueList:(r.ticketQueueList||[]).map((function(e){return{id:e.id,name:e.name,type:e.type}})),accountsList:(r.accountsList||[]).map((function(e){return{id:e.id,description:e.description}})),outwardDetail:{arrivalDateTime:r.arriveDateTime,arrivalStationName:r.to,departureDateTime:r.departDateTime,departureStationName:r.from,supplierTickets:[{supplierName:n.providerName,ticketDescription:n.type,price:n.price,legs:m}]},inwardDetail:{arrivalDateTime:i.arriveDateTime,arrivalStationName:i.to,departureDateTime:i.departDateTime,departureStationName:i.from,supplierTickets:[{supplierName:a.providerName,ticketDescription:a.type,legs:f}]},transactionIdentifier:n.identifiers.transactionIdentifier,outbound:{fareIdentifiers:[n.identifiers.fareIdentifier],journeyIdentifier:n.identifiers.journeyIdentifier,isDualSingleReturn:!0,journeyLegs:this.removedScheduledPlatformFromCallingPoints(r.journeyLegs)},return:{fareIdentifiers:[a.identifiers.fareIdentifier],journeyIdentifier:a.identifiers.journeyIdentifier,isDualSingleReturn:!0,journeyLegs:this.removedScheduledPlatformFromCallingPoints(i.journeyLegs)},termsAndCond:h},adults:u.adults,price:Number(Number(n.price+a.price).toFixed(2)),currency:n.currency,searchQuery:u,co2PerItem:r.co2PerItem,co2PerPassenger:r.co2PerPassenger,outboundDate:r.arriveDateTime,inboundDate:i.arriveDateTime},l&&(y.detail.return.ticketExtras=l),c&&(y.detail.outbound.ticketExtras=c),[2,this.basketService.addToBasket(y,d,this.searchService,this.travellers)]):[2,Promise.resolve()]}}))}))},n.prototype.findCheapestTicket=function(){return 0},n.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeRailQuery()),this._isValid()},n.prototype._setAirportExpressStations=function(){var e=this.airportExpressStationsCodes[this.airportExpressStation];console.log("--- Parsed Station is :",e),e&&(this._travellingFrom=e.dep,this._travellingTo=e.arr)},n.prototype._isValid=function(){var e,t;if(this.doChecks){this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.validationMessages=[];var r=u.default();this._travellingFrom||this.validationMessages.push("Please Enter a From Location."),this._travellingTo||this.validationMessages.push("Please Enter a To Location."),(null===(e=this.outBoundDateTime)||void 0===e?void 0:e.isBefore(r))&&this.validationMessages.push("Departure Date/Time cannot be in the past."),this.chosenSearchType===X.ReturnJourney&&(null===(t=this.inBoundDateTime)||void 0===t?void 0:t.isSameOrBefore(this.outBoundDateTime))&&this.validationMessages.push("Return Date/Time must be after Departure Date/Time"),this.via&&(this.tempParams.viaLocation||this.validationMessages.push("Please enter a via location.")),this.tempParams.noOfAdults+this.tempParams.noOfChildren<1&&this.validationMessages.push("There must be at least 1 traveller"),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages)}},n.prototype.startSearch=function(){if(this.results.next([]),this.isValid.value){var e=this.getSearchQuery(this.tempParams);return this._originalUserSearch=Object.freeze(this.helpers.clone(this.tempParams)),this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.Railfetcher.fetchList(e))}return Promise.resolve(!1)},n.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:ee.Rail,searchArgs:t,travelDate:this.outBoundDateTime.format(),travellers:this.helpers.getTravellersId(this.travellers)}},n.prototype.updateSerchQuery=function(e){var t,r,i,n,a=e;return this.isAirportExpress&&(a.isAirportExpress=this.isAirportExpress),this.airportExpressStation&&(a.airportExpressStation=this.airportExpressStation),this.travellingFrom&&(a.travellingFrom=this.travellingFrom),this.travellingTo&&(a.travellingTo=this.travellingTo),this.viaLocation&&(a.viaLocation=this.viaLocation),a.outboundStationCode=null===(r=null===(t=this.travellingFrom)||void 0===t?void 0:t.railstation)||void 0===r?void 0:r.stationCode,a.inboundStationCode=null===(n=null===(i=this.travellingTo)||void 0===i?void 0:i.railstation)||void 0===n?void 0:n.stationCode,a},n.prototype.startRecentSearch=function(e){var t,r;if(this.chosenSearchType=e.searchArgs.journeyType,this.chosenSearchClass=e.searchArgs.class,this.extraTime=e.searchArgs.extraTimeToChange,this.isAirportExpress=e.searchArgs.isAirportExpress,this.airportExpressStation=e.searchArgs.airportExpressStation,this.outBoundDateTime=e.searchArgs.outboundDepartureDateTime?u.default(e.searchArgs.outboundDepartureDateTime):u.default(e.searchArgs.outboundArrivalDateTime),this.outboundCriteria=this.getCriteria(e.searchArgs.outboundDepartureDateTime,e.searchArgs.outboundArrivalDateTime),e.searchArgs.journeyType===X.ReturnJourney&&(this.inBoundDateTime=e.searchArgs.returnDepartureDateTime?u.default(e.searchArgs.returnDepartureDateTime):u.default(e.searchArgs.returnArrivalDateTime),this.returnCriteria=this.getCriteria(e.searchArgs.returnDepartureDateTime,e.searchArgs.returnArrivalDateTime)),this.applyRailcards=!!(null===(r=null===(t=e.searchArgs)||void 0===t?void 0:t.railCardQualifiers)||void 0===r?void 0:r.length),this.applyRailcards&&(this.railCards=e.searchArgs.railCardQualifiers),this.travellingTo=e.searchArgs.travellingTo,this.travellingFrom=e.searchArgs.travellingFrom,e.searchArgs.viaLocation&&(this.via=!0,this.viaLocation=e.searchArgs.viaLocation),e.searchArgs.isAirportExpress){var i={departureLocationId:e.searchArgs.departureLocationId,arrivalLocationId:e.searchArgs.arrivalLocationId};this.setAirportExpressStationIds(i)}e.searchArgs.journeyType===X.OpenReturnJourney&&(this.openReturn=!0),this.searchService.startSearches()},n.prototype._updateOutboundDateTime=function(){if(this._outbound_date&&this._outbound_time){var e=this.helpers.ngDateToMoment(this._outbound_date,this._outbound_time);this.outBoundDateTime=e.isValid()?e:null,this._isValid()}},n.prototype._updateReturnDateTime=function(){if(this._return_date&&this._return_time){var e=this.helpers.ngDateToMoment(this._return_date,this._return_time);this.inBoundDateTime=e.isValid()?e:null,this._isValid()}},n.prototype.getSearchQuery=function(t){var r,i,n,a,o,s,u;this.isAirportExpress&&this.openReturn&&(this.openReturn=!1);var l={countryCode:"GB",journeyType:t.chosenSearchType,adults:t.noOfAdults,arrivalLocationId:null===(i=null===(r=t.travellingTo)||void 0===r?void 0:r.railstation)||void 0===i?void 0:i.id,departureLocationId:null===(a=null===(n=t.travellingFrom)||void 0===n?void 0:n.railstation)||void 0===a?void 0:a.id,children:t.noOfChildren,class:t.chosenSearchClass,extraTimeToChange:t.extraTime,outboundArrivalDateTime:this.helpers.formatGraphQLDateTime(t.outBoundDateTime),outboundDepartureDateTime:this.helpers.formatGraphQLDateTime(t.outBoundDateTime),returnArrivalDateTime:this.helpers.formatGraphQLDateTime(t.inBoundDateTime),returnDepartureDateTime:this.helpers.formatGraphQLDateTime(t.inBoundDateTime),viaLocationId:null===(s=null===(o=t.viaLocation)||void 0===o?void 0:o.railstation)||void 0===s?void 0:s.id,railCardQualifiers:null===(u=t.railCards)||void 0===u?void 0:u.map((function(e){return e.code}))};switch(0===t.noOfChildren&&(l.children=null),""===this._viaLocation&&(l.viaLocationId=null),t.outboundCriteria){case e.RailSearchCriteria.Depart:l.outboundArrivalDateTime=null;break;case e.RailSearchCriteria.Arrive:l.outboundDepartureDateTime=null;break;default:console.warn("+++ Unknown Criteria: "+this.tempParams.outboundCriteria+" +++")}switch(t.returnCriteria){case e.RailSearchCriteria.Depart:l.returnArrivalDateTime=null;break;case e.RailSearchCriteria.Arrive:l.returnDepartureDateTime=null;break;default:console.warn("+++ Unknown Criteria: "+this.tempParams.returnCriteria+" +++")}switch(t.chosenSearchType){case X.SingleJourney:case X.OpenReturnJourney:l.returnDepartureDateTime=null,l.returnArrivalDateTime=null}return t.isAirportExpress&&(l.arrivalLocationId=this._travellingTo,l.departureLocationId=this._travellingFrom),this.helpers.removeNulls(l)},n.prototype.getCriteria=function(t,r){return t?e.RailSearchCriteria.Depart:r?e.RailSearchCriteria.Arrive:null},n.prototype.updateFromPreviousSearches=function(e){},n.prototype.getRailStation=function(e,i){return 3===e.length?(null==i||i.next(!0),this.getRailStationFetcher.fetchList({code:e}).pipe(r.tap((function(){return null==i?void 0:i.next(!1)})),r.take(1))):t.of()},n.prototype.getSelectedRailJourneyFare=function(){return null},n.prototype.getLegsFromRailJourneyOption=function(e){var t=[];return(null==e?void 0:e.journeyLegs.length)&&(t=e.journeyLegs.map((function(e){return{operator:e.operator,departureDateTime:e.departDateTime,departureStationName:e.depart,arrivalDateTime:e.arriveDateTime,arrivalStationName:e.arrive}}))),t},n.prototype.addSingleJourneyToBasket=function(e,t,r,i){var n;return g(this,void 0,void 0,(function(){var a,o,s,u,l,c,d;return v(this,(function(p){switch(p.label){case 0:return a=this.getSearchQuery(t),(null===(n=null==r?void 0:r.ticketExtras)||void 0===n?void 0:n.length)&&(o=this.createTicketExtrasObject(r.ticketExtras[0])),[4,this.basketService.getDefaultBasket()];case 1:return s=p.sent(),u=null==s?void 0:s.subject.value,l=this.getTermsAndCond(i,r),u?(c=this.getLegsFromRailJourneyOption(r),d={basket:u.id,service:e.toString(),detail:{ticketQueueList:(r.ticketQueueList||[]).map((function(e){return{id:e.id,name:e.name,type:e.type}})),accountsList:(r.accountsList||[]).map((function(e){return{id:e.id,description:e.description}})),outwardDetail:{arrivalDateTime:r.arriveDateTime,arrivalStationName:r.to,departureDateTime:r.departDateTime,departureStationName:r.from,supplierTickets:[{supplierName:i.providerName,ticketDescription:i.type,price:i.price,legs:c}]},transactionIdentifier:i.identifiers.transactionIdentifier,outbound:{fareIdentifiers:[i.identifiers.fareIdentifier],journeyIdentifier:i.identifiers.journeyIdentifier,journeyLegs:this.removedScheduledPlatformFromCallingPoints(r.journeyLegs)},termsAndCond:l},adults:a.adults,price:i.price,currency:i.currency,searchQuery:a,co2PerItem:r.co2PerItem,co2PerPassenger:r.co2PerPassenger,outboundDate:r.departDateTime},o&&(d.detail.outbound.ticketExtras=o),[2,this.basketService.addToBasket(d,s,this.searchService,this.travellers)]):[2,Promise.resolve()]}}))}))},n.prototype.addReturnJourneyToBasket=function(e,t,r,i,n,a){var o;return g(this,void 0,void 0,(function(){var s,u,l,c,d,p,h,m;return v(this,(function(f){switch(f.label){case 0:return s=this.getSearchQuery(t),(null===(o=null==r?void 0:r.ticketExtras)||void 0===o?void 0:o.length)&&(u=this.createTicketExtrasObject(r.ticketExtras[0])),[4,this.basketService.getDefaultBasket()];case 1:return l=f.sent(),c=null==l?void 0:l.subject.value,d=this.getTermsAndCond(n,r,i),c?(p=this.getLegsFromRailJourneyOption(r),h=this.getLegsFromRailJourneyOption(i),m={basket:c.id,service:e,detail:{ticketQueueList:(r.ticketQueueList||[]).map((function(e){return{id:e.id,name:e.name,type:e.type}})),accountsList:(r.accountsList||[]).map((function(e){return{id:e.id,description:e.description}})),outwardDetail:{arrivalDateTime:r.arriveDateTime,arrivalStationName:r.to,departureDateTime:r.departDateTime,departureStationName:r.from,supplierTickets:[{supplierName:n.providerName,ticketDescription:n.type,price:n.price,legs:p}]},inwardDetail:{arrivalDateTime:i.arriveDateTime,arrivalStationName:i.to,departureDateTime:i.departDateTime,departureStationName:i.from,supplierTickets:[{supplierName:a.providerName,ticketDescription:a.type,legs:h}]},transactionIdentifier:n.identifiers.transactionIdentifier,outbound:{fareIdentifiers:[n.identifiers.fareIdentifier],journeyIdentifier:n.identifiers.journeyIdentifier,journeyLegs:this.removedScheduledPlatformFromCallingPoints(r.journeyLegs)},return:{fareIdentifiers:[a.identifiers.fareIdentifier],journeyIdentifier:a.identifiers.journeyIdentifier,journeyLegs:this.removedScheduledPlatformFromCallingPoints(i.journeyLegs)},termsAndCond:d},adults:s.adults,price:n.price,currency:n.currency,searchQuery:s,co2PerItem:r.co2PerItem,co2PerPassenger:r.co2PerPassenger,outboundDate:r.arriveDateTime,inboundDate:i.arriveDateTime},u&&(m.detail.outbound.ticketExtras=u),[2,this.basketService.addToBasket(m,l,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},n.prototype.removedScheduledPlatformFromCallingPoints=function(e){for(var t=0;t<e.length;t++)for(var r=e[t],i=0;i<r.callingPoints.length;i++){delete r.callingPoints[i].scheduledPlatform}return e},n.prototype.createTicketExtrasObject=function(e){var t=this.noOfChildren*(null==e?void 0:e.childAmount)+this.noOfAdults*e.adultAmount;return[{type:e.identifiers.type,location:e.identifiers.location,date:e.identifiers.date,price:t}]},n.prototype.calculateTimeDifferenceInMins=function(e){return this.helpers.getTimeDifference(e.arriveDateTime,e.departDateTime).toString()},n.prototype.ticketIsAnETicket=function(){return null},n.prototype.applyFilter=function(){this._applyFilter()},n.prototype._applyFilter=function(){var t=this,r=function(e,r){var i=t._findSummary(r,t.summary.return);return t._selectedSummary?function(r){return r.map((function(r){var n,a,o,s;return r?Object.assign(Object.assign({},t.helpers.addRailActionRules(Object.assign({},r),[null===(n=t._selectedSummary[e][t.selectedTicket.fare.fareHash])||void 0===n?void 0:n.ruleDataWhenSelectedWith[r.fareHash],i?null===(a=i[e][r.fareHash])||void 0===a?void 0:a.ruleDataWhenSelectedAlone:null])),{selected:r.fareHash===t.selectedTicket.fare.fareHash,selectable:!!(null===(s=null===(o=t._selectedSummary[e][t.selectedTicket.fare.fareHash])||void 0===o?void 0:o.allowedWith)||void 0===s?void 0:s.includes(r.fareHash))}):null}))}:function(r){return r.map((function(r){return r?Object.assign(Object.assign({},t.helpers.addRailActionRules(Object.assign({},r),i?[i[e][r.fareHash].ruleDataWhenSelectedAlone]:[])),{selected:!1,selectable:!0}):null}))}},i=function(e,r,i){return function(n){var a=t._findSummary(r,t.summary[i]);return n.map((function(r){return r?t.helpers.addRailActionRules(Object.assign(Object.assign({},r),{selected:t.selectedTicket&&r.fareHash===t.selectedTicket.fare.fareHash}),a?[a[e][r.fareHash].ruleDataWhenSelectedAlone]:[]):null}))}};this.results.next(this.helpers.clone(this.fullResults).reduce((function(n,a){var o=Object.assign(Object.assign({},a),{outbound:(a.outbound||[]).map((function(r){return Object.assign(Object.assign({},r),{dualSingleJourneyFares:t.helpers.map(r.dualSingleJourneyFares||{},i("dualSingleJourneyFares",r,e.RailDirection.Outbound)),returnJourneyFares:t.helpers.map(r.returnJourneyFares||{},i("returnJourneyFares",r,e.RailDirection.Outbound)),openReturnJourneyFares:t.helpers.map(r.openReturnJourneyFares||{},i("openReturnJourneyFares",r,e.RailDirection.Outbound))})})),return:(a.return||[]).map((function(e){return Object.assign(Object.assign({},e),{returnJourneyFares:t.helpers.map(e.returnJourneyFares||{},r("returnJourneyFares",e)),dualSingleJourneyFares:t.helpers.map(e.dualSingleJourneyFares||{},r("dualSingleJourneyFares",e)),singleJourneyFares:t.helpers.map(e.singleJourneyFares||{},i("singleJourneyFares",e,"return")),openReturnJourneyFares:t.helpers.map(e.openReturnJourneyFares||{},i("openReturnJourneyFares",e,"return"))})}))});return n.push(o),n}),[]))},n.prototype.getTermsAndCond=function(e,t,r){return[{name:"Ticket Type Class",value:e.terms.ticketTypeClass},{name:"Ticket Type Conditions Description",value:e.terms.ticketTypeConditionsDescription},{name:"Valid Return Rule",value:e.terms.validReturnRule},{name:"Ticket Type Name",value:e.terms.ticketTypeName},{name:"Change Rule",value:e.terms.changeRule},{name:"Pre Booking Requirement",value:e.terms.preBookingRequirement},{name:"Railcard Discount",value:e.terms.railcardDiscount},{name:"Ticket Type Code",value:e.terms.ticketTypeCode},{name:"Child Discount",value:e.terms.childDiscount},{name:"Valid Out Rule",value:e.terms.validOutRule},{name:"Start Date",value:t.departDateTime},{name:"End Date",value:t.arriveDateTime},{name:"Journey Break Rule",value:e.terms.journeyBreakRule},{name:"Refund Cancellation Rule",value:e.terms.refundCancellationRule},{name:"Journey Type",value:e.terms.journeyType},{name:"Tod Available",value:e.terms.todAvailable},{name:"Return Start Date",value:null==r?void 0:r.departDateTime},{name:"Return End Date",value:null==r?void 0:r.arriveDateTime}]},n.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(this.tempParams),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:ee.Rail,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},n}(c);yt.STORAGE_SESSION_PARAMS="search_rail",yt.STORAGE_SESSION_RESULTS="rail_results",yt.PASSING_POINT="Passing",(ft=e.ages||(e.ages={})).Child="Child",ft.Youth="Youth",ft.Adult="Adult",ft.Senior="Senior";var gt,vt,bt=function(){function e(){}return e.hasItem=function(e){return!!e},e.fullname=function(e){return[e.title,e.forename,e.surname].filter(this.hasItem).join(" ")},e.makeTravellerObjectFromUser=function(e){return{id:e.user_id.toString(),forename:e.forename,surname:e.surname,email:e.username,title:e.title,isChild:!1,isInfant:!1,childDOB:null,guest:!1,name:e.surname+" "+e.forename}},e.equals=function(e,t){return e.email===t.email},e.compare=function(t,r){var i=e.fullname(t),n=e.fullname(r);return i===n?0:i<n?-1:1},e}();(gt=e.SortTypesIrl||(e.SortTypesIrl={})).CheapestFirst="C",gt.EarliestFirst="E",gt.LatestFirst="L",(vt=e.ClassType||(e.ClassType={})).Class_1="1",vt.Class_2="2",vt.Second_Class="2nd Class",vt.First_Class="1st Class";var St=function(t){function i(r,n,a,o,s,l){var c=t.call(this,s,a)||this;c.Irlfetcher=r,c.irlDiscountCardsFetcher=n,c.basketService=o,c.searchService=l,c.resultsSessionName=i.STORAGE_SESSION_RESULTS,c.multiResultsSessionName=i.STORAGE_SESSION_RESULTS,c._sortArray=[{title:"Price",methodRef:e.SortMethod.sortByPrice,icon:"ico-dollar"},{title:"Time",methodRef:e.SortMethod.sortByDate,icon:"ico-calendar"}],c.searchTypes=[{display:"Return",value:G.ReturnJourney},{display:"One-Way",value:G.SingleJourney}],c.classTypes=[{display:"Any",value:V.All},{display:"Standard",value:V.Standard},{display:"First",value:V.First}],c.ageRanges=[{key:e.ages.Child,value:"Child (0-3)"},{key:e.ages.Child,value:"Child (4-5)"},{key:e.ages.Child,value:"Child (6-11)"},{key:e.ages.Youth,value:"Youth (12-14)"},{key:e.ages.Youth,value:"Youth (15-25)"},{key:e.ages.Adult,value:"Adult (26-59)"},{key:e.ages.Youth,value:"Senior (60+)"}],c.travelCards=[{display:"Young persons railcard",value:"YNG"},{display:"Disability railcard",value:"DIS"},{display:"Family railcard",value:"FAM"},{display:"Forces railcard",value:"HMF"},{display:"Travel agency discount",value:"TAD"}],c.type=ee.InternationalRail,c.minOutboundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},c.minInboundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},c._supplier=null,c._countryCode=null,c._class=null,c._outboundDepartureDateTime=null,c._departureLocationId=null,c._arrivalLocationId=null,c._adults=0,c._children=0,c._cheapestStandard=null,c._cheapestFirst=null,c._returnDepartureDateTime=null,c._ageRange=null,c._priceDir=!1,c._dateDir=!1,c._irlDiscountCardsArray=[],c._outbound_date=null,c._outbound_time=null,c._return_date=null,c._return_time=null,c._offline=!1,c._irlClass=V.All,c._journeytype=G.SingleJourney;var d=s.getSessionItem(i.STORAGE_SESSION_PARAMS)||{query:{},tempParams:{},originalUserSearch:{}};c.updateTempParams(c.searchService.makeIrlQuery(d.tempParams)),c._originalUserSearch=d.originalUserSearch,l.shouldAddTravellerSubscription()&&l.travellerInformation.subscribe((function(t){c.travellers=t,c.travellers[0]&&!c.travellers[0].ageType&&(c.travellers[0].ageType=e.ages.Adult);var r=c.helpers.selectedTravellers(t,ee.InternationalRail);c.tempParams.adults=r.adults.length,c.tempParams.children=r.children.length,c.travellers=t,c._isValid()})),c._isValid();var p=s.getSessionItemAsList(c.resultsSessionName)||[];return c._cheapestResultPrice=c.updateLowestPrice(p),c.results.next(p||[]),c}return m(i,t),Object.defineProperty(i.prototype,"outboundJourneyOptions",{get:function(){return this._outboundJourneyOptions},set:function(e){this._outboundJourneyOptions=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outboundTicket",{get:function(){return this._outboundTicket},set:function(e){this._outboundTicket=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"noOfAdults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"noOfChildren",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"travellingTo",{get:function(){return this.tempParams.arrivalLocationId},set:function(e){var t;this.tempParams.arrivalLocationId=e,this._travellingTo="",(null===(t=null==e?void 0:e.railstation)||void 0===t?void 0:t.id)&&(this._travellingTo=e.railstation.id),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"travellingFrom",{get:function(){return this.tempParams.departureLocationId},set:function(e){var t,r=this;this.tempParams.departureLocationId=e,this._travellingFrom="",(null===(t=null==e?void 0:e.railstation)||void 0===t?void 0:t.id)&&(this._travellingFrom=e.railstation.id,this.supplier=e.railstation.supplier,this.getIrlDiscountCards().subscribe((function(e){r.irlDiscountCardsArray=e}))),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"supplier",{get:function(){return this._supplier},set:function(e){this._supplier=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"countryCode",{get:function(){return this._countryCode},set:function(e){this._countryCode=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"class",{get:function(){return this._class},set:function(e){this._class=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outboundDepartureDateTime",{get:function(){return this._outboundDepartureDateTime},set:function(e){this.tempParams.outboundDepartureDateTime=e,e&&e.isValid()&&(this._outboundDepartureDateTime=e,this._outbound_date=this.helpers.momentToNgDate(e),this._outbound_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"0700"),this._updateOutboundDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"departureLocationId",{get:function(){return this._departureLocationId},set:function(e){this._departureLocationId=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"arrivalLocationId",{get:function(){return this._arrivalLocationId},set:function(e){this._arrivalLocationId=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"adults",{get:function(){return this._adults},set:function(e){this._adults=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"children",{get:function(){return this._children},set:function(e){this._children=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cheapestStandard",{get:function(){return this._cheapestStandard},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cheapestFirst",{get:function(){return this._cheapestFirst},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"returnDepartureDateTime",{get:function(){return this._returnDepartureDateTime},set:function(e){this.tempParams.returnDepartureDateTime=e,e&&e.isValid()&&(this._returnDepartureDateTime=e,this._return_date=this.helpers.momentToNgDate(e),this._return_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"1600"),this._updateReturnDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"ageRange",{get:function(){return this._ageRange},set:function(e){this._ageRange=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"priceDir",{get:function(){return this._priceDir},set:function(e){this._priceDir=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dateDir",{get:function(){return this._dateDir},set:function(e){this._dateDir=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"chosenSearchClass",{get:function(){return this.tempParams.class},set:function(e){this.tempParams.class=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"discountCard",{get:function(){return this.tempParams.irlDiscountCards},set:function(e){this.tempParams.irlDiscountCards=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"irlDiscountCardsArray",{get:function(){return this._irlDiscountCardsArray},set:function(e){this._irlDiscountCardsArray=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outBoundDateTime",{get:function(){return this.tempParams.outboundDepartureDateTime},set:function(e){this.tempParams.outboundDepartureDateTime=u.default(e),this.minInboundDate={year:e.year(),month:e.month()+1,day:e.date()},e&&e.isValid()&&(this._outbound_date=this.helpers.momentToNgDate(e),this._outbound_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"0700"),this.outBoundDateTime&&this.inBoundDateTime&&this.outBoundDateTime.isAfter(this.inBoundDateTime)&&(this.inBoundDateTime=this.outBoundDateTime.clone().add(1,"day")),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"inBoundDateTime",{get:function(){return this.tempParams.returnDepartureDateTime},set:function(e){this.tempParams.returnDepartureDateTime=e,e&&e.isValid()&&(this._return_date=this.helpers.momentToNgDate(e),this._return_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"1600"),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outbound_date",{get:function(){return this._outbound_date},set:function(e){this._outbound_date=e,this._updateOutboundDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outbound_time",{get:function(){return this._outbound_time},set:function(e){this._outbound_time=e,this._updateOutboundDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"return_date",{get:function(){return this._return_date},set:function(e){this._return_date=e,this._updateReturnDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"return_time",{get:function(){return this._return_time},set:function(e){this._return_time=e,this._updateReturnDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"timeArray",{get:function(){return this._timeArray=this._timeArray||Array(48).fill(0).map((function(e,t){return{value:Math.floor(t/2).toString().padStart(2,"0")+(t%2*30).toString().padStart(2,"0"),display:Math.floor(t/2).toString().padStart(2,"0")+":"+(t%2*30).toString().padStart(2,"0")}})),this._timeArray},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"offline",{get:function(){return this._offline},set:function(e){this._offline=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"irlClass",{get:function(){return this._irlClass},set:function(e){this._irlClass=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"journeyType",{get:function(){return this._journeytype},set:function(e){this._journeytype=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"sortDropdownValues",{get:function(){return this._sortArray},enumerable:!1,configurable:!0}),i.prototype.processResults=function(e){var t;return null===(t=e[0])||void 0===t||t.outbound.forEach((function(e){e.providers[0].ticketOptions.map((function(e,t){return e.selected=!1,e.ShowDetail=!1,e.uid=e.identifiers.journeyIdentifier+"_"+(t+1),e}))})),Object.freeze(e),e},i.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeIrlQuery()),this._isValid()},i.prototype._isValid=function(){var e;this.storageService.setSessionItem(i.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.validationMessages=[];var t=u.default();this._travellingFrom||this.validationMessages.push("Please Enter a From Location."),this._travellingTo||this.validationMessages.push("Please Enter a To Location."),(null===(e=this.outBoundDateTime)||void 0===e?void 0:e.isBefore(t))&&this.validationMessages.push("Departure Date/Time cannot be in the past."),this.tempParams.adults+this.tempParams.children<1&&this.validationMessages.push("There must be at least 1 traveller"),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages)},i.prototype.startSearch=function(){if(this.results.next([]),this.isValid.value){var e=this.getSearchQuery();return this._originalUserSearch=Object.freeze(Object.assign({},this.tempParams)),this.storageService.setSessionItem(i.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.Irlfetcher.fetchList(e).pipe(r.map((function(e){return e}))))}return Promise.resolve(!1)},i.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:ee.InternationalRail,searchArgs:t,travelDate:this.outBoundDateTime.format(),travellers:this.helpers.getTravellersId(this.travellers)}},i.prototype.updateSerchQuery=function(e){var t=e;return this.travellingFrom&&(t.travellingFrom=this.travellingFrom),this.travellingTo&&(t.travellingTo=this.travellingTo),t},i.prototype.startRecentSearch=function(e){this.journeyType=e.searchArgs.journeyType,this.irlClass=e.searchArgs.class,this.travellingTo=e.searchArgs.travellingTo,this.travellingFrom=e.searchArgs.travellingFrom,this.outBoundDateTime=u.default(e.searchArgs.outboundDepartureDateTime),e.searchArgs.journeyType===G.ReturnJourney&&(this.inBoundDateTime=u.default(e.searchArgs.returnDepartureDateTime)),this.searchService.startSearches()},i.prototype._updateOutboundDateTime=function(){if(this._outbound_date&&this._outbound_time){var e=this.helpers.ngDateToMoment(this._outbound_date,this._outbound_time);this.outBoundDateTime=e.isValid()?e:null,this._isValid()}},i.prototype._updateReturnDateTime=function(){if(this._return_date&&this._return_time){var e=this.helpers.ngDateToMoment(this._return_date,this._return_time);this.inBoundDateTime=e.isValid()?e:null,this._isValid()}},i.prototype.getSearchQuery=function(){var t=this;this.noOfAdults=this.travellers.filter((function(t){return t.ageType===e.ages.Adult||t.ageType===e.ages.Youth||t.ageType===e.ages.Senior})).length,this.noOfChildren=this.travellers.filter((function(t){return t.ageType===e.ages.Child})).length,!this.supplier&&this.travellingFrom.name&&(this.supplier=this.travellingFrom.railstation.supplier,this.getIrlDiscountCards().subscribe((function(e){t.irlDiscountCardsArray=e})));var r={supplier:this.supplier,countryCode:"GB",irlDiscountCards:this.discountCard?this.discountCard.id:null,class:this.irlClass,outboundDepartureDateTime:this.tempParams.outboundDepartureDateTime,departureLocationId:this._travellingFrom,arrivalLocationId:this._travellingTo,adults:this.tempParams.adults,children:this.tempParams.children,returnDepartureDateTime:this.tempParams.returnDepartureDateTime,journeyType:this.journeyType};switch(0===this.tempParams.children&&(r.children=null),this.tempParams.journeyType){case G.SingleJourney:r.returnDepartureDateTime=null}return this.helpers.removeNulls(r)},i.prototype.updateFromPreviousSearches=function(e){},i.prototype.updateCanCombine=function(e){var t=this;(e.identifiers.allowedWith||[]).forEach((function(r){t._canCombine[e.type][r.journeyIdentifier]?t._canCombine[e.type][r.journeyIdentifier].push(r.fareIdentifier):t._canCombine[e.type][r.journeyIdentifier]=[r.fareIdentifier]}))},i.prototype.getLegsFromIrlJourneyOption=function(e){var t=[];return(null==e?void 0:e.segments.length)&&(t=e.segments.map((function(t){return{operator:t.operator||e.providers[0].providerId,departureDateTime:t.departDateTime,departureStationName:t.depart,arrivalDateTime:t.arriveDateTime,arrivalStationName:t.arrive}}))),t},i.prototype.getSelectedIrlTicketOption=function(e,t,r){return e.providers[r].ticketOptions.find((function(e){return e.type===t.type&&(e.price===t.price||e.identifiers.fareIdentifier===t.identifiers.fareIdentifier)}))},i.prototype.addSingleJourneyToBasket=function(e,t,r,i){return g(this,void 0,void 0,(function(){var n,a,o,s,u,l;return v(this,(function(c){switch(c.label){case 0:return[4,this.basketService.getDefaultBasket()];case 1:return n=c.sent(),(a=null==n?void 0:n.subject.value)?(o=this.getSelectedIrlTicketOption(i,r,0),s=this.getLegsFromIrlJourneyOption(i),u=this.getTermsAndCond(i),l={basket:a.id,service:e,detail:{outwardDetail:{arrivalDateTime:i.arriveDateTime,arrivalStationName:i.to,arrivalStationCode:i.toCode,departureDateTime:i.departDateTime,departureStationName:i.from,departureStationCode:i.fromCode,supplierTickets:[{supplierName:i.providers[0].name,ticketDescription:o.type,price:o.price,legs:s}]},transactionIdentifier:i.identifiers.transactionIdentifier,outbound:{fareIdentifiers:[o.identifiers.fareIdentifier],journeyIdentifier:o.identifiers.journeyIdentifier},supplier:i.providers[0].providerId,termsAndCond:u},adults:t.adults,price:o.price,currency:o.currency,searchQuery:t,outboundDate:i.departDateTime},[2,this.basketService.addToBasket(l,n,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},i.prototype.addReturnJourneyToBasket=function(e,t,r,i){return g(this,void 0,void 0,(function(){var r,n,a,o,s,u,l,c,d;return v(this,(function(p){switch(p.label){case 0:return r=this.outboundTicket,n=this.outboundJourneyOptions,[4,this.basketService.getDefaultBasket()];case 1:return a=p.sent(),(o=null==a?void 0:a.subject.value)?(s=this.getSelectedIrlTicketOption(n,r,0),u=this.getLegsFromIrlJourneyOption(n),l=this.getLegsFromIrlJourneyOption(i),c=this.getTermsAndCond(n),d={basket:o.id,service:e,detail:{outwardDetail:{arrivalDateTime:n.arriveDateTime,arrivalStationName:n.to,arrivalStationCode:n.toCode,departureStationCode:n.fromCode,departureDateTime:n.departDateTime,departureStationName:n.from,supplierTickets:[{supplierName:n.providers[0].name,ticketDescription:s.type,price:s.price,legs:u}]},inwardDetail:{arrivalDateTime:i.arriveDateTime,arrivalStationName:i.to,arrivalStationCode:i.toCode,departureStationCode:i.fromCode,departureDateTime:i.departDateTime,departureStationName:i.from,supplierTickets:[{supplierName:i.providers[0].name,ticketDescription:s.type,legs:l}]},transactionIdentifier:r.identifiers.transactionIdentifier,outbound:{fareIdentifiers:[s.identifiers.fareIdentifier],journeyIdentifier:s.identifiers.journeyIdentifier},supplier:n.providers[0].providerId,termsAndCond:c},adults:t.adults,price:s.price,currency:s.currency,searchQuery:t,outboundDate:n.departDateTime},this.filterSelected(),[2,this.basketService.addToBasket(d,a,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},i.prototype.updateLowestPrice=function(e){if(!e.length)return null;var t=e[0].outbound[0].providers[0].cheapestTicket.currency;return{amount:this.findCheapestTicket(e),currencyCode:t}},i.prototype.findCheapestTicket=function(e){var t=this;if(this._cheapestFirst=null,this._cheapestStandard=null,!e.length)return null;var r=[];return e.map((function(e){e.outbound.map((function(e){e.providers.map((function(e){var i=e.cheapestTicket.price;e.ticketOptions.map((function(e){var n,a,o=e.price,s=e.class;"First"===s&&((null===(n=t._cheapestFirst)||void 0===n?void 0:n.price)>o||!t._cheapestFirst)?t._cheapestFirst=e:"Standard"===s&&((null===(a=t._cheapestStandard)||void 0===a?void 0:a.price)>o||!t._cheapestStandard)&&(t._cheapestStandard=e),o===i&&r.push(i)}))}))}))})),Math.min.apply(Math,T(r))},i.prototype.sortByPrice=function(){var e=this;this.priceDir=!this.priceDir;var t=this.filterSelected(this._isFiltered),r=function(t,r){return e.priceDir?t.providers[0].cheapestTicket.price-r.providers[0].cheapestTicket.price:r.providers[0].cheapestTicket.price-t.providers[0].cheapestTicket.price};t[0].outbound=t[0].outbound.sort(r),t[0].return=t[0].return.sort(r),this.results.next(t)},i.prototype.sortByDate=function(){var e=this;this.dateDir=!this.dateDir;var t=this.filterSelected(this._isFiltered),r=function(t,r){return e.dateDir?u.default(t.departDateTime).unix()-u.default(r.departDateTime).unix():u.default(r.departDateTime).unix()-u.default(t.departDateTime).unix()};t[0].outbound=t[0].outbound.sort(r),t[0].return=t[0].return.sort(r),this.results.next(t)},i.prototype.addOutboundAndFilter=function(e,t){this.outboundJourneyOptions=t,this.outboundTicket=e,this.filterSelected(!0)},i.prototype.filterSelected=function(e){var t=this;void 0===e&&(e=!1);var r=this.helpers.clone(this.fullResults);return e?(this._isFiltered=!0,r[0].outbound=[r[0].outbound.find((function(e){return e.departDateTime===t._outboundJourneyOptions.departDateTime&&e.arriveDateTime===t._outboundJourneyOptions.arriveDateTime}))],r[0].outbound[0].providers[0].ticketOptions=r[0].outbound[0].providers[0].ticketOptions.reduce((function(e,r){return r.uid===t._outboundTicket.uid&&(r.selected=!0,e.push(r)),e}),[])):(this._isFiltered=!1,this.outboundJourneyOptions=null,this.outboundTicket=null,r[0].outbound.forEach((function(e){e.providers[0].ticketOptions.map((function(e){return e.selected=!1,e.ShowDetail=!1,e}))}))),this.results.next(r),r},i.prototype.getIrlDiscountCards=function(){var e=this.supplier;return this.irlDiscountCardsFetcher.fetchList({supplier:e})},i.prototype.getTermsAndCond=function(e){var t,r;return[{name:"Fare Rules",value:null===(r=null===(t=null==e?void 0:e.providers[0])||void 0===t?void 0:t.ticketOptions[0])||void 0===r?void 0:r.fareRules}]},i.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:ee.InternationalRail,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},i}(c);St.STORAGE_SESSION_PARAMS="search_irl",St.STORAGE_SESSION_RESULTS="irl_results",St.PASSING_POINT="Passing";var Tt,Ct,Dt={type:"string"},Pt={type:"object",properties:{countryCode:Dt,areaCode:Dt,number:Dt,extension:Dt},required:["countryCode","areaCode","number","extension"]},_t={type:"object",properties:{numberOrName:Dt,street:Dt,town:Dt,county:Dt,postcode:Dt,countryCode:Dt},required:["numberOrName","street","town","county","postcode","countryCode"]},At=function(){function e(e){this.helpers=e,this.details={numberOrName:"",street:"",town:"",county:"",postcode:"",countryCode:"GB"},this.bookingAddress=new t.BehaviorSubject([])}return e.prototype.updateDetails=function(e){var t=this;this.bookingAddress.next(e.map((function(e){return t.helpers.sanatizeReturns(t.details,e)})))},e}(),kt=function(){function e(e){this.helpers=e,this.details={countryCode:"",areaCode:"",number:"",extension:""},this.bookingPhoneNUmber=new t.BehaviorSubject([])}return e.prototype.updateDetails=function(e){var t=this;this.bookingPhoneNUmber.next(e.map((function(e){return t.helpers.sanatizeReturns(t.details,e)})))},e}(),Ft=function(){function e(e,t,r,i,n,a){this.user=e,this.getUserFetcher=t,this.helpers=r,this.perPassengerPhoneNumber=i,this.perPassengerAddress=n,this.perPassengerSupplementaryBookingInfoSchema=a,this.userDetails=null,this.userInfo={id:e.id,address:null,phoneNumber:null,supplementaryInfo:null}}return Object.defineProperty(e.prototype,"id",{get:function(){return this.user.id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userAddress",{get:function(){return null===this.userInfo.address&&this.setUpUserInfo(),this.userInfo.address},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userPhoneNumber",{get:function(){var e;return null===(null===(e=this.userInfo)||void 0===e?void 0:e.phoneNumber)&&this.setUpUserInfo(),this.userInfo.phoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userSupplementaryInfo",{get:function(){return null===this.userInfo.supplementaryInfo&&this.setUpUserInfo(),this.userInfo.supplementaryInfo},enumerable:!1,configurable:!0}),e.prototype.setUpUserInfo=function(){var e=this;this.userInfo.address=new At(this.helpers),this.userInfo.phoneNumber=new kt(this.helpers),this.userInfo.supplementaryInfo=this.perPassengerSupplementaryBookingInfoSchema,this.user.id&&this.getUserFetcher.fetchOne({id:this.user.id}).pipe(r.take(1)).subscribe((function(t){t&&(e.userDetails=t,e.userInfo.address.updateDetails(null==t?void 0:t.addresses),e.userInfo.phoneNumber.updateDetails(null==t?void 0:t.phoneNumbers))}))},e}(),Ot=function(){function t(e,t,r){var i=this;this.basketItem=e,this.helpers=t,this.hasDetails=!1,this.basketItem.perPassengerSupplementaryBookingInfoSchema=e.perPassengerSupplementaryBookingInfoSchema?this.processSchema(this.basketItem.perPassengerSupplementaryBookingInfoSchema):null,this.userInfo=this.basketItem.users.map((function(e){return new Ft(e,r,t,i.basketItem.perPassengerPhoneNumber,i.basketItem.perPassengerAddress,i.basketItem.perPassengerSupplementaryBookingInfoSchema)})),this.address=new At(this.helpers),this.phoneNumber=new kt(this.helpers),this.basketItem.perItemSupplementaryBookingInfoSchema=this.basketItem.perItemSupplementaryBookingInfoSchema?this.processSchema(this.basketItem.perItemSupplementaryBookingInfoSchema||{}):null}return Object.defineProperty(t.prototype,"perItemAddress",{get:function(){return!!this.basketItem.perItemAddress},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perItemPhoneNumber",{get:function(){return!!this.basketItem.perItemPhoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perItemSupplementarySchema",{get:function(){return this.basketItem.perItemSupplementaryBookingInfoSchema},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perPassengerAddress",{get:function(){return!!this.basketItem.perPassengerAddress},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perPassengerPhoneNumber",{get:function(){return!!this.basketItem.perPassengerPhoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perPassengerSupplementaryBookingInfoSchema",{get:function(){return this.basketItem.perPassengerSupplementaryBookingInfoSchema},enumerable:!1,configurable:!0}),t.prototype.processSchema=function(t){var r=this;return console.warn("processing: ",t),t=this.helpers.clone(t),this.hasDetails=this.perItemAddress||this.perItemPhoneNumber||this.perPassengerAddress||this.perPassengerPhoneNumber,Object.keys(t.properties||{}).forEach((function(i){console.log("here: ",i),r.hasDetails=!0;var n=t.properties[i];"object"===n.type&&(n.format=r.addRailFormat(i)||e.SchemaFormat.object,t.properties[i]=Object.assign(Object.assign({},r.processSchema(n)),{format:r.addRailFormat(i)||e.SchemaFormat.object})),n.format=n.format||r.schemaWidgetToFormat(n.widget)||r.schemaTypeToFormat(n.type),n.oneOf&&n.oneOf.length>0&&"railSeating"!==n.format&&(n.format=e.SchemaFormat.select)})),console.log("+++ has Details: "+this.hasDetails+" +++"),t},t.prototype.schemaWidgetToFormat=function(t){switch(t){case e.Widgets.COUNTRY_CODE:return e.SchemaFormat.countryCode;default:return null}},t.prototype.addRailFormat=function(t){switch(t){case e.SchemaFormat.additionalSeatPreference:return e.SchemaFormat.additionalSeatPreference;case e.SchemaFormat.seatPrefGroups:return e.SchemaFormat.seatPrefGroups;default:return null}},t.prototype.schemaTypeToFormat=function(t){switch(t){case"string":return e.SchemaFormat.string;case"integer":return e.SchemaFormat.integer;case"object":return e.SchemaFormat.object;case"array":return e.SchemaFormat.array;case"boolean":return e.SchemaFormat.boolean;default:return e.SchemaFormat.string}},t.prototype.createSupplemtalBookingInformation=function(e){var t=this,r={basketItem:this.basketItem.id,userInfo:[],supplementaryInfo:{},paymentMethodDetails:{}};return void 0!==e.perItemAddress&&(r.address=this.helpers.toStrings(e.perItemAddress,_t)),void 0!==e.perItemPhoneNumber&&(r.phoneNumber=this.helpers.toStrings(e.perItemPhoneNumber,Pt)),void 0!==e.perItemSupplementarySchema&&(r.supplementaryInfo=this.helpers.toStrings(e.perItemSupplementarySchema,this.perItemSupplementarySchema)),r.userInfo=this.userInfo.map((function(r,i){var n={id:r.id,supplementaryInfo:{}},a=e["user_"+i]||{};return void 0!==a.perPassengerAddress&&(n.address=t.helpers.toStrings(a.perPassengerAddress,_t)),void 0!==a.perPassengerPhoneNumber&&(n.phoneNumber=t.helpers.toStrings(a.perPassengerPhoneNumber,Pt)),void 0!==a.perPassengerSupplementaryBookingInfoSchema&&(n.supplementaryInfo=t.helpers.toStrings(a.perPassengerSupplementaryBookingInfoSchema,t.perPassengerSupplementaryBookingInfoSchema)),n})),r},t}();(Tt=e.IncludedType||(e.IncludedType={})).Leg="leg",Tt.Photo="photo",Tt.PhotoAttachment="photo_attachment",Tt.Upa="upa",(Ct=e.IrlDirection||(e.IrlDirection={})).Outbound="out",Ct.Inbound="in";var Rt=function(e){function t(t,r,i){var n=e.call(this,r)||this;return n.query=t,n.helpers=i,n}return m(t,e),t.prototype.fetchOne=function(e){return this.processCall(this.query.fetch(this.helpers.removeNulls(e)))},t}(p),It=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return null==e?void 0:e.data.applyJITFlightRules},t}(Rt),Et=function(e){function t(t,r,i){var n=e.call(this,i)||this;return n.query=t,n.helpers=r,n}return m(t,e),t.prototype.fetchList=function(e){return this.processCall(this.query.fetch(this.helpers.removeNulls(e)))},t.prototype.fetchKeyedObject=function(e,t){var i=this;return this.processCall(this.query.fetch(t)).pipe(r.map((function(t){return t?i.helpers.arrayToObject(t,e):null})))},t.prototype.fetchKeyedObjectArray=function(e,t){var i=this;return this.processCall(this.query.fetch(t)).pipe(r.map((function(t){return t?i.helpers.arrayToObjectArray(t,[e]):null})))},t}(p),Nt=function(e){function i(t,r,i){return e.call(this,t,r,i)||this}return m(i,e),i.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.applyJITHotelRules.result},i.prototype.processCall=function(e){var i=this;return e.pipe(r.take(1),r.map((function(e){return i.checkError(e.errors),i.getDataFromResult(e)})),r.catchError((function(e){return i.checkError(e),t.of({})})))},i}(Et),Bt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.getUserBasket},t}(Rt),Mt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchCabHire)||void 0===r?void 0:r.results},t}(Et),Lt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.carHireAvailabilityDetailRequest},t}(Et),jt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchCarHire)||void 0===r?void 0:r.results},t}(Et),wt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getConfermaOfficeNames},t}(Et),xt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getConfermaOffice},t}(Rt),Ut=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=e.data)||void 0===t?void 0:t.getConfermaQuicklist)||void 0===r?void 0:r.results},t}(Et),Vt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchEurostar)||void 0===r?void 0:r.results},t}(Et),Gt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.getFlightFareRules},t}(Et),Ht=function(e){function t(t,r,i,n){var a=e.call(this,t,r,i)||this;return a.environment=n,a}return m(t,e),t.prototype.fetchList=function(t){var r,i;return(null===(r=this.environment)||void 0===r?void 0:r.groupMax)>0&&(t.groupMax=null===(i=this.environment)||void 0===i?void 0:i.groupMax),e.prototype.fetchList.call(this,t)},t.prototype.getDataFromResult=function(e){var t,r,i,n;return Object.assign(Object.assign({},null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchFlightsV2)||void 0===r?void 0:r.results),{ruleActionSummary:null===(n=null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.searchFlightsV2)||void 0===n?void 0:n.ruleActionSummary})},t}(Et),Qt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getCOVIDMicrositeToken},t}(Et),Jt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getRailcards},t}(Et),Wt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getRailLiveDepartures},t}(Et),Yt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getRailStation},t}(Et),Kt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getRiskAlerts},t}(Et),zt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.getUserCompanyOffices},t}(Et),Xt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUserCurrentCarbonAllowance},t}(Et),qt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUserRecentSearches},t}(Et),Zt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUserBaskets},t}(Et),$t=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUserMIAutoSuggestValues},t}(Et),er=function(e){function i(t,r,i){return e.call(this,t,r,i)||this}return m(i,e),i.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getMultipleHotelsAvailability.results},i.prototype.processCall=function(e){var i=this;return e.pipe(r.take(1),r.map((function(e){return i.checkError(e.errors),i.getDataFromResult(e)})),r.catchError((function(e){return i.checkError(e),t.of({})})))},i}(Et),tr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchHotels)||void 0===r?void 0:r.results},t}(Et),rr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getIRLDiscountCards},t}(Et),ir=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchIRL)||void 0===r?void 0:r.results},t}(Et),nr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchLounges)||void 0===r?void 0:r.results},t}(Et),ar=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchParking)||void 0===r?void 0:r.results},t}(Et),or=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchRail)||void 0===r?void 0:r.results},t}(Et),sr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.searchAirlines},t}(Rt),ur=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.searchAirports},t}(Rt),lr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.searchCities},t}(Et),cr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.searchConfermaCities},t}(Rt),dr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getCarHireDepots},t}(Et),pr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.searchHotelChains},t}(Et),hr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchIRLSupplierStations},t}(Et),mr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return[null===(t=e.data)||void 0===t?void 0:t.getPostcodeDetails]},t}(Et),fr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.searchRailStations},t}(Et),yr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.searchUserCanBookFor},t}(Et),gr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getUserAddresses},t}(Et),vr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUser},t}(Rt),br=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getUserMessages},t}(Et),Sr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getUserServices},t}(Et),Tr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getUserUIConfigs.all},t}(Et),Cr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.getFlightSeatMap},t}(Et),Dr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUserFavouriteSearches},t}(Et),Pr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.getConfermaRoomImages},t}(Et),_r=function(){};_r.WHITE_CHARS=/[\r\n\t\s]/gm,_r.CAPS=/([A-Z])/g,_r.EMAIL_VALIDATOR=/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/,_r.UK_POSTCODE=/^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z]))))\s?[0-9][A-Za-z]{2})$/,_r.EMAIL_REGEX="^(([^<>()\\[\\]\\.,;:\\s@']+(\\.[^<>()\\[\\]\\.,;:\\s@']+)*)|('.+'))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}))$";var Ar,kr=function(e){function t(t,r,i,n,a){void 0===a&&(a="Invalid username or password. Please try again");var o=e.call(this,a)||this;return o.reason=t,o.data=r,o.statusText=i,o.error=n,o.name="LoginError",o}return m(t,e),t}(Error);(Ar=e.LoginErrorReason||(e.LoginErrorReason={}))[Ar.PASSWORD_EXPIRED=0]="PASSWORD_EXPIRED",Ar[Ar.PASSWORD_CHANGE=1]="PASSWORD_CHANGE",Ar[Ar.LOGED_IN=2]="LOGED_IN",Ar[Ar.AUTH_ERROR=3]="AUTH_ERROR",Ar[Ar.SSO=4]="SSO";var Fr,Or=function(){function e(e,t,r){this.username=e,this.password=t,this.overwrite="",r&&(this.overwrite="1")}return e.prototype.getAgent=function(){return"Agent="+encodeURIComponent(this.username.toLowerCase())},e.prototype.getPasswd=function(){return"Passwd="+encodeURIComponent(this.password)},e.prototype.getToken=function(){return"token="+encodeURIComponent(this.token)},e.prototype.getTokenStr=function(){try{return this.getAgent()+"&"+this.getPasswd()+"&overwrite="+this.overwrite+"&"+this.getToken()}catch(e){console.error("Sorry there is no enough information to get token string.")}},e.prototype.getChangePassTokenStr=function(){try{return("\n "+this.getAgent()+"&\n oldpasswd="+encodeURIComponent(this.oldPassword)+"&\n newpasswd="+encodeURIComponent(this.password)+"&\n cnfpasswd="+encodeURIComponent(this.confirmPassword)+"&\n "+this.getToken()).replace(_r.WHITE_CHARS,"")}catch(e){console.error("Sorry there is no enough information to get token string.",e)}},e.prototype.getResetPassTokenStr=function(){try{return("\n newpasswd="+encodeURIComponent(this.password)+"&\n cnfpasswd="+encodeURIComponent(this.confirmPassword)+"&\n "+this.getToken()).replace(_r.WHITE_CHARS,"")}catch(e){console.error("Sorry there is no enough information to get token string.",e)}},e}(),Rr=function(){function e(e,r,i,n){this.helpers=r,this.basketService=i,this.getUserFetcher=n,Object.assign(this,{subject:new t.BehaviorSubject(Object.assign(Object.assign({},e),{prices:{},mixedCurrency:!1,count:0,miGroups:[],basketInfoMiDetails:[],suppInfo:[]})),tempid:e.id,id:e.id,title:e.title,prices:{},mixedCurrency:!1,count:0,miGroups:[],basketInfoMiDetails:[],suppInfo:[]}),this.next(e)}return e.prototype.destructor=function(){this.subject.complete()},e.prototype.next=function(e){var t,r=this;if((e=this.helpers.clone(e)).status!==_.Approved||void 0!==e.basketItems[0].perItemPhoneNumber){this.id=e.id,this.title=e.title;var i=Object.assign(Object.assign({},e),(e.basketItems||[]).reduce((function(e,t,i){var n,a;return e.prices[t.currency]||(e.prices[t.currency]=0),e.prices[t.currency]+=t.price,e.suppInfo.push(new Ot(t,r.helpers,r.getUserFetcher)),t.miGroupsAvailable&&t.miGroupsAvailable.length>0&&e.miGroups.push({type:t.service.type,options:t.miGroupsAvailable,basketItem:t,value:t.miGroupSelected||""}),(null===(n=t.managementInfo)||void 0===n?void 0:n.length)>0&&(null===(a=t.users)||void 0===a?void 0:a.length)>0&&e.basketInfoMiDetails.push(new Se(t,r.basketService,r.helpers)),e}),{prices:{},mixedCurrency:!1,count:(null===(t=e.basketItems)||void 0===t?void 0:t.length)||0,miGroups:[],basketInfoMiDetails:[],suppInfo:[]}));i.mixedCurrency=Object.keys(i.prices).length>1,this.subject.next(i)}else this.basketService.getBasket({convertCurrencyTo:"GBP",id:e.id,withSupplemental:!0}).subscribe((function(e){r.next(e)}))},e}(),Ir=function(){function i(r,i,n,a,o,s,u,l,c,d,p,h,m,f,y,g,v,b,S,T,C,D,P,_){var A=this;this.acceptNewPriceUpdater=r,this.addItemToBasketUpdater=i,this.addUserToBasketItem=n,this.basketCreator=a,this.basketFetcher=o,this.bookBasketUpdater=s,this.deleteBasketUpdater=u,this.getMiAutoSugestionFetcher=l,this.helpers=c,this.removeItemFromBasketUpdater=d,this.revalidateBasketUpdater=p,this.setBasketItemMiGroupUpdater=h,this.setBasketItemMiValueUpdater=m,this.validateMiFreeValue=f,this.sendBasketForApprovalUpdater=y,this.getUserFetcher=g,this.getUserBasketsFetcher=v,this.SetBasketItemLeadPassenger=b,this.moveItemToADifferentBasket=S,this.updateBasketNotesUpdater=T,this.updateBasketTitleUpdater=C,this.setPaymentMethodUpdater=D,this.userService=P,this.modalService=_,this.currentBaskets=[],this.highlightBasketItemsEmitter=new t.Subject,this.basketChangeEmitter=new t.BehaviorSubject(""),this.baskets=new t.BehaviorSubject([]),this.basketList=[{type:ee.Flight,text:"FLIGHTS",price:0},{type:ee.Rail,text:"RAIL",price:0},{type:ee.Hotel,text:"HOTELS",price:0},{type:ee.Cab,text:"TAXIS",price:0},{type:ee.Car,text:"CARS",price:0},{type:ee.Eurostar,text:"EUROSTAR",price:0},{type:ee.InternationalRail,text:"INTERNATIONAL RAIL",price:0},{type:ee.Parking,text:"PARKING",price:0},{type:ee.Lounge,text:"LOUNGES",price:0},{type:ee.Coach,text:"COACH",price:0},{type:ee.FastTrack,text:"FAST_TRACK",price:0}],this.basketPrices=new t.BehaviorSubject({total:null,list:this.basketList}),this.menuState=e.MenuSlideEnum.OUT,this.userService.changeUser.subscribe({next:function(e){A.reset()}})}return Object.defineProperty(i.prototype,"currentBasketID",{get:function(){return this.basketChangeEmitter.value},set:function(e){e!==this.currentBasketID&&this.basketChangeEmitter.next(e)},enumerable:!1,configurable:!0}),i.prototype.reset=function(){var e=this;this.userService.getfullUserDetails(!1).userData.value?this.getUserBasketsFetcher.fetchList({basketStatus:_.Open,user:this.userService.getfullUserDetails(!0).userData.value.user_id.toString()}).pipe(r.take(1)).subscribe((function(t){var r=t.map((function(t){if(t){var r=e.findBasket(t.id);return r||(r=new Rr(t,e.helpers,e,e.getUserFetcher),e.currentBaskets.push(r)),r}}));e.baskets.next(r),r.length>0?e.currentBasketID=r[0].id:e.currentBasketID=null,e.basketChangeEmitter.next(e.currentBasketID)}),(function(e){console.error(e)})):(this.currentBaskets.forEach((function(e){return e.subject.unsubscribe()})),this.currentBaskets=[],this.currentBasketID=null,this.baskets.next(this.currentBaskets),this.basketChangeEmitter.next(this.currentBasketID))},i.prototype.getAllOpenBaskets=function(e){return g(this,void 0,void 0,(function(){var t=this;return v(this,(function(i){return[2,this.getUserBasketsFetcher.fetchList({basketStatus:_.Open,user:e}).pipe(r.take(1),r.map((function(e){return e.length&&e.forEach((function(e){if(!t.findBasket(e.id)){var r=new Rr(e,t.helpers,t,t.getUserFetcher);t.currentBaskets.push(r)}})),e}))).toPromise()]}))}))},i.prototype.addToBasket=function(e,t,i,n){return void 0===n&&(n=[]),g(this,void 0,void 0,(function(){var a=this;return v(this,(function(o){return e.convertCurrencyTo="GBP",(null==n?void 0:n.length)>0&&(e.users=this.helpers.makeUsers(n),e.leadPassenger=e.users[0].id),e.outboundDate=e.outboundDate?new Date(this.helpers.formatIsoDateTime(e.outboundDate)):e.outboundDate,e.inboundDate=e.inboundDate?new Date(this.helpers.formatIsoDateTime(e.inboundDate)):e.inboundDate,(e=this.checkDetails(e))&&t&&this.addItemToBasketUpdater.updateOne(e).pipe(r.take(1)).subscribe((function(r){t.next(Object.assign(Object.assign({},t.subject.value),r));var n=a.userService.findService(e.service).type;i.search_objects[n].booking_chosen=!0,i.search_objects[n].chosen=!1;var o=r.basketItems;a.highlightBasketItemsEmitter.next(o),a.basketChangeEmitter.next(a.currentBasketID)}),(function(e){console.error(e),t.subject.next(t.subject.value)})),[2,!1]}))}))},i.prototype.loadBasket=function(e){var t=this.findBasket(e);t||(t=new Rr({id:e,basketItems:[]},this.helpers,this,this.getUserFetcher),this.currentBaskets.push(t)),this.basketFetcher.fetchOne({convertCurrencyTo:"GBP",id:e}).subscribe((function(e){t.next(e)}))},i.prototype.subsribeToBasket=function(e,t){var r=this.findBasket(e);r&&r.subject.subscribe(t)},i.prototype.removeExpiredItems=function(e){var t=this;this.findBasket(e).subject.value.basketItems.filter((function(e){return 0!==e.latestValidationPriceDifference||e.expired})).forEach((function(r){t.removeBasketItem(e,r)}))},i.prototype.removeBasketItem=function(e,t){return g(this,void 0,void 0,(function(){var r,i,n=this;return v(this,(function(a){switch(a.label){case 0:return r=this.findBasket(e),t.service.type!==ee.Hotel?[3,4]:(i=r.subject.value.basketItems.filter((function(e){return t.detail.hotelId===e.detail.hotelId&&t.detail.rooms[0].id===e.detail.rooms[0].id&&t.detail.rooms[0].checkIn===e.detail.rooms[0].checkIn&&t.detail.rooms[0].checkOut===e.detail.rooms[0].checkOut}))).length>1?[4,this.modalService.open(d.WarningRemoveModalComponent)]:[3,2];case 1:return a.sent(),i.forEach((function(t){n.removeItemFromBasketUpdater.updateOne({convertCurrencyTo:"GBP",basketItem:t.id}).subscribe((function(t){r.next(Object.assign(Object.assign({},r.subject.value),t)),n.basketChangeEmitter.next(e)}))})),[3,3];case 2:this.removeItemFromBasketUpdater.updateOne({convertCurrencyTo:"GBP",basketItem:t.id}).subscribe((function(t){r.next(Object.assign(Object.assign({},r.subject.value),t)),n.basketChangeEmitter.next(e)})),a.label=3;case 3:return[3,5];case 4:this.removeItemFromBasketUpdater.updateOne({convertCurrencyTo:"GBP",basketItem:t.id}).subscribe((function(t){r.next(Object.assign(Object.assign({},r.subject.value),t)),n.basketChangeEmitter.next(e)})),a.label=5;case 5:return[2]}}))}))},i.prototype.getDefaultBasket=function(e){return void 0===e&&(e=!1),g(this,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return null,[4,this.findOrCreateBasket(this.currentBasketID,e).then((function(e){return e}))];case 1:return[2,t.sent()]}}))}))},i.prototype.findBasket=function(e){return this.currentBaskets.find((function(t){return t.id===e||t.tempid===e}))},i.prototype.findOrCreateBasket=function(e,t){return void 0===t&&(t=!1),g(this,void 0,void 0,(function(){var r,i;return v(this,(function(n){switch(n.label){case 0:return r=null,e?[3,7]:[4,this.getAllOpenBaskets(this.userService.getfullUserDetails(!0).userData.value.user_id.toString())];case 1:return(null==(i=n.sent())?void 0:i.length)?[3,3]:[4,this.createBasket()];case 2:return r=n.sent(),[3,6];case 3:return"BOOKED"!==(r=this.findBasket(i[0].id)).subject.value.status||t?[3,5]:(console.warn("+++ Retrieved basket is in booked status - creating a new one +++"),[4,this.createBasket()]);case 4:r=n.sent(),this.currentBaskets.push(r),n.label=5;case 5:this.baskets.next(this.currentBaskets),n.label=6;case 6:return[3,8];case 7:r=this.findBasket(e),n.label=8;case 8:return[2,r]}}))}))},i.prototype.createBasket=function(){return g(this,void 0,void 0,(function(){var e,t,r;return v(this,(function(i){switch(i.label){case 0:return e={id:"TEMPID_"+u.default().unix().toString(),owner:null,reference:null,title:null,notes:null,createdAt:null,updatedAt:null,basketItems:[],status:null,validated:!1},t=new Rr(e,this.helpers,this,this.getUserFetcher),[4,this.createBasketOnDB(t)];case 1:return r=i.sent(),this.currentBaskets.push(r),this.baskets.next(this.currentBaskets),this.basketChangeEmitter.next(r.id),[2,r]}}))}))},i.prototype.createBasketOnDB=function(e){var t=this;return new Promise((function(i,n){t.basketCreator.updateOne({}).pipe(r.take(1)).subscribe((function(t){e.id=t.id,e.next(t),i(e)}),(function(e){n(e)}),(function(){}))}))},i.prototype.toggleMenu=function(){this.menuState===e.MenuSlideEnum.IN||this.menuState===e.MenuSlideEnum.FLAT?this.menuState=e.MenuSlideEnum.OUT:this.menuState=e.MenuSlideEnum.IN},i.prototype.closeMenu=function(){this.menuState=e.MenuSlideEnum.IN},i.prototype.getLatestBasketItemForTypes=function(e){return(e||[]).reduce((function(e,t){return e[t.service.type]=t,e}),{})},i.prototype.checkDetails=function(e){var t=this.userService.findService(e.service);if(!t)return console.error("Unable to find service for basket item : "+e.service),null;var r=new l.default;r.addFormat("js-date-time",(function(e){return"object"==typeof e&&e.hasOwnProperty("toISOString")&&(e=e.toISOString()),!isNaN(Date.parse(e))})),r.addFormat("railSeating",(function(e){return!0}));var i=r.compile(t.detailSchema),n=r.compile(t.searchQuerySchema);if(e.searchQuery=this.helpers.sanitizeMomentDates(e.searchQuery),e.detail=this.helpers.removeNulls(e.detail),!n(e.searchQuery)){var a="Item searchQuery is not valid for "+t.name+" search schema.";return console.warn("searchSchema",t.searchQuerySchema),console.warn("item.searchQuery",e.searchQuery),console.warn("Search Query Validation errors",n.errors),this.modalService.open(d.ModalErrorComponent,{},{error:a}),null}if(!i(e.detail)){a="Item detail is not valid for "+t.name+" detail schema.";return console.warn("detailSchema",t.detailSchema),console.warn("item.detail",e.detail),console.warn("Detail errors",i.errors),this.modalService.open(d.ModalErrorComponent,{},{error:a}),null}return e},i.prototype.getNumberItemsForBasket=function(e){return void 0===e&&(e=null),(null==(e=e||this.findBasket(this.currentBasketID))?void 0:e.subject.value.basketItems.length)||0},i.prototype.removeBasket=function(e){var i=this;if(e)return this.deleteBasketUpdater.updateOne({id:e}).pipe(r.take(1),r.switchMap((function(r){var n,a;return null===(n=i.findBasket(e))||void 0===n||n.destructor(),i.currentBaskets=i.currentBaskets.filter((function(t){return t.id!==e})),i.baskets.next(i.currentBaskets),e===i.currentBasketID&&(i.currentBasketID=(null===(a=i.currentBaskets[0])||void 0===a?void 0:a.id)||null,i.basketChangeEmitter.next(i.currentBasketID)),t.of(r)})))},i.prototype.continueSearchAndBook=function(e,t,r){var i=this.getLatestBasketItemForTypes(e),n=r.getHighestSearchPriorityObject(i);return n?(r.searches[n.type].updateFromPreviousSearches(i),[n.searchUrl]):t},i.prototype.addTravellers=function(e,t,r,i){var n=this;void 0===i&&(i=0);var a=this.findBasket(e);if(i<r.length){var o=r[i],s=o.isChild?W.Child:o.isInfant?W.Infant:W.Adult;this.addUserToBasketItem.updateOne({convertCurrencyTo:"GBP",basketItem:t.id,users:[{id:o.id,passengerType:s}],withSupplemental:!1}).subscribe((function(){}),(function(){}),(function(){n.addTravellers(a.id,t,r,i+1)}))}else this.basketFetcher.fetchOne({convertCurrencyTo:"GBP",id:a.id}).subscribe((function(e){a.subject.next(Object.assign(Object.assign({},a.subject.value),e))}),(function(e){}),(function(){a.next(a.subject.value)}))},i.prototype.setLeadPassenger=function(e,t,r,i){var n=this;void 0===i&&(i=0);var a=this.findBasket(e);i<1?this.SetBasketItemLeadPassenger.updateOne({convertCurrencyTo:"GBP",id:t.id,user:r.id,withSupplemental:!1}).subscribe((function(){}),(function(){}),(function(){n.setLeadPassenger(a.id,t,r,i+1)})):this.basketFetcher.fetchOne({convertCurrencyTo:"GBP",id:a.id}).subscribe((function(e){a.subject.next(Object.assign(Object.assign({},a.subject.value),e))}),(function(e){}),(function(){a.next(a.subject.value)}))},i.prototype.updateBasket=function(e,t){var i=this;return new Promise((function(n,a){t.pipe(r.take(1)).subscribe((function(t){i.findBasket(e).next(t),n()}),(function(t){console.error(t);var r=i.findBasket(e);r.next(r.subject.value),a(t)}),(function(){}))}))},i.prototype.revalidate=function(e){this.updateBasket(e,this.revalidateBasketUpdater.updateOne({convertCurrencyTo:"GBP",id:e}))},i.prototype.setBasketItemMiGroup=function(e,t,r){this.updateBasket(e,this.setBasketItemMiGroupUpdater.updateOne({convertCurrencyTo:"GBP",basketItem:t,group:r}))},i.prototype.acceptNewPrice=function(e,t){this.updateBasket(e,this.acceptNewPriceUpdater.updateOne({convertCurrencyTo:"GBP",id:t.id}))},i.prototype.validateFreeValeMi=function(e,t){var r=this;return new Promise((function(i,n){r.validateMiFreeValue.test({mi:e.id,freeValue:t}).subscribe(i,n)}))},i.prototype.setMiFreeValue=function(e,t,i,n){void 0===n&&(n=null);var a=this.findBasket(e),o={convertCurrencyTo:"GBP",mi:t.id,miFreeValue:i};n&&(o.user=n),this.setBasketItemMiValueUpdater.updateOne(o).pipe(r.take(1)).subscribe((function(e){a.next(e)}),(function(e){}),(function(){a.next(a.subject.value)}))},i.prototype.setMiSelectedValue=function(e,t,r,i){void 0===i&&(i=null);var n={convertCurrencyTo:"GBP",mi:t.id,miValue:r};i&&(n.user=i),this.updateBasket(e,this.setBasketItemMiValueUpdater.updateOne(n))},i.prototype.getMiAutoSugestions=function(e,t,i){return null==i||i.next(!0),this.getMiAutoSugestionFetcher.fetchList({mi:e,partialLabel:t}).pipe(r.tap((function(e){null==i||i.next(!1)})))},i.prototype.saveMiData=function(e,t){t.forEach((function(t){t.miPerItem.forEach((function(t){t.save(e,null)})),t.users.forEach((function(r){t.miPerUser[r].managementInfo.forEach((function(t){t.save(e,r)}))}))}))},i.prototype.sendBasketForApproval=function(e){return this.updateBasket(e,this.sendBasketForApprovalUpdater.updateOne({convertCurrencyTo:"GBP",basket:e}).pipe(r.take(1)))},i.prototype.setBasketItemPaymentOption=function(e,t,r){return this.updateBasket(e.id,this.setPaymentMethodUpdater.updateOne({convertCurrencyTo:"GBP",basketItem:t.id,paymentMethod:r}))},i.prototype.bookBasket=function(e,t){return this.updateBasket(e,this.bookBasketUpdater.updateOne({convertCurrencyTo:"GBP",id:e,supplementaryInfo:t}))},i.prototype.moveBasketItem=function(e,t,r){var i=this;this.moveItemToADifferentBasket.updateOne({convertCurrencyTo:"GBP",basketItem:t.id,newBasket:r}).subscribe((function(){i.loadBasket(e),i.loadBasket(r)}))},i.prototype.updateBasketNotes=function(e,t){this.updateBasket(e,this.updateBasketNotesUpdater.updateOne({convertCurrencyTo:"GBP",id:e,notes:t}))},i.prototype.updateBasketTitle=function(e,t){this.updateBasket(e,this.updateBasketTitleUpdater.updateOne({convertCurrencyTo:"GBP",id:e,newTitle:t}))},i.prototype.getBasket=function(e){return this.basketFetcher.fetchOne(e)},i.prototype.atLeastOneSearchChosen=function(){return!!this.currentBaskets.filter((function(e){return e.subject.value.basketItems.length})).length},i.prototype.getBasketStats=function(e){var t,r,i,n=this,a=(null===(i=null===(r=null===(t=this.baskets.value[e])||void 0===t?void 0:t.subject)||void 0===r?void 0:r.value)||void 0===i?void 0:i.prices)||{},o=Object.keys(a)[0];return o?(this.basketPrices.value.currency=o,this.basketPrices.value.total=this.baskets.value[e].subject.value.prices[o]):this.basketPrices.value.total=0,this.basketPrices.value.list.forEach((function(t){var r,i,a;t.price=null===(a=null===(i=null===(r=n.baskets.value[e])||void 0===r?void 0:r.subject)||void 0===i?void 0:i.value)||void 0===a?void 0:a.basketItems.filter((function(e){return e.service.type===t.type})).reduce((function(e,t){return e+t.price}),0)})),this.basketPrices},i}(),Er="results_hotel_avallibility",Nr=function(){function e(e,r,i,n){this.avalibilityFethcer=e,this.sessionStorage=r,this.helpers=i,this.environment=n,this.data=null,this.behaviours={},this.toFetch=[],this.fetching=new t.BehaviorSubject(!1),this.currencies={}}return e.prototype.readFromSession=function(){var e=this,r=this.sessionStorage.getSessionItem(Er)||{};return Object.values(r).forEach((function(r){e.behaviours[r.hotelId]=new t.BehaviorSubject(r)})),r},e.prototype.reset=function(){var e=this;this.data={},this.currencies={},this.toFetch=[],this.fetching.next(!1),this.sessionStorage.removeSessionItem(Er),Object.values(this.data).forEach((function(t){e.behaviours[t.hotelId].complete(),delete e.behaviours[t.hotelId]})),this.behaviours={}},e.prototype.getAvailabilityForId=function(e,r){var i;if(null===(i=null==r?void 0:r.availableRates)||void 0===i?void 0:i.rooms){if(this.behaviours[e.hotel])return this.behaviours[e.hotel];this.behaviours[e.hotel]=new t.BehaviorSubject(null);var n=r.availableRates;return n.minprice=r.availableRates.rooms[0]?r.availableRates.rooms[0].total:0,this.behaviours[e.hotel].next(n),this.behaviours[e.hotel]}return this.data=this.data||this.readFromSession(),this.behaviours[e.hotel]||this._getAvailabilityForId(e)},e.prototype.getAvailabilityValue=function(e){var t;return this.data=this.data||this.readFromSession(),(null===(t=this.behaviours[e.id])||void 0===t?void 0:t.value)||{}},e.prototype.updateHotel=function(e){return e.availableRates||(e.availableRates=this.getAvailabilityValue(e)),e},e.prototype.setHotelAvalability=function(e){return e.availableRates||(null==e?void 0:e.availableRates.hotelId)&&(this.data[e.availableRates.hotelId]=e.availableRates,this.behaviours[e.availableRates.hotelId].next(e.availableRates)),e},e.prototype._getAvailabilityForId=function(e){return this.timeout&&(window.clearTimeout(this.timeout),this.timeout=0),this.fetching.value||(this.timeout=window.setTimeout(this.fetchAvalilbility.bind(this),this.environment.autoFetchHotelTimeout)),this.toFetch.push(e),!this.fetching.value&&this.toFetch.length>=this.environment.numberOfHotelsToFetch&&this.fetchAvalilbility(),this.behaviours[e.hotel]=new t.BehaviorSubject(null),this.behaviours[e.hotel]},e.prototype.fetchAvalilbility=function(){var e=this;this.fetching.next(!0),this.timeout&&(window.clearTimeout(this.timeout),this.timeout=0);var t=this.toFetch.slice(0,this.environment.numberOfHotelsToFetch);this.toFetch=this.toFetch.slice(this.environment.numberOfHotelsToFetch),console.log("Hotels still to fetch",this.toFetch.length);var i={hotel:t.map((function(e){return e.hotel})),currency:t[0].currency,endDate:t[0].endDate,startDate:t[0].startDate,occupants:t[0].occupants,rooms:t[0].rooms};this.avalibilityFethcer.fetchList(i).pipe(r.take(1)).subscribe((function(t){t.forEach((function(t){(t=e.helpers.clone(t)).rooms=(t.rooms||[]).filter((function(e){return e.total>0})).map((function(t){return(t=e.helpers.clone(t)).LocalPrice=t.currencyConversion?t.currencyConversion.localTotal:t.total,t.LocalCurrency=t.currencyConversion?t.currencyConversion.localCode:t.currencyCode,t})),t.currencies=t.rooms.reduce((function(t,r){return r.currencyConversion&&(t[r.currencyConversion.convertedCode]=t[r.currencyConversion.convertedCode]||{maxprice:Number.MIN_VALUE,minprice:Number.MAX_VALUE},t[r.currencyConversion.convertedCode].maxprice=Math.max(t[r.currencyConversion.convertedCode].maxprice,r.currencyConversion.convertedTotal),t[r.currencyConversion.convertedCode].minprice=Math.min(t[r.currencyConversion.convertedCode].minprice,r.currencyConversion.convertedTotal),e.currencies[r.currencyConversion.convertedCode]=e.currencies[r.currencyConversion.convertedCode]||{maxprice:Number.MIN_VALUE,minprice:Number.MAX_VALUE},e.currencies[r.currencyConversion.convertedCode].minprice=Math.ceil(Math.min(e.currencies[r.currencyConversion.convertedCode].minprice,r.currencyConversion.convertedTotal)),e.currencies[r.currencyConversion.convertedCode].maxprice=Math.ceil(Math.max(e.currencies[r.currencyConversion.convertedCode].maxprice,r.currencyConversion.convertedTotal))),t}),{});var r=t.rooms.map(e.helpers.mapFieldFromObject("total"));r.length||r.push(0),t.minprice=Math.min.apply(Math,T(r)),t.maxprice=Math.max.apply(Math,T(r)),t.rooms=t.rooms,(null==t?void 0:t.hotelId)&&e.behaviours[t.hotelId]&&(e.data[t.hotelId]=t,e.behaviours[t.hotelId].next(t))})),e.sessionStorage.setSessionItem(Er,t),e.toFetch.length>0?setTimeout((function(){e.fetchAvalilbility()}),e.environment.hotelAvalibilityTimeout):e.fetching.next(!1)}),(function(t){return console.error("+++ Error recovering hotel availabilty: "+t+" - reseting availabilty +++"),e.fetching.next(!1),null}))},e.prototype.maxPriceForCurrency=function(e){return(this.currencies[e]||{maxprice:Number.MAX_VALUE,minprice:Number.MIN_VALUE}).maxprice},e.prototype.numberOfHotelsWithPrice=function(){var e,t,r=0;if(this.data)try{for(var i=b(Object.entries(this.data)),n=i.next();!n.done;n=i.next()){var a=S(n.value,2),o=(a[0],a[1]);(null==o?void 0:o.prpn)&&r++}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},e}(),Br=function(){function e(){}return e.prototype.serialize=function(e){return Object.keys(e).reduce((function(t,r){return(t.length?t+"&":"")+r+"="+encodeURIComponent("object"==typeof e[r]?JSON.stringify(e[r]):e[r])}),"")},e}(),Mr="USER_SIGNEDOUT",Lr=function(){function e(e,r,i,n,a,o){this.userUiConfigsFetcher=e,this.userProductsFetcher=r,this.userMessagesFetcher=i,this.baseConfirmMessagesUpdater=n,this.storageService=a,this.helpers=o,this.fullUserDetails={bookingAllowedFor:"",messages:new t.BehaviorSubject(null),travllerObject:new t.BehaviorSubject(null),userConfigs:new t.BehaviorSubject(null),userData:new t.BehaviorSubject(null),userServices:new t.BehaviorSubject(null)},this.changeUser=new t.BehaviorSubject(null)}return e.prototype.setUser=function(e){var t=this,r=this.fullUserDetails.userData.value;r&&r.username===e.username||(this.userUiConfigsFetcher.fetchKeyedObject("key").subscribe((function(e){t.fullUserDetails.userConfigs.next(e),t.checkEmitUser()}),(function(e){console.error(e)})),this.userProductsFetcher.fetchKeyedObjectArray("type").subscribe((function(e){t.fullUserDetails.userServices.next(e),t.checkEmitUser()})),this.userMessagesFetcher.fetchList().subscribe((function(e){t.fullUserDetails.messages.next(e),t.checkEmitUser()}),(function(e){console.error(e)})),this.fullUserDetails.travllerObject.next(bt.makeTravellerObjectFromUser(e))),this.fullUserDetails.userData.next(e),this.storageService.setSessionItem("lightning_user_data",e)},e.prototype.checkEmitUser=function(){this.fullUserDetails.userConfigs.value&&this.fullUserDetails.userData.value&&this.fullUserDetails.userServices.value&&this.fullUserDetails.messages.value&&this.changeUser.next(this.fullUserDetails)},e.prototype.getfullUserDetails=function(e){return void 0===e&&(e=!1),this._getFullUserDetails()},e.prototype._getFullUserDetails=function(){return this.fullUserDetails||this.storageService.getSessionItem("lightning_user_data")},e.prototype.getUserDropdownInfo=function(){var e={name:"Unable to retrieve name.",email:"Unable to rerieve email",account_type:"Unknown",title:""},t=this.getUsersFullname(),r=this.getUserEmail(),i=this.getUserBookingType(),n=this.getUserTitle();return t&&(e.name=t),r&&(e.email=r),i&&(e.account_type=i),n&&(e.title=n),e},e.prototype.getUserTitle=function(){var e=this.getfullUserDetails();return e&&e.userData?e.userData.value.title:""},e.prototype.getUserEmail=function(){var e=this.getfullUserDetails();return e&&e.userData?e.userData.value.username:""},e.prototype.getUserBookingType=function(){var e=this.getfullUserDetails();return e&&e.userData?e.userData.value.booker_type:null},e.prototype.getUsersFullname=function(){var e=this.getfullUserDetails();return!(!e||!e.userData)&&e.userData.value.forename+" "+e.userData.value.surname},e.prototype.getUsersTitleAndFullName=function(){var e=this.getfullUserDetails();return!(!e||!e.userData)&&e.userData.value.title+" "+e.userData.value.forename+" "+e.userData.value.surname},e.prototype.getUserFavoriteValue=function(e,t){void 0===t&&(t=Ke.non);var r=this.fullUserDetails.userConfigs.value;return this.helpers.fromObject(r,e.value,"config",e.value)},e.prototype.getUserFavoriteObject=function(e){var t=this.fullUserDetails.userConfigs.value;return this.helpers.fromObject(t,e.value,"config")},e.prototype.getUserFavoriteNumber=function(e,t){void 0===t&&(t=Ke.non);var r=this.fullUserDetails.userConfigs.value;return this.helpers.fromObject(r,e.value,"config","value")},e.prototype.isUserFavoriteSet=function(e,t){void 0===t&&(t=Ke.non);var r=this.fullUserDetails.userConfigs.value;return this.helpers.fromObject(r,e.value,"config","value")},e.prototype.createSelfTraveller=function(){return this.fullUserDetails.travllerObject.value},e.prototype.travellerIsUser=function(e){return!1},e.prototype.emptyUserData=function(){this.fullUserDetails.userData.next(null),this.fullUserDetails.userConfigs.next(null),this.fullUserDetails.userServices.next(null),this.fullUserDetails.messages.next(null),this.changeUser.next(this.fullUserDetails)},e.prototype.createGuestUser=function(e,t,r,i,n,a,o,s,u,l,c){return{isChild:u,isInfant:l,childDOB:c,guest:!0,id:"",forename:t,surname:r,email:i,title:e,name:[e,t,r].join(" ")}},e.prototype.userIsClient=function(){return!0},e.prototype.hasIgnorePolicy=function(){return!1},e.prototype.useAgentCanBookFor=function(){return!0},e.prototype.canBook=function(e){var t=this.fullUserDetails.userServices.value;return t&&!!t[e]},e.prototype.isTraveller=function(){return this.fullUserDetails.userData.value.booker_type===k.Traveller},e.prototype.userIsAgent=function(){return this.fullUserDetails.userData.value.booker_type===k.Company},e.prototype.userIsAdmin=function(){return this.fullUserDetails.userData.value.admin},e.prototype.userIsCompanyAdmin=function(){return this.fullUserDetails.userData.value.company_admin},e.prototype.isSelfBook=function(){return this.fullUserDetails.userData.value.booker_type===k.SelfBook},e.prototype.isBooker=function(){return this.fullUserDetails.userData.value.booker_type===k.Booker},e.prototype.getUserId=function(){return this.fullUserDetails.userData.value.user_id},e.prototype.userHasServiceProvider=function(e,t){return!!this.fullUserDetails.userServices.value&&!!(this.fullUserDetails.userServices.value[e]||[]).find((function(e){return e.name===t}))},e.prototype.findService=function(e){return this.fullUserDetails.userServices.value?this.helpers.findService(this.fullUserDetails.userServices.value,e):null},e.prototype.getUserMessages=function(){return this.userMessagesFetcher.fetchList()},e.prototype.confirmMessages=function(e){return this.baseConfirmMessagesUpdater.updateOne({messages:e})},e}(),jr=function(){function i(e,t,r,i,n,a,o){this.userService=e,this.modalService=t,this.http=r,this.router=i,this.eventMessenager=n,this.storageService=a,this.environment=o,this.loading=!1,this.isLoggedIn=!1,this.redirectUrl="",this.refreshPromise=null}return i.prototype.checkLogin=function(){return this.refreshToken()},i.prototype.refreshToken=function(){var t=this;return this.refreshPromise=this.refreshPromise||new Promise((function(i,n){t.clearRefresh(),t.http.formEncodedPostNoErrorHandling(e.URLS.Refresh,{}).pipe(r.take(1),r.map((function(e){return t.handleResponse(e)}))).subscribe((function(e){if("string"==typeof e){if(i(!1),"login"!==t.router.url)t.modalService.open(d.BaseModalComponent,{},{title:"Auto Logout",body:"",isLoading:!1,options:{buttonCancel:!1,buttonOk:!0,buttonOkText:"Continue"}}).then((function(){t.logout(),i(!1)}))}else i(!0),t.setRefresh()}),(function(e){i(!1)}))})).then((function(e){return t.refreshPromise=null,e})).catch((function(e){throw t.refreshPromise=null,e})),this.refreshPromise},i.prototype.clearRefresh=function(){this.timeoutSubscription&&(clearTimeout(this.timeoutSubscription),this.timeoutSubscription=null)},i.prototype.setRefresh=function(){this.timeoutSubscription=window.setTimeout(this.refreshToken.bind(this),1e3*this.environment.authRefreshTimeout)},i.prototype.login=function(t,i,n){var a=this;return this.userService.emptyUserData(),this.storageService.clearSessionData(),this.clearRefresh(),this.http.formEncodedPostNoErrorHandling(e.URLS.AccessToken,{username:t,password:i}).pipe(r.take(1),r.map((function(e,t){return a.setRefresh(),a.handleResponse(e)})))},i.prototype.handleResponse=function(e){return"object"==typeof e&&e.jwt&&(this.userService.setUser(e.jwtObject),delete e.jwt,delete e.jwtObject),e},i.prototype.cookieLogin=function(e){return t.of(null)},i.prototype.logout=function(){var t=this;this.userService.isUserFavoriteSet(Ye.SSO_no_password);this.clearRefresh(),this.isLoggedIn=!1,this.userService.emptyUserData(),this.storageService.clearSessionData(),this.http.post(e.URLS.LOGOUT_URL).subscribe((function(e){e.LogoutSuccess||console.warn("You're not logged in, cannot log out.")}),(function(){t.eventMessenager.emit(Mr,{}),t.userService.isUserFavoriteSet(Ye.SSO_no_password)?t.router.navigate(["logOutDigitsUser"]):t.router.navigate(["logon"])}))},i.prototype.changePassword=function(e){return t.of(null)},i.prototype.resetPassword=function(t,r){return this.http.formEncodedPost(e.URLS.RESET_PASSWORD,{passwordResetToken:t,newPassword:r})},i.prototype.recoverPassword=function(t){return this.http.formEncodedPost(e.URLS.RECOVER_PASSWORD_URL,{username:""+t},"text")},i.prototype.handleError=function(e){var t={error:e};this.modalService.open(d.ModalErrorComponent,{},t)},i}(),wr=function(){function e(){this.openModalEvent=new t.Subject}return e.prototype.open=function(e,t,r){var i=this;return void 0===t&&(t=null),void 0===r&&(r=null),new Promise((function(n,a){i.openModalEvent.next({type:e,data:r||{},options:t||{},results:n})}))},e.prototype.subscribe=function(e){return this.openModalEvent.subscribe(e)},e}(),xr=function(){function e(e,r,i){var n,a;this.getUserBasketsFetcher=e,this.searchUserCanBookFor=r,this.cancelBookingUpdater=i,this.baskets=new t.BehaviorSubject([]),this._basketStatusIconClasses=((n={})[_.Approved]="ico-tick",n[_.AwaitingApproval]="ico-clock",n[_.BookingFailed]="ico-deny",n[_.Disapproved]="ico-deny",n[_.Open]="ico-calendar",n[_.PartiallyBooked]="ico-deny",n[_.Booked]="ico-deny",n),this._serviceTypeIconClasses=((a={})[ee.Cab]="ico-m-taxi",a[ee.Car]="ico-car",a[ee.Coach]="ico-bus",a[ee.Flight]="ico-flight",a[ee.Hotel]="ico-bed",a[ee.FastTrack]="",a[ee.InternationalRail]="ico-rail",a[ee.Lounge]="ico-material ico-lounge",a[ee.Parking]="ico-material ico-parking",a[ee.Rail]="ico-rail",a[ee.Eurostar]="ico-rail",a)}return e.prototype.getUserBaskets=function(e,t){var i=this;t.next(!0),this.getUserBasketsFetcher.fetchList(e).pipe(r.take(1)).subscribe((function(e){i.baskets.next(e),t.next(!1)}),(function(e){console.error(e),t.next(!1)}))},e.prototype.getSearchUserCanBookFor=function(e,i){return e.length>2?(i.next(!0),this.searchUserCanBookFor.fetchList({email:e}).pipe(r.take(1),r.map((function(e){return i.next(!1),e})))):t.of([])},e.prototype.getServiceTypeFilters=function(e){var t,r,i=[];try{for(var n=b(Object.entries(e.search_objects)),a=n.next();!a.done;a=n.next()){var o=S(a.value,1)[0];i.push(o)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return i},e.prototype.getBasketStatusFilters=function(){var e=[];return Object.values(_).forEach((function(t){return e.push(t)})),e},e.prototype.getServiceTypeFilterVanityName=function(e){switch(e){case ee.Cab:return"Taxi";case ee.InternationalRail:return"European Rail";default:return e}},e.prototype.getBasketStatusIconClass=function(e){return this._basketStatusIconClasses[e]||"ico-exclamation"},e.prototype.getServiceTypeIconClass=function(e){return this._serviceTypeIconClasses[e.service.type]||"ico-exclamation"},e.prototype.getTotalPriceForBasketItems=function(e){return e.reduce((function(e,t){return e+t.price}),0)},e.prototype.getTravellerNamesFromBasketItems=function(e){var t=[];return e.map((function(e){return e.users.map((function(e){return t.push(e.forename+" "+e.surname)}))})),t=T(new Set(t))},e.prototype.allBasketItemsMatchStatus=function(e,t){return e.every((function(e){return e.status===t}))},e.prototype.getHotelAddress=function(e){var t=e.county,r=e.postcode,i=e.streetName,n=e.town,a=[];return i&&a.push(i),n&&a.push(n),t&&a.push(t),r&&a.push(r),a.join(", ")},e.prototype.getHotelLocation=function(e){var t=e.county,r=e.town,i=[];return r&&i.push(r),t&&i.push(t),i.join(", ")},e.prototype.cancelBooking=function(e){return this.cancelBookingUpdater.updateOne({basketItem:e})},e}(),Ur=[{cName:"Afghanistan",dCode:"93",cCode:"AF"},{cName:"Aland Islands",dCode:"358",cCode:"AX"},{cName:"Albania",dCode:"355",cCode:"AL"},{cName:"Algeria",dCode:"213",cCode:"DZ"},{cName:"AmericanSamoa",dCode:"1684",cCode:"AS"},{cName:"Andorra",dCode:"376",cCode:"AD"},{cName:"Angola",dCode:"244",cCode:"AO"},{cName:"Anguilla",dCode:"1264",cCode:"AI"},{cName:"Antarctica",dCode:"672",cCode:"AQ"},{cName:"Antigua and Barbuda",dCode:"1268",cCode:"AG"},{cName:"Argentina",dCode:"54",cCode:"AR"},{cName:"Armenia",dCode:"374",cCode:"AM"},{cName:"Aruba",dCode:"297",cCode:"AW"},{cName:"Australia",dCode:"61",cCode:"AU"},{cName:"Austria",dCode:"43",cCode:"AT"},{cName:"Azerbaijan",dCode:"994",cCode:"AZ"},{cName:"Bahamas",dCode:"1242",cCode:"BS"},{cName:"Bahrain",dCode:"973",cCode:"BH"},{cName:"Bangladesh",dCode:"880",cCode:"BD"},{cName:"Barbados",dCode:"1246",cCode:"BB"},{cName:"Belarus",dCode:"375",cCode:"BY"},{cName:"Belgium",dCode:"32",cCode:"BE"},{cName:"Belize",dCode:"501",cCode:"BZ"},{cName:"Benin",dCode:"229",cCode:"BJ"},{cName:"Bermuda",dCode:"1441",cCode:"BM"},{cName:"Bhutan",dCode:"975",cCode:"BT"},{cName:"Bolivia, Plurinational State of",dCode:"591",cCode:"BO"},{cName:"Bosnia and Herzegovina",dCode:"387",cCode:"BA"},{cName:"Botswana",dCode:"267",cCode:"BW"},{cName:"Brazil",dCode:"55",cCode:"BR"},{cName:"British Indian Ocean Territory",dCode:"246",cCode:"IO"},{cName:"Brunei Darussalam",dCode:"673",cCode:"BN"},{cName:"Bulgaria",dCode:"359",cCode:"BG"},{cName:"Burkina Faso",dCode:"226",cCode:"BF"},{cName:"Burundi",dCode:"257",cCode:"BI"},{cName:"Cambodia",dCode:"855",cCode:"KH"},{cName:"Cameroon",dCode:"237",cCode:"CM"},{cName:"Canada",dCode:"1",cCode:"CA"},{cName:"Cape Verde",dCode:"238",cCode:"CV"},{cName:"Cayman Islands",dCode:" 345",cCode:"KY"},{cName:"Central African Republic",dCode:"236",cCode:"CF"},{cName:"Chad",dCode:"235",cCode:"TD"},{cName:"Chile",dCode:"56",cCode:"CL"},{cName:"China",dCode:"86",cCode:"CN"},{cName:"Christmas Island",dCode:"61",cCode:"CX"},{cName:"Cocos (Keeling) Islands",dCode:"61",cCode:"CC"},{cName:"Colombia",dCode:"57",cCode:"CO"},{cName:"Comoros",dCode:"269",cCode:"KM"},{cName:"Congo",dCode:"242",cCode:"CG"},{cName:"Congo, The Democratic Republic of the Congo",dCode:"243",cCode:"CD"},{cName:"Cook Islands",dCode:"682",cCode:"CK"},{cName:"Costa Rica",dCode:"506",cCode:"CR"},{cName:"Cote d'Ivoire",dCode:"225",cCode:"CI"},{cName:"Croatia",dCode:"385",cCode:"HR"},{cName:"Cuba",dCode:"53",cCode:"CU"},{cName:"Cyprus",dCode:"357",cCode:"CY"},{cName:"Czech Republic",dCode:"420",cCode:"CZ"},{cName:"Denmark",dCode:"45",cCode:"DK"},{cName:"Djibouti",dCode:"253",cCode:"DJ"},{cName:"Dominica",dCode:"1767",cCode:"DM"},{cName:"Dominican Republic",dCode:"1849",cCode:"DO"},{cName:"Ecuador",dCode:"593",cCode:"EC"},{cName:"Egypt",dCode:"20",cCode:"EG"},{cName:"El Salvador",dCode:"503",cCode:"SV"},{cName:"Equatorial Guinea",dCode:"240",cCode:"GQ"},{cName:"Eritrea",dCode:"291",cCode:"ER"},{cName:"Estonia",dCode:"372",cCode:"EE"},{cName:"Ethiopia",dCode:"251",cCode:"ET"},{cName:"Falkland Islands (Malvinas)",dCode:"500",cCode:"FK"},{cName:"Faroe Islands",dCode:"298",cCode:"FO"},{cName:"Fiji",dCode:"679",cCode:"FJ"},{cName:"Finland",dCode:"358",cCode:"FI"},{cName:"France",dCode:"33",cCode:"FR"},{cName:"French Guiana",dCode:"594",cCode:"GF"},{cName:"French Polynesia",dCode:"689",cCode:"PF"},{cName:"Gabon",dCode:"241",cCode:"GA"},{cName:"Gambia",dCode:"220",cCode:"GM"},{cName:"Georgia",dCode:"995",cCode:"GE"},{cName:"Germany",dCode:"49",cCode:"DE"},{cName:"Ghana",dCode:"233",cCode:"GH"},{cName:"Gibraltar",dCode:"350",cCode:"GI"},{cName:"Greece",dCode:"30",cCode:"GR"},{cName:"Greenland",dCode:"299",cCode:"GL"},{cName:"Grenada",dCode:"1473",cCode:"GD"},{cName:"Guadeloupe",dCode:"590",cCode:"GP"},{cName:"Guam",dCode:"1671",cCode:"GU"},{cName:"Guatemala",dCode:"502",cCode:"GT"},{cName:"Guernsey",dCode:"44",cCode:"GG"},{cName:"Guinea",dCode:"224",cCode:"GN"},{cName:"Guinea-Bissau",dCode:"245",cCode:"GW"},{cName:"Guyana",dCode:"595",cCode:"GY"},{cName:"Haiti",dCode:"509",cCode:"HT"},{cName:"Holy See (Vatican City State)",dCode:"379",cCode:"VA"},{cName:"Honduras",dCode:"504",cCode:"HN"},{cName:"Hong Kong",dCode:"852",cCode:"HK"},{cName:"Hungary",dCode:"36",cCode:"HU"},{cName:"Iceland",dCode:"354",cCode:"IS"},{cName:"India",dCode:"91",cCode:"IN"},{cName:"Indonesia",dCode:"62",cCode:"ID"},{cName:"Iran, Islamic Republic of Persian Gulf",dCode:"98",cCode:"IR"},{cName:"Iraq",dCode:"964",cCode:"IQ"},{cName:"Ireland",dCode:"353",cCode:"IE"},{cName:"Isle of Man",dCode:"44",cCode:"IM"},{cName:"Israel",dCode:"972",cCode:"IL"},{cName:"Italy",dCode:"39",cCode:"IT"},{cName:"Jamaica",dCode:"1876",cCode:"JM"},{cName:"Japan",dCode:"81",cCode:"JP"},{cName:"Jersey",dCode:"44",cCode:"JE"},{cName:"Jordan",dCode:"962",cCode:"JO"},{cName:"Kazakhstan",dCode:"77",cCode:"KZ"},{cName:"Kenya",dCode:"254",cCode:"KE"},{cName:"Kiribati",dCode:"686",cCode:"KI"},{cName:"Korea, Democratic People's Republic of Korea",dCode:"850",cCode:"KP"},{cName:"Korea, Republic of South Korea",dCode:"82",cCode:"KR"},{cName:"Kuwait",dCode:"965",cCode:"KW"},{cName:"Kyrgyzstan",dCode:"996",cCode:"KG"},{cName:"Laos",dCode:"856",cCode:"LA"},{cName:"Latvia",dCode:"371",cCode:"LV"},{cName:"Lebanon",dCode:"961",cCode:"LB"},{cName:"Lesotho",dCode:"266",cCode:"LS"},{cName:"Liberia",dCode:"231",cCode:"LR"},{cName:"Libyan Arab Jamahiriya",dCode:"218",cCode:"LY"},{cName:"Liechtenstein",dCode:"423",cCode:"LI"},{cName:"Lithuania",dCode:"370",cCode:"LT"},{cName:"Luxembourg",dCode:"352",cCode:"LU"},{cName:"Macao",dCode:"853",cCode:"MO"},{cName:"Macedonia",dCode:"389",cCode:"MK"},{cName:"Madagascar",dCode:"261",cCode:"MG"},{cName:"Malawi",dCode:"265",cCode:"MW"},{cName:"Malaysia",dCode:"60",cCode:"MY"},{cName:"Maldives",dCode:"960",cCode:"MV"},{cName:"Mali",dCode:"223",cCode:"ML"},{cName:"Malta",dCode:"356",cCode:"MT"},{cName:"Marshall Islands",dCode:"692",cCode:"MH"},{cName:"Martinique",dCode:"596",cCode:"MQ"},{cName:"Mauritania",dCode:"222",cCode:"MR"},{cName:"Mauritius",dCode:"230",cCode:"MU"},{cName:"Mayotte",dCode:"262",cCode:"YT"},{cName:"Mexico",dCode:"52",cCode:"MX"},{cName:"Micronesia, Federated States of Micronesia",dCode:"691",cCode:"FM"},{cName:"Moldova",dCode:"373",cCode:"MD"},{cName:"Monaco",dCode:"377",cCode:"MC"},{cName:"Mongolia",dCode:"976",cCode:"MN"},{cName:"Montenegro",dCode:"382",cCode:"ME"},{cName:"Montserrat",dCode:"1664",cCode:"MS"},{cName:"Morocco",dCode:"212",cCode:"MA"},{cName:"Mozambique",dCode:"258",cCode:"MZ"},{cName:"Myanmar",dCode:"95",cCode:"MM"},{cName:"Namibia",dCode:"264",cCode:"NA"},{cName:"Nauru",dCode:"674",cCode:"NR"},{cName:"Nepal",dCode:"977",cCode:"NP"},{cName:"Netherlands",dCode:"31",cCode:"NL"},{cName:"Netherlands Antilles",dCode:"599",cCode:"AN"},{cName:"New Caledonia",dCode:"687",cCode:"NC"},{cName:"New Zealand",dCode:"64",cCode:"NZ"},{cName:"Nicaragua",dCode:"505",cCode:"NI"},{cName:"Niger",dCode:"227",cCode:"NE"},{cName:"Nigeria",dCode:"234",cCode:"NG"},{cName:"Niue",dCode:"683",cCode:"NU"},{cName:"Norfolk Island",dCode:"672",cCode:"NF"},{cName:"Northern Mariana Islands",dCode:"1670",cCode:"MP"},{cName:"Norway",dCode:"47",cCode:"NO"},{cName:"Oman",dCode:"968",cCode:"OM"},{cName:"Pakistan",dCode:"92",cCode:"PK"},{cName:"Palau",dCode:"680",cCode:"PW"},{cName:"Palestinian Territory, Occupied",dCode:"970",cCode:"PS"},{cName:"Panama",dCode:"507",cCode:"PA"},{cName:"Papua New Guinea",dCode:"675",cCode:"PG"},{cName:"Paraguay",dCode:"595",cCode:"PY"},{cName:"Peru",dCode:"51",cCode:"PE"},{cName:"Philippines",dCode:"63",cCode:"PH"},{cName:"Pitcairn",dCode:"872",cCode:"PN"},{cName:"Poland",dCode:"48",cCode:"PL"},{cName:"Portugal",dCode:"351",cCode:"PT"},{cName:"Puerto Rico",dCode:"1939",cCode:"PR"},{cName:"Qatar",dCode:"974",cCode:"QA"},{cName:"Romania",dCode:"40",cCode:"RO"},{cName:"Russia",dCode:"7",cCode:"RU"},{cName:"Rwanda",dCode:"250",cCode:"RW"},{cName:"Reunion",dCode:"262",cCode:"RE"},{cName:"Saint Barthelemy",dCode:"590",cCode:"BL"},{cName:"Saint Helena, Ascension and Tristan Da Cunha",dCode:"290",cCode:"SH"},{cName:"Saint Kitts and Nevis",dCode:"1869",cCode:"KN"},{cName:"Saint Lucia",dCode:"1758",cCode:"LC"},{cName:"Saint Martin",dCode:"590",cCode:"MF"},{cName:"Saint Pierre and Miquelon",dCode:"508",cCode:"PM"},{cName:"Saint Vincent and the Grenadines",dCode:"1784",cCode:"VC"},{cName:"Samoa",dCode:"685",cCode:"WS"},{cName:"San Marino",dCode:"378",cCode:"SM"},{cName:"Sao Tome and Principe",dCode:"239",cCode:"ST"},{cName:"Saudi Arabia",dCode:"966",cCode:"SA"},{cName:"Senegal",dCode:"221",cCode:"SN"},{cName:"Serbia",dCode:"381",cCode:"RS"},{cName:"Seychelles",dCode:"248",cCode:"SC"},{cName:"Sierra Leone",dCode:"232",cCode:"SL"},{cName:"Singapore",dCode:"65",cCode:"SG"},{cName:"Slovakia",dCode:"421",cCode:"SK"},{cName:"Slovenia",dCode:"386",cCode:"SI"},{cName:"Solomon Islands",dCode:"677",cCode:"SB"},{cName:"Somalia",dCode:"252",cCode:"SO"},{cName:"South Africa",dCode:"27",cCode:"ZA"},{cName:"South Sudan",dCode:"211",cCode:"SS"},{cName:"South Georgia and the South Sandwich Islands",dCode:"500",cCode:"GS"},{cName:"Spain",dCode:"34",cCode:"ES"},{cName:"Sri Lanka",dCode:"94",cCode:"LK"},{cName:"Sudan",dCode:"249",cCode:"SD"},{cName:"SuricName",dCode:"597",cCode:"SR"},{cName:"Svalbard and Jan Mayen",dCode:"47",cCode:"SJ"},{cName:"Swaziland",dCode:"268",cCode:"SZ"},{cName:"Sweden",dCode:"46",cCode:"SE"},{cName:"Switzerland",dCode:"41",cCode:"CH"},{cName:"Syrian Arab Republic",dCode:"963",cCode:"SY"},{cName:"Taiwan",dCode:"886",cCode:"TW"},{cName:"Tajikistan",dCode:"992",cCode:"TJ"},{cName:"Tanzania, United Republic of Tanzania",dCode:"255",cCode:"TZ"},{cName:"Thailand",dCode:"66",cCode:"TH"},{cName:"Timor-Leste",dCode:"670",cCode:"TL"},{cName:"Togo",dCode:"228",cCode:"TG"},{cName:"Tokelau",dCode:"690",cCode:"TK"},{cName:"Tonga",dCode:"676",cCode:"TO"},{cName:"Trinidad and Tobago",dCode:"1868",cCode:"TT"},{cName:"Tunisia",dCode:"216",cCode:"TN"},{cName:"Turkey",dCode:"90",cCode:"TR"},{cName:"Turkmenistan",dCode:"993",cCode:"TM"},{cName:"Turks and Caicos Islands",dCode:"1649",cCode:"TC"},{cName:"Tuvalu",dCode:"688",cCode:"TV"},{cName:"Uganda",dCode:"256",cCode:"UG"},{cName:"Ukraine",dCode:"380",cCode:"UA"},{cName:"United Arab Emirates",dCode:"971",cCode:"AE"},{cName:"United Kingdom",dCode:"44",cCode:"GB"},{cName:"United States",dCode:"1",cCode:"US"},{cName:"Uruguay",dCode:"598",cCode:"UY"},{cName:"Uzbekistan",dCode:"998",cCode:"UZ"},{cName:"Vanuatu",dCode:"678",cCode:"VU"},{cName:"Venezuela, Bolivarian Republic of Venezuela",dCode:"58",cCode:"VE"},{cName:"Vietnam",dCode:"84",cCode:"VN"},{cName:"Virgin Islands, British",dCode:"1284",cCode:"VG"},{cName:"Virgin Islands, U.S.",dCode:"1340",cCode:"VI"},{cName:"Wallis and Futuna",dCode:"681",cCode:"WF"},{cName:"Yemen",dCode:"967",cCode:"YE"},{cName:"Zambia",dCode:"260",cCode:"ZM"},{cName:"Zimbabwe",dCode:"263",cCode:"ZW"}],Vr=[{gateway:"QDH",destination:"Ashford International (Kent) (QDH)"},{gateway:"ZYR",destination:"Brussels Midi (ZYR)"},{gateway:"XQE",destination:"Ebbsfleet International (Kent) (XQE)"},{gateway:"XDB",destination:"Lille Europe (XDB)"},{gateway:"QQS",destination:"London St Pancras International (QQS)"},{gateway:"XED",destination:"Marne La Vallee (Disneyland) (XED)"},{gateway:"XPG",destination:"Paris Gare du Nord (XPG)"}];(Fr=e.TravellerSearchTypes||(e.TravellerSearchTypes={})).email="email",Fr.name="name",Fr.employeeNumber="employeeNumber";var Gr=function(){function i(e,r,n,a,o,u,l,c,d,p,h,m,f,y,g,v,b,S,T,C,D,P,_,A,k,F,O,R,I,E,N,B,M,L,j,w,x,U,V,G,H,Q,J,W,Y,K,z,X,q,Z,$,te,re,ie,ne,ae){var oe,se=this;this.searchAirportsFetcher=e,this.searchAirlinesFetcher=r,this.storageService=n,this.userService=a,this.modalService=o,this.router=u,this.helpers=l,this.hotelAvalibilityService=c,this.citiesFetcher=d,this.confermaCitiesFetcher=p,this.postcodeFetcher=h,this.railStationFetcher=m,this.saveUserAddressUpdater=f,this.userAddressesFetcher=y,this.basketService=g,this.getUserCompanyOfficesFetcher=v,this.searchHotelChainsFetcher=b,this.getConfermaRoomImagesFetcher=S,this.baseValidateIsPostcodeValidTester=T,this.depotFetcher=C,this.confermaOfficeNamesFetcher=D,this.confermaOfficeFetcher=P,this.baseDeleteUserAddressUpdater=_,this.baseDeleteRecentSearchUpdater=A,this.baseSaveRecentSearchUpdater=k,this.getUserCurrentCarbonAllowanceFetcher=F,this.baseSaveFavouriteSearchUpdater=O,this.getRailStationFetcher=V,this.riskAlertsFetcher=H,this.getUserRecentSearchesFetcher=J,this.getRailCardsFetcher=W,this.getCovidMicrositeTokenFetcher=Y,this.searchUsersCanBookForFetcher=z,this.searchIrlStationsFetcher=X,this.irlDiscountCardsFetcher=q,this.getFlightFareRulesFetcher=Z,this.getFlightSeatMapFetcher=$,this.getRailLiveDeparturesFetcher=te,this.getUserFavouriteSearchesFetcher=ne,this.deleteFavouriteSearchUpdater=ae,this.traveller_error=!1,this.travellerInformation=new t.BehaviorSubject([]),this.errors=new t.BehaviorSubject([]),this.searchLoadingDone=new t.BehaviorSubject(!1),this.searchTimedOut=new t.BehaviorSubject(!1),this.newSearchStarted=new t.BehaviorSubject(!1),this.firstLoad=!0,this.highest_search_priority=8,this.show_errors=!1,this.travellerValidationMessages=[],this.search_loading=!1,this.search_airport_loading=!1,this.selectedTravellers=[],this.selectedPlaces=[],this.countries=Ur,this.eurostations=s.default.toArray(Vr),console.log("Enterpise search service being inited"),this.searches=((oe={})[ee.Lounge]=new it(I,l,g,n,this),oe[ee.Parking]=new st(E,l,g,n,this),oe[ee.Flight]=new Ze(B,l,a,g,n,this,ie,o),oe[ee.Hotel]=new rt(M,l,a,R,c,g,n,this,N,Q,V,re),oe[ee.Car]=new xe(L,j,l,g,n,this),oe[ee.Cab]=new we(w,l,n,this,g),oe[ee.InternationalRail]=new St(U,q,l,g,n,this),oe[ee.FastTrack]=null,oe[ee.Coach]=null,oe[ee.Rail]=new yt(x,V,l,g,n,this,a,o),oe[ee.Eurostar]=new dt(K,l,a,g,n,this),oe),console.log("Newly created search objects: ",this.searches),this.search_objects=this.helpers.clone(this.init_search_objects()),this.selectedTravellers=this.storageService.getSessionItemAsList(i.SESSION_TRAVELLER),this.travellerInformation.next(this.selectedTravellers),a.fullUserDetails.userServices.subscribe((function(e){e&&(se.search_objects=Object.keys(se.search_objects).reduce((function(t,r){return t[r].enabled=!!e&&!!e[r],t}),se.search_objects))})),Array.isArray(this.countries)&&(this.countries=this.countries.sort((function(e,t){return e.cName<t.cName?-1:e.cName>t.cName?1:0}))),G.autoLogoutConfig=this.getAutoLogoutConfig()}return i.prototype.reset=function(){this.resetAllSearchItems(),this.basketService.reset()},i.prototype.resetAllSearchItems=function(){Object.values(this.searches).forEach((function(e){null==e||e.reset()})),this.removeAllTravellers(),this.resetSearchObjects()},i.prototype.getUserCurrentCarbonAllowance=function(e,t){t&&t.next(!0);var i={user:e};return this.getUserCurrentCarbonAllowanceFetcher.fetchList(i).pipe(r.take(1),r.map((function(e){return e})))},i.prototype.getRiskAlerts=function(e,t,i,n){n&&n.next(!0);var a={minLevel:e,maxLevel:t,countryIsoCode:i};return this.riskAlertsFetcher.fetchList(a).pipe(r.take(1),r.map((function(e){return n&&n.next(!1),e})))},i.prototype.getAirportsList=function(e,i,n,a,o,s){var u=this;if(e.length>2){n&&n.next(!0);var l={query:e};return i&&(l.countryCode=i),"boolean"==typeof a&&(l.hasLounge=a),"boolean"==typeof o&&(l.hasParking=o),"boolean"==typeof s&&(l.hasFastTrack=s),this.searchAirportsFetcher.fetchOne(l).pipe(r.take(1),r.map((function(e){if(n&&n.next(!1),e&&e.generalMatches)return u.helpers.clone(e.generalMatches).map((function(e){var t,r,i;return{destination:e.name,gateway:e.iata,terminals:u.processTerminals(e.terminals),country:null===(t=null==e?void 0:e.locationDetails)||void 0===t?void 0:t.country,postcode:null===(r=null==e?void 0:e.locationDetails)||void 0===r?void 0:r.postcode,countryCode:null===(i=null==e?void 0:e.locationDetails)||void 0===i?void 0:i.countryCode}}))})))}return t.of([])},i.prototype.getAirlinesList=function(e,i){var n=this;if(e.length>=2){i&&i.next(!0);var a={query:e};return this.searchAirlinesFetcher.fetchOne(a).pipe(r.take(1),r.map((function(e){if(i&&i.next(!1),e&&e.generalMatches)return n.helpers.clone(e.generalMatches).map((function(e){return{code:e.iata,name:e.name}}))})))}return t.of([])},i.prototype.getAirportLocations=function(t,i,n,a,o,s){return this.getAirportsList(t,i,n,a,o,s).pipe(r.map((function(t){return t.map((function(t){return{name:t.destination,type:e.LocationTypes.Airport,airport:t}}))})))},i.prototype.getCityLocations=function(e,t,r,i){if(!(e.length<=2))return i?this.getConfermaCityLocations(e,t,r):this._getCityLocations(e,t,r)},i.prototype._getCityLocations=function(t,i,n){null==n||n.next(!0);var a={query:t};i&&(a.countryCode=i);return this.citiesFetcher.fetchList(a).pipe(r.take(1),r.map((function(t){var r=t.map((function(t){return{name:t.name,longitude:t.coordinates.longitude,latitude:t.coordinates.latitude,type:e.LocationTypes.City,countryCode:t.countryCode,id:t.id}}));return null==n||n.next(!1),r})))},i.prototype.getConfermaCityLocations=function(t,i,n){null==n||n.next(!0);var a={cityName:t};i&&(a.countryCode=i);return this.confermaCitiesFetcher.fetchOne(a).pipe(r.take(1),r.map((function(t){var r=t.suggestions.map((function(t){return{name:t.name,longitude:t.longitude,latitude:t.latitude,type:e.LocationTypes.City,countryCode:t.countryCode}}));return null==n||n.next(!1),r})))},i.prototype.getCarHireDepots=function(e,t,r,i){null==i||i.next(!0);var n={latitude:e,longitude:t};return r&&(n.radius=r),this.depotFetcher.fetchList(n)},i.prototype.getPostcodeList=function(i){return _r.UK_POSTCODE.test(i)?this.postcodeFetcher.fetchList({postcode:i}).pipe(r.map((function(t){return t.map((function(t){return{name:t.postcode,type:e.LocationTypes.Postcode,latitude:t.latitude,longitude:t.longitude}}))}))):t.of([])},i.prototype.addToSelectedPlaces=function(e){this.selectedPlaces.push(e)},i.prototype.getSelectedPlaceById=function(e){return this.selectedPlaces.find((function(t){return t.place_id===e}))},i.prototype.getConfirmaOffices=function(i){if((null==i?void 0:i.length)>2){return this.confermaOfficeNamesFetcher.fetchList().pipe(r.take(1),r.map((function(t){return(null==t?void 0:t.results)?t.results.map((function(t){return{name:t.name,type:e.LocationTypes.Office,id:t.id}})):[]})))}return t.of([])},i.prototype.getOfficeLocations=function(i){if(i.length>2){return this.getUserCompanyOfficesFetcher.fetchList().pipe(r.take(1),r.map((function(t){return t.map((function(t){return{name:t.name,office:t.addresses[0],type:e.LocationTypes.Office}}))})))}return t.of([])},i.prototype.getStationLocations=function(i,n){return i.length>2?(null==n||n.next(!0),this.railStationFetcher.fetchList({query:i}).pipe(r.take(1),r.map((function(t){return n&&n.next(!1),t?t.map((function(t){return{type:e.LocationTypes.TrainStation,name:t.name,railstation:t}})):[]})))):t.of([])},i.prototype.searchIrlStationsLocations=function(i,n){return i.length>2?(null==n||n.next(!0),this.searchIrlStationsFetcher.fetchList({query:i}).pipe(r.take(1),r.map((function(t){return n&&n.next(!1),t.map((function(t){return{type:e.LocationTypes.TrainStation,name:t.name+" ("+t.supplier+")",railstation:t}}))})))):t.of([])},i.prototype.getHotelLocationsList=function(e,i,n){return e.length>2?_r.UK_POSTCODE.test(e)?this.getPostcodeList(e):((null==n?void 0:n.value)||n.next(!0),t.forkJoin([this.getAirportLocations(e,i,n),this.getCityLocations(e,i,n),this.getStationLocations(e,n),this.getConfirmaOffices(e)]).pipe(r.map((function(e){return(null==n?void 0:n.value)&&n.next(!1),e.reduce((function(e,t){return e.push.apply(e,T(t)),e}),[])})))):t.of([])},i.prototype.getStationsAndAirportsList=function(e,i,n){return e.length>2?((null==n?void 0:n.value)||n.next(!0),t.forkJoin([this.getAirportLocations(e,i,n),this.getStationLocations(e,n)]).pipe(r.map((function(e){return(null==n?void 0:n.value)&&n.next(!1),e.reduce((function(e,t){return e.push.apply(e,T(t)),e}),[])})))):t.of([])},i.prototype.removeTraveller=function(e){this._removeTraveller(e),this.storageService.setSessionItem(i.SESSION_TRAVELLER,this.selectedTravellers),this.updateTravellerInformation()},i.prototype._removeTraveller=function(e){this.selectedTravellers=this.selectedTravellers.filter((function(t){return!bt.equals(t,e)}))},i.prototype.removeAllTravellers=function(){var e=this;console.log("remove all travellers called!"),console.log(this.selectedTravellers),this.selectedTravellers||(this.selectedTravellers=[]),this.selectedTravellers.forEach((function(t){e._removeTraveller(t)})),this.storageService.setSessionItem(i.SESSION_TRAVELLER,this.selectedTravellers),this.updateTravellerInformation()},i.prototype.addTraveller=function(e){this.travellerAlreadyAdded(e)||this.currentNoOfTravellersGreaterOrEqualToMax()||(this.selectedTravellers.push(e),this.storageService.setSessionItem(i.SESSION_TRAVELLER,this.selectedTravellers),this.updateTravellerInformation())},i.prototype.currentNoOfTravellersGreaterOrEqualToMax=function(){return this.selectedTravellers.length>=this.maxTravellers()},i.prototype.maxTravellers=function(){return this.canUseTravellerProfile()?1:8},i.prototype.travellerAlreadyAdded=function(e){return!!this.selectedTravellers.find((function(t){return bt.equals(t,e)}))},i.prototype.canUseTravellerProfile=function(){return!1},i.prototype.getCurrentNoOfTravellers=function(){return this.selectedTravellers.length},i.prototype.updateTravellerInformation=function(){this.storageService.setSessionItem(i.SESSION_TRAVELLER,this.selectedTravellers),this.travellerInformation.next(T(this.selectedTravellers))},i.prototype.determineHighestSearchPriority=function(){return this.highest_search_priority=this._getHighestSearchPriorityObject().highest},i.prototype.getHighestSearchPriorityObject=function(e){return this._getHighestSearchPriorityObject(e).currentItem},i.prototype._getHighestSearchPriorityObject=function(e){return void 0===e&&(e={}),Object.values(this.search_objects).reduce((function(t,r){var i=t.highest,n=t.currentItem;if(r.chosen&&r.priority<i){if(!e[r.type])return{highest:r.priority,currentItem:r};r.chosen=!1}return{highest:i,currentItem:n}}),{highest:Number.MAX_SAFE_INTEGER,currentItem:null})},i.prototype.getSelectedOptions=function(){var e=this;return Object.keys(this.search_objects).reduce((function(t,r){return e.search_objects[r].chosen&&t.push(r),t}),[])},i.prototype.hasSimpleGuests=function(){return!1},i.prototype.setGetMeThereSearchObjects=function(){console.log("+++ Setting GetMeThere Search Objects +++"),this.search_objects=this.helpers.clone(this.getMeThereSearchObjects())},i.prototype.resetSearchParams=function(){console.log("Reseting Search Params!"),this.search_objects=this.helpers.clone(this.init_search_objects()),this.storageService.setSessionItem(i.SESSION_TRAVELLER,this.search_objects),Object.values(this.searches).forEach((function(e){e.reset()}))},i.prototype.canSearch=function(e){return this.determineHighestSearchPriority(),!!(this.search_objects[e]&&(console.log("can search here"),this.search_objects[e].chosen&&this.hasHighestSearchPriority(this.search_objects[e].priority)))&&(console.log(e+" can be searched"),!0)},i.prototype.hasHighestSearchPriority=function(e){return this.determineHighestSearchPriority(),e<=this.highest_search_priority},i.prototype.getAllErrorMessages=function(){var e=this.travellerValidationMessages;return this.search_objects[ee.Lounge].chosen&&this.canSearch(ee.Lounge)&&e.push.apply(e,T(this.searches[ee.Lounge].validationMessages)),this.search_objects[ee.Car].chosen&&this.canSearch(ee.Car)&&e.push.apply(e,T(this.searches[ee.Car].validationMessages)),this.search_objects[ee.Rail].chosen&&this.canSearch(ee.Rail)&&e.push.apply(e,T(this.searches[ee.Rail].validationMessages)),this.search_objects[ee.Parking].chosen&&this.canSearch(ee.Parking)&&e.push.apply(e,T(this.searches[ee.Parking].validationMessages)),this.search_objects[ee.Cab].chosen&&this.canSearch(ee.Cab)&&e.push.apply(e,T(this.searches[ee.Cab].validationMessages)),this.search_objects[ee.Hotel].chosen&&this.canSearch(ee.Hotel)&&e.push.apply(e,T(this.searches[ee.Hotel].validationMessages)),this.errors.next(e),e},i.prototype.travellersContainUser=function(){var e=this;return!!this.selectedTravellers.find((function(t){return t.id===e.userService.getUserId().toString()}))},i.prototype.validateTravellers=function(){switch(this.travellerValidationMessages=[],this.userService.fullUserDetails.userData.value.booker_type){case k.SelfBook:1===this.selectedTravellers.length&&this.travellersContainUser()||this.travellerValidationMessages.push("Current user must be a traveller");break;case k.BookerWithSelf:this.selectedTravellers.length<1&&this.travellersContainUser()||(this.travellerValidationMessages.push("Please add your self."),this.traveller_error=!0);break;case k.Booker:case k.Company:case k.CompanyGroup:case k.Office:case k.Tmc:case k.Root:this.selectedTravellers.length>=1||(this.travellerValidationMessages.push("Please select at least one traveller"),this.traveller_error=!0);break;default:return this.travellerValidationMessages.push("Unrecognised user type! - Please contact support."),!1}return 0===this.travellerValidationMessages.length},i.prototype.findPaxInTravellers=function(e){return this.selectedTravellers.find((function(t){return e===t.email}))},i.prototype.validateForms=function(){var e=this._findSearchObtect();return this.getAllErrorMessages(),!!e&&(this.errors.next(this.searches[e.type].messages.value),this.validateTravellers()&&this.searches[e.type].isValid.value)},i.prototype._findSearchObtect=function(){var e=this;return Object.values(this.search_objects).find((function(t){return!!t&&t.priority===e.highest_search_priority&&t.chosen}))},i.prototype.startSearches=function(e){var t,r=this;this.newSearchStarted.next(!0),this.search_loading=!0,(t=this._findSearchObtect())&&(t.chosen=!0),e?this.router.navigate([e]):t&&!this.router.url.includes(t.resultUrl)&&this.router.navigate([t.resultUrl]);try{Promise.all(Object.values(this.searches).map((function(e){return e&&r.search_objects[e.type]&&r.search_objects[e.type].chosen?e.startSearch():Promise.resolve(!1)}))).finally((function(){r.search_loading=!1,r.searchLoadingDone.next(!0)}))}catch(e){console.error(e),this.search_loading=!1,this.searchLoadingDone.next(!0)}},i.prototype.getTaxiStationLocations=function(e,r){return e.length<3?t.of([]):t.of([{destination:"Manchester Airpot",isairport:!0,supplier_code:"MAN",address:"Manchester Airport",postcode:"M90 1QX"},{destination:"Manchester Piccadilly",isairport:!1,supplier_code:"MMAN",address:"Manchester Piccadilly",postcode:"M1 2PZ"},{destination:"London Heathrow",isairport:!0,supplier_code:"LHR",address:"London Heathrow Airport",postcode:"TW6 1EW"}])},i.prototype.getAddresses=function(e){return t.of([{House:"Cecil Court",Street:"28-36 Cecil Road",Town:"Hale",PostCode:"WA15 9PB",Country:"UK"}])},i.prototype.getUserAddresses=function(e){return this.userAddressesFetcher.fetchList().pipe(r.take(1),r.map((function(e){return e.map((function(e){return{ID:e.id,House:e.numberOrName,Street:e.street,Town:e.town,PostCode:e.postcode,Country:e.countryCode}}))})))},i.prototype.deleteUserAddressByID=function(e){return this.baseDeleteUserAddressUpdater.updateOne({id:e})},i.prototype.getHotelChain=function(e,i){if(e.length>2){null==i||i.next(!0);return this.searchHotelChainsFetcher.fetchList({query:e}).pipe(r.take(1),r.map((function(e){var t=e.map((function(e){return{name:e}}));return null==i||i.next(!1),t})))}return t.of([])},i.prototype.getOfficeNames=function(e){return this.confermaOfficeNamesFetcher.fetchList().pipe(r.take(1),r.map((function(e){var t;if(e)return null===(t=null==e?void 0:e.results)||void 0===t?void 0:t.map((function(e){return{id:e.id,name:e.name}}))})))},i.prototype.getOffice=function(e){return e?this.confermaOfficeFetcher.fetchOne({officeId:e}).pipe(r.take(1),r.map((function(e){if(e)return e.results}))):t.of()},i.prototype.getRailCards=function(){return this.getRailCardsFetcher.fetchList().pipe(r.take(1),r.map((function(e){if(e)return null==e?void 0:e.map((function(e){return{name:e.name,code:e.code}}))})))},i.prototype.getAirportByCode=function(e){return e?this.searchAirportsFetcher.fetchOne({query:e}).pipe(r.take(1),r.map((function(e){return e}))):t.of()},i.prototype.init_search_objects=function(){return{}},i.prototype.getMeThereSearchObjects=function(){return{}},i.prototype.getSelectedtravellers=function(){return this.selectedTravellers},i.prototype.resetSearchObjects=function(){this.search_objects=this.helpers.clone(this.init_search_objects())},i.prototype.processTerminals=function(e){var t=[];return e.includes("1")||e.includes("2")||e.includes("3")||e.includes("4")||e.includes("5")?(t.push({key:"Any Terminal",value:"Any"}),e.forEach((function(e){t.push({key:"Terminal "+e,value:""+e})}))):1===e.length?t.push({key:e[0]+" Terminal",value:"Any"}):(t.push({key:"Any Terminal",value:"Any"}),e.forEach((function(e){t.push({key:e+" Terminal",value:""+e})}))),t},i.prototype.saveUserAddress=function(e){return g(this,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return e?[4,this.saveUserAddressUpdater.updateOne(e).toPromise()]:[3,2];case 1:return[2,t.sent()];case 2:return[2]}}))}))},i.prototype.canBook=function(e){return!!this.userService.canBook(e)},i.prototype.isPostcodeVaild=function(e){return this.baseValidateIsPostcodeValidTester.test({postcode:e})},i.prototype.makeCabHireQuery=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i={adults:0,airport:null,children:0,countryCode:null,departs:this.helpers.makeMomentDayTime(),fromAddress:null,fromStation:null,fromLocationType:e.TaxiFormMode.ADDRESS,infants:0,toAddress:null,toStation:null,toLocationType:e.TaxiFormMode.ADDRESS,vehicleType:F.Any,viasFrom:null,viasTo:null};return this.helpers.sanatizeReturns(i,Object.assign.apply(Object,T([{}],t)),["departs"])},i.prototype.makeCarHireQuery=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={adults:0,airCon:null,carClass:null,carType:null,children:0,chosenVendor:null,chosenDistance:"5",cityDropoff:null,cityDropoffDepot:null,cityPickup:null,cityPickupDepot:null,dropoff_country:"GB",dropoff_datetime:null,dropoff_location:null,estimatedMileage:null,locationType:null,pickup_country:null,pickup_datetime:null,pickup_location:null,postcodeDropoff:null,postcodeDropoffRaw:null,postcodePickup:null,postcodePickupRaw:null,return_to_pickup:!0,transmission:null};return this.helpers.sanatizeReturns(r,Object.assign.apply(Object,T([{}],e)),["pickup_datetime","dropoff_datetime"])},i.prototype.makeFlightQuery=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this.helpers.makeMomentDayTime(),n=this.helpers.makeMomentDayTime(1),a=this.helpers.momentRoundMinutes(i,30),o=this.helpers.momentRoundMinutes(n,30),s={adults:0,arriveLocation:null,cabinClass:x.Any,children:0,chosenSearchType:null,departLocation:null,fareType:w.Flexible,inboundDate:a,inTimeCriteria:e.TimeWindow.Depart,maxConnections:null,includeNearbyAirports:!1,multiDestination:[],outBoundDate:o,outTimeCriteria:e.TimeWindow.Depart,preferredCarriers:[null,null,null,null],returnCabinClass:x.Any};return this.helpers.sanatizeReturns(s,Object.assign.apply(Object,T([{}],t)),["outBoundDate","inboundDate"])},i.prototype.makeHotelQuery=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i={checkin_date:u.default().set("hour",23).set("minute",59),checkout_date:u.default().add(1,"day").set("hour",23).set("minute",59),country:{cCode:"GB",cName:"United Kingdom"},currency:"GBP",distance:5,hotel_availability:null,hotel_chain:null,hotel_name:null,location_type_select:e.LocationTypes.Airport,location:null,no_of_occupants:1,no_of_rooms:1,office:null,postcode:null,prefered_hotels_only:!1,trainsStation:null};return this.helpers.sanatizeReturns(i,Object.assign.apply(Object,T([{}],t)),["checkin_date","checkout_date"])},i.prototype.makeLoungesQuery=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={adults:0,arrivalDatetime:u.default(),children:0,infants:0,locationCode:null,terminal:null};return this.helpers.sanatizeReturns(r,Object.assign.apply(Object,T([{}],e)),["arrivalDatetime"])},i.prototype.makeParkingQuery=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.helpers.makeMomentDayTime(),i=this.helpers.makeMomentDayTime(1),n=this.helpers.momentRoundMinutes(r,30),a=this.helpers.momentRoundMinutes(i,30),o={arrivalDatetime:n,carParkedForYou:null,departDatetime:a,locationCode:null,meetAndGreet:null,onAirport:null,outFlightNumber:null,parkAndRide:null,parkAndStroll:null,recommended:null,terminal:null};return this.helpers.sanatizeReturns(o,Object.assign.apply(Object,T([{}],e)),["arrivalDatetime","departDatetime"])},i.prototype.makeRailQuery=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this.helpers.momentRoundMinutes(u.default(),30),n={airportExpressStation:null,applyRailcards:!1,carnetTicket:!1,chosenSearchClass:z.All,chosenSearchType:X.ReturnJourney,disableAutoDiscounts:!1,extraTime:!1,inBoundDateTime:i,isAirportExpress:!1,noOfAdults:0,noOfChildren:0,outboundCriteria:e.RailSearchCriteria.Depart,outBoundDateTime:i,prioritiseByPrice:!1,returnCriteria:e.RailSearchCriteria.Depart,travellingFrom:null,travellingTo:null,via:!1,viaLocation:null,railCards:null};return this.helpers.sanatizeReturns(n,Object.assign.apply(Object,T([{}],t)),["inBoundDateTime","outBoundDateTime"])},i.prototype.makeIrlQuery=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.helpers.momentRoundMinutes(u.default(),30),i={supplier:null,countryCode:"",journeyType:G.ReturnJourney,class:null,outboundDepartureDateTime:r,departureLocationId:null,arrivalLocationId:null,adults:0,children:0,returnDepartureDateTime:r,irlDiscountCards:null};return this.helpers.sanatizeReturns(i,Object.assign.apply(Object,T([{}],e)),["returnDepartureDateTime","outboundDepartureDateTime"])},i.prototype.makeEurostarQuery=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this.helpers.makeMomentDayTime(),n=this.helpers.makeMomentDayTime(1),a=this.helpers.momentRoundMinutes(i,30),o=this.helpers.momentRoundMinutes(n,30),s={adults:0,arriveLocation:null,cabinClass:x.Any,children:0,chosenSearchType:e.EurostarSearchType.return,departLocation:null,fareType:w.Flexible,inboundDate:a,inTimeCriteria:e.TimeWindow.Depart,maxConnections:null,includeNearbyAirports:!1,multiDestination:[],outBoundDate:o,outTimeCriteria:e.TimeWindow.Depart,preferredCarriers:[null,null,null,null],returnCabinClass:x.Any};return this.helpers.sanatizeReturns(s,Object.assign.apply(Object,T([{}],t)),["outBoundDate","inboundDate"])},i.prototype.shouldAddTravellerSubscription=function(){return!1},i.prototype.getAutoLogoutConfig=function(){return{}},i.prototype.shouldFetchAllOffices=function(){return!1},i.prototype.isFlightsGrouped=function(){return!1},i.prototype.getCountryFullNameFromCountryCode=function(e){for(var t=0;t<this.countries.length;t++){var r=this.countries[t];if(r.cCode===e)return r.cName}return"Unknown"},i.prototype.getUserRecentSearches=function(e,t){null==t||t.next(!0);var i={serviceType:e};return this.getUserRecentSearchesFetcher.fetchList(i).pipe(r.take(1),r.map((function(e){var r=e.map((function(e){return{id:e.id,name:e.name,serviceType:e.serviceType,searchArgs:e.searchArgs,createdAt:e.createdAt,updatedAt:e.updatedAt,travelDate:e.travelDate,travellers:e.travellers}}));return null==t||t.next(!1),r})))},i.prototype.getUserFavouriteSearches=function(e,t){null==t||t.next(!0);var i={serviceType:e};return this.getUserFavouriteSearchesFetcher.fetchList(i).pipe(r.take(1),r.tap((function(e){null==t||t.next(!1)})))},i.prototype.deleteRecentSearchByID=function(e){return this.baseDeleteRecentSearchUpdater.updateOne({id:e})},i.prototype.deleteFavouriteSearchByID=function(e){return this.deleteFavouriteSearchUpdater.updateOne({id:e})},i.prototype.saveRecentSearch=function(e){e&&this.baseSaveRecentSearchUpdater.updateOne(e).pipe(r.take(1)).subscribe()},i.prototype.getCovidMicrositeToken=function(){return this.getCovidMicrositeTokenFetcher.fetchList()},i.prototype.lookupEurostarStations=function(e){return console.log("term| ",e),""===e?t.of(this.eurostations):t.of(this.eurostations.filter((function(t){return t.destination.toLowerCase().indexOf(e.toLowerCase())>-1})))},i.prototype.searchTravellers=function(t,i){var n=this,a=this.userService.getUserBookingType();if(this.traveller_error=!1,a&&a!==k.SelfBook&&a!==k.Traveller&&t.length>=1){var o=t.toLowerCase().match(/([\w])+/g),s={};switch(i){case e.TravellerSearchTypes.name:s.userName=o.length>1?o[0]:t;break;case e.TravellerSearchTypes.email:s.email=t;break;case e.TravellerSearchTypes.employeeNumber:s.employeeId=t}return this.searchUsersCanBookForFetcher.fetchList(s).pipe(r.map((function(e){return e?n.helpers.clone(e).sort((function(e,t){return e.surname<t.surname?-1:e.surname>t.surname?1:0})):[]})))}},i.prototype.getFlightFareRules=function(e){return this.getFlightFareRulesFetcher.fetchList({flight:e})},i.prototype.getRailLiveDepartures=function(e,t){return this.getRailLiveDeparturesFetcher.fetchList({stationCode:e,departDateTime:t})},i.prototype.getFlightSeatMap=function(e){return this.getFlightSeatMapFetcher.fetchList({flight:e}).pipe(r.map((function(e){if(e)return e.results})))},i.prototype.saveFavouriteSearch=function(e){return this.baseSaveFavouriteSearchUpdater.updateOne(e)},i.prototype.getConfermaRoomImages=function(e){if(e)return this.getConfermaRoomImagesFetcher.fetchList({hotelId:e}).pipe(r.take(1))},i}();Gr.SESSION_TRAVELLER="search_travellers";var Hr=function(){},Qr=function(){function t(e,t){this.modalOpenerService=e,this._jwtToken=null,this.timer=null,this.timeoutDuration=3600,this.autoLogoutConfig={},this.timeOutDuration=t.autoLogoutTime}return Object.defineProperty(t.prototype,"timeOutDuration",{set:function(e){this.timeoutDuration=60*e-60},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"jwtToken",{set:function(e){e!==this.jwtToken&&(this._jwtToken=e)},enumerable:!1,configurable:!0}),t.prototype._updateTimer=function(){var e=this;window.clearTimeout(this.timer),this.timer=null,console.log("Resetting auto log out"),this.timer=window.setTimeout((function(){e.checkToLogout()}),6e4)},t.prototype.checkToLogout=function(){var t=this;u.default().unix(),this.lastUpdated.unix(),this.timeoutDuration;u.default().unix()-this.lastUpdated.unix()>this.timeoutDuration?(this.timer=null,this.lastUpdated=u.default(),this.modalOpenerService.open(d.AutoLogout,this.autoLogoutConfig,{}).then((function(r){r!==e.LogoutEnum.LOGOUT?t._updateTimer():t._jwtToken=null}))):this._updateTimer()},t}(),Jr=function(){function e(e,t){this.httpService=e,this.helpers=t}return e.prototype.getAmenitiesForFlight=function(e){return new t.BehaviorSubject([])},e.prototype.parseAmenities=function(e){var t=e.linked,r=function(e,t){return t.find((function(t){return t.id==e}))};return e.data.map((function(e){var i=r(e.links.segments[0],t.segments);return{seat:r(i.links.seat.toString(),t.seats),wifi:r(i.links.wifi.toString(),t.wifis),power:r(i.links.power.toString(),t.entertainments),entertainment:r(i.links.entertainment.toString(),t.entertainments),fresh_food:r(i.links.fresh_food.toString(),t.fresh_foods),beverage:r(i.links.beverage.toString(),t.beverages),layout:r(i.links.layout.toString(),t.layouts),aircraft:r(i.links.aircraft.toString(),t.aircrafts)}}))},e.prototype.convertClassString=function(e){switch(e){case"ECONOMY":return"ECON";case"PREMIUM ECONOMY":return"PREMECON";case"BUSINESS":return"BUSINESS";case"FIRST":return"FIRST";default:return"ECON"}},e.prototype.getUpasForFlight=function(e){var r=this,i=new t.BehaviorSubject([]);return e.LegDetails.map((function(e){return{segments:[{dep:e.depPoint,arr:e.arrPoint,carrier:e.touropID,flt_no:e.transNo.substr(e.touropID.length),dep_date:r.helpers.formatIsoDate(r.helpers.yymmddToMoment(e.dateDep)),cabin_id:r.convertClass(e.seatClassBasic.toUpperCase())}]}})),i},e.prototype.convertClass=function(e){switch(e){case"ECONOMY":return 1;case"PREMIUM ECONOMY":return 2;case"BUSINESS":return 3;case"FIRST":return 4;default:return 1}},e.prototype.parseResponse=function(e){var t=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.join("_")},r=function(e){return e.attributes},i=e.included.reduce((function(e,r){return e[t(r.type,r.id)]=r,e}),{}),n=function(e){return i[function(e){return t(e.type,e.id)}(e)]};return e.data.relationships.legs.data.map((function(e){var t=n(e).relationships.leg_fares.data.map(n).filter((function(e){return!!e.relationships.fare.data}));return{brands:t.map((function(e){return n(e.relationships.fare.data)})).map(r),upas:t.map((function(e){return e.relationships.leg_fare_segments.data.map(n)})).map((function(e){return e.map((function(e){return e.relationships.upas.data.map(n).map((function(e){return{id:e.id,details:r(e)}})).reduce((function(e,t){return e[t.id]=t.details,e}),{})}))}))}}))},e}();f([Ee(),y("design:type",Function),y("design:paramtypes",[Object]),y("design:returntype",t.BehaviorSubject)],Jr.prototype,"getAmenitiesForFlight",null),f([Ee(),y("design:type",Function),y("design:paramtypes",[Object]),y("design:returntype",t.BehaviorSubject)],Jr.prototype,"getUpasForFlight",null);var Wr=function(e){function t(t,r){var i=e.call(this,r)||this;return i.query=t,i}return m(t,e),t.prototype.test=function(e){return this.processCall(this.query.fetch(e))},t}(p),Yr=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.validateUserMIFreeValue},t}(Wr),Kr=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.isPostcodeValid},t}(Wr),zr=function(e){function t(t,r){var i=e.call(this,r)||this;return i.query=t,i}return m(t,e),t.prototype.updateOne=function(e){return this.processCall(this.query.mutate(e))},t}(p),Xr=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.acceptNewPrice},t}(zr),qr=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.addItemToBasket},t}(zr),Zr=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.addUserToBasketItem},t}(zr),$r=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.bookBasket},t}(zr),ei=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.createBasket},t}(zr),ti=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.moveItemToADifferentBasket},t}(zr),ri=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.deleteBasket},t}(zr),ii=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.removeItemFromBasket},t}(zr),ni=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.deleteUserAddress},t}(zr),ai=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.deleteRecentSearch},t}(zr),oi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.revalidateBasket},t}(zr),si=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.saveUserAddress},t}(zr),ui=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.sendBasketForApproval},t}(zr),li=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.setBasketItemLeadPassenger},t}(zr),ci=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.setBasketItemMIGroup},t}(zr),di=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.setBasketItemMIValue},t}(zr),pi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.updateBasketTitle},t}(zr),hi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.baseUpdateBasketNotes},t}(zr),mi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.saveRecentSearch},t}(zr),fi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.setBasketItemPaymentMethod},t}(zr),yi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.confirmMessages},t}(zr),gi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.cancelBooking},t}(zr),vi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.saveFavouriteSearch},t}(zr),bi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.deleteFavouriteSearch},t}(zr);e.AbstractHttpCallService=Br,e.AddressImpl=At,e.AuthInfo=Or,e.BaseAcceptNewPriceUpdater=Xr,e.BaseAddItemToBasketUpdater=qr,e.BaseAddUserToBasketItemUpdater=Zr,e.BaseApplyJitFlightRulesFetcher=It,e.BaseBookBasketUpdater=$r,e.BaseCabhireQuoteFetcher=Mt,e.BaseCancelBookingUpdater=gi,e.BaseCarHireAvailabilityDetailFetcher=Lt,e.BaseCarhireQuoteFetcher=jt,e.BaseConfermaOfficeFetcher=xt,e.BaseConfermaOfficeNamesFetcher=wt,e.BaseConfirmMessagesUpdater=yi,e.BaseCreateBasketUpdater=ei,e.BaseDeleteBasketUpdater=ri,e.BaseDeleteFavouriteSearchUpdater=bi,e.BaseDeleteRecentSearchUpdater=ai,e.BaseDeleteUserAddressUpdater=ni,e.BaseEnterpriseBasketService=Ir,e.BaseEnterpriseMyBookingsService=xr,e.BaseEnterpriseSearch=c,e.BaseEnterpriseSearchService=Gr,e.BaseEnvironment=Ve,e.BaseEurostarQuoteFetcher=Vt,e.BaseEventMessenager=Qe,e.BaseFlightQuoteFetcher=Ht,e.BaseGetBasketFetcher=Bt,e.BaseGetConfermaRoomImagesFetcher=Pr,e.BaseGetCovidMicrositeTokenFetcher=Qt,e.BaseGetFlightFareRulesFetcher=Gt,e.BaseGetFlightSeatMapFetcher=Cr,e.BaseGetMiAutoSugestionFetcher=$t,e.BaseGetRailLiveDeparturesFetcher=Wt,e.BaseGetRailStationFetcher=Yt,e.BaseGetRailcardsFetcher=Jt,e.BaseGetRiskAlertsFetcher=Kt,e.BaseGetUserBasketsFetcher=Zt,e.BaseGetUserCompanyOfficesFetcher=zt,e.BaseGetUserCurrentCarbonAllowanceFetcher=Xt,e.BaseGetUserFavouriteSearchesFetcher=Dr,e.BaseGetUserFetcher=vr,e.BaseGetUserRecentSearchesFetcher=qt,e.BaseHelperRoutines=Le,e.BaseHotelAvalibilityQuoteFetcher=er,e.BaseHotelAvalibilityService=Nr,e.BaseHotelQuoteFetcher=tr,e.BaseHotelRulesFetcher=Nt,e.BaseIrlDiscountCardFetcher=rr,e.BaseIrlQuoteFetcher=ir,e.BaseLogonService=jr,e.BaseLoungeQuoteFetcher=nr,e.BaseModalOpenerService=wr,e.BaseNetworkCall=p,e.BaseParkingQuoteFetcher=ar,e.BaseRailQuoteFetcher=or,e.BaseRemoveItemFromBasketUpdater=ii,e.BaseRevalidateBasketUpdater=oi,e.BaseRouteHappyService=Jr,e.BaseSaveFavouriteSearchUpdater=vi,e.BaseSaveRecentSearchUpdater=mi,e.BaseSaveUserAddressUpdater=si,e.BaseSearchAirlinesFetcher=sr,e.BaseSearchAirportsFetcher=ur,e.BaseSearchCityFetcher=lr,e.BaseSearchConfermaCityFetcher=cr,e.BaseSearchConfermaQuicklistFetcher=Ut,e.BaseSearchDepotFetcher=dr,e.BaseSearchHotelChainsFetcher=pr,e.BaseSearchIrlStationsFetcher=hr,e.BaseSearchPostcodeFetcher=mr,e.BaseSearchRailStationsFetcher=fr,e.BaseSearchUsersCanBookForFetcher=yr,e.BaseSendBasketForApprovalUpdater=ui,e.BaseSetBasketItemLeadPassengerUpdater=li,e.BaseSetBasketItemMiGroupUpdater=ci,e.BaseSetBasketItemMiValueUpdater=di,e.BaseSetPaymentOptionUpdater=fi,e.BaseStorageService=Hr,e.BaseUpdateBasketNoteUpdater=hi,e.BaseUpdateBasketTitleUpdater=pi,e.BaseUserAddressesFetcher=gr,e.BaseUserMessagesFetcher=br,e.BaseUserProductsFetcher=Sr,e.BaseUserService=Lr,e.BaseUserUiConfigsFetcher=Tr,e.BaseValidateIsPostcodeValidTester=Kr,e.BaseValidateMiFreeValueTester=Yr,e.BaseWebTokenService=Qr,e.BasemoveBasketItemToBasket=ti,e.BasketInfoMiDetailsImpl=Se,e.BookableBasket=Oe,e.CabHireEnterpriseSearch=we,e.CarhireEnterpriseSearch=xe,e.DEFAULT_FLIGHT_FILTERS=We,e.EurostarEnterpriseSearch=dt,e.FlightEnterpriseSearch=Ze,e.HotelEnterpriseSearch=rt,e.HotelFilters=tt,e.IRLEnterpriseSearch=St,e.InternalBasket=Rr,e.LimitedCache=Ie,e.LoginError=kr,e.LoungesEnterpriseSearch=it,e.MAX_TRAVELLERS=8,e.ManagementInfoAndIsValid=me,e.Memorise=Ee,e.ModalTypes=d,e.ParkingEnterpriseSearch=st,e.PhoneNumberImpl=kt,e.RailEnterpriseSearch=yt,e.RegExps=_r,e.SupplementaryBookingInfoImpl=Ot,e.Suppliers=Ke,e.TravellerObject=bt,e.USER_SIGNEDIN="USER_SIGNEDIN",e.USER_SIGNEDOUT=Mr,e.UserFavorurite=Ye,e.UserInfoImpl=Ft,e.ValidatorChecker=ie,e.defaultValidations=ot,e.excludedExpression=ke,e.filtersKeys={chain:"chain",preferred:"preferred",amenitytype:"amenitytype",distanceRange:"distanceRange",extra:"extra",hotelName:"hotelName",priceRange:"priceRange",breakfastType:"breakfastType"},e.includedExpression=Ae,e.makeManagamentInfo=be,e.maxTravellerWellbeing=4,e.ɵ0=Ge,e.ɵd=Et,e.ɵe=Rt,e.ɵf=zr,e.ɵg=Wr,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
15
|
+
***************************************************************************** */function m(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}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function f(e,t,r,i){var n,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(o=(a<3?n(o):a>3?n(t,r,o):n(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function y(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function g(e,t,r,i){return new(r||(r=Promise))((function(n,a){function o(e){try{u(i.next(e))}catch(e){a(e)}}function s(e){try{u(i.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((i=i.apply(e,t||[])).next())}))}function v(e,t){var r,i,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[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(;o;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}Object.create;function b(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],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 i,n,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o}function T(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(S(arguments[t]));return e}Object.create;var C,D,P,_,A,k,F,O,R,E,I,N,B,L,M,j,w,x,U,V,G,H,Q,J,W,Y,K,z,X,q,Z,$,ee,te,re,ie,ne=function(){};!function(e){e.BeforeSearch="BEFORE_SEARCH",e.AfterSearch="AFTER_SEARCH"}(C||(C={})),function(e){e.CheckIn="CheckIn",e.HandCarry="HandCarry"}(D||(D={})),function(e){e.Open="OPEN",e.Booked="BOOKED",e.BookingFailed="BOOKING_FAILED"}(P||(P={})),function(e){e.Open="OPEN",e.Booked="BOOKED",e.AwaitingApproval="AWAITING_APPROVAL",e.Approved="APPROVED",e.Disapproved="DISAPPROVED",e.PartiallyBooked="PARTIALLY_BOOKED",e.BookingFailed="BOOKING_FAILED"}(_||(_={})),function(e){e.Name="NAME",e.Email="EMAIL"}(A||(A={})),function(e){e.Root="ROOT",e.Tmc="TMC",e.Company="COMPANY",e.Office="OFFICE",e.CompanyGroup="COMPANY_GROUP",e.SelfBook="SELF_BOOK",e.Booker="BOOKER",e.Traveller="TRAVELLER",e.BookerWithSelf="BOOKER_WITH_SELF"}(k||(k={})),function(e){e.Any="Any",e.DdaCar="DDACar",e.CoachLarge="CoachLarge",e.CoachSmall="CoachSmall",e.Economy="Economy",e.EconomyCoach="EconomyCoach",e.EconomyMpvSmall="EconomyMPVSmall",e.EconomyMpvLarge="EconomyMPVLarge",e.EconomySuv="EconomySUV",e.ExecutiveCar="ExecutiveCar",e.ExecutiveSuv="ExecutiveSUV",e.GreenCar="GreenCar",e.GreenExecutive="GreenExecutive",e.GreenSuv="GreenSUV",e.SmallMpv="SmallMPV",e.MediumMpv="MediumMPV",e.LargeMpv="LargeMPV",e.StandardCar="StandardCar",e.Suv="SUV",e.BlackCab="BlackCab",e.TaxiSuv="TaxiSUV"}(F||(F={})),function(e){e.Mini="Mini",e.MiniElite="MiniElite",e.Economy="Economy",e.EconomyElite="EconomyElite",e.Compact="Compact",e.CompactElite="CompactElite",e.Intermediate="Intermediate",e.IntermediateElite="IntermediateElite",e.Standard="Standard",e.StandardElite="StandardElite",e.Fullsize="Fullsize",e.FullsizeElite="FullsizeElite",e.Premium="Premium",e.PremiumElite="PremiumElite",e.Luxury="Luxury",e.LuxuryElite="LuxuryElite",e.Oversize="Oversize",e.Special="Special"}(O||(O={})),function(e){e.Manual="Manual",e.Auto="Auto"}(R||(R={})),function(e){e.TwoToThreeDoor="TwoToThreeDoor",e.TwoOrFourDoor="TwoOrFourDoor",e.FourToFiveDoor="FourToFiveDoor",e.WagonOrEstate="WagonOrEstate",e.PassengerVan="PassengerVan",e.Limousine="Limousine",e.Sport="Sport",e.Convertible="Convertible",e.Suv="SUV",e.OpenAirAllTerrain="OpenAirAllTerrain",e.Special="Special",e.PickUpRegularCab="PickUpRegularCab",e.PickUpExtendedCab="PickUpExtendedCab",e.SpecialOfferCar="SpecialOfferCar",e.Coupe="Coupe",e.MonospaceEuropeanUse="MonospaceEuropeanUse",e.MotorHome="MotorHome",e.TwoWheelVehicle="TwoWheelVehicle",e.Roadster="Roadster"}(E||(E={})),function(e){e.Company="COMPANY",e.Office="OFFICE",e.User="USER"}(I||(I={})),function(e){e.Aed="AED",e.Afn="AFN",e.All="ALL",e.Amd="AMD",e.Ang="ANG",e.Aoa="AOA",e.Ars="ARS",e.Aud="AUD",e.Awg="AWG",e.Azn="AZN",e.Bam="BAM",e.Bbd="BBD",e.Bdt="BDT",e.Bgn="BGN",e.Bhd="BHD",e.Bif="BIF",e.Bmd="BMD",e.Bnd="BND",e.Bob="BOB",e.Bov="BOV",e.Brl="BRL",e.Bsd="BSD",e.Btn="BTN",e.Bwp="BWP",e.Byn="BYN",e.Bzd="BZD",e.Cad="CAD",e.Cdf="CDF",e.Che="CHE",e.Chf="CHF",e.Chw="CHW",e.Clf="CLF",e.Clp="CLP",e.Cny="CNY",e.Cop="COP",e.Cou="COU",e.Crc="CRC",e.Cuc="CUC",e.Cup="CUP",e.Cve="CVE",e.Czk="CZK",e.Djf="DJF",e.Dkk="DKK",e.Dop="DOP",e.Dzd="DZD",e.Egp="EGP",e.Ern="ERN",e.Etb="ETB",e.Eur="EUR",e.Fjd="FJD",e.Fkp="FKP",e.Gbp="GBP",e.Gel="GEL",e.Ghs="GHS",e.Gip="GIP",e.Gmd="GMD",e.Gnf="GNF",e.Gtq="GTQ",e.Gyd="GYD",e.Hkd="HKD",e.Hnl="HNL",e.Hrk="HRK",e.Htg="HTG",e.Huf="HUF",e.Idr="IDR",e.Ils="ILS",e.Inr="INR",e.Iqd="IQD",e.Irr="IRR",e.Isk="ISK",e.Jmd="JMD",e.Jod="JOD",e.Jpy="JPY",e.Kes="KES",e.Kgs="KGS",e.Khr="KHR",e.Kmf="KMF",e.Kpw="KPW",e.Krw="KRW",e.Kwd="KWD",e.Kyd="KYD",e.Kzt="KZT",e.Lak="LAK",e.Lbp="LBP",e.Lkr="LKR",e.Lrd="LRD",e.Lsl="LSL",e.Lyd="LYD",e.Mad="MAD",e.Mdl="MDL",e.Mga="MGA",e.Mkd="MKD",e.Mmk="MMK",e.Mnt="MNT",e.Mop="MOP",e.Mru="MRU",e.Mur="MUR",e.Mvr="MVR",e.Mwk="MWK",e.Mxn="MXN",e.Mxv="MXV",e.Myr="MYR",e.Mzn="MZN",e.Nad="NAD",e.Ngn="NGN",e.Nio="NIO",e.Nok="NOK",e.Npr="NPR",e.Nzd="NZD",e.Omr="OMR",e.Pab="PAB",e.Pen="PEN",e.Pgk="PGK",e.Php="PHP",e.Pkr="PKR",e.Pln="PLN",e.Pyg="PYG",e.Qar="QAR",e.Ron="RON",e.Rsd="RSD",e.Rub="RUB",e.Rwf="RWF",e.Sar="SAR",e.Sbd="SBD",e.Scr="SCR",e.Sdg="SDG",e.Sek="SEK",e.Sgd="SGD",e.Shp="SHP",e.Sll="SLL",e.Sos="SOS",e.Srd="SRD",e.Ssp="SSP",e.Stn="STN",e.Svc="SVC",e.Syp="SYP",e.Szl="SZL",e.Thb="THB",e.Tjs="TJS",e.Tmt="TMT",e.Tnd="TND",e.Top="TOP",e.Try="TRY",e.Ttd="TTD",e.Twd="TWD",e.Tzs="TZS",e.Uah="UAH",e.Ugx="UGX",e.Usd="USD",e.Usn="USN",e.Uyi="UYI",e.Uyu="UYU",e.Uzs="UZS",e.Vef="VEF",e.Vnd="VND",e.Vuv="VUV",e.Wst="WST",e.Xaf="XAF",e.Xag="XAG",e.Xau="XAU",e.Xba="XBA",e.Xbb="XBB",e.Xbc="XBC",e.Xbd="XBD",e.Xcd="XCD",e.Xdr="XDR",e.Xof="XOF",e.Xpd="XPD",e.Xpf="XPF",e.Xpt="XPT",e.Xsu="XSU",e.Xts="XTS",e.Xua="XUA",e.Xxx="XXX",e.Yer="YER",e.Zar="ZAR",e.Zmw="ZMW",e.Zwl="ZWL"}(N||(N={})),function(e){e.K="K",e.M="M"}(B||(B={})),function(e){e.M="M",e.F="F"}(L||(L={})),function(e){e.Passport="PASSPORT",e.Visa="VISA",e.IdCard="ID_CARD"}(M||(M={})),function(e){e.Cancellation="Cancellation",e.Change="Change",e.NoShow="NoShow",e.Upgrade="Upgrade",e.Other="Other"}(j||(j={})),function(e){e.Flexible="Flexible",e.Lowest="Lowest",e.Negotiated="Negotiated",e.NonNegotiated="NonNegotiated",e.Leisure="Leisure",e.RequestFareRules="RequestFareRules",e.SelectAndPro="SelectAndPro"}(w||(w={})),function(e){e.Any="Any",e.LiteEconomy="LiteEconomy",e.Economy="Economy",e.EconomyRestricted="EconomyRestricted",e.EconomyNoBags="EconomyNoBags",e.EconomyFlexi="EconomyFlexi",e.PremiumEconomy="PremiumEconomy",e.Business="Business",e.PremiumBusiness="PremiumBusiness",e.First="First",e.PremiumFirst="PremiumFirst"}(x||(x={})),function(e){e.Adult="ADULT",e.Child="CHILD",e.Infant="INFANT"}(U||(U={})),function(e){e.All="All",e.First="First",e.Standard="Standard"}(V||(V={})),function(e){e.ReturnJourney="ReturnJourney",e.SingleJourney="SingleJourney"}(G||(G={})),function(e){e.Renfe="Renfe",e.BeNe="BeNe",e.Ntv="Ntv"}(H||(H={})),function(e){e.Placeholder="placeholder",e.Complete="complete"}(Q||(Q={})),function(e){e.Error="ERROR",e.Warn="WARN",e.Info="INFO",e.Http="HTTP",e.Verbose="VERBOSE",e.Debug="DEBUG",e.Silly="SILLY"}(J||(J={})),function(e){e.Login="LOGIN",e.SearchForm="SEARCH_FORM",e.Results="RESULTS",e.MiForm="MI_FORM",e.BasketBeforeConfirm="BASKET_BEFORE_CONFIRM",e.Dashboard="DASHBOARD"}(W||(W={})),function(e){e.Adult="ADULT",e.Child="CHILD",e.Infant="INFANT"}(Y||(Y={})),function(e){e.Mobile="MOBILE",e.Landline="LANDLINE",e.Fax="FAX",e.Other="OTHER"}(K||(K={})),function(e){e.MealRequest="MEAL_REQUEST",e.SeatingPreference="SEATING_PREFERENCE",e.SpeacialNeed="SPEACIAL_NEED",e.SeatLocation="SEAT_LOCATION",e.SeatPosition="SEAT_POSITION",e.SeatDirection="SEAT_DIRECTION"}(z||(z={})),function(e){e.All="All",e.First="First",e.Standard="Standard"}(X||(X={})),function(e){e.SingleJourney="SingleJourney",e.ReturnJourney="ReturnJourney",e.OpenReturnJourney="OpenReturnJourney"}(q||(q={})),function(e){e.Origin="Origin",e.Intermediate="Intermediate",e.Destination="Destination",e.Unknown="Unknown"}(Z||(Z={})),function(e){e.RequestStop="RequestStop",e.PickUpOnly="PickUpOnly",e.SetDownOnly="SetDownOnly",e.Normal="Normal",e.Passing="Passing",e.Unknown="Unknown"}($||($={})),function(e){e.Low="Low",e.Moderate="Moderate",e.Medium="Medium",e.High="High",e.Extreme="Extreme"}(ee||(ee={})),function(e){e.Flight="FLIGHT",e.Eurostar="EUROSTAR",e.InternationalRail="INTERNATIONAL_RAIL",e.Rail="RAIL",e.Hotel="HOTEL",e.Car="CAR",e.Lounge="LOUNGE",e.FastTrack="FAST_TRACK",e.Parking="PARKING",e.Cab="CAB",e.Coach="COACH"}(te||(te={})),function(e){e.All="ALL",e.Mock="MOCK",e.Lightning="LIGHTNING",e.App="APP"}(re||(re={})),function(e){e.FreeText="FREE_TEXT",e.AutoSuggest="AUTO_SUGGEST",e.Dropdown="DROPDOWN",e.Hidden="HIDDEN"}(ie||(ie={}));var ae,oe,se,ue,le,ce,de,pe,he,me,fe=function(e){function r(r){var i=e.call(this)||this;return i.isLoading=new t.BehaviorSubject(!1),i.search=function(e){return t.of([])},Object.assign(i,r),i}return m(r,e),Object.defineProperty(r.prototype,"selectedValues",{get:function(){return this._selectedValues},set:function(e){Object.is(this._selectedValues,e)||(this._selectedValues=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},set:function(e){this.setValue(e)},enumerable:!1,configurable:!0}),r.prototype.isValid=function(){return!this.mandatory||0!==this.selectedValues.length},r.prototype.hasErrors=function(e){var t=this;return new Promise((function(r,i){r(!t.mandatory||e&&0!==e.length?null:{hasErrors:!0})}))},r}(ne),ye=function(e){function t(t,r){var i,n=this;return(n=e.call(this,t)||this).basketService=r,n.tempValue=n.selectedValues&&(null===(i=n.selectedValues[0])||void 0===i?void 0:i.freeValue)||"",n}return m(t,e),t.prototype.getValue=function(){return this.tempValue},t.prototype.setValue=function(e){this.tempValue!==e&&(this.tempValue=e,this.selectedValues=[{freeValue:e,basketLevelValue:this.perBooking,userLevelValue:this.perPassenger}])},t.prototype.save=function(e,t){this.basketService.setMiFreeValue(e,this,this.selectedValues[0]?this.selectedValues[0].freeValue:"",t)},t.prototype.hasErrors=function(t){var r=this;return new Promise((function(i,n){if(!r.mandatory||t&&0!==t.length||i({hasErrors:!0}),r.valueMask&&t)return r.basketService.validateFreeValeMi(r,t).then((function(e){i(e?null:{hasErrors:!0})}));r.values.length>0?i(r.values.find((function(e){return e.value===t}))?null:{hasErrors:!0}):i(e.prototype.hasErrors.call(r,t))}))},t}(fe),ge=function(e){function i(i,n){var a,o=this;return(o=e.call(this,i)||this).basketService=n,o.search=function(e){return e.pipe(r.debounceTime(300),r.distinctUntilChanged(),r.switchMap((function(e){return e.length>2?o.basketService.getMiAutoSugestions(o.id,e,o.isLoading):t.of(o.avaliableItems)})),r.tap((function(e){o.avaliableItems=e})))},(null===(a=o.values)||void 0===a?void 0:a.length)>0&&(o.avaliableItems=o.values),o}return m(i,e),i.prototype.getValue=function(){return this.selectedValues[0]?this.selectedValues[0].value.id:"__NONE"},i.prototype.hasErrors=function(e){return g(this,void 0,void 0,(function(){return v(this,(function(t){try{return[2,this.avaliableItems.find((function(t){return t.id===e}))?null:{hasErrors:!0}]}catch(e){return[2,null]}return[2]}))}))},i.prototype.setValue=function(e){try{var t=this.avaliableItems.find((function(t){return t.id===e}));this.selectedValues=t?[{value:{id:t.id,label:t.label,value:t.value,default:t.default,fixed:t.fixed,agentOnly:t.agentOnly},basketLevelValue:this.perBooking,userLevelValue:this.perPassenger}]:[]}catch(e){this.selectedValues=[]}},i.prototype.save=function(e,t){this.basketService.setMiSelectedValue(e,this,this.selectedValues[0].value.id,t)},i}(fe),ve=function(e){function t(t){return e.call(this,t)||this}return m(t,e),t.prototype.getValue=function(){return""},t.prototype.setValue=function(e){},t.prototype.save=function(e,t){},t}(fe),be=function(e){function t(t,r){var i,n=this;return(n=e.call(this,t)||this).basketService=r,(null===(i=n.values)||void 0===i?void 0:i.length)>0?n.avaliableItems=n.values:console.error("No values for Dropdown MI field "),n.defaultValue&&!n.selectedValues.length&&(n.value=n.defaultValue.id,n.selectedValues[0].value=n.defaultValue),n}return m(t,e),t.prototype.getValue=function(){return this.selectedValues[0]?this.selectedValues[0].value.id:"__NONE"},t.prototype.hasErrors=function(e){return g(this,void 0,void 0,(function(){return v(this,(function(t){try{return[2,this.avaliableItems.find((function(t){return t.id===e}))?null:{hasErrors:!0}]}catch(e){return[2,null]}return[2]}))}))},t.prototype.setValue=function(e){var t=this.avaliableItems.find((function(t){return t.id===e}));this.selectedValues=t?[{value:{id:t.id,label:t.label,value:t.value,default:t.default,fixed:t.fixed,agentOnly:t.agentOnly},basketLevelValue:this.perBooking,userLevelValue:this.perPassenger}]:[]},t.prototype.save=function(e,t){this.basketService.setMiSelectedValue(e,this,this.selectedValues[0].value.id,t)},t}(fe),Se=function(e,t){switch(e.uiPresentation){case ie.FreeText:return new ye(e,t);case ie.AutoSuggest:return new ge(e,t);case ie.Hidden:return new ve(e);case ie.Dropdown:return new be(e,t);default:var r=e.uiPresentation;console.log(r)}return null},Te=function(e,t,r){var i=this;this.basketService=t,this.helpers=r,this.isValidObservers=[],this.basketItem=e;var n=e.managementInfo.reduce((function(e,t){var r=Se(t,i.basketService);return i.isValidObservers.push(r),t.perBooking?e.perItem.push(r):e.perUser.push(r),e}),{perItem:[],perUser:[]}),a=n.perItem,o=n.perUser;this.miPerItem=a,this.miPerUser=e.users.reduce((function(e,t){return e[t.id]={managementInfo:i.helpers.clone(o).map((function(e){var t=Se(e,i.basketService);return i.isValidObservers.push(t),t}))},e}),{}),this.users=Object.keys(this.miPerUser)};(ae=e.LogoutEnum||(e.LogoutEnum={}))[ae.LOGOUT=0]="LOGOUT",ae[ae.STAYIN=1]="STAYIN",(oe=e.LocationTypes||(e.LocationTypes={})).City="City",oe.Office="Office",oe.Airport="Airport",oe.TrainStation="Train Station",oe.Postcode="Postcode",oe.Shortlist="Shortlist",(se=e.BreatfastTypes||(e.BreatfastTypes={})).BreakfastIncluded="BreakfastIncluded",se.BreakfastNotIncluded="BreakfastNotIncluded",(ue=e.HotelPolicyEnum||(e.HotelPolicyEnum={})).cancellation="cancellation",ue.deposit="deposit",ue.disabledAccess="disabledAccess",ue.general="general",ue.guarantee="guarantee",ue.refundAvailable="refundAvailable",(le=e.BookingStatus||(e.BookingStatus={}))[le.Loading=0]="Loading",le[le.AddingItems=1]="AddingItems",le[le.AddingTravellers=2]="AddingTravellers",le[le.AddingLeadPassenger=3]="AddingLeadPassenger",le[le.Failed=4]="Failed",le[le.Revalidate=5]="Revalidate",le[le.RevalidatingError=6]="RevalidatingError",le[le.ChooseMIGroup=7]="ChooseMIGroup",le[le.ProvideMi=8]="ProvideMi",le[le.SendForApproval=9]="SendForApproval",le[le.AwaitingApproval=10]="AwaitingApproval",le[le.ApprovedPaymentOption=11]="ApprovedPaymentOption",le[le.ApprovedSupplemtal=12]="ApprovedSupplemtal",le[le.ApprovedBook=13]="ApprovedBook",le[le.PartiallyBooked=14]="PartiallyBooked",le[le.Complete=15]="Complete",(ce=e.SchemaFormat||(e.SchemaFormat={})).array="array",ce.datetime="date-time",ce.integer="integer",ce.object="object",ce.select="select",ce.string="string",ce.boolean="boolean",ce.countryCode="countryCode",ce.additionalSeatPreference="t_additionalSeatPreference",ce.seatPrefGroups="a_seatPrefGroups",ce.railSeating="railSeating",(e.Widgets||(e.Widgets={})).COUNTRY_CODE="COUNTRY_CODE",(de=e.PreferredFlags||(e.PreferredFlags={}))[de.none=0]="none",de[de.officePreferred=1]="officePreferred",de[de.companyPreferred=2]="companyPreferred",de[de.tmcPreferred=4]="tmcPreferred",de[de.all=7]="all",(pe=e.FlightDirectionEnum||(e.FlightDirectionEnum={}))[pe.Outbound=1]="Outbound",pe[pe.Inbound=0]="Inbound",pe[pe.DualSingleOutbound=2]="DualSingleOutbound",pe[pe.DualSingleInbound=3]="DualSingleInbound",(he=e.OBTFlightCabinClass||(e.OBTFlightCabinClass={})).Business="Business",he.BusinessBranded="BrandedBusiness",he.EconomyFlexi="EconomyFlexi",he.EconomyFlexiBranded="BrandedEconomyFlexi",he.EconomyNoBags="EconomyNoBags",he.EconomyNoBagsBranded="BrandedEconomyNoBags",he.EconomyRestricted="EconomyRestricted",he.EconomyRestrictedBranded="BrandedEconomyRestricted",he.First="First",he.FirstBranded="BrandedFirst",he.PremiumEconomy="PremiumEconomy",he.PremiumEconomyBranded="BrandedPremiumEconomy",(me=e.EurostarClassEnum||(e.EurostarClassEnum={})).ANY="Any",me.BUSINESS_PREMIER="BusinessPremier",me.STANDARD_PREMIER="StandardPremier",me.STANDARD="Standard";var Ce,De,Pe,_e="("+["breakfast not included","breakfast is not included","Breakfast isn't included","Does not include breakfast","EXCL","exel Breakfast","Breakfast Costs","no breakfast"].join(")|(")+")",Ae="("+["BREAKFAST INCLUDED","breakfast","BB","B&B","Bead and breakfast","Bed and breakfast","Bed&Break","INCLUDES BREAK","INCL BED AND BRE","BRKFST","BED AND BRKFST"].join(")|(")+")",ke=new RegExp(Ae,"i"),Fe=new RegExp(_e,"i");(Ce=e.SearchHandler||(e.SearchHandler={})).AVAILABILITY="Availability",Ce.FEMALE_FRIENDLY="SOLO Female Friendly",Ce.CTM_GREEN_CHOICE="CTM Greener Choice",Ce.BREAKFAST_INCLUDED="BreakfastIncluded",Ce.BREAKFAST_NOT_INCLUDED="BreakfastNotIncluded",Ce.CLIENT="Client",Ce.AGENCY="Agency",Ce.ANY="Any",(De=e.MenuSlideEnum||(e.MenuSlideEnum={})).IN="in",De.OUT="out",De.FLAT="flat",(Pe=e.RiskLevelRanking||(e.RiskLevelRanking={})).Low="1",Pe.Moderate="2",Pe.Medium="3",Pe.High="4",Pe.Extreme="5";var Oe;(Oe=e.ServiceProvider||(e.ServiceProvider={})).Confirma="Conferma",Oe.Evolvi="Evolvi",Oe.SabreCarHire="Sabre Car Hire",Oe.Lounges="Holiday Extras Lounges",Oe.FastTrack="Holiday Extras Fast Track",Oe.Parking="Holiday Extras Parking",Oe.CMAC="CMAC",Oe.FarelogixLFGNDC="Farelogix LFG NDC",Oe.BaNdc="BA NDC",Oe.EurostarSabre="Eurostar (Sabre)",Oe.Trainline="Trainline",(e.WellbeingEnum||(e.WellbeingEnum={})).WELLBEING="/results/wellbeing";var Re=function(){function r(r,i){this.basketService=r,this.helpers=i,this.status=new t.BehaviorSubject(e.BookingStatus.Loading),this.basket=new t.BehaviorSubject({}),this.needsToViewMi=!0,this.isUpdating=new t.BehaviorSubject(!1),this.id=null}return r.prototype.loadBasket=function(r){this.id=r,this.basket=new t.BehaviorSubject({}),this.status.next(e.BookingStatus.Loading),this.isUpdating.next(!0),this._loadBasket(r)},r.prototype._loadBasket=function(e){var t=this;this.basketService.loadBasket(e),this.basketService.subsribeToBasket(e,{next:function(e){t.basket.next(e),t.updateBasket(e)},error:function(e){t.basket.error(e),console.error(e)},complete:function(){t.basket.complete(),console.log("Basket completed")}})},r.prototype.updateBasket=function(t){switch(this.isUpdating.next(!1),t.status){case _.Open:this.workoutOpenState(t);break;case _.AwaitingApproval:this.status.next(this.workoutState(t,e.BookingStatus.AwaitingApproval));break;case _.Approved:this.status.next(this.workoutApprovedState(t));break;case _.Booked:this.status.next(this.workoutState(t,e.BookingStatus.Complete));break;case _.BookingFailed:this.status.next(this.workoutState(t,e.BookingStatus.Failed));break;case _.Disapproved:case _.PartiallyBooked:this.status.next(e.BookingStatus.Failed);break;default:var r=t.status;console.log(r)}},r.prototype.sendBasketForApproval=function(){return this.basketService.sendBasketForApproval(this.id)},r.prototype.workoutApprovedState=function(t){var r=e.BookingStatus.ApprovedBook;if(t.basketItems.find((function(e){var t;return(null===(t=e.availablePaymentMethods)||void 0===t?void 0:t.length)>0&&!e.selectedPaymentMethod})))return this.workoutState(t,e.BookingStatus.ApprovedPaymentOption);console.log(t.suppInfo);var i=t.suppInfo.find((function(e){return e.hasDetails}));return console.log(i),i&&(r=e.BookingStatus.ApprovedSupplemtal),this.workoutState(t,r)},r.prototype.workoutState=function(t,r){return t.validated?r:(this._hasInvalidPrice(t),e.BookingStatus.Revalidate)},r.prototype.workoutOpenState=function(t){if(0!==t.basketItems.length)if(this._needsCorrectTravellers(t))this.status.next(e.BookingStatus.AddingTravellers);else{if(!this._needLeadPassengers(t))return t.validated?void(this._needsMiGroups(t)?this.status.next(e.BookingStatus.ChooseMIGroup):this.helpers.needsMi(t,this.needsToViewMi)?this.status.next(e.BookingStatus.ProvideMi):this.status.next(e.BookingStatus.SendForApproval)):(this._hasInvalidPrice(t),void this.status.next(e.BookingStatus.Revalidate));this.status.next(e.BookingStatus.AddingLeadPassenger)}else this.status.next(e.BookingStatus.AddingItems)},r.prototype.revalidate=function(){this.basketService.revalidate(this.id)},r.prototype.addTravellers=function(e,t,r,i){void 0===i&&(i=0),this.isUpdating.next(!0),this.basketService.addTravellers(e.id,t,r,i)},r.prototype.setLeadPassenger=function(e,t,r,i){void 0===i&&(i=0),this.isUpdating.next(!0),this.basketService.setLeadPassenger(e.id,t,r,i)},r.prototype.setBasketItemMiGroup=function(e,t){this.isUpdating.next(!0),this.basketService.setBasketItemMiGroup(e,t.basketItem.id,t.value)},r.prototype.saveMiGroup=function(e){var t=this;this.isUpdating.next(!0),e.forEach((function(e){t.setBasketItemMiGroup(t.id,e)}))},r.prototype.saveMi=function(e){this.needsToViewMi=!1,this.isUpdating.next(!0),e&&this.basketService.saveMiData(this.id,e)},r.prototype.removeExpiredItems=function(){this.isUpdating.next(!0),this.basketService.removeExpiredItems(this.id)},r.prototype.setBasketItemPaymentOption=function(e,t){return this.isUpdating.next(!0),this.basketService.setBasketItemPaymentOption(this.basket.value,e,t)},r.prototype.bookBasket=function(e){if(this.isUpdating.next(!0),e)return this.basketService.bookBasket(this.id,e)},r.prototype._needsMiGroups=function(e){return!!e.basketItems.find((function(e){return e.miGroupsAvailable.length>0&&!e.miGroupSelected}))},r.prototype._needsCorrectTravellers=function(e){var t=this;return!!e.basketItems.find((function(e){var r=t._splitTravellers(e);return e.service.type===te.Parking?!(1===e.adults):!(r.adults.length===e.adults&&r.children.length===e.children&&r.infants.length===e.infants)}))},r.prototype._hasInvalidPrice=function(e){return!!e.basketItems.find((function(e){return!e.latestValidationPriceDifference||e.expired}))},r.prototype._needLeadPassengers=function(e){return!!e.basketItems.find((function(e){return!e.leadPassenger}))},r.prototype._splitTravellers=function(e){var t=this;return(e.userPassengerTypes||[]).reduce((function(r,i,n){switch(i.passengerType){case Y.Adult:r.adults.push(t._findUser(e.users,Number(i.id)));break;case Y.Child:r.children.push(t._findUser(e.users,Number(i.id)));break;case Y.Infant:r.infants.push(t._findUser(e.users,Number(i.id)))}return r}),{adults:[],children:[],infants:[]})},r.prototype._findUser=function(e,t){return e.find((function(e){return Number(e.id)===t}))},r.prototype.getId=function(){return this.id},r}(),Ee=function(e,t){this.key=e,this.value=t,this.next=null,this.pre=null},Ie=function(){function e(e){void 0===e&&(e=10),this.size=e,this.cache={},this.count=0,this.head=new Ee("",null);var t=new Ee("",null);this.head.next=t,t.pre=this.head}return e.prototype.get=function(e){return this.cache[e]?this.cache[e].value:null},e.prototype.set=function(e,t){var r=this.cache[e];r?(r.value=t,this.deleteItem(r),this.addToHead(r)):(this.cache[e]=new Ee(e,t),this.addToHead(this.cache[e]))},e.prototype.hasKey=function(e){return this.cache.hasOwnProperty(e)},e.prototype.deleteItem=function(e){e.pre.next=e.next,e.next.pre=e.pre},e.prototype.addToHead=function(e){e.next=this.head.next,e.next.pre=e,e.pre=this.head,this.head.next=e},e}();function Ne(){return function(e,t,r){var i=new Ie,n=r.value;r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=JSON.stringify(e);return i.hasKey(r)||i.set(r,n.apply(this,e)),i.get(r)}}}var Be,Le,Me,je=function(){function t(){}return t.prototype.minToHour=function(e){return Math.floor(e/60)+"h "+e%60+"m"},t.prototype.makeColonTime=function(e){return e.substring(0,2)+":"+e.substring(2,4)},t.prototype.nonNullMin=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(t,r){return r&&r[e]&&t.min>Number(r[e])?{item:r,min:Number(r[e])}:t}),{min:Number.MAX_SAFE_INTEGER,item:null}).item},t.prototype.joinByComma=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return s.default.isEmpty(t)&&(e+=t+","),e}),"").slice(0,-1)},t.prototype.mutuallyInclude=function(e,t){try{return e.includes(t)||t.includes(e)}catch(e){return console.warn("Trying to mutually compare undefined variable."),!1}},t.prototype.findByKey=function(e,t,r){return e.filter((function(e){return e[t]===r})).pop()},t.prototype.dateToNgDate=function(e){return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}},t.prototype.convertToYYMMDD=function(e){return e.length>6?this.formatDate(this.yyyymmddTimeToMoment(e)):e},t.prototype.formatDateToMMDDYYY=function(e){return u.default(e).format(t.MMDDYY_DATE)},t.prototype.formatDate=function(e){return(e=u.default(e)).format(t.DATE_FORMAT)},t.prototype.formatTime=function(e){try{return e.format(t.TIME_FORMAT)}catch(e){console.error(e)}},t.prototype.formatTimeColon=function(e){return(e=u.default(e)).format(t.TIME_FORMAT_COLON)},t.prototype.formatIsoDate=function(e){return(e=u.default(e)).format(t.ISO_DATA_FORMAT)},t.prototype.formatIsoDateTime=function(e){return(e=u.default(e)).format(t.ISO_DATA_FORMAT_TIME)},t.prototype.formatGraphQLDateTime=function(e){return(e=u.default(e)).format(t.GRAPHQL_DATA_FORMAT_TIME)},t.prototype.formatIsoDateNoHyphans=function(e){return(e=u.default(e)).format(t.ISO_DATA_FORMAT_NO_HYPHANS)},t.prototype.generateTimesList=function(e,t,r){void 0===e&&(e=0),void 0===t&&(t=24),void 0===r&&(r=15);for(var i=[],n=0;n<t-e;n++)for(var a=0;a<60;a+=r)i.push(u.default({hour:n,minute:a}).format("HH:mm"));return i},t.prototype.momentToNgDate=function(e){return e=u.default(e),this.dateToNgDate(e.toDate())},t.prototype.ngDateToDate=function(e){return new Date(e.year,e.month-1,e.day)},t.prototype.ngDateToMoment=function(e,t){var r=u.default(this.ngDateToDate(e));if(t){var i=t.split(":");2===i.length?r.set("hours",Number(i[0])).set("minutes",Number(i[1])):r.set("hours",Number(t.substr(0,2))).set("minutes",Number(t.substr(2,2)))}return r},t.prototype.todayToNgbDateStruct=function(){var e=u.default();return{year:e.year(),month:e.month()+1,day:e.date()}},t.prototype.objectToArray=function(e){return Object.keys(e).map((function(t){return e[t]}))},t.prototype.yyyymmddToDate=function(e){return new Date(Number(e.substring(0,4)),Number(e.substring(4,6))-1,Number(e.substring(6,8)))},t.prototype.yyyymmddToMoment=function(e){return u.default(this.yyyymmddToDate(e))},t.prototype.yymmddToMoment=function(e){return u.default(e,"YYMMDD")},t.prototype.yymmddToNgbDate=function(e){return this.momentToNgDate(this.yymmddToMoment(e))},t.prototype.yymmdd_hhmmToMoment=function(e,t){return u.default(e+" "+t,"YYMMDD HHmm")},t.prototype.yyyymmdd_hhmmToMoment=function(e,t){return u.default(e+" "+t,"YYYYMMDD HHmm")},t.prototype.yyyymmddToNgDate=function(e){return this.dateToNgDate(this.yyyymmddToDate(e))},t.prototype.yyyymmddTimeToNgDate=function(e,t){var r=this.yyyymmddToMoment(e).add(Number(t.substring(0,2)),"hours").add(Number(t.substring(2,4)),"minutes");return this.momentToNgDate(r)},t.prototype.yyyymmddTimeToMoment=function(e){return 6===e.length?u.default(""+e,"YYMMDD"):u.default(""+e,"YYYYMMDD")},t.prototype.hhmmToTime=function(e){return e.substring(0,2)+":"+e.substring(2,4)},t.prototype.dateStringToyyyymmdd=function(e){if("string"!=typeof e)return null;var t=/(\d{4})[-\/]?(\d{2})[-\/]?(\d{2})/.exec(e);return t?""+t[1]+t[2]+t[3]:null},t.prototype.timeStringTohh_mm=function(e){if("string"!=typeof e)return null;var t=/(\d{2})[:-]?(\d{2})/.exec(e);return t?t[1]+":"+t[2]:null},t.prototype.stringToBool=function(e){return e&&"false"!==e&&"0"!==e&&"no"!==e&&"n"!==e},t.prototype.clone=function(e){return s.default.cloneDeep(e)},t.prototype.replaceKeysInText=function(e,t){return Object.keys(t).reduce((function(e,r){return e.replace("%"+r,t[r])}),e)},t.prototype.getNextMinuets=function(e,t){return void 0===e&&(e=u.default()),void 0===t&&(t=15),e.minute(Math.ceil(e.minute()/t)*t),e.format("HH:mm")},t.prototype.getNumberOnceValue=function(e){var t=this.guid();return t+"_"+hex_hmac_md5(e,t)},t.prototype.guid=function(){for(var e="",t=0;t<32;t++)e+=this.s4();return e},t.prototype.s4=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)},t.prototype.capitaliseFirstLetter=function(e){return e.length>0?e[0].toUpperCase()+e.slice(1).toLowerCase():""},t.prototype.fromObject=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=e.shift(),i=0;r&&i<e.length;i+=1)r=r[e[i]];return r},t.prototype.momentRoundMinutes=function(e,t){var r=(e=u.default(e).startOf("minutes")).minutes()%t;return 0!==r&&(r=t-r),e.add(r,"minute")},t.prototype.round=function(e,t){return u.default(Math.ceil(+e/+t)*+t)},t.prototype.icsFold=function(e){return e.split(/\r\n/g).map((function(e){var t="";for(e=e.trim();e.length>72;)t+=e.slice(0,72)+"\r\n",e=" "+e.slice(72).trim();return e.trim()&&(t+=e),t})).join("\r\n")},t.prototype.splitAddressLine=function(e,t){var r={line:e.replace(/\s+/g," ").trim(),residue:""};if(r.line.length>t){var i=r.line.slice(0,t).lastIndexOf(",");i>0?(r.residue=r.line.slice(i+1).trim(),r.line=r.line.slice(0,i).trim()):(i=r.line.slice(0,t).lastIndexOf(" "))>0?(r.residue=r.line.slice(i+1).trim(),r.line=r.line.slice(0,i)):(r.residue=r.line.slice(t),r.line=r.line.slice(0,t))}return r},t.prototype.daysBetween=function(e,t){return t.diff(e,"days")},t.prototype.mapPromise=function(e,t,r){for(var i=e[Symbol.iterator](),n=[],a=[],o=0,s=function(){var e=i.next();if(!e.done){var r=o++;return Promise.resolve(t(e.value,r)).then((function(e){return n[r]=e,s()}))}};!r||a.length<=r;){var u=s();if(!u)break;a.push(u)}return Promise.all(a).then((function(){return n}))},t.prototype.mapSeriesPromise=function(e,t){return this.mapPromise(e,t,1)},t.prototype.obj2queryString=function(e){return s.default.reduce(e,(function(e,t,r){return""!==e&&(e+="&"),""+e+encodeURIComponent(r)+"="+encodeURIComponent(t)}),"")},t.prototype.stripPunctuation=function(e){return e.replace(/[^a-zA-Z0-9\s]/g,"")},t.prototype.replaceAll=function(e,t,r){return e?e.replace(new RegExp(t,"g"),r):null},t.prototype.dateTime=function(e,t){var r=e.match(/.{1,2}/g),i=t.match(/.{1,2}/g);return"20"+r[0]+"-"+r[1]+"-"+r[2]+"T"+i[0]+":"+i[1]+":00"},t.prototype.alternateJSONStringify=function(e){var t=JSON.stringify(e);return t=t.replace(/"/g,"`")},t.prototype.ConvertObjectToArray=function(e){var t=s.default.values(e);return t=s.default.flatten(t)},t.prototype.addDay=function(e){var t=new Date(e.year,e.month-1,e.day+1);return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}},t.prototype.hashCode=function(e){for(var t=0,r=0;r<e.length;r+=1){t=(t<<5)-t+e.charCodeAt(r),t&=t}return t.toString()},t.prototype.MMddyyToNgb=function(e){return this.momentToNgDate(u.default(e,t.MMDDYY_DATE))},t.prototype.selectedChildrenTravellers=function(e,t){switch(t){case te.Hotel:case te.Cab:return[]}return e.filter((function(e){return e.isChild}))},t.prototype.selectedTravellers=function(e,t){switch(t){case te.Hotel:case te.Cab:return{adults:e,children:[],infants:[]};default:return e.reduce((function(e,t){return t.isChild?t.isInfant?e.infants.push(t):e.children.push(t):e.adults.push(t),e}),{adults:[],children:[],infants:[]})}},t.prototype.selectedAdultTravellers=function(e,t){switch(t){case te.Hotel:case te.Cab:return e}return e.filter((function(e){return!e.isChild&&!e.isInfant}))},t.prototype._isChild=function(e,r){return e instanceof Date?u.default().add(-r,"years").isBefore(u.default(e,t.ISO_DATA_FORMAT),"day"):e.isChild},t.prototype.isChildFlight=function(e){return this._isChild(e,16)},t.prototype.isChildRail=function(e){return this._isChild(e,12)},t.prototype.isChildEurostar=function(e){return this._isChild(e,12)},t.prototype.uniqBy=function(e,t){return s.default.uniqBy(e,t)},t.prototype.isChild=function(e,t){switch(t){case te.Flight:return this._isChild(e,16);case te.Rail:return this._isChild(e,12);case te.Coach:return this._isChild(e,15);case te.Lounge:return this._isChild(e,12);case te.Hotel:case te.Cab:default:return!1}},t.prototype.isInfant=function(e,t){switch(t){case te.Flight:case te.Rail:case te.Coach:case te.Lounge:return this._isChild(e,0);case te.Hotel:case te.Cab:default:return!1}},t.prototype.getAgeType=function(e,t){return this.isChild(e,t)?"C":"A"},t.prototype.getMaxChildAge=function(e){switch(e){case te.Flight:return u.default().add(-15,"years").format(t.MMDDYY_DATE);case te.Rail:return u.default().add(-11,"years").format(t.MMDDYY_DATE);case te.Coach:return u.default().add(-14,"years").format(t.MMDDYY_DATE);case te.Lounge:return u.default().add(-11,"years").format(t.MMDDYY_DATE)}},t.prototype.getDefaultAdultAge=function(e){switch(e){case te.Flight:return u.default().add(-26,"years").format(t.MMDDYY_DATE);case te.Rail:return u.default().add(-22,"years").format(t.MMDDYY_DATE);case te.Coach:return u.default().add(-25,"years").format(t.MMDDYY_DATE);case te.Lounge:return u.default().add(-22,"years").format(t.MMDDYY_DATE);case te.Hotel:case te.Cab:return u.default().add(-18,"years").format(t.MMDDYY_DATE)}return u.default().add(-18,"years").format(t.MMDDYY_DATE)},t.prototype.transform=function(e,t,r){return s.default.transform(e,t,r)},t.prototype.arrayToObject=function(e,t){return e.filter((function(e){return!!e})).reduce((function(e,r){return r&&r[t]&&(e[r[t]]=r),e}),{})},t.prototype.setFieldInObject=function(e,t,r){if(0===t.length)throw new Error("Invalid field");if(e||(e={}),1===t.length)e[t[0]]=e[t[0]]||[],e[t[0]].push(r);else{var i=t[0];e[i]=this.setFieldInObject(e[i],t.slice(1),r)}return e},t.prototype.arrayToObjectArray=function(e,t){var r=this;return e.filter((function(e){return!!e})).reduce((function(e,i){var n=t.reduce((function(e,t){var n=Array.isArray(t)?t.map((function(e){return r.fieldFromObject(i,e)})).join("_"):r.fieldFromObject(i,t);return e&&n?(e.push(n),e):null}),[]);if(i&&n)return r.setFieldInObject(e,n,i)}),{})},t.prototype.getTerminals=function(e){return e.terminals},t.prototype.fieldFromObject=function(e,t){return(Array.isArray(t)?t:(t||"").split(".")).reduce((function(e,t){return e&&e[t]?e[t]:null}),e)},t.prototype.mapFieldFromObject=function(e){return function(t){return t[e]}},t.prototype.removeNulls=function(e){var t=this;return e?u.default.isMoment(e)?e:Array.isArray(e)?e.map((function(e){return t.removeNulls(e)})).filter((function(e){return!!e}))||null:"object"==typeof e?Object.keys(e).reduce((function(r,i){if("_"!==i[0]){var n=e[i],a=t.removeNulls(n);(null!=a&&"null"!==a||Array.isArray(a)&&a.length>0)&&(r[i]=a)}return r}),{}):e:e},t.prototype.getTravellersId=function(e){if(e)return e.reduce((function(e,t,r){return 0===r?[t.id]:T(e,[t.id])}),[])},t.prototype.sanitizeMomentDates=function(e,t){var r,i;void 0===t&&(t=!1);var n=Object.assign({},e);try{for(var a=b(Object.entries(n)),o=a.next();!o.done;o=a.next()){var s=S(o.value,2),l=s[0],c=s[1];u.default.isMoment(c)&&(n[l]=n[l].toISOString())}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return t&&(console.log("-- sanitizeMomentDates() called --"),console.log("original query: ",e),console.log("sanitized query: ",n)),n},t.prototype.toStrings=function(e,t){var r=this;return Object.entries(t.properties||{}).reduce((function(i,n){var a=S(n,2),o=a[0],s=a[1],u=r._formatValue(e[o],s,(t.required||[]).includes(o));return null!==u&&(i[o]=u),i}),{})},t.prototype._formatValue=function(e,t,r){switch(t.type){case"integer":var i=Number.parseInt(e,10);return Number.isNaN(i)?r?0:null:i;case"string":var n=e?e.toString():null;return n&&n.length>0?n:r?"":null;case"object":return e?this.toStrings(e,t):r?{}:null;case"array":default:return e}},t.prototype.makeTimeWindow=function(e,t,r){var i=e.clone().add(t,"hour"),n=e.clone().add(r,"hour");return this.formatTime(i)+"-"+this.formatTime(n)},t.prototype.inRange=function(e,t){return e>=t.min&&e<=t.max},t.prototype.makeUsers=function(e){return e.map((function(e){return{id:e.id,passengerType:e.isChild?Y.Child:e.isInfant?Y.Infant:Y.Adult}}))},t.prototype.makeMomentDayTime=function(e,t,r){var i=u.default();return void 0!==e&&i.add(e,"day"),void 0!==t&&i.set("hours",t),void 0!==r&&i.set("minutes",r),i},t.prototype.sanatizeReturns=function(e,t,r){var i=Object.assign({},e,t);return(r||[]).reduce((function(e,t){var r=e[t];return e[t]=r?"string"==typeof r?u.default(r):r:u.default(),e}),i)},t.prototype.miIsValid=function(e){return 0===e.length||!!e.find((function(e){return e.isValid()}))},t.prototype.isMiValid=function(e,t){var r=this,i=Object.values(t||{});return this.miIsValid(e)&&(0===i.length||!!i.find((function(e){return r.miIsValid(e.managementInfo)})))},t.prototype.needsMi=function(e,t){var r=this;return e.basketInfoMiDetails.length>0&&(t||!e.basketInfoMiDetails.find((function(e){return r.isMiValid(e.miPerItem,e.miPerUser)})))},t.prototype.findService=function(e,t){return Object.values(e).reduce((function(e,r){return e||r.find((function(e){return e.id===t}))}),null)},t.prototype.allTrue=function(e,t){return e.filter(t).length===e.length},t.prototype.joinFromAttribute=function(e,t,r){return r.map((function(e){return e[t]})).join(e)},t.prototype.splitUpArray=function(e,t,r){void 0===r&&(r=!0);var i=s.default.cloneDeep(e),n=[];if(i.length>t){for(;i.length>=t;)n.push(i.splice(0,t));i.length&&r&&n.push(i)}else n=i;return n},t.prototype.getTimeDifference=function(e,t){return u.default(e).diff(u.default(t),"minutes")},t.prototype.dayDifference=function(e,t){var r=u.default(t).startOf("day").diff(u.default(e).startOf("day"),"day");return r>0?r.toString():""},t.prototype.makeFareRules=function(t,r){var i=r===e.FlightDirectionEnum.Outbound?t.outboundFlights:t.inboundFlights;return{rules:i.reduce((function(e,t){var r,i,n,a,o;return e.cancellation=e.cancellation.concat((null===(r=t.fareConditions)||void 0===r?void 0:r.cancellation)||[]),e.change=e.change.concat((null===(i=t.fareConditions)||void 0===i?void 0:i.change)||[]),e.noShow=e.noShow.concat((null===(n=t.fareConditions)||void 0===n?void 0:n.noShow)||[]),e.upgrade=e.upgrade.concat((null===(a=t.fareConditions)||void 0===a?void 0:a.upgrade)||[]),e.other=e.other.concat((null===(o=t.fareConditions)||void 0===o?void 0:o.other)||[]),e}),{cancellation:[],change:[],noShow:[],upgrade:[],other:[]}),flights:i}},t.prototype.generateIcsFileContents=function(e){return["BEGIN:VCALENDAR\r\n","PRODID:-//Micros Travel//SABS Corporate - MMXIII//EN\r\n","VERSION:2.0\r\n","METHOD:REQUEST\r\n",this.generateIcsFileBodyContent(e),"END:VCALENDAR\r\n"].join("")},t.prototype.generateIcsFileBodyContent=function(e){var t=[];return e.map((function(e,r){var i={dStart:"",dEnd:"",locationFrom:"",locationTo:"",basketId:"",description:"",serviceType:"",summary:""},n="DD MMMM YYYY HH:mm",a=e.service.type,o=e.adults,s=e.children,l=e.bookingThirdPartyReference,c=e.detail,d=e.service;switch(a){case te.Lounge:i.basketId=e.id,i.dStart=null==c?void 0:c.arrivalDatetime,i.dEnd="",i.summary="Airport Lounge - "+c.name,i.serviceType=d.type.toLowerCase(),i.description=["Lounge: "+c.name+"\r\n","Starts: "+u.default(c.arrivalDatetime).format(n)+"\r\n","Adults: "+o+"\r\n","Children: "+s+"\r\n","Booking Ref: "+l].join("");break;case te.Cab:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.departs,i.dEnd="",i.summary="Taxi booking - from "+c.fromLocation.address+" to "+c.toLocation.address,i.description=["Pickup Point: "+c.fromLocation.address+"\r\n","Time: "+u.default(c.departs).format(n)+"\r\n","Booking Ref: "+l].join("");break;case te.Car:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.pickUpDatetime,i.dEnd=null==c?void 0:c.dropOffDatetime,i.summary="Car booking - from "+c.pickUpLocation.address+" to "+c.dropOffLocation.address,i.description=["Pickup Point: "+c.pickUpLocation.address+"\r\n","Time: "+u.default(c.pickUpDatetime).format(n)+"\r\n","Arrival Point: "+c.dropOffLocation.address+"\r\n","Booking Ref: "+l].join(""),i.locationFrom=c.pickUpLocation.address,i.locationTo=c.dropOffLocation.address;break;case te.Coach:case te.FastTrack:case te.Flight:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.outboundFlights[0].dateTimeDeparting,i.dEnd=null==c?void 0:c.outboundFlights[0].dateTimeArriving,i.summary="Flight Booking - From "+c.outboundFlights[0].originAirport+" to "+c.outboundFlights[0].destinationAirport,i.description=["From: "+c.outboundFlights[0].originAirport+"\r\n","Depart: "+u.default(c.outboundFlights[0].dateTimeDeparting).format(n)+"\r\n","To: "+c.outboundFlights[0].destinationAirport+"\r\n","Arrive: "+u.default(c.outboundFlights[0].dateTimeArriving).format(n)+"\r\n","Booking Ref: "+l].join("");break;case te.Hotel:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.checkIn,i.dEnd=null==c?void 0:c.checkOut,i.summary="Hotel booking - "+c.hotelName,i.description=["Hotel: "+c.hotelName+"\r\n","Arrival: "+u.default(c.checkIn).format(n)+"\r\n","Departure: "+u.default(c.checkOut).format(n)+"\r\n","Booking Ref: "+l].join("");break;case te.InternationalRail:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.outwardDetail.departureDateTime,i.dEnd=null==c?void 0:c.outwardDetail.arrivalDateTime,i.locationFrom=c.outwardDetail.departureStationName,i.locationTo=c.outwardDetail.arrivalDateTime,i.summary="Train Booking - From "+c.outwardDetail.departureStationName+" to "+c.outwardDetail.arrivalStationName,i.description=["From "+c.outwardDetail.departureStationName+"\r\n","To "+c.outwardDetail.arrivalStationName+"\r\n","Departure "+u.default(c.outwardDetail.departureDateTime).format(n)+"\r\n","Arrival "+u.default(c.outwardDetail.arrivalDateTime).format(n)+"\r\n","Booking Ref: "+l].join("");break;case te.Parking:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.arrivalDatetime,i.dEnd=null==c?void 0:c.departDatetime,i.summary="Airport parking - "+c.name,i.description=["Airport Parking: "+c.name+"\r\n","Booking Ref: "+l].join("");break;case te.Rail:i.basketId=e.id,i.serviceType=d.type.toLowerCase(),i.dStart=null==c?void 0:c.outwardDetail.departureDateTime,i.dEnd=null==c?void 0:c.outwardDetail.arrivalDateTime,i.locationFrom=c.outwardDetail.departureStationName,i.locationTo=c.outwardDetail.arrivalDateTime,i.summary="Train Booking - From "+c.outwardDetail.departureStationName+" to "+c.outwardDetail.arrivalStationName,i.description=["From "+c.outwardDetail.departureStationName+"\r\n","To "+c.outwardDetail.arrivalStationName+"\r\n","Departure "+u.default(c.outwardDetail.departureDateTime).format(n)+"\r\n","Arrival "+u.default(c.outwardDetail.arrivalDateTime).format(n)+"\r\n","Booking Ref: "+l].join("")}t.push(["BEGIN:VEVENT\r\n",i.dStart?"DTSTART:"+u.default(i.dStart).format("YYYYMMDDTHHmmss")+"\r\n":"",i.dEnd?"DTEND:"+u.default(i.dEnd).format("YYYYMMDDTHHmmss")+"\r\n":"",'ORGANIZER;CN="Do not reply to this email":mailto:do_not_reply@sabscorp.com\r\n',i.locationTo&&i.locationFrom?"LOCATION: "+i.locationTo+" to "+i.locationFrom+" \r\n":"","TRANSP:OPAQUE\r\n","SEQUENCE:0\r\n","UID:"+i.serviceType+"_"+r+"_"+i.basketId+"@sabscorp.com\r\n","DTSTAMP:"+u.default().format("YYYYMMDDTHHmmss")+"\r\n","DESCRIPTION:"+i.description+"\r\n","SUMMARY:"+i.summary+"\r\n","END:VEVENT\r\n"].join(""))})),t.join("")},t.prototype.downloadIcs=function(e,t){var r=document.createElement("a");r.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),r.setAttribute("download",e),r.setAttribute("target","_blank"),r.style.display="none",r.click()},t.prototype.splitStringOnCapitals=function(e,t){void 0===t&&(t=!1);var r=e.split(/(?=[A-Z])/);return t?r.join(" "):r},t.prototype.createFlightFilters=function(e,t){return e.reduce((function(e,t){var r=t.outboundFlights.length-1;e.stops[r]=e.stops[r]||{display:0===r?"Direct":r+" stop"+(1!==r?"s":""),selected:!1,value:r+1};var i=t.inboundFlights?t.inboundFlights.length-1:0,n=i>r?i:r;e.totalStops[n]=e.totalStops[n]||{display:0===n?"Direct":n+" stop"+(1!==n?"s":""),selected:!1,value:n+1};var a=function(t){e.classes[t.cabinClass]=e.classes[t.cabinClass]||{display:t.cabinClass,selected:!1,value:t.cabinClass},e.airlines[t.marketingCarrier]=e.airlines[t.marketingCarrier]||{display:t.marketingCarrierName,selected:!1,value:t.marketingCarrier}};t.outboundFlights.forEach(a);var o=t.baggageAllowance.map((function(e){return e.qty})),s=o.length?Math.min.apply(Math,T(o)):0;e.baggage[s]=e.baggage[s]||{selected:!1,display:s+" bag"+(s>1?"s":""),value:s};var l=function(t,r,i,n,a){var o=t&&t[a]?t[a][i]:void 0;void 0!==o&&(e[r][o]=e[r][o]||{value:t[a][i],display:t[a][n],selected:!1})};l(t.outboundFlights,"depatureAirport","originAirport","originAirportName",0),l(t.outboundFlights,"arrivalAirport","destinationAirport","destinationAirportName",t.outboundFlights.length-1),e.price.min=e.price.min<t.total.price?e.price.min:t.total.price,e.price.max=e.price.max>t.total.price?e.price.max:t.total.price,e.duration.min=e.duration.min<t.outboundTotalDuration?e.duration.min:t.outboundTotalDuration,e.duration.max=e.duration.max>t.outboundTotalDuration?e.duration.max:t.outboundTotalDuration;var c=u.default(t.outboundFlights[0].dateTimeDeparting).get("hour");e.departureTime.min=e.departureTime.min<c?e.departureTime.min:c,e.departureTime.max=e.departureTime.max>c?e.departureTime.max:c;var d=u.default(t.outboundFlights[t.outboundFlights.length-1].dateTimeArriving).get("hour");if(e.arrivalTime.min=e.arrivalTime.min<d?e.arrivalTime.min:d,e.arrivalTime.max=e.arrivalTime.max>d?e.arrivalTime.max:d,t.inboundFlights&&t.inboundFlights.length>0){e.returnDuration.min=e.returnDuration.min<t.inboundTotalDuration?e.returnDuration.min:t.inboundTotalDuration,e.returnDuration.max=e.returnDuration.max>t.inboundTotalDuration?e.returnDuration.max:t.inboundTotalDuration;var p=t&&t.inboundFlights&&t.inboundFlights[0]?u.default(t.inboundFlights[0].dateTimeDeparting).get("hour"):-1;e.returnDepartureTime.min=e.returnDepartureTime.min<p?e.returnDepartureTime.min:p,e.returnDepartureTime.max=e.returnDepartureTime.max>p?e.returnDepartureTime.max:p;var h=u.default(t.outboundFlights[t.outboundFlights.length-1].dateTimeArriving).get("hour");e.returnArrivalTime.min=e.returnArrivalTime.min<h?e.returnArrivalTime.min:h,e.returnArrivalTime.max=e.returnArrivalTime.max>h?e.returnArrivalTime.max:h,(t.inboundFlights||[]).forEach(a),l(t.inboundFlights,"depatureReturnAirport","originAirport","originAirportName",0),l(t.inboundFlights,"arrivalReturnAirport","destinationAirport","destinationAirportName",t.outboundFlights.length-1)}return e}),this.clone(t))},t.prototype.mapOverObject=function(e,t){return Object.entries(e).reduce((function(e,r){return e[r[0]]=t(r[1],r[0]),e}),{})},t.prototype.normaliseMinuteToBase10=function(e){return Math.round(100*e/60)},t.prototype.OBTFlightCabinClassToFlightCabinClass=function(t){var r;return((r={})[e.OBTFlightCabinClass.Business]=x.Business,r[e.OBTFlightCabinClass.BusinessBranded]=x.Business,r[e.OBTFlightCabinClass.EconomyFlexi]=x.EconomyFlexi,r[e.OBTFlightCabinClass.EconomyFlexiBranded]=x.EconomyFlexi,r[e.OBTFlightCabinClass.EconomyNoBags]=x.EconomyNoBags,r[e.OBTFlightCabinClass.EconomyNoBagsBranded]=x.EconomyNoBags,r[e.OBTFlightCabinClass.EconomyRestricted]=x.EconomyRestricted,r[e.OBTFlightCabinClass.EconomyRestrictedBranded]=x.EconomyRestricted,r[e.OBTFlightCabinClass.First]=x.First,r[e.OBTFlightCabinClass.FirstBranded]=x.First,r[e.OBTFlightCabinClass.PremiumEconomy]=x.PremiumEconomy,r[e.OBTFlightCabinClass.PremiumEconomyBranded]=x.PremiumEconomy,r)[t]},t.prototype.FlightCabinClassToBrandedOBTFlightCabinClass=function(t,r){var i,n;return(r?((i={})[x.PremiumEconomy]=e.OBTFlightCabinClass.PremiumEconomyBranded,i[x.PremiumBusiness]=e.OBTFlightCabinClass.BusinessBranded,i[x.LiteEconomy]=e.OBTFlightCabinClass.EconomyRestrictedBranded,i[x.Economy]=e.OBTFlightCabinClass.EconomyRestrictedBranded,i[x.PremiumFirst]=e.OBTFlightCabinClass.FirstBranded,i[x.EconomyRestricted]=e.OBTFlightCabinClass.EconomyRestrictedBranded,i[x.PremiumEconomy]=e.OBTFlightCabinClass.PremiumEconomyBranded,i[x.EconomyFlexi]=e.OBTFlightCabinClass.EconomyFlexiBranded,i[x.EconomyNoBags]=e.OBTFlightCabinClass.EconomyNoBagsBranded,i[x.Business]=e.OBTFlightCabinClass.BusinessBranded,i[x.First]=e.OBTFlightCabinClass.FirstBranded,i):((n={})[x.PremiumEconomy]=e.OBTFlightCabinClass.PremiumEconomy,n[x.PremiumBusiness]=e.OBTFlightCabinClass.Business,n[x.LiteEconomy]=e.OBTFlightCabinClass.EconomyRestricted,n[x.Economy]=e.OBTFlightCabinClass.EconomyRestricted,n[x.PremiumFirst]=e.OBTFlightCabinClass.First,n[x.EconomyRestricted]=e.OBTFlightCabinClass.EconomyRestricted,n[x.PremiumEconomy]=e.OBTFlightCabinClass.PremiumEconomy,n[x.EconomyFlexi]=e.OBTFlightCabinClass.EconomyFlexi,n[x.EconomyNoBags]=e.OBTFlightCabinClass.EconomyNoBags,n[x.Business]=e.OBTFlightCabinClass.Business,n[x.First]=e.OBTFlightCabinClass.First,n))[t]},t.prototype.convertMetresToMiles=function(e,t){void 0===t&&(t=-1);var r=e/1609;return t>=0?Number(r.toFixed(t)):r},t.prototype.convertSecondsToHours=function(e,t){void 0===t&&(t=-1);var r=e/60/60;return t>=0?Number(r.toFixed(t)):r},t.prototype.convertSecondsToMins=function(e,t){void 0===t&&(t=-1);var r=e/60;return t>=0?Number(r.toFixed(t)):r},t.prototype.addRailActionRules=function(e,t){return t.reduce((function(e,t){return null!=(null==t?void 0:t.unavailable)&&(e.unavailable=t.unavailable,e.unavailableMessage=t.unavailableMessage),e}),e)},t.prototype.map=function(e,t){return Object.assign.apply(Object,T([{}],Object.entries(e).map((function(e){var r,i=S(e,2),n=i[0],a=i[1];return(r={})[n]=t(a),r}))))},t.prototype.mergeObjects=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return s.default.merge(e,t)}),{})},t.prototype.interceptMethodCalls=function(e,t){return new Proxy(e,{get:function(e,r){return"function"==typeof e[r]?new Proxy(e[r],{apply:function(e,i,n){return t(r,n),Reflect.apply(e,i,n)}}):Reflect.get(e,r)}})},t.prototype.getRoundedDownQuarterHour=function(e){var t=e.minutes();return t<=15?e.set("minutes",0):t<=30?e.set("minutes",15):t<=45?e.set("minutes",30):e.set("minutes",45),e},t.prototype.getRoundedUpQuarterHour=function(e){var t=e.minutes();return t<=15?e.set("minutes",15):t<=30?e.set("minutes",30):t<=45?e.set("minutes",45):(e.set("minutes",0),e.add(1,"hour")),e},t}();je.READ_DATE_FORMAT="dd, D MMM YYYY",je.READ_TIME_FORMAT="HH:mm",je.DATE_FORMAT="YYMMDD",je.GRAPHQL_DATA_FORMAT_TIME="YYYY-MM-DD HH:mm:ss",je.ISO_DATA_FORMAT="YYYY-MM-DD",je.ISO_DATA_FORMAT_TIME="YYYY-MM-DD HH:mm",je.ISO_DATA_FORMAT_NO_HYPHANS="YYYYMMDD",je.TIME_FORMAT="HHmm",je.TIME_FORMAT_COLON="HH:mm",je.MMDDYY_DATE="DDMMYYYY",f([Ne(),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",Number)],je.prototype,"getTimeDifference",null),f([Ne(),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",String)],je.prototype,"dayDifference",null),f([Ne(),y("design:type",Function),y("design:paramtypes",[Object,Number]),y("design:returntype",void 0)],je.prototype,"makeFareRules",null),(Be=e.TaxiFormMode||(e.TaxiFormMode={})).ADDRESS="location",Be.STATION="station",(Le=e.AirportSearchMode||(e.AirportSearchMode={})).PICKUP="Airport Pick Up",Le.DROPOFF="Airport drop off",(Me=e.ActionType||(e.ActionType={})).GET="get",Me.SAVE="save",Me.DELETE="delete";var we,xe=function(r){function i(n,a,o,s,l){var c=r.call(this,o,a)||this;c.cabfetcher=n,c.searchService=s,c.basketService=l,c.type=te.Cab,c.airportChange=new t.Subject,c.transTypes=[{key:F.Any,value:"Any (1-8 Passengers)",id:8},{key:F.StandardCar,value:"Saloon Car (1-4 Passengers)",id:4},{key:F.BlackCab,value:"Hackney Carriage (1-4 Passengers)",id:4},{key:F.DdaCar,value:"Dda - wheelchair accessible (1-4 Passengers)",id:4},{key:F.MediumMpv,value:"People Carrier (1-7 Passengers)",id:7},{key:F.ExecutiveCar,value:"Executive (1-4 Passengers)",id:4}],c.attributes=[{enabled:!1,key:"wheelchair",value:"Wheelchair (On Request)"},{enabled:!1,key:"call_on_arrival",value:"Call On Arrival"},{enabled:!1,key:"meet_and_greet",value:"Meet And Greet (Charge Applies)"},{enabled:!1,key:"wait_and_return",value:"Wait And Return"}],c.searchTypes=["One-way","Return"],c.airportSearchTypes=["Airport drop off","Airport Pick Up"],c.criteria=["Pick Up Time"],c.mode=e.TaxiFormMode.ADDRESS,c.minSelectDate=u.default(),c.minReturnSelectDate={day:u.default().date(),month:u.default().month()+1,year:u.default().year()},c._date=null,c.selectedPlaces=[],c._vias=[null,null,null,null],c._searchType=c.searchTypes[0],c._airportSearchType=e.AirportSearchMode.DROPOFF,c._searchCriteria=c.criteria[0],c._outboundDateTime=c.helpers.round(u.default(),u.default.duration(15,"minutes")),c._returnDateTime=c.helpers.round(u.default(),u.default.duration(15,"minutes")),c._flightNumber="",c._terminal=null,c._time=null,c.resultsSessionName=i.STORAGE_SESSION_RESULTS,c.multiResultsSessionName=i.MULTI_STORAGE_SESSION_RESULTS,c.getPassengers=function(){var e=c.adults,t=c.children,r=e+" Adult";return 1!==Number(e)&&(r+="s"),1===Number(t)&&(r+=", "+t+" Child"),Number(t)>1&&(r+=", "+t+" Children"),r};var d=o.getSessionItem(i.STORAGE_SESSION_PARAMS)||{tempParams:{}};c.updateTempParams(s.makeCabHireQuery(d.tempParams));try{var p=o.getSessionItem(i.SECONDARY_STORAGE_SESSION_PARAMS);p&&(c.returnDateTime=u.default(p.tempParams.departs),c.searchType=c.searchTypes[1])}catch(e){console.error("+++ Error recovering return data: ",e," +++")}d.tempParams.fromAddress&&(c.fromAddress=d.tempParams.fromAddress),d.tempParams.toAddress&&(c.toAddress=d.tempParams.toAddress),s.shouldAddTravellerSubscription()&&s.travellerInformation.subscribe((function(e){c.travellers=e;var t=c.helpers.selectedTravellers(e,te.Cab);c.tempParams.adults=t.adults.length,c.tempParams.children=t.children.length,c._isValid()}));var h=o.getSessionItemAsList(c.resultsSessionName)||[];c.fullResults=h,c._cheapestResultPrice=c.updateLowestPrice(h),c.results.next(h||[]);var m=o.getSessionItemAsList(c.multiResultsSessionName)||[];return c.fullMultiResults=m,c.multiResults.next(m),c._isValid(),c.outboundVisibility=new t.BehaviorSubject(!1),c.inboundVisibility=new t.BehaviorSubject(!1),c}return m(i,r),Object.defineProperty(i.prototype,"fromLocation",{get:function(){return this._fromLocation},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"toLocation",{get:function(){return this._toLocation},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"date",{get:function(){return this._date},set:function(e){this._date=e,this._updateDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"searchType",{get:function(){return this._searchType},set:function(e){this._searchType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"airportSearchType",{get:function(){return this._airportSearchType},set:function(e){this._airportSearchType=e,(this.fromAddress||this.toAddress)&&this.switchFromAndToLocation()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fromLocationType",{get:function(){return this.tempParams.fromLocationType},set:function(e){this.tempParams.fromLocationType=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"toLocationType",{get:function(){return this.tempParams.toLocationType},set:function(e){this.tempParams.toLocationType=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"searchCriteria",{get:function(){return this._searchCriteria},set:function(e){this._searchCriteria=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outboundDateTime",{get:function(){return this._outboundDateTime},set:function(e){this._outboundDateTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"returnDateTime",{get:function(){return this._returnDateTime},set:function(e){this._returnDateTime=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"flightNumber",{get:function(){return this._flightNumber},set:function(e){this._flightNumber=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"airport",{get:function(){return this.tempParams.airport},set:function(e){this.tempParams.airport=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"terminal",{get:function(){return this._terminal},set:function(e){this._terminal=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"time",{get:function(){return this._time},set:function(e){this._time=e,this._updateDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"departs",{get:function(){return this.tempParams.departs},set:function(e){this.tempParams.departs=e.isValid?e:null,e&&e.isValid()&&(this._date=this.helpers.momentToNgDate(e),this._time=this.helpers.formatTimeColon(e)),this.minReturnSelectDate={day:u.default(e).date(),month:u.default(e).month()+1,year:u.default(e).year()},e.isAfter(this.returnDateTime)&&this.returnDateTime.set("date",e.date()),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"adults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"children",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"infants",{get:function(){return this.tempParams.infants},set:function(e){this.tempParams.infants=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"countryCode",{get:function(){return this.tempParams.countryCode},set:function(e){this.tempParams.countryCode=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"vias",{get:function(){return this._vias},set:function(e){this._vias=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viasFrom",{get:function(){return this.tempParams.viasFrom},set:function(e){this.tempParams.viasFrom=e,this._vias[0]=e?this.createCabHireLocation(e):null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"viasTo",{get:function(){return this.tempParams.viasTo},set:function(e){this.tempParams.viasTo=e,this._vias[1]=e?this.createCabHireLocation(e):null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"vehicleType",{get:function(){return this.tempParams.vehicleType},set:function(e){this.tempParams.vehicleType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fromAddress",{get:function(){return this.tempParams.fromAddress},set:function(e){this.tempParams.fromAddress=e,this._fromLocation=e?this.createCabHireLocation(e):null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fromStation",{get:function(){return this.tempParams.fromStation},set:function(e){this.tempParams.fromStation=e,this._fromLocation=e?{address:e.destination,postcode:e.postcode}:null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"toAddress",{get:function(){return this.tempParams.toAddress},set:function(e){this.tempParams.toAddress=e,this._toLocation=e?this.createCabHireLocation(e):null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"toStation",{get:function(){return this.tempParams.toStation},set:function(e){this.tempParams.toStation=e,this._toLocation=e?{address:e.destination,postcode:e.postcode}:null,this._isValid()},enumerable:!1,configurable:!0}),i.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeCabHireQuery());try{this.storageService.removeSessionItem(i.SECONDARY_STORAGE_SESSION_PARAMS)}catch(e){}this._searchType=this.searchTypes[0],this._isValid()},i.prototype.resetParams=function(){this.reset(),this.resetQuery(),this.results.next([]),this.multiResults.next([])},i.prototype._isValid=function(){this.doChecks&&(this.storageService.setSessionItem(i.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams}),this.validationMessages=[],this.tempParams.fromAddress||this.validationMessages.push("From - Enter a location or postcode."),this.tempParams.toAddress||this.validationMessages.push("To - Enter a location or postcode."),this.tempParams.departs.unix()<u.default().unix()&&this.validationMessages.push("Taxi journey cannot be in the past."),this.tempParams.adults+this.tempParams.children<1&&this.validationMessages.push("There must be at least 1 traveller"),this.searchType===this.searchTypes[1]&&this.returnDateTime.isSameOrBefore(this.departs)&&this.validationMessages.push("Return Date/Time must be after outbound date/time"),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages))},i.prototype._updateDateTime=function(){this._date&&this._time&&(this.departs=this.helpers.ngDateToMoment(this._date,this._time))},i.prototype.startSearch=function(){if(this.results.next([]),this.multiResults.next([]),this.isValid.value){if(this.searchType===this.searchTypes[1]){var e=this.getSearchQuery(),t=this.getReturnSearchQuery();return console.log("+++ Search Query: ",e," +++"),console.log("+++ Search Return Query: ",t," +++"),this.storageService.setSessionItem(i.SECONDARY_STORAGE_SESSION_PARAMS,{tempParams:t}),this._startMultiSearch([this.cabfetcher.fetchList(this.helpers.removeNulls(e)),this.cabfetcher.fetchList(this.helpers.removeNulls(t))])}e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(this.getSearchQuery())),this._startSearch(this.cabfetcher.fetchList(this.helpers.removeNulls(e)))}return Promise.resolve(!1)},i.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:te.Cab,searchArgs:t,travelDate:this.departs.format(),travellers:this.helpers.getTravellersId(this.travellers)}},i.prototype.updateSerchQuery=function(e){var t=e;return t.fromAddress=this.tempParams.fromAddress,t.toAddress=this.tempParams.toAddress,t.fromStation=this.tempParams.fromStation,t.toStation=this.tempParams.toStation,t.viasFrom=this.viasFrom,t.viasTo=this.viasTo,t},i.prototype.startRecentSearch=function(e){this.departs=u.default(e.searchArgs.departs),this.vehicleType=e.searchArgs.vehicleType,this.fromAddress=e.searchArgs.fromAddress,this.toAddress=e.searchArgs.toAddress,this.fromStation=e.searchArgs.fromStation,this.toStation=e.searchArgs.toStation,this._fromLocation=this.createCabHireLocation(this.fromAddress),this._toLocation=this.createCabHireLocation(this.toAddress),this.viasFrom=e.searchArgs.viasFrom,this.viasTo=e.searchArgs.viasTo,this.searchService.startSearches()},i.prototype.getSearchQuery=function(){var e={adults:this.tempParams.adults,children:this.tempParams.children,departs:this.tempParams.departs,fromLocation:this.createCabHireLocation(this.tempParams.fromAddress),toLocation:this.createCabHireLocation(this.tempParams.toAddress),infants:0,vehicleType:this.vehicleType,vias:this._vias};return this.helpers.removeNulls(e)},i.prototype.getReturnSearchQuery=function(){var e={adults:this.tempParams.adults,children:this.tempParams.children,departs:this._returnDateTime,fromLocation:this.createCabHireLocation(this.tempParams.toAddress),toLocation:this.createCabHireLocation(this.tempParams.fromAddress),infants:0,vehicleType:this.vehicleType,vias:this._vias};return this.helpers.removeNulls(e)},i.prototype.updateOutboundAddress=function(e,t){this.tempParams.fromAddress=this.getAddressFormat(e,t)},i.prototype.updateInboundAddress=function(e,t){this.tempParams.toAddress=this.getAddressFormat(e,t)},i.prototype.createCabHireLocation=function(e){return{address:[null==e?void 0:e.Terminal,null==e?void 0:e.House,null==e?void 0:e.Street,null==e?void 0:e.Town,null==e?void 0:e.Country].filter((function(e){return!!e})).join(","),postcode:null==e?void 0:e.PostCode}},i.prototype.matchAddresses=function(){this._toLocation=this.createCabHireLocation(this.tempParams.toAddress),this._fromLocation=this.createCabHireLocation(this.tempParams.fromAddress),this._isValid()},i.prototype.sortBy=function(e,t){if(t>=0){console.log("here");var r=this.helpers.clone(this.fullMultiResults[t]);r=e?r.sort((function(e,t){return t.price-e.price})):r.sort((function(e,t){return e.price-t.price})),this.fullMultiResults[t]=r,this.multiResults.next(this.fullMultiResults)}else{r=this.helpers.clone(this.fullResults);r=e?r.sort((function(e,t){return t.price-e.price})):r.sort((function(e,t){return e.price-t.price})),this.results.next(r)}},i.prototype.getAddressFormat=function(e,t){return{House:this.getAddressFromPlaceDetails(e,["floor","street_number","premise"]),Street:this.getAddressFromPlaceDetails(e,["route","street_name","establishment"]),Town:this.getAddressFromPlaceDetails(e,["postal_town","administrative_area_level_2","locality"]),PostCode:this.getAddressFromPlaceDetails(e,["postal_code"]),Country:this.getAddressFromPlaceDetails(e,["country"]),placeDescription:t}},i.prototype.getAddressFromPlaceDetails=function(e,t){var r,i,n=null;if(e&&Array.isArray(e)){var a=function(t){var r=e.filter((function(e){return Array.isArray(e.types)&&e.types.includes(t)}))[0];if(r)return n=r.long_name,"break"};try{for(var o=b(t),s=o.next();!s.done;s=o.next()){if("break"===a(s.value))break}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}}return n},i.prototype.getAddressFromAirportDetails=function(e,t){console.log(e);var r=null;return e&&(r={Country:e.country,Street:e.road,PostCode:e.postcode,Town:e.city,placeDescription:t,House:t}),r},i.prototype.setLocationFromAirport=function(t,r){var i=this.getAddressFromAirportDetails(t,r);this.mode===e.TaxiFormMode.STATION&&(this.airportSearchType===e.AirportSearchMode.PICKUP?this.fromAddress=i:this.toAddress=i)},i.prototype.addToSelectedPlaces=function(e){this.selectedPlaces.push(e)},i.prototype.setOutboundFormVisibility=function(e){this.outboundVisibility.next(e)},i.prototype.setInboundFormVisibility=function(e){this.inboundVisibility.next(e)},i.prototype.getOutboundFormVisibility=function(){return this.outboundVisibility},i.prototype.getInboundFormVisibility=function(){return this.inboundVisibility},i.prototype.updateFromPreviousSearches=function(e){var t;null===(t=e[te.Flight])||void 0===t||t.searchQuery},i.prototype.getTransType=function(){var e,t=this.tempParams.vehicleType;return(null===(e=this.transTypes.find((function(e){return e.key===t})))||void 0===e?void 0:e.value)||""},i.prototype.addCabHireToBasket=function(e,t){return g(this,void 0,void 0,(function(){var r,i,n;return v(this,(function(a){switch(a.label){case 0:return e.unavailable?[2,Promise.resolve(!1)]:[4,this.basketService.getDefaultBasket()];case 1:return r=a.sent(),i=null==r?void 0:r.subject.value,n=this.getTermsAndCond(e),i?[2,this.basketService.addToBasket({adults:t.adults,basket:i.id,service:e.sourceId.toString(),detail:{id:e.id,departs:e.departs,supplierName:e.supplierName,estimatedCO2:e.estimatedCO2,fromLocation:{address:t.fromLocation.address,postcode:t.fromLocation.postcode,latitude:e.fromLocation.latitude,longitude:e.fromLocation.longitude},toLocation:{address:t.toLocation.address,postcode:t.toLocation.postcode,latitude:e.toLocation.latitude,longitude:e.toLocation.longitude},vehicleType:t.vehicleType,tripDistanceMetres:e.tripDistanceMetres,tripDurationSeconds:e.tripDurationSeconds,termsAndCond:n},price:e.price,currency:e.currency,searchQuery:t,co2PerItem:e.co2PerItem,co2PerPassenger:e.co2PerPassenger,outboundDate:t.departs.format()},r,this.searchService,this.travellers)]:[2,Promise.resolve(!1)]}}))}))},i.prototype.switchFromAndToLocation=function(){var e=Object.assign({},this.toAddress),t=Object.assign({},this.fromAddress);this.fromAddress=e,this.toAddress=t},i.prototype.updateLowestPrice=function(e){if(!e.length)return null;var t=e[0].currency;return e.reduce((function(e,t){var r=t.price;return e.amount>r&&(e.amount=r),e}),{amount:Number.MAX_SAFE_INTEGER,currencyCode:t})},i.prototype.getTermsAndCond=function(e){var t=u.default(e.departs).format(je.ISO_DATA_FORMAT_TIME);return[{name:"Lowest Price",value:e.price.toString()+" "+e.currency},{name:"Pickup Time",value:t},{name:"Terms and Conditions",value:'<a target="_blank" href="https://www.cmacgroup.com/">www.cmacgroup.com</a>'}]},i.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:te.Cab,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},i}(c);xe.STORAGE_SESSION_PARAMS="search_cab",xe.SECONDARY_STORAGE_SESSION_PARAMS="secondary_search_cab",xe.STORAGE_SESSION_RESULTS="results_cab",xe.MULTI_STORAGE_SESSION_RESULTS="multi_results_cab",(we=e.SortTypesCar||(e.SortTypesCar={})).price="price",we.brand="brand",we.size="size",we.preferred="preferred",we.expensive="expensive";var Ue=function(i){function n(t,r,a,o,s,l){var c=i.call(this,s,a)||this;c.carhirefetcher=t,c.carHireAvailabilityDetailFetcher=r,c.basketService=o,c.searchService=l,c._carTypeCodes=[["B","2-3 Door",E.TwoToThreeDoor],["C","2/4 Door",E.TwoOrFourDoor],["D","4-5 Door",E.FourToFiveDoor],["W","Wagon / Estate",E.WagonOrEstate],["V","Passenger Van",E.PassengerVan],["L","Limousine",E.Limousine],["S","Sport",E.Sport],["T","Convertible",E.Convertible],["F","SUV",E.Suv],["J","Open Air All Terrain",E.OpenAirAllTerrain],["X","Special",E.Special],["P","Pickup Regular Cab",E.PickUpRegularCab],["Q","Pickup Extended Cab",E.PickUpExtendedCab],["Z","Special Offer Car",E.SpecialOfferCar],["E","Coupe",E.Coupe],["M","Monospace (Europe)",E.MonospaceEuropeanUse],["R","Recreational Vehicle",E.Suv],["H","Motor Home",E.MotorHome],["Y","2-Wheel Vehicle",E.TwoWheelVehicle],["N","Roadster",E.Roadster],["G","Crossover",E.Suv],["K","Commercial Van / Truck",E.PassengerVan]],c._carAirConditionTypes=[["Any","Any",null],["Y","Yes",!0],["N","No",!1]],c._withinDistance=[{name:"1 mile",value:"1"},{name:"2 miles",value:"2"},{name:"5 miles",value:"5"},{name:"10 miles",value:"10"},{name:"20 miles",value:"20"}],c._carTransmissionCodes=[["M","Manual",R.Manual],["N","Manual 4-Wheel Drive",R.Manual],["C","Manual All-Wheel Drive",R.Manual],["A","Automatic",R.Auto],["B","Automatic 4-Wheel Drive",R.Auto],["D","Automatic All- Wheel Drive",R.Auto]],c._vendors=[{code:"-",name:"Any"},{code:"AC",name:"Ace Rent A Car"},{code:"AD",name:"Advantage Rent A Car"},{code:"AL",name:"Alamo"},{code:"ZI",name:"Avis"},{code:"AT",name:"Atesa"},{code:"ZD",name:"Budget Rent A Car"},{code:"CI",name:"Citer Rent A Car"},{code:"ZR",name:"Dollar Rent A Car"},{code:"DF",name:"Driving Force"},{code:"EY",name:"Economy Rent A Car"},{code:"ET",name:"Enterprise"},{code:"EP",name:"Europcar"},{code:"IM",name:"Europcar Southafrica"},{code:"EZ",name:"Ez Rent A Car"},{code:"FF",name:"Firefly"},{code:"FX",name:"Fox Rent A Car"},{code:"GN",name:"Guerin Car Rental"},{code:"ZE",name:"Hertz"},{code:"LM",name:"L & M Car Rental"},{code:"LL",name:"Localiza"},{code:"MW",name:"Midway Car Rental"},{code:"ZL",name:"National Car Rental System"},{code:"NC",name:"Nextcar"},{code:"NU",name:"Nu Car Rentals"},{code:"ZA",name:"Payless Car Rental"},{code:"PR",name:"Priceless"},{code:"RW",name:"Rent A Wreck"},{code:"SX",name:"Sixt"},{code:"TE",name:"Tempest"},{code:"XF",name:"Test-S Cross Galileo"},{code:"XG",name:"Test-S Cross Trng"},{code:"ZT",name:"Thrifty Car Rental"},{code:"PM",name:"Travelport Test Code"},{code:"SV",name:"U-Save Auto Rental"},{code:"WF",name:"Woodford"}],c._car_classes=[{code:"M",name:"Mini",key:O.Mini,value:"10"},{code:"N",name:"Mini Elite",key:O.MiniElite,value:"20"},{code:"E",name:"Economy",key:O.Economy,value:"30"},{code:"H",name:"Economy Elite",key:O.EconomyElite,value:"40"},{code:"C",name:"Compact",key:O.Compact,value:"50"},{code:"D",name:"Compact Elite",key:O.CompactElite,value:"60"},{code:"I",name:"Intermediate",key:O.Intermediate,value:"70"},{code:"J",name:"Intermediate Elite",key:O.IntermediateElite,value:"80"},{code:"S",name:"Standard",key:O.Standard,value:"90"},{code:"R",name:"Standard Elite",key:O.StandardElite,value:"100"},{code:"F",name:"Full Size",key:O.Fullsize,value:"110"},{code:"G",name:"Full Size Elite",key:O.FullsizeElite,value:"120"},{code:"P",name:"Premium",key:O.Premium,value:"130"},{code:"U",name:"Premium Elite",key:O.PremiumElite,value:"140"},{code:"L",name:"Luxury",key:O.Luxury,value:"150"},{code:"W",name:"Luxury Elite",key:O.LuxuryElite,value:"160"},{code:"O",name:"Oversize",key:O.Oversize,value:"170"},{code:"X",name:"Special",key:O.Special,value:"180"}],c._location_types=[e.LocationTypes.City,e.LocationTypes.Airport,e.LocationTypes.Postcode],c.carClassMap={mini:0,"mini elite":1,economy:2,"economy elite":3,compact:4,"compact special":5,"compact elite":6,intermediate:7,"intermediate elite":8,standard:9,"standard elite":10,"full size":11,"full size elite":12,premium:13,"premium elite":14,luxury:15,"luxury elite":16,oversize:17,special:18},c.type=te.Car,c._sorting_options=[{value:0,display:"Cheapest First"},{value:1,display:"Most Expensive First"},{value:2,display:"Preferred First"}],c._minDate={day:u.default().date(),month:u.default().month()+1,year:u.default().year()},c._minInDate={day:u.default().date(),month:u.default().month()+1,year:u.default().year()},c._pickup_date=null,c._pickup_time=null,c._dropoff_date=null,c._dropoff_time=null,c.resultsSessionName=n.STORAGE_SESSION_RESULTS,c.multiResultsSessionName=n.STORAGE_SESSION_RESULTS;var d=s.getSessionItem(n.STORAGE_SESSION_PARAMS)||{tempParams:{}};c.updateTempParams(l.makeCarHireQuery(d.tempParams)),l.shouldAddTravellerSubscription()&&l.travellerInformation.subscribe((function(e){var t=c.helpers.selectedTravellers(e,te.Car);c.adults=t.adults.length,c.children=t.children.length,c.travellers=e,c._isValid()}));var p=s.getSessionItemAsList(c.resultsSessionName)||[];return c.fullResults=a.clone(p||[]),c._cheapestResultPrice=c.updateLowestPrice(p),c.results.next(p),c}return m(n,i),Object.defineProperty(n.prototype,"adults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"children",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"estimatedMileage",{get:function(){return this.tempParams.estimatedMileage},set:function(e){this.tempParams.estimatedMileage=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickupTime",{get:function(){return this._pickupTime},set:function(e){this._pickupTime=e,this._updateNgbPickupDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoffTime",{get:function(){return this._dropoffTime},set:function(e){this._dropoffTime=e,this._updateNgbDropoffDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"postcodePickupRaw",{get:function(){return this.tempParams.postcodePickupRaw},set:function(e){this.tempParams.postcodePickupRaw=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"postcodeDropoffRaw",{get:function(){return this.tempParams.postcodeDropoffRaw},set:function(e){this.tempParams.postcodeDropoffRaw=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cityPickupDepot",{get:function(){return this.tempParams.cityPickupDepot},set:function(e){this.tempParams.cityPickupDepot=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cityDropoffDepot",{get:function(){return this.tempParams.cityDropoffDepot},set:function(e){this.tempParams.cityDropoffDepot=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"postcodePickup",{get:function(){return this.tempParams.postcodePickup},set:function(t){this.tempParams.postcodePickup=t,this.tempParams.postcodePickup&&(this.tempParams.locationType=e.LocationTypes.Postcode),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"postcodeDropoff",{get:function(){return this.tempParams.postcodeDropoff},set:function(e){this.tempParams.postcodeDropoff=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cityPickup",{get:function(){return this.tempParams.cityPickup},set:function(t){this.tempParams.cityPickup=t,this.tempParams.cityPickup&&(this.tempParams.locationType=e.LocationTypes.City,console.log(this.tempParams.locationType)),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cityDropoff",{get:function(){return this.tempParams.cityDropoff},set:function(e){this.tempParams.cityDropoff=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"minDate",{get:function(){return this._minDate},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"minInDate",{get:function(){return this._minInDate},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickup_country",{get:function(){return this.tempParams.pickup_country},set:function(e){this.tempParams.pickup_country=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoff_country",{get:function(){return this.tempParams.dropoff_country},set:function(e){this.tempParams.dropoff_country=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickup_location",{get:function(){return this.tempParams.pickup_location},set:function(t){this.tempParams.pickup_location=t,this.tempParams.pickup_location&&(this.tempParams.locationType=e.LocationTypes.Airport),this.return_to_pickup&&(this.dropoff_location=t),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoff_location",{get:function(){return this.tempParams.dropoff_location},set:function(e){this.tempParams.dropoff_location=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ngbPickupDate",{get:function(){return this._ngbPickupDate},set:function(e){this._ngbPickupDate=e,this._updateNgbPickupDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ngbDropoffDate",{get:function(){return this._ngbDropoffDate},set:function(e){this._ngbDropoffDate=e,this._updateNgbDropoffDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickup_datetime",{get:function(){return this.tempParams.pickup_datetime},set:function(e){this.tempParams.pickup_datetime=e;try{e&&e.isValid()&&(this._ngbPickupDate=this.helpers.momentToNgDate(e),this._pickupTime=u.default(e).format("HH:mm")?u.default(e).format("HH:mm"):"07:30"),this._minInDate={day:e.date(),month:e.month()+1,year:e.year()},e.isSameOrAfter(this.tempParams.dropoff_datetime)&&(this.dropoff_datetime=this.dropoff_datetime.set("date",e.date()).set("month",e.month()).set("year",e.year()))}catch(e){}this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoff_datetime",{get:function(){return this.tempParams.dropoff_datetime},set:function(e){this.tempParams.dropoff_datetime=e,e&&e.isValid()&&(this._ngbDropoffDate=this.helpers.momentToNgDate(e),this._dropoffTime=u.default(e).format("HH:mm")?u.default(e).format("HH:mm"):"08:30"),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickup_date",{get:function(){return this._pickup_date},set:function(e){this._pickup_date=e,this._updatePickupDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pickup_time",{get:function(){return this._pickup_time},set:function(e){this._pickup_time=e,this._updatePickupDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoff_date",{get:function(){return this._dropoff_date},set:function(e){this._dropoff_date=e,this._updateDropoffDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dropoff_time",{get:function(){return this._dropoff_time},set:function(e){this._dropoff_time=e,this._updateDropoffDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"return_to_pickup",{get:function(){return this.tempParams.return_to_pickup},set:function(e){this.tempParams.return_to_pickup=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenVendor",{get:function(){return this.tempParams.chosenVendor},set:function(e){this.tempParams.chosenVendor=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenDistance",{get:function(){return this.tempParams.chosenDistance},set:function(e){this.tempParams.chosenDistance=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carClass",{get:function(){return this.tempParams.carClass},set:function(e){this.tempParams.carClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carType",{get:function(){return this.tempParams.carType},set:function(e){this.tempParams.carType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"transmission",{get:function(){return this.tempParams.transmission},set:function(e){this.tempParams.transmission=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"airCon",{get:function(){return this.tempParams.airCon},set:function(e){this.tempParams.airCon=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"locationType",{get:function(){return this.tempParams.locationType},set:function(e){this.tempParams.locationType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"timeArray",{get:function(){return this._timeArray=this._timeArray||Array(96).fill(0).map((function(e,t){return{value:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0"),display:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0")}})),this._timeArray},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carAirConditionTypes",{get:function(){return this._carAirConditionTypes},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"withinDistance",{get:function(){return this._withinDistance},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carTransmissionCodes",{get:function(){return this._carTransmissionCodes},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carTypeCodes",{get:function(){return this._carTypeCodes},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"vendors",{get:function(){return this._vendors},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sortingOptions",{get:function(){return this._sorting_options},enumerable:!1,configurable:!0}),n.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeCarHireQuery()),this.estimatedMileage=null,this._isValid()},n.prototype._isValid=function(){var t,r,i;if(this.doChecks){switch(this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams}),this.validationMessages=[],this.locationType){case e.LocationTypes.Airport:this.pickup_location&&this.pickup_location.destination||this.validationMessages.push("Please supply a pickup location"),this.dropoff_location&&this.dropoff_location.destination||this.validationMessages.push("Please supply a dropoff location");break;case e.LocationTypes.City:this.cityPickup||this.validationMessages.push("Please supply a pickup city"),this.cityDropoff||this.validationMessages.push("Please supply a dropoff city");break;case e.LocationTypes.Postcode:this.postcodePickup||this.validationMessages.push("Please supply a pickup depot"),this.postcodeDropoff||this.validationMessages.push("Please supply a dropoff depot")}this.estimatedMileage&&this.estimatedMileage<=0&&this.validationMessages.push("Estimated Milage must be a positive number.");try{this.pickup_datetime||this.validationMessages.push("Please supply a pickup time and date"),this.dropoff_datetime||this.validationMessages.push("Please supply a drop off time and date"),(null===(t=this.dropoff_datetime)||void 0===t?void 0:t.isSameOrBefore(this.pickup_datetime,"minute"))&&this.validationMessages.push("Dropoff date/time cannot be before or the same as pickup date/time"),(null===(r=this.pickup_datetime)||void 0===r?void 0:r.isBefore(u.default()))&&this.validationMessages.push("Pickup date/time must be after present date/time"),(null===(i=this.dropoff_datetime)||void 0===i?void 0:i.isBefore(u.default()))&&this.validationMessages.push("Dropoff date/time must be after present date/time")}catch(e){}this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages)}},n.prototype.startSearch=function(){if(this.results.next([]),this.isValid.value){var e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(this.getSearchQuery())),this._startSearch(this.carhirefetcher.fetchList(this.helpers.removeNulls(e)))}return Promise.resolve(!1)},n.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:te.Car,searchArgs:t,travelDate:this.pickup_datetime.format(),travellers:this.helpers.getTravellersId(this.travellers)}},n.prototype.updateSerchQuery=function(t){var r=t;switch(this.locationType){case e.LocationTypes.City:r.city={pickupName:this.cityPickup.name,pickupCountryCode:this.cityPickup.countryCode,pickupCity:this.cityPickup.id.toString(),pickupLatitude:this.cityPickup.latitude,pickupLongitude:this.cityPickup.longitude,dropOffName:this.cityDropoff.name,dropoffCountryCode:this.cityDropoff.countryCode,dropoffCity:this.cityDropoff.id.toString(),dropOffLatitude:this.cityDropoff.latitude,dropOffLongitude:this.cityDropoff.longitude,pickupAddressLines:this.cityPickupDepot.addressLines[0],pickupCityName:this.cityPickupDepot.cityName,pickupExtendedLocationCode:this.cityPickupDepot.extendedLocationCode,pickupLocationCode:this.cityPickupDepot.locationCode,pickupVendor:this.cityPickupDepot.vendor,pickupVendorCode:this.cityPickupDepot.vendorCode,chosenDistance:this.chosenDistance,dropOffAddressLines:this.cityDropoffDepot.addressLines[0],dropOffCityName:this.cityDropoffDepot.cityName,dropOffExtendedLocationCode:this.cityDropoffDepot.extendedLocationCode,dropOffLocationCode:this.cityDropoffDepot.locationCode,dropOffVendor:this.cityDropoffDepot.vendor,dropOffVendorCode:this.cityDropoffDepot.vendorCode};break;case e.LocationTypes.Postcode:r.depot={vendorCode:this.postcodePickup.vendorCode,pickupLocationCode:this.postcodePickup.locationCode,pickupExtendedLocationCode:this.postcodePickup.extendedLocationCode,pickupAddressLines:this.postcodePickup.addressLines[0],pickupCityName:this.postcodePickup.cityName,pickupVendor:this.postcodePickup.vendor,dropOffLocationCode:this.postcodeDropoff.locationCode,dropOffExtendedLocationCode:this.postcodeDropoff.extendedLocationCode,dropoffAddressLines:this.postcodeDropoff.addressLines[0],dropoffCityName:this.postcodeDropoff.cityName,dropoffVendor:this.postcodeDropoff.vendor,chosenDistance:this.chosenDistance,pickupPostCode:this.postcodePickupRaw.name,pickupLatitude:this.postcodePickupRaw.latitude,pickupLongitude:this.postcodePickupRaw.longitude,dropoffPostCode:this.postcodeDropoffRaw.name,dropoffLatitude:this.postcodeDropoffRaw.latitude,dropoffLongitude:this.postcodeDropoffRaw.longitude}}return r},n.prototype.startRecentSearch=function(e){this.chosenVendor=e.searchArgs.vendor,this.carClass=e.searchArgs.class,this.carType=e.searchArgs.type,this.transmission=e.searchArgs.transmission,this.airCon=e.searchArgs.aircon,this.estimatedMileage=e.searchArgs.estimatedDailyDistance,this.dropoff_datetime=u.default(e.searchArgs.dropoffDateTime),this.pickup_datetime=u.default(e.searchArgs.pickupDateTime),e.searchArgs.city?this.getParamsForCarbyCity(e):e.searchArgs.airport?this.getParamsForCarbyAirport(e):e.searchArgs.depot&&this.getParamsForCarbyPostCode(e)},n.prototype.getParamsForCarbyAirport=function(r){var i=this;this.locationType=e.LocationTypes.Airport,t.combineLatest([this.searchService.getAirportByCode(r.searchArgs.airport.pickupCode),this.searchService.getAirportByCode(r.searchArgs.airport.dropoffCode)]).subscribe((function(e){var t,r,n,a,o,s,u,l,c,d,p,h,m=S(e,2),f=m[0],y=m[1];f&&y&&(i.dropoff_location={destination:f.iataMatch.name,gateway:f.iataMatch.iata,terminals:i.searchService.processTerminals(y.iataMatch.terminals),country:null===(r=null===(t=f.iataMatch)||void 0===t?void 0:t.locationDetails)||void 0===r?void 0:r.country,postcode:null===(a=null===(n=f.iataMatch)||void 0===n?void 0:n.locationDetails)||void 0===a?void 0:a.postcode,countryCode:null===(s=null===(o=f.iataMatch)||void 0===o?void 0:o.locationDetails)||void 0===s?void 0:s.countryCode},i.pickup_location={destination:y.iataMatch.name,gateway:y.iataMatch.iata,terminals:i.searchService.processTerminals(y.iataMatch.terminals),country:null===(l=null===(u=y.iataMatch)||void 0===u?void 0:u.locationDetails)||void 0===l?void 0:l.country,postcode:null===(d=null===(c=y.iataMatch)||void 0===c?void 0:c.locationDetails)||void 0===d?void 0:d.postcode,countryCode:null===(h=null===(p=y.iataMatch)||void 0===p?void 0:p.locationDetails)||void 0===h?void 0:h.countryCode},i.dropoff_country=i.dropoff_location.countryCode,i.pickup_country=i.pickup_location.countryCode,i.searchService.startSearches())}))},n.prototype.getParamsForCarbyCity=function(t){this.locationType=e.LocationTypes.City,this.chosenDistance=t.searchArgs.city.chosenDistance,this.cityPickup={countryCode:t.searchArgs.city.pickupCountryCode,id:t.searchArgs.city.pickupCity,name:t.searchArgs.city.pickupName,type:e.LocationTypes.City,latitude:t.searchArgs.city.pickupLatitude,longitude:t.searchArgs.city.pickupLongitude},this.cityDropoff={countryCode:t.searchArgs.city.dropoffCountryCode,id:t.searchArgs.city.dropoffCity,name:t.searchArgs.city.dropOffName,type:e.LocationTypes.City,latitude:t.searchArgs.city.dropOffLatitude,longitude:t.searchArgs.city.dropOffLongitude},this.cityDropoffDepot={addressLines:[t.searchArgs.city.dropOffAddressLines],cityName:t.searchArgs.city.dropOffCityName,extendedLocationCode:t.searchArgs.city.dropOffExtendedLocationCode,locationCode:t.searchArgs.city.dropOffLocationCode,vendor:t.searchArgs.city.dropOffVendor,vendorCode:t.searchArgs.city.dropOffVendorCode},this.cityPickupDepot={addressLines:[t.searchArgs.city.pickupAddressLines],cityName:t.searchArgs.city.pickupCityName,extendedLocationCode:t.searchArgs.city.pickupExtendedLocationCode,locationCode:t.searchArgs.city.pickupLocationCode,vendor:t.searchArgs.city.pickupVendor,vendorCode:t.searchArgs.city.pickupVendorCode},this.searchService.startSearches()},n.prototype.getParamsForCarbyPostCode=function(t){this.locationType=e.LocationTypes.Postcode,this.chosenDistance=t.searchArgs.depot.chosenDistance,this.postcodeDropoff={addressLines:[t.searchArgs.depot.dropoffAddressLines],vendorCode:t.searchArgs.depot.vendorCode,locationCode:t.searchArgs.depot.dropOffLocationCode,extendedLocationCode:t.searchArgs.depot.dropOffExtendedLocationCode,cityName:t.searchArgs.depot.dropoffCityName,vendor:t.searchArgs.depot.dropoffVendor},this.postcodeDropoffRaw={name:t.searchArgs.depot.dropoffPostCode,type:e.LocationTypes.Postcode,latitude:t.searchArgs.depot.dropoffLatitude,longitude:t.searchArgs.depot.dropoffLongitude},this.postcodePickup={addressLines:[t.searchArgs.depot.pickupAddressLines],vendorCode:t.searchArgs.depot.vendorCode,locationCode:t.searchArgs.depot.pickupLocationCode,extendedLocationCode:t.searchArgs.depot.pickupExtendedLocationCode,cityName:t.searchArgs.depot.pickupCityName,vendor:t.searchArgs.depot.pickupVendor},this.postcodePickupRaw={name:t.searchArgs.depot.pickupPostCode,type:e.LocationTypes.Postcode,latitude:t.searchArgs.depot.pickupLatitude,longitude:t.searchArgs.depot.pickupLongitude},this.searchService.startSearches()},n.prototype.getSearchQuery=function(){var t={};switch(this.locationType){case e.LocationTypes.Airport:t.airport={pickupCode:"",dropoffCode:""},t.airport.pickupCode=this.pickup_location.gateway,t.airport.dropoffCode=this.return_to_pickup?this.pickup_location.gateway:this.dropoff_location.gateway;break;case e.LocationTypes.City:t.depot={vendorCode:this.cityPickupDepot.vendorCode,pickupLocationCode:this.cityPickupDepot.locationCode,pickupExtendedLocationCode:this.cityPickupDepot.extendedLocationCode,dropOffLocationCode:this.cityDropoffDepot.locationCode,dropOffExtendedLocationCode:this.cityDropoffDepot.extendedLocationCode};break;case e.LocationTypes.Postcode:t.depot={vendorCode:this.postcodePickup.vendorCode,pickupLocationCode:this.postcodePickup.locationCode,pickupExtendedLocationCode:this.postcodePickup.extendedLocationCode,dropOffLocationCode:this.postcodeDropoff.locationCode,dropOffExtendedLocationCode:this.postcodeDropoff.extendedLocationCode}}return t.dropoffDateTime=this.helpers.formatGraphQLDateTime(this.dropoff_datetime),t.pickupDateTime=this.helpers.formatGraphQLDateTime(this.pickup_datetime),t.aircon=this.airCon,this.locationType===e.LocationTypes.Airport&&(t.vendor="-"===this.chosenVendor?null:this.chosenVendor),t.transmission=this.transmission||null,t.class=this.carClass||null,t.type=this.carType||null,t.estimatedDailyDistance=this.estimatedMileage||null,t.estimatedDailyDistanceUnits=this.estimatedMileage?B.M:null,this.helpers.removeNulls(t)},n.prototype.getCarClasses=function(){return t.of(this._car_classes)},n.prototype.getLocationTypes=function(){return t.of(this._location_types)},n.prototype.filterResults=function(e,t){var r=this,i=this.helpers.clone(this.fullResults);i=i.filter((function(t){var i=r.getPrice(t);return i>=e.minPrice&&i<=e.maxPrice})),i=this.filterByTransmissionType(e.transmissions,i),i=this.filterByAirconType(e.airConditioning,i),i=this.filterByCarType(e.types,i),i=this.filterByCompany(e.companies,i),i=this.sortResults(t,i),this.results.next(i)},n.prototype.filterByCompany=function(e,t){var r=e.filter((function(e){return e.selected}));return r.length&&(t=t.filter((function(e){return r.find((function(t){return t.value.toString().toLowerCase()===e.identifiers.vendor.toLowerCase()}))}))),t},n.prototype.filterByCarType=function(e,t){var r=e.filter((function(e){return e.selected}));return r.length&&(t=t.filter((function(e){return r.find((function(t){return t.value.toString().toLowerCase()===e.displayRecord.vehicle.class.toLowerCase()}))}))),t},n.prototype.filterByTransmissionType=function(e,t){var r=e.find((function(e){return e.selected}));if(r&&"Y"!==r.value)try{t=t.filter((function(e){return e.identifiers.vehType[2].toLowerCase()===r.value.toString().toLowerCase()}))}catch(e){console.error("+++ Error filtering transmissions: "+e+" +++")}return t},n.prototype.filterByAirconType=function(e,t){var r=e.find((function(e){return e.selected}));if(r&&"A"!==r.value)try{t=t.filter((function(e){return e.identifiers.vehType[3].toLowerCase()===r.value.toString().toLowerCase()}))}catch(e){console.error("+++ Error filtering aircons: "+e+" +++")}return t},n.prototype.sortResults=function(e,t){var r=this,i=this.helpers.clone(t||this.results.value);switch(e){case 0:i=i.sort((function(e,t){return r.getPrice(e)-r.getPrice(t)}));break;case 1:i=i.sort((function(e,t){return r.getPrice(t)-r.getPrice(e)}));break;case 2:break;case 3:i=this.sortByBrand(i);break;case 4:i=this.sortBySize(i)}return this.results.next(i),i},n.prototype.sortExpensive=function(e){var t=this,r=this.helpers.clone(e||this.results.value).sort((function(e,r){return t.getPrice(r)-t.getPrice(e)}));return this.results.next(r),r},n.prototype.sortCheapest=function(e){var t=this,r=this.helpers.clone(e||this.results.value).sort((function(e,r){return t.getPrice(e)-t.getPrice(r)}));return this.results.next(r),r},n.prototype.sortBySize=function(e){var t=this,r=this.helpers.clone(e||this.results.value).sort((function(e,r){var i,n;return i=t.carClassMap[e.displayRecord.vehicle.class.toLowerCase()],n=t.carClassMap[r.displayRecord.vehicle.class.toLowerCase()],i>=0&&n>=0?i-n:-1}));return this.results.next(r),r},n.prototype.sortByBrand=function(e){var t=this.helpers.clone(e||this.results.value).sort((function(e,t){var r=e.identifiers.vendor,i=t.identifiers.vendor;switch(r){case"ZE":r="HE";break;case"ZI":r="AV"}switch(i){case"ZE":i="HE";break;case"ZI":i="AV"}return r<i?-1:r>i?1:0}));return this.results.next(t),t},n.prototype.getPrice=function(e){try{return Number(e.displayRecord.charges[0].amount)}catch(e){}return 0},n.prototype.getMinPrice=function(e){var t=this;return e.reduce((function(e,r){var i=t.getPrice(r);return i<e&&(e=i),e}),Number.MAX_SAFE_INTEGER)},n.prototype.getMaxPrice=function(e){var t=this;return e.reduce((function(e,r){var i=t.getPrice(r);return i>e&&(e=i),e}),Number.MIN_SAFE_INTEGER)},n.prototype.updateFromPreviousSearches=function(t){var r;if(console.log("PREPOPULATING CARHIRE FORM"),null===(r=t[te.Flight])||void 0===r?void 0:r.searchQuery)try{var i=this.searchService.searches[te.Flight].outBoundDate.toDate(),n=this.searchService.searches[te.Flight].inboundDate.toDate();this.locationType=e.LocationTypes.Airport,this.pickup_datetime=this.searchService.searches[te.Flight].outBoundDate,this.dropoff_datetime=this.searchService.searches[te.Flight].inboundDate,this.pickup_date={day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()},this.dropoff_date={day:n.getUTCDate(),month:n.getUTCMonth()+1,year:n.getUTCFullYear()},this.pickup_location=this.searchService.searches[te.Flight].arriveLocation,this.dropoff_location=this.searchService.searches[te.Flight].arriveLocation,this.pickup_country=this.searchService.searches[te.Flight].arriveLocation.countryCode,this.dropoff_country=this.searchService.searches[te.Flight].arriveLocation.countryCode}catch(e){console.error("Error trying to prepopulate carhire from flight item")}},n.prototype._updatePickupDateTime=function(){if(this._pickup_date&&this._pickup_time){var e=this.helpers.ngDateToMoment(this._pickup_date,this._pickup_time);this.pickup_datetime=e.isValid()?e:null,this._isValid()}},n.prototype._updateDropoffDateTime=function(){if(this._dropoff_date&&this._dropoff_time){var e=this.helpers.ngDateToMoment(this._dropoff_date,this._dropoff_time);this.dropoff_datetime=e.isValid()?e:null,this._isValid()}},n.prototype._updateNgbPickupDateTime=function(){if(this._ngbPickupDate&&this._pickupTime){var e=this.helpers.ngDateToMoment(this._ngbPickupDate,this._pickupTime);this.pickup_datetime=e.isValid()?e:null,this._isValid()}},n.prototype._updateNgbDropoffDateTime=function(){if(this._ngbDropoffDate&&this._dropoffTime){var e=this.helpers.ngDateToMoment(this._ngbDropoffDate,this._dropoffTime);this.dropoff_datetime=e.isValid()?e:null,this._isValid()}},n.prototype.isOverNight=function(){var e=this.pickup_datetime.date();return this.dropoff_datetime.date()-e>=1},n.prototype.updateLowestPrice=function(e){return e.length?{amount:this.getMinPrice(e),currencyCode:e[0].displayRecord.charges[0].currencyCode}:null},n.prototype.getCarHireAvailabilityDetail=function(e,t){return t.value||t.next(!0),this.carHireAvailabilityDetailFetcher.fetchList({locationDetails:e}).pipe(r.take(1),r.map((function(e){return t.value&&t.next(!1),e})))},n.prototype.addCarHireToBasket=function(t,r){var i,n;return g(this,void 0,void 0,(function(){var a,o,s,u,l,c,d,p,h;return v(this,(function(m){switch(m.label){case 0:return t.unavailable?[2,Promise.resolve(!1)]:[4,this.basketService.getDefaultBasket()];case 1:return a=m.sent(),(o=null==a?void 0:a.subject.value)?(s=t.co2PerItem,u=t.co2PerPassenger,l=t.displayRecord,c=t.identifiers,d=t.sourceId,p=parseFloat(null!==(n=null===(i=null==l?void 0:l.charges[0])||void 0===i?void 0:i.amount)&&void 0!==n?n:"0"),h=this.getTermsAndCond(t,r),[2,this.basketService.addToBasket({adults:this.adults,basket:o.id,service:d.toString(),detail:{pickUpDatetime:l.pickup,dropOffDatetime:l.dropoff,pickUpLocation:{iata:this.locationType===e.LocationTypes.Airport?c.locationCode:"",name:l.pickupLocation.name,address:l.pickupLocation.topLine+", "+l.pickupLocation.city,postcode:l.pickupLocation.postCode},dropOffLocation:{iata:this.locationType===e.LocationTypes.Airport?c.dropOffLocation:"",name:l.returnLocation.name,address:l.returnLocation.topLine+", "+l.returnLocation.city,postcode:l.returnLocation.postCode},car:{type:l.vehicle.type,manualTransmission:l.vehicle.transmission.includes(R.Manual)},vendorName:l.vendor.name,identifiers:{dropOffLocation:c.dropOffLocation,locationCode:c.locationCode,locationName:c.locationName,vehType:c.vehType,vendor:c.vendor},termsAndCond:h},price:p,currency:"GBP",searchQuery:r,co2PerItem:s,co2PerPassenger:u,outboundDate:new Date(l.pickup).toISOString()},a,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},n.prototype.getTermsAndCond=function(e,t){return[{name:"Additional Driver",value:""},{name:"Age Requirements",value:""},{name:"Cross Border Policy",value:""},{name:"Damage Waiver",value:""},{name:"Debit Card Policy",value:""},{name:"One Way Drop Policy",value:""},{name:"Extended Protection",value:""},{name:"Excess Protection",value:""},{name:"Inclusive Policy",value:""},{name:"Mileage Policy",value:""},{name:"Miscellaneous Policy",value:""},{name:"Forms of Payment",value:""},{name:"Roadside Protection",value:""},{name:"Renter Requirements",value:""},{name:"Third Party Liability",value:""}]},n.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:te.Car,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},n}(c);Ue.STORAGE_SESSION_PARAMS="carhire_params",Ue.STORAGE_SESSION_RESULTS="carhire_results";var Ve,Ge=function(){this.numberHotelToPreload=Number.MAX_SAFE_INTEGER,this.numberOfHotelsToFetch=5,this.autoFetchHotelTimeout=50,this.autoLogoutTime=60,this.hotelAvalibilityTimeout=2e3,this.maxBasketNumber=5,this.searchTimeout=3e4,this.groupMax=0},He=function(e){},Qe={next:He},Je=function(){function e(){this.events={}}return e.prototype.getEmmitter=function(e){return this.events[e]=this.events[e]||new t.Subject,this.events[e]},e.prototype.emit=function(e,t){(this.events[e]||Qe).next(t)},e}();(Ve=e.FlightDisplayTypes||(e.FlightDisplayTypes={}))[Ve.returns=1]="returns",Ve[Ve.dualSingles=2]="dualSingles";var We,Ye=Object.freeze({stops:{},totalStops:{},mustInclude:{},classes:{},airlines:{},travelPolicy:{},depatureAirport:{},depatureReturnAirport:{},arrivalAirport:{},arrivalReturnAirport:{},baggage:{},fareTypes:{},price:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},duration:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},returnDuration:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},departureTime:{min:0,max:24},arrivalTime:{min:0,max:24},returnDepartureTime:{min:0,max:24},returnArrivalTime:{min:0,max:24},flightNumber:""});(We=e.FlightSearchType||(e.FlightSearchType={})).return="return",We.oneWay="oneWay",We.multiCity="multiCity";var Ke=function(e){this.value=e};Ke.MaxFlightClass=new Ke("MaxFlightClass"),Ke.SSO_no_password=new Ke("SSO_no_password"),Ke.HideFlightCabinClasses=new Ke("hideFlightCabinClasses"),Ke.AlternativeRailItineraryEnabled=new Ke("alternativeRailItineraryEnabled"),Ke.riskMinimumLevel=new Ke("riskMinimumLevel"),Ke.ENABLE_CHATBOT=new Ke("enableChatbot");var ze=function(e){this.value=e};ze.non=new ze("non"),ze.EVI=new ze("evi");var Xe,qe;(Xe=e.TimeWindow||(e.TimeWindow={})).Anytime="Anytime",Xe.Depart="Depart By",Xe.Arrive="Arrive By",(qe=e.FlightSortTypes||(e.FlightSortTypes={})).Cheapest="Cheapest",qe.MostExpensive="Most Expensive",qe.Fastest="Fastest",qe.Preferred="Preferred",qe.LowestEmissions="Lowest Emissions",qe.DepartureTime="Departure Time",qe.ArrivalTime="Arrival Time",qe.Quickest="Quickest",qe.MostDirect="Most Direct";var Ze,$e=function(i){function n(r,a,o,s,l,c,d,p){var h,m,f=i.call(this,l,a)||this;f.flightfetcher=r,f.userService=o,f.basketService=s,f.searchService=c,f.applyFlightRules=d,f.modalService=p,f.type=te.Flight,f.avaliableClasses=new t.BehaviorSubject([]),f.timeCriteriaOptions=new t.BehaviorSubject([]),f.flightOperators=new t.BehaviorSubject([]),f._negotiated=!1,f._nearby_airports=!1,f._sortArray=[{display:"Cheapest First",value:e.FlightSortTypes.Cheapest},{display:"Most Expensive First",value:e.FlightSortTypes.MostExpensive},{display:"Fastest First",value:e.FlightSortTypes.Fastest},{display:"Preferred Fares First",value:e.FlightSortTypes.Preferred},{display:"Lowest Co2 Emissions First",value:e.FlightSortTypes.LowestEmissions}],f._sortItinaryRoutines=((h={})[e.FlightSortTypes.Cheapest]=function(e,t){return e.total.price-t.total.price},h[e.FlightSortTypes.MostExpensive]=function(e,t){return t.total.price-e.total.price},h[e.FlightSortTypes.Fastest]=function(e,t){return e.outboundTotalDuration+(e.inboundTotalDuration?e.inboundTotalDuration:0)-(t.outboundTotalDuration+(t.inboundTotalDuration?t.inboundTotalDuration:0))},h[e.FlightSortTypes.Preferred]=function(e,t){return e.preferred-t.preferred},h[e.FlightSortTypes.LowestEmissions]=function(e,t){return e.co2PerItem-t.co2PerItem},h[e.FlightSortTypes.DepartureTime]=function(e,t){var r=u.default(e.outboundFlights[0].dateTimeDeparting),i=u.default(t.outboundFlights[0].dateTimeDeparting);return r.isBefore(i)?-1:r.isSame(i)?0:1},h[e.FlightSortTypes.ArrivalTime]=function(e,t){var r=u.default(e.outboundFlights[0].dateTimeArriving),i=u.default(t.outboundFlights[0].dateTimeArriving);return r.isBefore(i)?-1:r.isSame(i)?0:1},h[e.FlightSortTypes.Quickest]=function(e,t){return e.outboundTotalDuration+(e.inboundTotalDuration?e.inboundTotalDuration:0)-(t.outboundTotalDuration+(t.inboundTotalDuration?t.inboundTotalDuration:0))},h[e.FlightSortTypes.MostDirect]=function(e,t){return e.outboundFlights.length+(e.outboundFlights?e.outboundFlights.length:0)-(t.outboundFlights.length+(t.outboundFlights?t.outboundFlights.length:0))},h),f._sortGroupedRoutines=((m={})[e.FlightSortTypes.Cheapest]=function(e,t){return e.direction!==t.direction?e.direction-t.direction:e.minPrice-t.minPrice},m[e.FlightSortTypes.MostExpensive]=function(e,t){return e.direction!==t.direction?e.direction-t.direction:t.minPrice-e.maxPrice},m[e.FlightSortTypes.Fastest]=function(t,r){return t.direction!==r.direction?t.direction-r.direction:t.direction===e.FlightDirectionEnum.Outbound?t.outboundTotalDuration-r.outboundTotalDuration:t.inboundTotalDuration-r.inboundTotalDuration},m[e.FlightSortTypes.Preferred]=function(e,t){return e.direction!==t.direction?e.direction-t.direction:(e.preferred?1:0)-(t.preferred?1:0)},m[e.FlightSortTypes.LowestEmissions]=function(e,t){return e.direction!==t.direction?e.direction-t.direction:e.co2PerItem-t.co2PerItem},m[e.FlightSortTypes.DepartureTime]=function(e,t){if(e.direction!==t.direction)return e.direction-t.direction;var r=u.default(e.departDateTime),i=u.default(t.departDateTime);return r.isBefore(i)?-1:r.isSame(i)?0:1},m[e.FlightSortTypes.ArrivalTime]=function(e,t){if(e.direction!==t.direction)return e.direction-t.direction;var r=u.default(e.arrivalDateTime),i=u.default(t.arrivalDateTime);return r.isBefore(i)?-1:r.isSame(i)?0:1},m[e.FlightSortTypes.Quickest]=function(t,r){return t.direction!==r.direction?t.direction-r.direction:t.direction===e.FlightDirectionEnum.Outbound?t.outboundTotalDuration-r.outboundTotalDuration:(t.inboundTotalDuration?t.inboundTotalDuration:0)-(r.inboundTotalDuration?r.inboundTotalDuration:0)},m[e.FlightSortTypes.MostDirect]=function(t,r){return t.direction!==r.direction?t.direction-r.direction:t.direction===e.FlightDirectionEnum.Outbound?t.outlegs.length-r.outlegs.length:(t.inlegs||[]).length-(r.inlegs||[]).length},m),f._fareTypeArray=[{value:w.Flexible,display:"Flexible"},{value:w.Leisure,display:"Leisure"},{value:w.Lowest,display:"Lowest"},{value:w.Negotiated,display:"Negotiated"},{value:w.NonNegotiated,display:"Non-Negotiated"},{value:w.RequestFareRules,display:"Request Fare Rules"},{value:w.SelectAndPro,display:"Select & Pro"}],f.minimumOutBoundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},f.minimumInBoundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},f._grouped=null,f.travellers=null,f.resultsSessionName=n.STORAGE_SESSION_RESULTS,f.multiResultsSessionName=n.STORAGE_SESSION_RESULTS,f._showHotelForm=!1,f._hotelSearchRequested=!1,f.filters=new t.BehaviorSubject(Ye),f.duralSingleFilter=new t.BehaviorSubject(Ye),f.choosenDisplayType=new t.BehaviorSubject(e.FlightDisplayTypes.returns),f._multiDestination=[];var y=l.getSessionItem(n.STORAGE_SESSION_PARAMS)||{tempParams:{},originalUserSearch:{}},g=c.makeFlightQuery(y.tempParams);return f.updateTempParams(g),f._originalUserSearch=y.originalUserSearch,c.shouldAddTravellerSubscription()&&c.travellerInformation.subscribe((function(e){f.travellers=e;var t=f.helpers.selectedTravellers(e,te.Flight);f.tempParams.adults=t.adults.length,f.tempParams.children=t.children.length,f.updateTravellers(),f._isValid()})),o.changeUser.subscribe((function(t){f.timeCriteriaOptions.next([e.TimeWindow.Anytime,e.TimeWindow.Arrive,e.TimeWindow.Depart]),f.flightOperators.next([{code:"BA",name:"British Airways"}]),f.updateAvaliableClasses()})),f.updateTravellers(),f.negotiated=f.tempParams.fareType===w.Negotiated,f}return m(n,i),Object.defineProperty(n.prototype,"timeArray",{get:function(){return this._timeArray=this._timeArray||Array(96).fill(0).map((function(e,t){return{value:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0"),display:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0")}})),this._timeArray},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"preferredCarriers",{get:function(){return this.tempParams.preferredCarriers},set:function(e){this.tempParams.preferredCarriers=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"operator1",{get:function(){return this.tempParams.preferredCarriers[0]},set:function(e){this.tempParams.preferredCarriers[0]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"operator2",{get:function(){return this.tempParams.preferredCarriers[1]},set:function(e){this.tempParams.preferredCarriers[1]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"operator3",{get:function(){return this.tempParams.preferredCarriers[2]},set:function(e){this.tempParams.preferredCarriers[2]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"operator4",{get:function(){return this.tempParams.preferredCarriers[3]},set:function(e){this.tempParams.preferredCarriers[3]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"minDate",{get:function(){return this._minDate=this._minDate||this.helpers.momentToNgDate(u.default()),this._minDate},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"adults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=Number(e),this.updateTravellers()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"children",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=Number(e),this.updateTravellers()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"departLocation",{get:function(){return this.tempParams.departLocation},set:function(e){this.tempParams.departLocation=e,"string"==typeof e?this._originAirport="":e&&e.gateway?this._originAirport=e.gateway:this._originAirport=null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"queryOriginAiport",{get:function(){return this._originAirport},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"queryDestinationAiport",{get:function(){return this._destinationAirport},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"departDate",{get:function(){return this._outDate},set:function(e){this._outDate=e,this.outBoundDate=this.helpers.ngDateToMoment(this._outDate,this._outTime)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"departTime",{get:function(){return this._outTime},set:function(e){this._outTime=e,this.outBoundDate=this.helpers.ngDateToMoment(this._outDate,this._outTime)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outBoundDate",{get:function(){return this.tempParams.outBoundDate},set:function(e){this.tempParams.outBoundDate=e.isValid()?e:null,this.minimumInBoundDate={year:e.year(),month:e.month()+1,day:e.date()},this.tempParams.outBoundDate&&this.tempParams.inboundDate&&this.tempParams.outBoundDate.isAfter(this.tempParams.inboundDate)&&(this.inboundDate=u.default(this.tempParams.outBoundDate).add(1,"day")),this._outDate=this.helpers.momentToNgDate(e),this._outTime=this.helpers.formatTimeColon(e),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"returnDate",{get:function(){return this._inDate},set:function(e){this._inDate=e,this.inboundDate=this.helpers.ngDateToMoment(this._inDate,this._inTime)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"arriveTime",{get:function(){return this._inTime},set:function(e){this._inTime=e,this.inboundDate=this.helpers.ngDateToMoment(this._inDate,this._inTime)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"inboundDate",{get:function(){return this.tempParams.inboundDate},set:function(e){this.tempParams.inboundDate=e.isValid()?e:null,this._inDate=this.helpers.momentToNgDate(e),this._inTime=this.helpers.formatTimeColon(e),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"arriveLocation",{get:function(){return this.tempParams.arriveLocation},set:function(e){this.tempParams.arriveLocation=e,"string"==typeof e?this._destinationAirport="":e&&e.gateway?this._destinationAirport=e.gateway:this._destinationAirport=null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cabinClass",{get:function(){return this.tempParams.cabinClass},set:function(e){this.tempParams.cabinClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"returnCabinClass",{get:function(){return this.tempParams.returnCabinClass},set:function(e){this.tempParams.returnCabinClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenSearchType",{get:function(){return this.tempParams.chosenSearchType},set:function(e){this.tempParams.chosenSearchType=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isReturn",{get:function(){return this.tempParams.chosenSearchType===e.FlightSearchType.return},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outTimeCriteria",{get:function(){return this.tempParams.outTimeCriteria},set:function(e){this.tempParams.outTimeCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"inTimeCriteria",{get:function(){return this.tempParams.inTimeCriteria},set:function(e){this.tempParams.inTimeCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxConnections",{get:function(){return this.tempParams.maxConnections},set:function(e){this.tempParams.maxConnections=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"multiDestination",{get:function(){return this.tempParams.multiDestination},set:function(e){this.tempParams.multiDestination=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"showHotelForm",{get:function(){return this._showHotelForm},set:function(e){this._showHotelForm=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hotelSearchRequested",{get:function(){return this._hotelSearchRequested},set:function(e){this._hotelSearchRequested=e},enumerable:!1,configurable:!0}),n.prototype.setMultiDestinationQuery=function(e){var t=this;return this.helpers.clone(e).reduce((function(e,r){var i={};return i.orig=r.orig.gateway,i.dest=r.dest.gateway,i.date=t.helpers.formatIsoDate(r.date),e.push(i),e}),[])},Object.defineProperty(n.prototype,"sortDropdownValues",{get:function(){return this._sortArray},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fareTypesValues",{get:function(){return this._fareTypeArray},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fareType",{get:function(){return this.tempParams.fareType},set:function(e){this.tempParams.fareType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"negotiated",{get:function(){return this._negotiated},set:function(e){this._negotiated=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"includeNearbyAirports",{get:function(){return this.tempParams.includeNearbyAirports},set:function(e){this.tempParams.includeNearbyAirports=e},enumerable:!1,configurable:!0}),n.prototype.processResults=function(t){if(!t)return this._grouped=[],this.multi=[],this.resultQuery=null,[];this._grouped=t.grouped||[],this._ruleActionSummary=Object.assign({},{journeyWhenSelected:{},dualSingleWhenSelected:{},whenSelectedAlone:{}},t.ruleActionSummary),this.resultQuery=this.getSearchQuery(),this.multi=t.multi,this.setFlightDisplayType(e.FlightDisplayTypes.returns),this.currentFilters=this.helpers.createFlightFilters(t.journeys,Ye),this.filters.next(this.currentFilters),delete this.resultQuery.withGrouped;var r=t.multi.reduce((function(e,t){return e[0===t.order?"outbound":"inbound"]=t.results.reduce((function(e,t){return e[t.uid]=Object.assign({selected:!1,canSelect:!0},t),e}),e[0===t.order?"outbound":"inbound"]),e}),{outbound:{},inbound:{}}),i=this.helpers.createFlightFilters(Object.values(r.inbound),Ye);if(this.duralSingleFilter.next(this.helpers.createFlightFilters(Object.values(r.outbound),Object.assign(Object.assign({},Ye),{arrivalReturnAirport:i.arrivalAirport,depatureReturnAirport:i.depatureAirport,returnArrivalTime:i.arrivalTime,returnDuration:i.duration,returnDepartureTime:i.departureTime}))),t&&this.searchService.isFlightsGrouped()){var n=(t.journeys||[]).reduce((function(e,t){return e[t.uid]=Object.assign({selected:!1,canSelect:!0},t),e}),{}),a=T((t.grouped||[]).reduce(this.makeGroupedObjects(n),[]),(t.grouped||[]).reduce(this.makeGroupedObjects(r.outbound),[]).map((function(t){return t.direction=e.FlightDirectionEnum.DualSingleOutbound,t})),(t.grouped||[]).reduce(this.makeGroupedObjects(r.inbound,!0),[]).map((function(t){return t.direction=e.FlightDirectionEnum.DualSingleInbound,t})));return console.log("Processed Grouped data",a),a}return t?[t]:[]},n.prototype.makeGroupedObjects=function(t,r){var i=this;return void 0===r&&(r=!1),function(n,a){var o,s=a.boundIndicator===e.FlightDirectionEnum.Outbound,u={type:"FlightGroupedQuoteResult",direction:a.boundIndicator,classes:(o={},o[e.OBTFlightCabinClass.Business]=null,o[e.OBTFlightCabinClass.BusinessBranded]=null,o[e.OBTFlightCabinClass.EconomyFlexi]=null,o[e.OBTFlightCabinClass.EconomyFlexiBranded]=null,o[e.OBTFlightCabinClass.EconomyNoBags]=null,o[e.OBTFlightCabinClass.EconomyNoBagsBranded]=null,o[e.OBTFlightCabinClass.EconomyRestricted]=null,o[e.OBTFlightCabinClass.EconomyRestrictedBranded]=null,o[e.OBTFlightCabinClass.First]=null,o[e.OBTFlightCabinClass.FirstBranded]=null,o[e.OBTFlightCabinClass.PremiumEconomy]=null,o[e.OBTFlightCabinClass.PremiumEconomyBranded]=null,o),originAirport:"",originAirportName:"",destinationAirport:"",destinationAirportName:"",departDateTime:"",arrivalDateTime:"",outboundTotalDuration:0,inboundTotalDuration:0,outlegs:null,inlegs:null,outlegsCount:0,inlegsCount:0,dataSource:"",preferred:!1,outboundFlightNumber:"",operator:"",operatorFull:"",inboundFlightNumber:"",isReturn:!1,minPrice:Number.MAX_SAFE_INTEGER,maxPrice:0,co2PerItem:0,co2PerPassenger:0,gid:a.referenceID},l=a.flights;return Object.keys(l).filter((function(e){return"_"!==e[0]})).forEach((function(e){l[e].length&&l[e].forEach((function(n){var a,o,l=t[n];if(l){s||r?i.createGroupedItem(u,l.source,l.outboundFlights,l.outboundTotalDuration,l.inboundFlights,l.inboundTotalDuration,l.co2PerItem,l.co2PerPassenger):i.createGroupedItem(u,l.source,l.inboundFlights,l.inboundTotalDuration,l.outboundFlights,l.outboundTotalDuration,l.co2PerItem,l.co2PerPassenger);var c=i.helpers.FlightCabinClassToBrandedOBTFlightCabinClass(e,!!l.baseFareId&&l.baseFareId!==l.uid),d=Math.floor(l.total.price),p=Math.ceil(l.total.price);u.minPrice=u.minPrice<d?u.minPrice:d,u.maxPrice=u.maxPrice>p?u.maxPrice:p,(null===(o=null===(a=u.classes[c])||void 0===a?void 0:a.flights)||void 0===o?void 0:o.length)?(u.classes[c].flights.push(l),u.classes[c].minprice=Math.min(u.classes[c].minprice,d),u.classes[c].maxprice=Math.max(u.classes[c].maxprice,p)):u.classes[c]={flights:[l],minprice:d,maxprice:p,currency:l.total.currency}}}))})),u&&Object.values(u.classes).find((function(e){var t;return(null===(t=null==e?void 0:e.flights)||void 0===t?void 0:t.length)>0}))&&n.push(u),n.filter((function(e){return!!e}))}},n.prototype.createGroupedItem=function(e,t,r,i,n,a,o,s){if((null==r?void 0:r.length)&&!e.departDateTime){var u=r[0],l=r[r.length-1];e.originAirport=u.originAirport,e.originAirportName=u.originAirportName,e.destinationAirport=l.destinationAirport,e.destinationAirportName=l.destinationAirportName,e.departDateTime=u.dateTimeDeparting,e.arrivalDateTime=l.dateTimeArriving,e.outboundTotalDuration=i,e.dataSource=t,e.operator=u.marketingCarrier,e.operatorFull=u.marketingCarrierName,e.outlegsCount=r.length,e.outlegs=r,e.outboundFlightNumber=this.helpers.joinFromAttribute("-","marketingFlightNumber",r),e.isReturn=!1,e.co2PerItem=o,e.co2PerPassenger=s}(null==n?void 0:n.length)&&!e.inboundTotalDuration&&(e.inboundTotalDuration=a,e.inlegsCount=n.length,e.inlegs=n,e.inboundFlightNumber=this.helpers.joinFromAttribute("-","operatingFlightNumber",n),e.isReturn=!0)},n.prototype.makeSessionResults=function(e){return{results:e,grouped:this._grouped,query:this.resultQuery}},n.prototype.getMaxFlightPriceForBrand=function(e){var t=0;return e.forEach((function(e){var r;t<(null===(r=null==e?void 0:e.total)||void 0===r?void 0:r.price)&&(t=e.total.price)})),t},n.prototype.getMinFlightPriceForBrand=function(e){var t=Number.MAX_SAFE_INTEGER;return e.forEach((function(e){var r;t>(null===(r=null==e?void 0:e.total)||void 0===r?void 0:r.price)&&(t=e.total.price)})),t},n.prototype.resetQuery=function(e){void 0===e&&(e=!0),this.updateTempParams(this.searchService.makeFlightQuery()),e&&this._isValid()},n.prototype.resetParams=function(){this.reset(),this.resetQuery()},n.prototype._isValid=function(){this.doChecks&&(this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.validationMessages=[],this.tempParams.chosenSearchType===e.FlightSearchType.multiCity?this.multiCityValidation():(this._originAirport||this.validationMessages.push("Please add in a departure location"),this._destinationAirport||this.validationMessages.push("Please add in an arrival destination"),this.tempParams.outBoundDate.isAfter(u.default())||this.validationMessages.push("Departure date can not be in the past"),this._originAirport&&this._destinationAirport&&this._destinationAirport===this._originAirport&&this.validationMessages.push("Origin and destination airport cannot be the same"),this.isReturn&&this.tempParams.outBoundDate.isSameOrAfter(this.tempParams.inTimeCriteria)&&this.validationMessages.push("Return date must be after the departure date"),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages)))},n.prototype.multiCityValidation=function(){var e=!1,t=!1,r=!1;this.tempParams.multiDestination.map((function(i,n){i.orig||(e=!0,n<2&&(t=!0)),i.orig===i.dest&&(r=!0)})),u.default(this.tempParams.multiDestination[0].date).isAfter(u.default())||this.validationMessages.push("Departure date can not be in the past"),t&&this.validationMessages.push("Please select landing airport(s)"),e&&this.validationMessages.push("Please select take off airport(s)"),r&&this.validationMessages.push("Take off and landing location(s) cannot be the same")},n.prototype.startSearch=function(){if(this.results.next([]),this._isValid(),this.isValid.value){this._originalUserSearch=Object.freeze(this.helpers.clone(this.tempParams)),this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch});var e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.flightfetcher.fetchList(e))}return Promise.resolve(!1)},n.prototype.getRecentSearchQuery=function(e){return{serviceType:te.Flight,searchArgs:e,travelDate:this.outBoundDate.format(),travellers:this.helpers.getTravellersId(this.travellers)}},n.prototype.startRecentSearch=function(r){var i=this;if(r.searchArgs.outboundDate){var n=r.searchArgs.outboundDepartureTimeWindow?r.searchArgs.outboundDepartureTimeWindow:r.searchArgs.outboundArrivalTimeWindow;this.outBoundDate=this.convertRecentSearchDateTime(r.searchArgs.outboundDate,n)}if(r.searchArgs.returnDate){var a=r.searchArgs.returnDepartureTimeWindow?r.searchArgs.returnDepartureTimeWindow:r.searchArgs.returnArrivalTimeWindow;this.inboundDate=this.convertRecentSearchDateTime(r.searchArgs.returnDate,a)}this.fareType=r.searchArgs.fareType,this.maxConnections=r.searchArgs.maxConnections,r.searchArgs.outboundCabinClass&&(this.cabinClass=r.searchArgs.outboundCabinClass[0]),r.searchArgs.returnCabinClass&&(this.returnCabinClass=r.searchArgs.returnCabinClass[0]),this.includeNearbyAirports=!!r.searchArgs.includeNearbyAirports,this.chosenSearchType=r.searchArgs.returnTrip?e.FlightSearchType.return:e.FlightSearchType.oneWay,r.searchArgs.outboundDepartureTimeWindow?this.outTimeCriteria=e.TimeWindow.Depart:r.searchArgs.outboundArrivalTimeWindow?this.outTimeCriteria=e.TimeWindow.Arrive:this.outTimeCriteria=e.TimeWindow.Anytime,r.searchArgs.returnDepartureTimeWindow?this.inTimeCriteria=e.TimeWindow.Depart:r.searchArgs.returnArrivalTimeWindow?this.inTimeCriteria=e.TimeWindow.Arrive:this.inTimeCriteria=e.TimeWindow.Anytime,t.combineLatest([this.searchService.getAirportByCode(r.searchArgs.originAirport),this.searchService.getAirportByCode(r.searchArgs.destinationAirport)]).subscribe((function(e){var t,n,a,o,s,u,l,c,d,p,h,m,f=S(e,2),y=f[0],g=f[1];if(y&&g){if(i.departLocation={destination:y.iataMatch.name,gateway:y.iataMatch.iata,terminals:i.searchService.processTerminals(y.iataMatch.terminals),country:null===(n=null===(t=y.iataMatch)||void 0===t?void 0:t.locationDetails)||void 0===n?void 0:n.country,postcode:null===(o=null===(a=y.iataMatch)||void 0===a?void 0:a.locationDetails)||void 0===o?void 0:o.postcode,countryCode:null===(u=null===(s=y.iataMatch)||void 0===s?void 0:s.locationDetails)||void 0===u?void 0:u.countryCode},i.arriveLocation={destination:g.iataMatch.name,gateway:g.iataMatch.iata,terminals:i.searchService.processTerminals(g.iataMatch.terminals),country:null===(c=null===(l=g.iataMatch)||void 0===l?void 0:l.locationDetails)||void 0===c?void 0:c.country,postcode:null===(p=null===(d=g.iataMatch)||void 0===d?void 0:d.locationDetails)||void 0===p?void 0:p.postcode,countryCode:null===(m=null===(h=g.iataMatch)||void 0===h?void 0:h.locationDetails)||void 0===m?void 0:m.countryCode},r.searchArgs.preferredCarriers){var v=[];r.searchArgs.preferredCarriers.map((function(e){i.searchService.getAirlinesList(e).subscribe((function(t){t.map((function(t){t.code===e&&v.push(t)})),i.preferredCarriers=v,i.searchService.startSearches()}))}))}i.searchService.startSearches()}})),this.searchService.startSearches()},n.prototype.makeDepartureTimeWindow=function(t,r,i){return r===e.TimeWindow.Depart?i?this.helpers.makeTimeWindow(t,-2,2):this.helpers.makeTimeWindow(t,0,4):null},n.prototype.makeArrivalTimeWindow=function(t,r,i){return r!==e.TimeWindow.Arrive?null:i?this.helpers.makeTimeWindow(t,-2,2):this.helpers.makeTimeWindow(t,0,4)},n.prototype.convertRecentSearchDateTime=function(e,t){if(t){var r=t.split("-");return u.default(e).add(u.default.duration(this.helpers.hhmmToTime(r[0]))).clone().add(2,"hour")}return u.default(e)},n.prototype.getSearchQuery=function(){var t=this.tempParams.chosenSearchType===e.FlightSearchType.multiCity;this._multiDestination=t?this.setMultiDestinationQuery(this.tempParams.multiDestination):null,this._multiDestination=this.tempParams.chosenSearchType===e.FlightSearchType.multiCity?this.setMultiDestinationQuery(this.tempParams.multiDestination):[];var r=this.searchService.isFlightsGrouped();return this.helpers.removeNulls(Object.assign({},t?{multiDestination:this._multiDestination}:{originAirport:this._originAirport,destinationAirport:this._destinationAirport,outboundDate:this.helpers.formatIsoDate(this.tempParams.outBoundDate),outboundDepartureTimeWindow:this.makeDepartureTimeWindow(this.tempParams.outBoundDate,this.tempParams.outTimeCriteria,r),outboundArrivalTimeWindow:this.makeArrivalTimeWindow(this.tempParams.outBoundDate,this.tempParams.outTimeCriteria,r)},{passengers:this._passengers,returnTrip:this.isReturn,outboundCabinClass:this.tempParams.cabinClass?[this.tempParams.cabinClass]:null,requireFreeBag:null,maxConnections:this.tempParams.maxConnections,includeNearbyAirports:this.tempParams.includeNearbyAirports,preferredCarriers:this.tempParams.preferredCarriers.map((function(e){return(null==e?void 0:e.code)?e.code:null})),fareType:this.tempParams.fareType,withGrouped:r},this.isReturn?{returnDate:this.helpers.formatIsoDate(this.tempParams.inboundDate),returnDepartureTimeWindow:this.makeDepartureTimeWindow(this.tempParams.inboundDate,this.tempParams.inTimeCriteria,r),returnArrivalTimeWindow:this.makeArrivalTimeWindow(this.tempParams.inboundDate,this.tempParams.inTimeCriteria,r),returnCabinClass:this.tempParams.returnCabinClass?[this.tempParams.returnCabinClass]:null}:{}))},n.prototype.updateTravellers=function(){for(var e=[],t=0;t<this.tempParams.adults;t+=1)e.push({type:U.Adult});for(t=0;t<this.tempParams.children;t+=1)e.push({type:U.Child});this._passengers=e,this._isValid()},n.prototype.updateAvaliableClasses=function(){var e=this.userService.getUserFavoriteObject(Ke.HideFlightCabinClasses)||{any:!1,business:!1,economy:!1,first:!1,premiumEconomy:!1},t=[];e.any||t.push({name:"Any",type:x.Any}),e.economy||t.push({name:"Economy",type:x.Economy}),e.premiumEconomy||t.push({name:"Premium",type:x.PremiumEconomy}),e.business||t.push({name:"Business",type:x.Business}),e.first||t.push({name:"First",type:x.First}),this.cabinClass=this.getUpdatedCabinClass(this.cabinClass,e,t),this.returnCabinClass=this.getUpdatedCabinClass(this.returnCabinClass,e,t),this.avaliableClasses.next(t)},n.prototype.getUpdatedCabinClass=function(e,t,r){switch(e){case x.Any:return t.any?r[0].type:e;case x.Business:return t.business?r[0].type:e;case x.Economy:return t.economy?r[0].type:e;case x.First:return t.first?r[0].type:e;case x.PremiumEconomy:return t.premiumEconomy?r[0].type:e}return e},n.prototype.updateFromPreviousSearches=function(e){},n.prototype.getTotalBaggage=function(e){var t=0,r=JSON.parse(e.additional);return r&&r.outboundFlights?r.outboundFlights.forEach((function(e){e.baggage.forEach((function(e){e.allowance&&e.allowance>t&&(t=e.allowance)}))})):r&&r.baggageAllowance&&r.baggageAllowance.forEach((function(e){e.baggage.qty&&Number(e.baggage.qty)>t&&(t=Number(e.baggage.qty))})),t},n.prototype.isGroupedFlights=function(e){var t;return"FlightGroupedQuoteResult"===(null===(t=e[0])||void 0===t?void 0:t.type)},n.prototype.applyFilters=function(t,r){var i,n,a=this;this.currentFilters=t,this.currentSort=r,0===this.fullResults.length&&this.results.next([]);var o=this.selectedGroupFlight?(null===(i=this.selectedGroupFlight.inboundFlights)||void 0===i||i.length,function(t,r){return function(i){return r===e.FlightDirectionEnum.DualSingleInbound||t.includes(i.uid)}}):function(e,t){return function(e){return!0}},s=function(e,t){var r=Object.values(e).filter((function(e){return e.selected}));return r.length?function(e){return!!r.find((function(r){return t(e,r.value)}))}:function(e){return!0}},l=function(e,t){return e.replace("OUTBOUND_DEPARTURE","outboundFlights.0").replace("OUTBOUND_ARRIVAL","outboundFlights."+(t.outboundFlights.length-1)).replace("INBOUND_DEPARTURE","inboundFlights.0").replace("INBOUND_ARRIVAL","inboundFlights."+((t.inboundFlights||[]).length-1))},c=function(e,t){return function(r){var i,n=(i=a.helpers).fromObject.apply(i,T([r],l(t,r).split(".")));return n>=e.min&&n<=e.max}},d=function(e,t){return function(r){var i,n,o=u.default((i=a.helpers).fromObject.apply(i,T([r],l(t,r).split(".")))).get("hour"),s=u.default((n=a.helpers).fromObject.apply(n,T([r],l(t,r).split(".")))).get("minute"),c=Number(o+"."+a.helpers.normaliseMinuteToBase10(s));return c>=e.min&&c<=e.max}},p=function(e){return function(t,r){return t[e]===r}},h=[],m=[],f=[];h.push(d(t.arrivalTime,"OUTBOUND_ARRIVAL.dateTimeArriving")),h.push(d(t.departureTime,"OUTBOUND_DEPARTURE.dateTimeDeparting")),f.push(c(t.returnDuration,"outboundTotalDuration")),h.push(c(t.duration,"outboundTotalDuration")),h.push(c(t.price,"total.price")),h.push(s(t.stops,(function(e,t){return e.outboundFlights.length===t}))),m.push(s(t.totalStops,(function(e,t){return e.outboundFlights.length+(e.inboundFlights||[]).length===t}))),f.push(s(t.totalStops,(function(e,t){return e.outboundFlights.length===t}))),h.push(s(t.baggage,(function(e,t){var r=e.baggageAllowance.map((function(e){return e.qty}));return(r.length?Math.min.apply(Math,T(r)):0)===t}))),h.push(s(t.depatureAirport,(function(e,t){var r;return(null===(r=e.outboundFlights[0])||void 0===r?void 0:r.originAirport)===t}))),h.push(s(t.arrivalAirport,(function(e,t){var r;return(null===(r=e.outboundFlights[e.outboundFlights.length-1])||void 0===r?void 0:r.destinationAirport)===t}))),m.push(c(t.duration,"outboundTotalDuration")),m.push(c(t.price,"total.price")),f.push(c(t.price,"total.price")),m.push(d(t.returnArrivalTime,"INBOUND_ARRIVAL.dateTimeArriving")),f.push(d(t.returnArrivalTime,"OUTBOUND_ARRIVAL.dateTimeArriving")),m.push(d(t.returnDepartureTime,"INBOUND_DEPARTURE.dateTimeDeparting")),m.push(c(t.returnDuration,"inboundTotalDuration")),f.push(c(t.returnDuration,"outboundTotalDuration")),m.push(s(t.stops,(function(e,t){return e.inboundFlights.length===t}))),f.push(s(t.stops,(function(e,t){return e.outboundFlights.length===t}))),m.push(s(t.totalStops,(function(e,t){return e.outboundFlights.length+(e.inboundFlights||[]).length===t}))),m.push(s(t.baggage,(function(e,t){var r=e.baggageAllowance.map((function(e){return e.qty}));return(r.length?Math.min.apply(Math,T(r)):0)===t}))),f.push(s(t.baggage,(function(e,t){var r=e.baggageAllowance.map((function(e){return e.qty}));return(r.length?Math.min.apply(Math,T(r)):0)===t}))),m.push(s(t.depatureReturnAirport,(function(e,t){var r;return(null===(r=e.inboundFlights[0])||void 0===r?void 0:r.originAirport)===t}))),f.push(s(t.depatureReturnAirport,(function(e,t){var r;return(null===(r=e.outboundFlights[0])||void 0===r?void 0:r.originAirport)===t}))),m.push(s(t.arrivalReturnAirport,(function(e,t){var r;return(null===(r=e.inboundFlights[e.inboundFlights.length-1])||void 0===r?void 0:r.destinationAirport)===t}))),f.push(s(t.arrivalReturnAirport,(function(e,t){var r;return(null===(r=e.outboundFlights[e.outboundFlights.length-1])||void 0===r?void 0:r.destinationAirport)===t})));var y=[];y.push(s(t.classes,p("cabinClass"))),y.push(s(t.airlines,p("marketingCarrier")));var g=[];g.push(s(t.classes,p("cabinClass"))),g.push(s(t.airlines,p("marketingCarrier")));var v=function(e,t){return h.reduce((function(t,r){return t=t&&r(e)}),!0)&&(!e.outboundFlights||!!(e.outboundFlights||[]).find((function(e){return!!y.reduce((function(t,r){return t&&r(e)}),!0)})))},b=function(e){var t;return m.reduce((function(t,r){return t&&r(e)}),!0)&&(!(null===(t=e.inboundFlights)||void 0===t?void 0:t.length)||!!(e.inboundFlights||[]).find((function(e){return!!g.reduce((function(t,r){return t&&r(e)}),!0)})))},C=function(e){var t;return f.reduce((function(t,r){return t&&r(e)}),!0)&&(!(null===(t=e.outboundFlights)||void 0===t?void 0:t.length)||!!(e.outboundFlights||[]).find((function(e){return!!g.reduce((function(t,r){return t&&r(e)}),!0)})))},D=this._ruleActionSummary.dualSingleWhenSelected[null===(n=this.selectedGroupFlight)||void 0===n?void 0:n.journeyHash]||{},P=function(e){var t,r,i,n,o,s;return e.selected=e.uid===(null===(t=a.selectedGroupFlight)||void 0===t?void 0:t.uid),e.unavailable=(null===(r=a._ruleActionSummary.journeyWhenSelected[e.journeyHash])||void 0===r?void 0:r.unavailable)||(null===(i=a._ruleActionSummary.whenSelectedAlone[e.journeyHash])||void 0===i?void 0:i.unavailable)||(null===(n=D[e.journeyHash])||void 0===n?void 0:n.unavailable)||!1,e.unavailableMessage=(null===(o=a._ruleActionSummary.journeyWhenSelected[e.journeyHash])||void 0===o?void 0:o.unavailableMessage)||(null===(s=a._ruleActionSummary.whenSelectedAlone[e.journeyHash])||void 0===s?void 0:s.unavailableMessage)||"",e};if(this.isGroupedFlights(this.fullResults)){var _=this._grouped.find((function(e){return e.referenceID===a.selectedGroupId}));this.results.next(this.helpers.clone(this.fullResults).filter((function(e){return!!e})).map((function(t){var r=t.direction===e.FlightDirectionEnum.Outbound||t.direction===e.FlightDirectionEnum.DualSingleOutbound?v:t.direction===e.FlightDirectionEnum.DualSingleInbound?C:b;return t.classes=Object.entries(t.classes).reduce((function(e,i){var n=S(i,2),s=n[0],u=n[1];if(u&&u.flights){var l=u.flights.filter((function(e){return!!e})).filter(o((null==_?void 0:_.flights[a.helpers.OBTFlightCabinClassToFlightCabinClass(s)])||[],t.direction)).filter(r).map(P);l.length>0&&(e[s]=Object.assign(Object.assign({},u),{flights:l}))}return e}),{}),t})).filter((function(e){return e&&Object.keys(e.classes).length>0})).sort(this._sortGroupedRoutines[r]))}else this.results.next(Object.freeze(this.helpers.clone(this.fullResults).map((function(e){var i=a.helpers.clone(e.journeys);if(t.flightNumber&&(i=i.filter((function(e){var r=e.outboundFlights.find((function(e){return e.marketingFlightNumber===t.flightNumber})),i=e.inboundFlights.find((function(e){return e.marketingFlightNumber===t.flightNumber}));if(r||i)return e}))),i=i.filter(v),a.isReturn){var n=a.helpers.clone(e.journeys);n=n.filter(b),i=a.mergeOutInBound(i,n)}return i.sort(a._sortItinaryRoutines[r]),{type:"FlightAllQuoteResult",journeys:i}}))))},n.prototype.mergeOutInBound=function(e,t){return Object.values(T(e,t).reduce((function(e,t){var r=t.uid,i=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(t,["uid"]);return e[r]||(e[r]=Object.assign(Object.assign(Object.assign({},e[r]||{}),{uid:r}),i)),e}),[]))},n.prototype.updateLowestPrice=function(e){if(e.length&&!this.searchService.isFlightsGrouped()){var t=e[0].journeys;if(t.length){var r=t[0].total.currency;return t.reduce((function(e,t){var r=t.total.price;return e.amount>r&&(e.amount=r),e}),{amount:Number.MAX_SAFE_INTEGER,currencyCode:r})}}},n.prototype.selectGroupedFlight=function(t,r,i){return g(this,void 0,void 0,(function(){var n,a,o=this;return v(this,(function(s){switch(s.label){case 0:return[4,this.basketService.getDefaultBasket()];case 1:return n=s.sent(),(a=null==n?void 0:n.subject.value)&&this.originalUserSearch.chosenSearchType===e.FlightSearchType.oneWay&&r===e.FlightDirectionEnum.Outbound?(this.bookSingleFlight(n,t),[2]):(!a||this.originalUserSearch.chosenSearchType!==e.FlightSearchType.return||r!==e.FlightDirectionEnum.Outbound&&r!==e.FlightDirectionEnum.DualSingleOutbound||(t.selected?(this.selectedGroupFlight=null,this.selectedGroupId=-1,this.applyFilters(this.currentFilters,this.currentSort)):(this.selectedGroupFlight=t,this.selectedGroupId=i,this.applyFilters(this.currentFilters,this.currentSort),this._updateTravelPolicies()),t.selected=!t.selected),a&&this.originalUserSearch.chosenSearchType===e.FlightSearchType.return&&r===e.FlightDirectionEnum.Inbound&&this.selectedGroupFlight?(this.doBooking(n,t,{outboundFlights:T(t.outboundFlights.map((function(e,t){return o.makeSchemaFlights(e,"outbound",0,t)}))),inboundFlights:T(t.inboundFlights.map((function(e,t){return o.makeSchemaFlights(e,"inbound",0,t)}))),journeyType:"roundtrip"},t.outboundFlights[0].dateTimeDepartingUTC,t.inboundFlights[0].dateTimeDepartingUTC),this.selectedGroupFlight.selected=!1,this.selectedGroupFlight=null,this.applyFilters(this.currentFilters,this.currentSort),[2]):(a&&this.originalUserSearch.chosenSearchType===e.FlightSearchType.return&&r===e.FlightDirectionEnum.DualSingleInbound&&this.selectedGroupFlight&&(this.bookSingleFlight(n,this.selectedGroupFlight),this.bookSingleFlight(n,t),this.selectedGroupFlight.selected=!1,this.selectedGroupFlight=null,this.applyFilters(this.currentFilters,this.currentSort)),[2]))}}))}))},n.prototype._updateTravelPolicies=function(){var e=this;if(this.selectedGroupFlight&&!this._ruleActionSummary.dualSingleWhenSelected[this.selectedGroupFlight.journeyHash]&&this.multi&&0!==this.multi.length){var t=(this.multi||[]).reduce((function(e,t){return 1===t.order&&t.results&&t.results.length>0&&(e=e.concat(t.results)),e}),[]);t.length>0&&this.applyFlightRules.fetchOne({selectedOutboundFlight:this.selectedGroupFlight,availableInboundFlights:t}).pipe(r.take(1)).subscribe((function(t){t&&(e._ruleActionSummary=e.helpers.mergeObjects(e._ruleActionSummary,t),e._applyFilter())}))}},n.prototype.bookSingleFlight=function(e,t){var r=this;this.doBooking(e,t,{outboundFlights:t.outboundFlights.map((function(e,t){return r.makeSchemaFlights(e,"outbound",0,t)})),inboundFlights:[],journeyType:"single"},t.outboundFlights[0].dateTimeDeparting)},n.prototype.doBooking=function(e,t,r,i,n){var a=t.sourceId,o=t.co2PerItem,s=t.co2PerPassenger,u=t.total,l={adults:this.adults,basket:e.id,children:this.children,co2PerItem:o,co2PerPassenger:s,currency:u.currency,detail:r,price:u.price,searchQuery:this.resultQuery,service:a.toString(),outboundDate:i};n&&(l.inboundDate=n),this.basketService.addToBasket(l,e,this.searchService,this.travellers)},n.prototype.makeSchemaFlights=function(e,t,r,i){return Object.assign(Object.assign({},e),{journeyInfo:{flightGroup:t,groupIndex:r,segmentIndex:i}})},n.prototype.addFlightJourneysToBasket=function(e){return g(this,void 0,void 0,(function(){var t,r,i,n,a,o,s,l,c,d;return v(this,(function(p){switch(p.label){case 0:return e.unavailable?[2,Promise.resolve(!1)]:[4,this.basketService.getDefaultBasket()];case 1:return t=p.sent(),(null==t?void 0:t.subject.value)?(r=e.sourceId,i=e.co2PerItem,n=e.co2PerPassenger,a=e.total,o=u.default(e.outboundFlights[0].dateTimeDeparting),s=e.inboundFlights.length?u.default(e.inboundFlights[0].dateTimeDeparting):null,l=this.getTermsAndCond(e),c={outboundFlights:T(e.outboundFlights.map((function(e,t){return Object.assign({},e)}))),inboundFlights:T(e.inboundFlights.map((function(e,t){return Object.assign({},e)}))),termsAndCond:l,journeyType:"single"},d={adults:this.adults,basket:t.id,children:this.children,co2PerItem:i,co2PerPassenger:n,currency:a.currency,detail:c,price:a.price,searchQuery:this.resultQuery,service:r.toString(),outboundDate:o.format()},s&&(d.inboundDate=s.format(),c.journeyType="roundtrip"),[2,this.basketService.addToBasket(d,t,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},n.prototype.setFlightDisplayType=function(e){this.selectedGroupFlight=null,this.choosenDisplayType.next(e)},n.prototype._applyFilter=function(){this.applyFilters(this.currentFilters,this.currentSort)},n.prototype.openFlightFareRules=function(e,t){var r=this;Object.values(e).find((function(e){return e.length}))?this.modalService.open(d.ModalFlightFareComponent,null,{rules:e,from:t[0].originAirport,to:t[t.length-1].destinationAirport}):this.searchService.getFlightFareRules(t[0]).subscribe((function(e){r.modalService.open(d.ModalFlightFareComponent,null,{rules:e.results[0],from:t[0].originAirport,to:t[t.length-1].destinationAirport})}),(function(e){console.log(e)}))},n.prototype.getTermsAndCond=function(e){return[{name:"Penalties",value:""},{name:"Eligibility",value:""},,{name:"Day/time",value:""},{name:"Seasonality",value:""},{name:"Flight Application",value:""},{name:"Advance Reservations/ticketing",value:""},{name:"Maximum Stay",value:""},{name:"Minimum Stay",value:""},{name:"Stopovers",value:""},{name:"Transfers",value:""},{name:"Combinations",value:""},{name:"Blackout Dates",value:""},{name:"Surcharges",value:""},{name:"Accompanied Travel",value:""},{name:"Travel Restrictions",value:""},{name:"Sales Restrictions",value:""},{name:"Hip/mileage Exceptions",value:""},{name:"Ticket Endorsements",value:""},{name:"Children Discounts",value:""},{name:"Tour Conductor Discounts",value:""},{name:"Agent Discounts",value:""},{name:"All Other Discounts",value:""},{name:"Miscellaneous Provisions",value:""},{name:"Fare By Rule",value:""},{name:"Groups",value:""},{name:"Tours",value:""},{name:"Visit Another Country",value:""},{name:"Deposits",value:""},{name:"Voluntary Changes",value:""},{name:"Voluntary Refunds",value:""},{name:"Negotiated Fares",value:""},{name:"Rule Application And Other Conditions",value:""}]},n.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:te.Flight,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},n.prototype.updateSerchQuery=function(t){var r=t;switch(this.chosenSearchType){case e.FlightSearchType.multiCity:r.multiDestinationDetail=this.multiDestination;break;case e.FlightSearchType.return:case e.FlightSearchType.oneWay:r.departLocationDetail=this.departLocation,r.arriveLocationDetail=this.arriveLocation}return r},n}(c);$e.STORAGE_SESSION_PARAMS="search_flight",$e.STORAGE_SESSION_RESULTS="results_flight",(Ze=e.URLS||(e.URLS={})).AccessToken="accessToken",Ze.LOGOUT_URL="logout",Ze.Refresh="refreshToken",Ze.CONFERMA_THUMBNAIL_URL="https://ssl.conferma.com/Images/PropertyThumbnails/",Ze.CONFIRMA_PHOTO_URL="/confermainfo/Info.aspx?mode=media&key=MICROSSABS&id=",Ze.CONFIRMA_INFO_URL="/confermainfo/Info.aspx?mode=hotel&key=MICROSSABS&id=",Ze.RECOVER_PASSWORD_URL="password/getResetToken",Ze.RESET_PASSWORD="password/resetByToken",Ze.ADMIN_USER_PANEL="https://admin-staging.ctmlightning.co.uk/user";var et,tt,rt=function(){this.priceRange={min:0,max:0},this.distanceRange={min:0,max:0},this.chain=[],this.amenitytype=[],this.preferred=[],this.extra=[],this.hotelName="",this.breakfastType=[]};(et=e.HotelView||(e.HotelView={})).LIST="list",et.MAP="map",(tt=e.SortTypesHotel||(e.SortTypesHotel={})).distance="distance",tt.name="name",tt.price="price";var it=function(i){function n(r,a,o,s,l,c,d,p,h,m,f,y){var g=i.call(this,d,a)||this;g.hotelFetcher=r,g.userService=o,g.environment=s,g.avaliabilityService=l,g.basketService=c,g.searchService=p,g.httpCallService=h,g.quickListFetcher=m,g.getRailStationFetcher=f,g.applyHotelRulesFetcher=y,g.type=te.Hotel,g.location_types=new t.BehaviorSubject([]),g.offices=new t.BehaviorSubject([]),g.lastActivePage=new t.BehaviorSubject(null),g.galleries={},g.occupied=0,g.results_details={chains:new Set,amenities:[],maxDistance:0},g._bookedTravellers=[],g.filterChange=new t.Subject,g.selectItemMapView=new t.Subject,g.display={minprice:Number.NEGATIVE_INFINITY,maxprice:Number.POSITIVE_INFINITY,filters:{breakfastType:[]}},g.min_date={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},g.min_return_date={year:u.default().year(),month:u.default().month()+1,day:u.default().date()+1},g.localFilters=new rt,g.currentView=e.HotelView.LIST,g._max_no_of_rooms=4,g._max_rooms_array=new Array(g._max_no_of_rooms).fill(0),g._max_no_of_occupants=8,g._max_occupant_array=new Array(g._max_no_of_occupants).fill(0),g._distance_list=[1,2,5,10,20,25],g._default_currency=null,g.resultsSessionName=n.STORAGE_SESSION_RESULTS,g.multiResultsSessionName=n.STORAGE_SESSION_RESULTS,g.query={},g.filterResults=function(){g.results.next(g.fullResults.filter((function(e){return g.inPriceRange(e)&&g.inDistanceRange(e)&&g.containsHotelname(e)&&g.hasChain(e)&&g.breakfastTypeFilter(e)})))},g.filterLighteningResults=function(){g.results.next(g.fullResults.filter((function(e){return g.inLighteningPriceRange(e)&&g.containsHotelname(e)&&g.hasChain(e)&&g.hasPreferred(e)&&g.breakfastTypeFilter(e)&&g.getExtraFilter(e)&&g.getAmenitiesFilter(e)})))},g.results_details.chains=new Set;var v=d.getSessionItem(n.STORAGE_SESSION_PARAMS)||{tempParams:{}};g.default_currency=g.tempParams.currency?g.tempParams.currency:g._default_currency,g.updateTempParams(p.makeHotelQuery(v.tempParams)),p.shouldAddTravellerSubscription()&&p.travellerInformation.subscribe((function(e){g.travellers=e;var t=g.helpers.selectedTravellers(e,te.Hotel);g.tempParams.no_of_occupants=t.adults.length,g.travellers=e,g._isValid()}));var b=d.getSessionItemAsList(g.resultsSessionName)||[];return b.slice(0,g.environment.numberHotelToPreload).forEach((function(e){g.searchService.canBook(te.Hotel)&&g.avaliabilityService.getAvailabilityForId(g.makeHotelAvalilityObject(e),e)})),b.forEach((function(e){g.results_details.chains.add(e.group)})),g.fullResults=b,g.results.next(b),g._isValid(),g.userService.changeUser.subscribe((function(t){g.location_types.next([e.LocationTypes.Airport,e.LocationTypes.City,e.LocationTypes.Office,e.LocationTypes.Shortlist,e.LocationTypes.TrainStation]),p.shouldFetchAllOffices()&&g.offices.next([])})),g.localFilters=new rt,g.avaliabilityService.fetching.subscribe((function(e){if(!e){var t=g.avaliabilityService.maxPriceForCurrency("GBP");t>0&&(g.filters.priceRange.max=t,g.localFilters.priceRange.max=t),g._cheapestResultPrice=g.updateLowestPrice(b),g.searchService.canBook(te.Hotel)&&g._applyTravelRules()}})),g}return m(n,i),Object.defineProperty(n.prototype,"chains",{get:function(){return T(this.results_details.chains)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"amenities",{get:function(){return T(this.results_details.amenities)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxDistance",{get:function(){return this.filters.distanceRange.max=Math.ceil(Math.max.apply(Math,this.results.value.map((function(e){return e.location.distance})))),this.results_details.maxDistance=this.filters.distanceRange.max,this.results_details.maxDistance},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxPrice",{get:function(){return Math.ceil(this.filters.priceRange.max)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"currency",{get:function(){return this.tempParams.currency},set:function(e){this.tempParams.currency=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"checkin_date_ngb",{get:function(){return this._checkin_date_ngb},set:function(e){this._checkin_date_ngb=e,this.tempParams.checkin_date=this.helpers.ngDateToMoment(e),this.checkin_date=this.helpers.ngDateToMoment(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"checkout_date_ngb",{get:function(){return this._checkout_date_ngb},set:function(e){this._checkout_date_ngb=e,this.tempParams.checkout_date=this.helpers.ngDateToMoment(e),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"checkin_date",{get:function(){return this.tempParams.checkin_date},set:function(e){e&&e.isValid()&&(this.tempParams.checkin_date=u.default(e),this._checkin_date_ngb=this.helpers.momentToNgDate(e),e.isSameOrBefore(this.tempParams.checkout_date)&&(this.checkout_date=u.default(e).add(1,"day")),this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"checkout_date",{get:function(){return this.tempParams.checkout_date},set:function(e){e&&e.isValid()&&(this.tempParams.checkout_date=e,this.checkout_date_ngb=this.helpers.momentToNgDate(e),this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"no_of_rooms",{get:function(){return this.tempParams.no_of_rooms},set:function(e){e>4||e<1||(this.tempParams.no_of_rooms=e,this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"no_of_occupants",{get:function(){return this.tempParams.no_of_occupants},set:function(e){e<1||(this.tempParams.no_of_occupants=e,this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"default_currency",{get:function(){return this.tempParams.currency},set:function(e){this.tempParams.currency=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"location",{get:function(){return this.tempParams.location},set:function(e){this.tempParams.location=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"formatted_location",{get:function(){return this.tempParams.location?this.tempParams.location.destination:"No Location Set"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"distance",{get:function(){return this.tempParams.distance},set:function(e){this.tempParams.distance=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"prefered_hotels_only",{get:function(){return this.tempParams.prefered_hotels_only},set:function(e){this.tempParams.prefered_hotels_only=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"country",{get:function(){return this.tempParams.country},set:function(e){this.tempParams.country=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"postcode",{get:function(){return this.tempParams.postcode},set:function(e){this.tempParams.postcode=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"trainsStation",{get:function(){return this.tempParams.trainsStation},set:function(e){this.tempParams.trainsStation=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"office",{get:function(){return this.tempParams.office},set:function(e){this.tempParams.office=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hotel_name",{get:function(){return this.tempParams.hotel_name},set:function(e){this.tempParams.hotel_name=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hotel_chain",{get:function(){return this.tempParams.hotel_chain},set:function(e){this.tempParams.hotel_chain=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"max_rooms_array",{get:function(){return this._max_rooms_array},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"max_occupant_array",{get:function(){return this._max_occupant_array},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"distance_list",{get:function(){return this._distance_list},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"location_type_select",{get:function(){return this.tempParams.location_type_select},set:function(e){this.tempParams.location_type_select=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"filters",{get:function(){return this.localFilters},enumerable:!1,configurable:!0}),n.prototype.processResults=function(e){var t=this;return this.results_details.maxDistance=0,this.results_details.chains=new Set,e.map((function(e,r){return t.results_details.maxDistance=Math.max(t.results_details.maxDistance,e.location.distance),t.filters.distanceRange.max=t.results_details.maxDistance,t.results_details.chains.add(e.group),r<t.environment.numberHotelToPreload&&t.avaliabilityService.getAvailabilityForId(t.makeHotelAvalilityObject(e),e),Object.assign({sortedTags:t.sortTags(e.tags),Details:{distance_airport:0,distance_metro:0,distance_rail:0,airport_details:{name:"Not returned"},metro_details:{name:"Not returned"},rail_details:{name:"Not returned"}}},e)}))},n.prototype._applyTravelRules=function(){var e=this,t=this.helpers.clone(this.fullResults||[]).map((function(t){return e.avaliabilityService.updateHotel(t)})).filter((function(e){return Object.keys(e.availableRates||{}).length>0}));0!==t.length&&this.applyHotelRulesFetcher.fetchKeyedObject("id",{data:t}).pipe(r.take(1)).subscribe((function(t){e.results.next(e.fullResults.map((function(r){return t[r.id]?e.avaliabilityService.setHotelAvalability(t[r.id]):r})))}))},n.prototype.makeLocations=function(e){return this.helpers.arrayToObjectArray(e,["distanceType"])},n.prototype.sortTags=function(e){var t=this;return e?T(e).sort((function(e,t){return e.name<t.name?-1:e.name>t.name?1:0})).map((function(e){return Object.assign(Object.assign({},e),{icon:t.environment.tagMap[e.name]||e.icon})})):[]},n.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeHotelQuery()),this.localFilters=new rt,this.results_details={chains:new Set,amenities:[],maxDistance:0},this._isValid()},n.prototype._isValid=function(){var t,r,i,a,o,s;if(this.doChecks){switch(this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams}),this.min_return_date=this.helpers.momentToNgDate(this.tempParams.checkin_date),this.tempParams.checkin_date.isSameOrAfter(this.tempParams.checkout_date)&&(this.checkout_date=u.default(this.tempParams.checkin_date).add(1,"day")),this.validationMessages=[],this.tempParams.location_type_select){case e.LocationTypes.City:this.country||this.validationMessages.push("Please select country"),this.location||this.postcode||this.validationMessages.push("Please select a hotel location or enter a postcode.");break;case e.LocationTypes.Office:"Office"===(null===(t=this.tempParams.location)||void 0===t?void 0:t.type)||this.office||this.validationMessages.push("Please select an office.");break;case e.LocationTypes.Airport:if(null===(r=this.tempParams)||void 0===r?void 0:r.location){(null===(i=this.tempParams.location.airport)||void 0===i?void 0:i.gateway)||this.validationMessages.push("Please select a airport.");break}this.validationMessages.push("Please select a airport.");break;case e.LocationTypes.TrainStation:(null===(o=null===(a=this.tempParams.location)||void 0===a?void 0:a.railstation)||void 0===o?void 0:o.stationCode)||(null===(s=this.trainsStation)||void 0===s?void 0:s.stationCode)||this.validationMessages.push("Please select a train station.");break;case e.LocationTypes.Shortlist:this.country||this.validationMessages.push("Please select country")}this.checkout_date&&this.checkout_date.isSameOrBefore(this.checkin_date)&&this.validationMessages.push("Checkout date must be after checkin date"),this.checkout_date&&this.checkout_date.isBefore(u.default())&&this.validationMessages.push("Checkout date must not be in the past"),this.checkin_date&&this.checkin_date.isBefore(u.default())&&this.validationMessages.push("Checkin date must not be in the past"),this.checkout_date&&this.checkin_date&&this.checkin_date.isAfter(this.checkout_date)&&this.validationMessages.push("Checkout data must be after the checkin date");var l=this.no_of_occupants/this.no_of_rooms;1!==l&&2!==l&&this.validationMessages.push("Occupants per room must be 1 or 2, if you have an odd number of travellers (greater than one), the no of rooms must be equal"),console.log(this.validationMessages),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages)}},n.prototype.startSearch=function(){if(this.results.next([]),this.avaliabilityService.reset(),this.isValid.value){this._originalUserSearch=Object.freeze(this.helpers.clone(this.tempParams)),this.buildQuery();var t=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(this.getSearchQuery())),this._startSearch(this.tempParams.location_type_select===e.LocationTypes.Shortlist?this.quickListFetcher.fetchList({countryCode:this.country.cCode}):this.hotelFetcher.fetchList(t))}return Promise.resolve(!1)},n.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:te.Hotel,searchArgs:t,travelDate:this.checkin_date.format(),travellers:this.helpers.getTravellersId(this.travellers)}},n.prototype.updateSerchQuery=function(t){var r,i=t;switch(i.location_type_select=this.location_type_select,(null===(r=this.location)||void 0===r?void 0:r.name)&&(i.cityName=this.location.name),i.location_type_select){case e.LocationTypes.Office:i.officeName=this.office.name;break;case e.LocationTypes.TrainStation:i.trainsStationDetail=this.trainsStation;break;case e.LocationTypes.Airport:i.airportDetail=this.location.airport}return i},n.prototype.startRecentSearch=function(t){var i=this;switch(this.location_type_select=t.searchArgs.location_type_select,this.currency=t.searchArgs.currency,this.distance=t.searchArgs.distance,this.no_of_rooms=t.searchArgs.rooms,this.checkin_date=u.default(t.searchArgs.startDate),this.checkout_date=u.default(t.searchArgs.endDate),this.hotel_name=t.searchArgs.hotelName,t.searchArgs.groupName&&(this.hotel_chain={name:t.searchArgs.groupName}),this.location_type_select){case e.LocationTypes.Airport:this.searchService.getAirportByCode(t.searchArgs.iata).subscribe((function(e){var t={airport:{gateway:e.iataMatch.iata}};i.location=Object.assign(Object.assign({},t),e.iataMatch),i.searchService.startSearches()}));break;case e.LocationTypes.City:this.country={cCode:t.searchArgs.countryCode,cName:""},t.searchArgs.latitude&&t.searchArgs.longitude?this.location={name:t.searchArgs.cityName,latitude:t.searchArgs.latitude,longitude:t.searchArgs.longitude}:t.searchArgs.postOrZipCode&&(this.postcode={name:t.searchArgs.postOrZipCode,type:e.LocationTypes.Postcode}),this.searchService.startSearches();break;case e.LocationTypes.Office:this.searchService.getOffice(t.searchArgs.officeId).pipe(r.take(1)).subscribe((function(e){i.office={id:e.id,name:e.name},i.searchService.startSearches()}));break;case e.LocationTypes.TrainStation:this.getRailStationByCode(t.searchArgs.trainStationCode).subscribe((function(e){i.trainsStation=e,i.searchService.startSearches()}));break;case e.LocationTypes.Shortlist:this.country={cCode:t.searchArgs.countryCode,cName:""},this.searchService.startSearches()}},n.prototype.getRailStationByCode=function(e){return e?this.getRailStationFetcher.fetchList({id:null,code:e}).pipe(r.take(1)):t.of()},n.prototype.getSearchQuery=function(e){return void 0===e&&(e=!1),this.buildQuery(e),this.helpers.removeNulls(this.query)},n.prototype.buildQuery=function(t){var r,i,n,a,o,s;void 0===t&&(t=!1);var u=t?this.originalUserSearch:this.tempParams,l={startDate:u.checkin_date.format("YYYY-MM-DD"),endDate:u.checkout_date.format("YYYY-MM-DD"),rooms:u.no_of_rooms,adults:u.no_of_occupants,currency:u.currency?u.currency:null,distance:u.distance,distanceType:B.M,maxResults:100};switch(this.getRoomNumber(),u.location_type_select){case e.LocationTypes.Airport:l.iata=u.location.airport.gateway;break;case e.LocationTypes.City:l.countryCode=u.country.cCode,this.location?(l.latitude=u.location.latitude,l.longitude=u.location.longitude):u.postcode&&(l.postOrZipCode=u.postcode.name);break;case e.LocationTypes.TrainStation:(null===(i=null===(r=u.location)||void 0===r?void 0:r.railstation)||void 0===i?void 0:i.stationCode)?l.trainStationCode=u.location.railstation.stationCode:(null===(n=u.trainsStation)||void 0===n?void 0:n.stationCode)&&(l.trainStationCode=u.trainsStation.stationCode);break;case e.LocationTypes.Office:(null===(a=u.location)||void 0===a?void 0:a.id)?l.officeId=+u.location.id:(null===(o=u.office)||void 0===o?void 0:o.id)&&(l.officeId=+u.office.id);break;case e.LocationTypes.Shortlist:l.countryCode=u.country.cCode;break;case e.LocationTypes.Postcode:l.countryCode=u.country.cCode,l.postOrZipCode=u.location.name}u.hotel_name&&(l.hotelName=u.hotel_name),u.hotel_chain&&(l.groupName=null===(s=u.hotel_chain)||void 0===s?void 0:s.name),this.query=l},n.prototype.makeHotelAvalilityObject=function(e){return{hotel:e.id,startDate:this.helpers.formatIsoDate(this.checkin_date),endDate:this.helpers.formatIsoDate(this.checkout_date),rooms:this.no_of_rooms,occupants:this.no_of_occupants,currency:"GBP"}},n.prototype.resultsHaveTag=function(e){var t=this,r=this.fullResults.filter((function(r){var i=r.tags.filter((function(r){if(r.name)return!!t.convertToOneString(r.name).toLowerCase().includes(t.convertToOneString(e).toLowerCase())}));return!!(i&&i.length>0)}));return!!(r&&r.length>0)},n.prototype.inPriceRange=function(e){var t=this.avaliabilityService.getAvailabilityValue(e);return!!t&&(this.helpers.inRange(t.maxprice,this.filters.priceRange)&&this.helpers.inRange(t.minprice,this.filters.priceRange))},n.prototype.inDistanceRange=function(e){return 0===this.filters.distanceRange.max||this.helpers.inRange(e.location.distance,this.filters.distanceRange)},n.prototype.containsHotelname=function(e){var t=this.filters.hotelName.toLowerCase();return!(t&&t.length>0)||e.name.toLowerCase().includes(t)},n.prototype.inLighteningPriceRange=function(e){var t=this.avaliabilityService.getAvailabilityValue(e);if(t&&0!==Object.keys(t).length){var r,i=0,n=this.helpers.inRange(t.prpn,this.filters.priceRange);return i=(null==t?void 0:t.maxprice)?t.maxprice:null==t?void 0:t.rooms.reduce((function(e,t){return e>t.total?e:t.total}),0),r=this.helpers.inRange(i,this.filters.priceRange),n&&r}return!0},n.prototype.hasChain=function(e){var t=(this.filters.chain||[]).map((function(e){return e.toLowerCase()}));return!t||!t.length||!!t.find((function(t){return e.group.toLowerCase().includes(t)}))},n.prototype.breakfastTypeFilter=function(t){if(!this.filters.breakfastType.length)return!0;var r=this.avaliabilityService.getAvailabilityForId(this.makeHotelAvalilityObject(t),t);if(!r&&!r.value)return!1;var i=r.value,n=this.filters.breakfastType.includes(e.SearchHandler.BREAKFAST_INCLUDED),a=this.filters.breakfastType.includes(e.SearchHandler.BREAKFAST_NOT_INCLUDED);return!!(null==i?void 0:i.rooms)&&!!i.rooms.filter((function(e){return n&&a?e:n?e.rateDescription.match(ke)&&!e.rateDescription.match(Fe):a?!e.rateDescription.match(ke)||e.rateDescription.match(Fe):void 0})).length},n.prototype.byMostExpensive=function(){this.sortByPrice(!1)},n.prototype.sortByPrice=function(e,t){var r=this;void 0===e&&(e=!0),void 0===t&&(t=!1);var i=this.fullResults,n=[],a=[];i.map((function(e){var t;(null===(t=r.avaliabilityService.getAvailabilityValue(e))||void 0===t?void 0:t.prpn)?n.push(e):a.push(e)})),n.sort((function(t,i){var n,a,o=null===(n=r.avaliabilityService.getAvailabilityValue(t))||void 0===n?void 0:n.prpn,s=null===(a=r.avaliabilityService.getAvailabilityValue(i))||void 0===a?void 0:a.prpn;return e?o>s?1:s>o?-1:0:o<s?1:s<o?-1:0}));var o=T(n,a);this.results.next(o),t&&(console.log("++ sortByPrice() called ++"),console.log("++ hotel ++",i),console.log("++ hotelsWithPrices ++",n),console.log("++ hotelsWithoutPrices ++",a),console.log("++ sortedHotels ++",o))},n.prototype.sortByName=function(){this.results.next(this.helpers.clone(this.fullResults).sort((function(e,t){return e.name.toLowerCase().localeCompare(t.name.toLowerCase())})))},n.prototype.sortByDistance=function(){this.results.next(this.helpers.clone(this.fullResults).sort((function(e,t){return Number(e.location.distance)-Number(t.location.distance)})))},n.prototype.byPreferred=function(){var e=this,t=this.results.value||[];try{t=t.sort((function(t,r){return e.preferredToInt(r)-e.preferredToInt(t)}))}catch(e){console.error("+++ Error sorting by preferred: ",e," +++")}this.results.next(t)},n.prototype.preferredToInt=function(e){return(e.preferred.client?1:0)+(e.preferred.consumer?2:0)},n.prototype.intToPreferred=function(e){return{client:1==(1&e),consumer:2==(2&e)}},n.prototype.addFilter=function(e,t){this.localFilters[t].push(e)},n.prototype.removeFilter=function(e,t){var r=this.localFilters;Array.isArray(r[t])&&(r[t]=r[t].filter((function(t){return e!==t})))},n.prototype.resetFilters=function(){this.localFilters.chain=[],this.localFilters.amenitytype=[],this.localFilters.preferred=[],this.localFilters.extra=[],this.localFilters.hotelName="",this.localFilters.breakfastType=[]},n.prototype.updateFromPreviousSearches=function(t){var r,i;console.log("PREPOPULATING HOTEL FORM");var n=null===(r=t[te.Flight])||void 0===r?void 0:r.searchQuery,a=null===(i=t[te.Rail])||void 0===i?void 0:i.searchQuery;if(n)try{this.location_type_select=e.LocationTypes.Airport,this.checkin_date=this.searchService.searches[te.Flight].outBoundDate,this.checkout_date=this.searchService.searches[te.Flight].inboundDate,this.location={name:this.searchService.searches[te.Flight].arriveLocation.destination,type:"Airport",airport:this.searchService.searches[te.Flight].arriveLocation}}catch(e){console.error("Error trying to prepopulate hotel from flight item")}else if(a)try{this.location_type_select=e.LocationTypes.TrainStation,this.checkin_date=this.searchService.searches[te.Rail].outBoundDateTime,this.checkout_date=this.searchService.searches[te.Rail].inBoundDateTime,this.trainsStation=this.searchService.searches[te.Rail].travellingTo}catch(e){console.error("Error trying to prepopulate hotel from rail item")}},n.prototype.hasPreferred=function(t){var r=this.filters.preferred;return!(r.length&&!r.includes(e.SearchHandler.ANY))||(r.includes(e.SearchHandler.AGENCY)&&r.includes(e.SearchHandler.CLIENT)?!0===t.preferred.consumer&&!0===t.preferred.client:r.includes(e.SearchHandler.AGENCY)?!0===t.preferred.consumer:r.includes(e.SearchHandler.CLIENT)?!0===t.preferred.client:void 0)},n.prototype.getmaxPriceForCurrency=function(e){return this.avaliabilityService.maxPriceForCurrency(e)},n.prototype.getExtraFilter=function(t){var r=this;return this.filters.extra.includes(e.SearchHandler.AVAILABILITY)?!0===t.unavailable:!this.filters.extra.includes(e.SearchHandler.FEMALE_FRIENDLY)||t.tags.filter((function(t){return!t.name||r.convertToOneString(t.name).toLowerCase().includes(r.convertToOneString(e.SearchHandler.FEMALE_FRIENDLY).toLowerCase())})).length>0},n.prototype.getAmenitiesFilter=function(e){var t=this,r=!0;return this.filters.amenitytype.forEach((function(i){var n=e.tags.filter((function(e){if(e.name)return!!t.convertToOneString(e.name).toLowerCase().includes(t.convertToOneString(i).toLowerCase())}));return r=!!(n&&n.length>0)})),r},n.prototype.convertToOneString=function(e){return e.replace(/[^a-zA-Z]/g,"")},n.prototype.getImages=function(i){var n=this,a=this.environment.hostBaseUrl+e.URLS.CONFIRMA_PHOTO_URL+i.split(",")[0];return this.galleries[i]?t.of(this.galleries[i]):this.httpCallService.get(a,{responseType:"text"}).pipe(r.map((function(e){if(!e)throw Error("Gallery for "+i+" can not be loaded.");var t=document.createElement("div");t.innerHTML=e;var r=Array.from(t.getElementsByTagName("img")).reduce((function(e,t){return t.src.includes("https://www.vfmii.com/")&&e.push(t.src),e}),[]);if(!r.length)throw Error("There is no media content provided for this hotel "+i);return n.galleries[i]=r})))},n.prototype.addPaginationPage=function(e){var t="PaginationPageCount";return this.storageService.setSessionItem(t,e),this.storageService.getSessionItem(t)},n.prototype.toggleView=function(){this.currentView===e.HotelView.LIST?this.currentView=e.HotelView.MAP:this.currentView=e.HotelView.LIST},n.prototype.calcDayDiff=function(){var e=u.default(this.checkout_date),t=u.default(this.checkin_date);return e.startOf("day").diff(t.startOf("day"),"days")},n.prototype.updateLowestPrice=function(e){var t=Object.keys(this.avaliabilityService.currencies);if(!e.length&&!t.length||!t.length)return null;var r=t[0];return{amount:this.avaliabilityService.currencies[r].minprice,currencyCode:r}},n.prototype.getRoomNumber=function(){for(var e=[],t=0;t<Number(this.tempParams.no_of_rooms);t++){var r={Adults:this.calcRoomOccupancy(this.tempParams.no_of_rooms,this.tempParams.no_of_occupants),Children:0,Infants:0};e.push(r)}for(var i=[],n=0;n<e.length;n++)for(var a=0;a<e[n].Adults;a++)i.push(n+1)},n.prototype.calcRoomOccupancy=function(e,t){console.log("No of Travellers: "+t+"| No of rooms: "+e+" | Assigned: "+this.occupied);var r=Math.ceil(t/e);return t-this.occupied<r&&(console.log("We have run out of occupiers!"),r=t-this.occupied),r<=0&&(r=1),this.occupied+=r,r},n.prototype.addHotelRoomToBasket=function(e,t,r,i){return g(this,void 0,void 0,(function(){var i,n,a,o,u,l,c,d,p,h,m=this;return v(this,(function(f){switch(f.label){case 0:return console.log(e),console.log(t),console.log(r),e.unavailable?[2,Promise.resolve(!1)]:(r.startDate=new Date(r.startDate).toISOString(),r.endDate=new Date(r.endDate).toISOString(),delete(i=Object.assign({},r)).adults,(n=[]).push({rateDescription:t.rateDescription,roomDescription:t.roomDescription,roomId:t.roomId,roomType:t.roomType,rateCode:t.rateCode,checkIn:r.startDate,checkOut:r.endDate}),[4,this.basketService.getDefaultBasket()]);case 1:return a=f.sent(),(o=null==a?void 0:a.subject.value)&&(u=this.tempParams.no_of_occupants,l=new Array(this.tempParams.no_of_rooms).fill("TEST"),c=this.tempParams.no_of_rooms===u?1:2,d=s.default.chunk(this.travellers,c),p=e.address,h=this.getTermsAndCond(t,r),l.forEach((function(s,u){if(m.basketService.addToBasket({adults:c,basket:o.id,service:e.sourceId.toString(),detail:{hotelAddress:{streetName:p.addressLine1,town:p.addressLine2,county:p.addressLine3,postcode:p.postOrZipCode,countryCode:p.countryCode},hotelDescription:e.group,hotelId:e.id,hotelName:e.name,numberOfRooms:1,rooms:n,termsAndCond:h},price:t.total,currency:t.currencyCode,searchQuery:i,outboundDate:r.startDate},a,m.searchService,d[u]||[]),u===l.length-1)return Promise.resolve(!0)}))),[2,Promise.resolve(!1)]}}))}))},n.prototype.getTermsAndCond=function(e,t){return[{name:"Rate Information",value:e.rateDescription},{name:"Cancellation Policy",value:e.policies.cancellation},{name:"Rate Code",value:e.rateCode},{name:"Room Information",value:e.roomDescription},{name:"Deposit Amount",value:(e.total*t.rooms).toString()+t.currency}]},n.prototype.saveSearch=function(e){if(void 0===e&&(e=null),this.isValid.value){var t=this.getSearchQuery(),r=this.updateSerchQuery(t);e&&(r.hotelName=e);var i={name:""+u.default(),serviceType:te.Hotel,searchArgs:r};return this.searchService.saveFavouriteSearch(i)}},n}(c);it.MAX_HOTEL_ROOMS=4,it.STORAGE_SESSION_PARAMS="search_hotel",it.STORAGE_SESSION_RESULTS="results_hotel";var nt=function(e){function r(i,n,a,o,s){var l=e.call(this,o,n)||this;l.loungefetcher=i,l.basketService=a,l.searchService=s,l.type=te.Lounge,l.terminals=new t.BehaviorSubject([]),l._flightNumber=null,l._selectedTerminal="",l.min_date={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},l._date=null,l._time=null,l.resultsSessionName=r.STORAGE_SESSION_RESULTS,l.multiResultsSessionName=r.STORAGE_SESSION_RESULTS;var c=o.getSessionItem(r.STORAGE_SESSION_PARAMS)||{tempParams:{}};l.updateTempParams(s.makeLoungesQuery(c.tempParams)),s.shouldAddTravellerSubscription()&&s.travellerInformation.subscribe((function(e){var t=l.helpers.selectedTravellers(e,te.Lounge);l.tempParams.adults=t.adults.length,l.tempParams.children=t.children.length,l.travellers=e,l._isValid()}));var d=o.getSessionItemAsList(l.resultsSessionName)||[];return l._cheapestResultPrice=l.updateLowestPrice(d),l.results.next(d||[]),l}return m(r,e),Object.defineProperty(r.prototype,"adults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"children",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"infants",{get:function(){return this.tempParams.infants},set:function(e){this.tempParams.infants=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"flightNumber",{get:function(){return this._flightNumber},set:function(e){this._flightNumber=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"locationCode",{get:function(){return this.tempParams.locationCode},set:function(e){var t;this.tempParams.locationCode=e;var r=null===(t=this.terminals)||void 0===t?void 0:t.value;"string"==typeof e?(this._locationCode="",this.terminal=null,this.terminals.next([]),this.selectedTerminal=null,this._isValid()):e&&e.gateway?(this._locationCode=e.gateway,this.terminal=null,this.terminals.next(e.terminals),1===r.length&&(this.selectedTerminal=r[0].key),this._isValid()):(this._locationCode=null,this.terminal=null,this.selectedTerminal=null,this.terminals.next([]),this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"terminal",{get:function(){return this.tempParams.terminal?this.tempParams.terminal.toString():null},set:function(e){this.tempParams.terminal=e;var t=this.terminals.value.find((function(t,r){if(t.value===e)return!0}));t?this.selectedTerminal=t.key:this.terminals.value&&this.terminals.value.length>0?this.selectedTerminal=this.terminals.value[0].key:this.selectedTerminal="Any Terminal",this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"selectedTerminal",{get:function(){return this._selectedTerminal},set:function(e){this._selectedTerminal=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"date",{get:function(){return this._date},set:function(e){this._date=e,this._updateDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"time",{get:function(){return this._time},set:function(e){this._time=e,this._updateDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"arrivalDatetime",{get:function(){return this.tempParams.arrivalDatetime},set:function(e){e.isValid()?(this.tempParams.arrivalDatetime=e,this._date=this.helpers.momentToNgDate(e),this._time=this.helpers.formatTimeColon(e)):this.tempParams.arrivalDatetime=null,this._isValid()},enumerable:!1,configurable:!0}),r.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeLoungesQuery()),this._isValid()},r.prototype.getSearchQuery=function(){var e={adults:this.tempParams.adults,children:this.tempParams.children,infants:this.tempParams.infants,locationCode:this._locationCode,terminal:"Any"===this.tempParams.terminal?null:this.tempParams.terminal,arrivalDatetime:this.tempParams.arrivalDatetime};return this.helpers.removeNulls(e)},r.prototype._isValid=function(){this.doChecks&&(this.storageService.setSessionItem(r.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,travellers:this.travellers}),this.validationMessages=[],this._locationCode&&""!==this._locationCode||this.validationMessages.push("You must select airport first."),this.tempParams.arrivalDatetime.unix()<u.default().unix()&&this.validationMessages.push("Outward journey cannot be in the past."),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages))},r.prototype._updateDateTime=function(){if(this._date&&this._time){var e=this.helpers.ngDateToMoment(this._date,this._time);this.tempParams.arrivalDatetime=e.isValid()?e:null,this._isValid()}},r.prototype.startSearch=function(){if(this.results.next([]),this.isValid.value){var e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.loungefetcher.fetchList(this.helpers.removeNulls(e)))}return Promise.resolve(!1)},r.prototype.getRecentSearchQuery=function(e){return{serviceType:te.Lounge,searchArgs:e,travelDate:this.arrivalDatetime.format(),travellers:this.helpers.getTravellersId(this.travellers)}},r.prototype.startRecentSearch=function(e){var t=this;this.arrivalDatetime=u.default(e.searchArgs.arrivalDatetime),this.terminal=e.searchArgs.terminal,this.searchService.getAirportByCode(e.searchArgs.locationCode).subscribe((function(r){var i,n,a,o,s,u;r&&(t.locationCode={country:null===(n=null===(i=r.iataMatch)||void 0===i?void 0:i.locationDetails)||void 0===n?void 0:n.country,countryCode:null===(o=null===(a=r.iataMatch)||void 0===a?void 0:a.locationDetails)||void 0===o?void 0:o.countryCode,destination:r.iataMatch.name,gateway:r.iataMatch.iata,postcode:null===(u=null===(s=r.iataMatch)||void 0===s?void 0:s.locationDetails)||void 0===u?void 0:u.postcode,terminals:t.searchService.processTerminals(r.iataMatch.terminals)},t.terminal=e.searchArgs.terminal,t.searchService.startSearches())})),this.searchService.startSearches()},r.prototype.sortByPrice=function(e,t){void 0===t&&(t=[]);var r=T(this.fullResults);r.length||(r=t),r=this.sortResultsPrice(r,e),this.results.next(r)},r.prototype.sortResultsPrice=function(e,t){var r=T(e);return r=t?r.sort((function(e,t){return t.price-e.price})):r.sort((function(e,t){return e.price-t.price}))},r.prototype.sortByTerminal=function(e){void 0===e&&(e=[]);var t=T(this.fullResults);t.length||(t=e);this.results.next(t.sort((function(e,t){return-1})))},r.prototype.updateFromPreviousSearches=function(e){var t;if(console.log("PREPOPULATING LOUNGE FORM"),null===(t=e[te.Flight])||void 0===t?void 0:t.searchQuery)try{var r=this.searchService.searches[te.Flight].outBoundDate.toDate();this.date={day:r.getUTCDate(),month:r.getUTCMonth()+1,year:r.getUTCFullYear()},this.locationCode=this.searchService.searches[te.Flight].arriveLocation}catch(e){console.error("Error trying to prepopulate parking from lounge item")}},r.prototype.addLoungeToBasket=function(e,t){var r;return g(this,void 0,void 0,(function(){var i,n,a;return v(this,(function(o){switch(o.label){case 0:return e.unavailable?[2,Promise.resolve(!1)]:[4,this.basketService.getDefaultBasket()];case 1:return i=o.sent(),n=null==i?void 0:i.subject.value,a=this.getTermsAndCond(e),n?[2,this.basketService.addToBasket({adults:t.adults,children:t.children,infants:t.infants,basket:n.id,service:e.sourceId.toString(),detail:{arrivalDatetime:t.arrivalDatetime.format(),locationCode:e.code,name:e.name,airportIata:null==t?void 0:t.locationCode,logo:e.lounge.logo,introduction:e.lounge.introduction,covidCopy:e.lounge.misc.covidCopy,cancellationInfo:e.lounge.cancellationInfo,admendmentsInfo:e.lounge.amendmentsInfo,checkInInfo:e.lounge.checkInInfo,dressCode:e.lounge.dressCode,foodAndBeverage:e.lounge.foodAndBeverage,whatsIncludedFood:e.lounge.whatsIncludedFood,whatsIncludedDrinks:e.lounge.whatsIncludedDrinks,whatsIncludedExtras:e.lounge.whatsIncludedExtras,groupInfo:e.lounge.groupInfo,terminal:null===(r=e.lounge.terminal)||void 0===r?void 0:r.toString(),termsAndCond:a},price:e.price,currency:e.currency,searchQuery:t,outboundDate:t.arrivalDatetime.format()},i,this.searchService,this.travellers)]:[2,Promise.resolve(!1)]}}))}))},r.prototype.getTermsAndCond=function(e){return[{name:"Name",value:e.lounge.name},{name:"Telephone",value:e.lounge.telephone},{name:"Important Information",value:e.lounge.misc.importantInformation},{name:"Introduction",value:e.lounge.introduction},{name:"Dress Code",value:e.lounge.dressCode},{name:"Business Facilities",value:e.lounge.misc.businessfacilities},{name:"Entertainment Facilities",value:e.lounge.misc.entertainmentFacilities},{name:"Disabled Facilities",value:e.lounge.misc.facilitiesdisabled},{name:"Facilities",value:e.lounge.facilities.toString()},{name:"Times",value:"Opens "+e.lounge.openTime+"; Closes "+e.lounge.closeTime},{name:"Directions",value:e.lounge.directions},{name:"Groups",value:e.lounge.groupInfo},{name:"Check-In Time",value:e.lounge.checkInInfo},{name:"Amend Info",value:e.lounge.amendmentsInfo},{name:"Cancel Info",value:e.lounge.cancellationInfo}]},r.prototype.updateLowestPrice=function(e){if(!e.length)return null;var t=e[0].currency;return e.reduce((function(e,t){var r=t.price;return e.amount>r&&(e.amount=r),e}),{amount:Number.MAX_SAFE_INTEGER,currencyCode:t})},r.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t={name:""+u.default(),serviceType:te.Lounge,searchArgs:e};return this.searchService.saveFavouriteSearch(t)}},r}(c);nt.STORAGE_SESSION_PARAMS="search_lounge",nt.STORAGE_SESSION_RESULTS="results_lounge";var at,ot,st={AirportFirst:"You must select airport first.",InvardJourney:"Inward journey cannot be in the past.",OutwardJourney:"Outward journey cannot be in the past.",DateOverlapped:"Inward Journey can not be before outward journey"},ut=function(e){function r(i,n,a,o,s){var l=e.call(this,o,n)||this;l.parkingfetcher=i,l.basketService=a,l.searchService=s,l.type=te.Parking,l.terminals=new t.BehaviorSubject([]),l.listViewToggle=new t.BehaviorSubject(null),l.parkingFiltersText={onAirport:"On Airport",meetAndGreet:"Meet and greet",parkAndRide:"Park and ride",parkAndStroll:"Park and stroll",carParkedForYou:"Car parked for you"},l._selectedTerminal="",l.min_date={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},l.min_return_date={year:u.default().year(),month:u.default().month()+1,day:u.default().date()+1},l.resultsSessionName=r.STORAGE_SESSION_RESULTS,l.multiResultsSessionName=r.STORAGE_SESSION_RESULTS,l._outdate=null,l._outtime=null,l._indate=null,l._intime=null;var c=o.getSessionItem(r.STORAGE_SESSION_PARAMS)||{tempParams:{}};l.updateTempParams(s.makeParkingQuery(c.tempParams));var d=o.getSessionItemAsList(l.resultsSessionName)||[];return l.results.next(d),l._cheapestResultPrice=l.updateLowestPrice(d),s.shouldAddTravellerSubscription()&&s.travellerInformation.subscribe((function(e){l.travellers=(null==e?void 0:e.slice(0,1))||[],l._isValid()})),l}return m(r,e),Object.defineProperty(r.prototype,"outdate",{get:function(){return this._outdate},set:function(e){this._outdate=e,this._outdate&&this._outdate&&(this.arrivalDatetime=this.helpers.ngDateToMoment(this._outdate,this._outtime))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"outtime",{get:function(){return this._outtime},set:function(e){this._outtime=e,this._outdate&&this._outtime&&(this.arrivalDatetime=this.helpers.ngDateToMoment(this._outdate,this._outtime))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"departDatetime",{get:function(){return this.tempParams.departDatetime},set:function(e){this.tempParams.departDatetime=e.isValid()?e:null,e&&e.isValid()&&(this._indate=this.helpers.momentToNgDate(e),this._intime=this.helpers.formatTimeColon(e)),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"indate",{get:function(){return this._indate},set:function(e){this._indate=e,this._indate&&this._intime&&(this.departDatetime=this.helpers.ngDateToMoment(this._indate,this._intime))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"intime",{get:function(){return this._intime},set:function(e){this._intime=e,this.departDatetime=this.helpers.ngDateToMoment(this._indate,this._intime)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"arrivalDatetime",{get:function(){var e;return null===(e=this.tempParams)||void 0===e?void 0:e.arrivalDatetime},set:function(e){if(this.tempParams.arrivalDatetime=e.isValid?e:null,e&&e.isValid()&&(this._outdate=this.helpers.momentToNgDate(e),this._outtime=this.helpers.formatTimeColon(e),this.departDatetime&&this.departDatetime.isSameOrBefore(this.arrivalDatetime))){var t=this.arrivalDatetime.clone();this.departDatetime=t}this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"outFlightNumber",{get:function(){var e;return null===(e=this.tempParams)||void 0===e?void 0:e.outFlightNumber},set:function(e){this.tempParams.outFlightNumber=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"recommended",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.recommended)},set:function(e){this.tempParams.recommended=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onAirport",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.onAirport)},set:function(e){this.tempParams.onAirport=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"meetAndGreet",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.meetAndGreet)},set:function(e){this.tempParams.meetAndGreet=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parkAndRide",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.parkAndRide)},set:function(e){this.tempParams.parkAndRide=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parkAndStroll",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.parkAndStroll)},set:function(e){this.tempParams.parkAndStroll=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"carParkedForYou",{get:function(){var e;return!!(null===(e=this.tempParams)||void 0===e?void 0:e.carParkedForYou)},set:function(e){this.tempParams.carParkedForYou=e||null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"terminal",{get:function(){return this.tempParams.terminal?this.tempParams.terminal.toString():null},set:function(e){this.tempParams.terminal=e;var t=this.terminals.value.find((function(t,r){if(t.value===e)return!0}));t?this.selectedTerminal=t.key:this.terminals.value&&this.terminals.value.length>0?this.selectedTerminal=this.terminals.value[0].key:this.selectedTerminal="Any Terminal",this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"locationCode",{get:function(){return this.tempParams.locationCode},set:function(e){this.tempParams.locationCode=e,"string"==typeof e?(this._locationCode=null,this.terminal=null,this.terminals.next([]),this.selectedTerminal=null,this._isValid()):e&&e.gateway?(this._locationCode=e.gateway,this.terminal=null,this.terminals.next(e.terminals),1===e.terminals.length&&(this.selectedTerminal=e.terminals[0].key),this._isValid()):(this._locationCode=null,this.terminal=null,this.terminals.next([]),this.selectedTerminal=null,this._isValid())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"selectedTerminal",{get:function(){return this._selectedTerminal},set:function(e){this._selectedTerminal=e},enumerable:!1,configurable:!0}),r.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeParkingQuery()),this._isValid()},r.prototype._isValid=function(){var e,t,i;this.doChecks&&(this.storageService.setSessionItem(r.STORAGE_SESSION_PARAMS,{location:this._locationCode,travellers:this.travellers,tempParams:this.tempParams}),this.validationMessages=[],this._locationCode&&""!==this._locationCode||this.validationMessages.push(st.AirportFirst),(null===(e=this.tempParams)||void 0===e?void 0:e.arrivalDatetime.unix())<u.default().unix()&&this.validationMessages.push(st.InvardJourney),(null===(t=this.tempParams)||void 0===t?void 0:t.departDatetime.unix())<u.default().unix()&&this.validationMessages.push(st.OutwardJourney),(null===(i=this.tempParams.departDatetime)||void 0===i?void 0:i.isBefore(this.tempParams.arrivalDatetime))&&this.validationMessages.push(st.DateOverlapped),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages))},r.prototype.startSearch=function(){if(this.results.next([]),this.isValid.value){var e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.parkingfetcher.fetchList(this.helpers.removeNulls(e)))}return Promise.resolve(!1)},r.prototype.getRecentSearchQuery=function(e){return{serviceType:te.Parking,searchArgs:e,travelDate:this.arrivalDatetime.format(),travellers:this.helpers.getTravellersId(this.travellers)}},r.prototype.startRecentSearch=function(e){var t=this;this.arrivalDatetime=u.default(e.searchArgs.arrivalDatetime),this.departDatetime=u.default(e.searchArgs.departDatetime),this.outFlightNumber=e.searchArgs.outFlightNumber,this.terminal=e.searchArgs.terminal,this.searchService.getAirportByCode(e.searchArgs.locationCode).subscribe((function(e){var r,i,n,a,o,s;e&&(t.locationCode={country:null===(i=null===(r=e.iataMatch)||void 0===r?void 0:r.locationDetails)||void 0===i?void 0:i.country,countryCode:null===(a=null===(n=e.iataMatch)||void 0===n?void 0:n.locationDetails)||void 0===a?void 0:a.countryCode,destination:e.iataMatch.name,gateway:e.iataMatch.iata,postcode:null===(s=null===(o=e.iataMatch)||void 0===o?void 0:o.locationDetails)||void 0===s?void 0:s.postcode,terminals:t.searchService.processTerminals(e.iataMatch.terminals)},t.searchService.startSearches())})),this.searchService.startSearches()},r.prototype.getSearchQuery=function(){var e={arrivalDatetime:this.tempParams.arrivalDatetime,departDatetime:this.tempParams.departDatetime,locationCode:this._locationCode,outFlightNumber:this.tempParams.outFlightNumber,recommended:this.tempParams.recommended,onAirport:this.tempParams.onAirport,meetAndGreet:this.tempParams.meetAndGreet,parkAndRide:this.tempParams.parkAndRide,parkAndStroll:this.tempParams.parkAndStroll,carParkedForYou:this.tempParams.carParkedForYou,terminal:"Any"===this.tempParams.terminal?null:this.tempParams.terminal};return this.helpers.removeNulls(e)},r.prototype.sortByPrice=function(e){var t=this.helpers.clone(this.results.value)||[];t=e?t.sort((function(e,t){return t.price-e.price})):t.sort((function(e,t){return e.price-t.price})),this.results.next(t)},r.prototype.updateFromPreviousSearches=function(e){var t;if(console.log("PREPOPULATING PARKING FORM"),null===(t=e[te.Flight])||void 0===t?void 0:t.searchQuery)try{var r=this.searchService.searches[te.Flight].outBoundDate.toDate(),i=this.searchService.searches[te.Flight].inboundDate.toDate();this.outdate={day:r.getUTCDate(),month:r.getUTCMonth()+1,year:r.getUTCFullYear()},this.indate={day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()},this.locationCode=this.searchService.searches[te.Flight].arriveLocation}catch(e){console.error("Error trying to prepopulate parking from flight item")}},r.prototype.addParkingToBasket=function(e,t){return g(this,void 0,void 0,(function(){var r,i,n;return v(this,(function(a){switch(a.label){case 0:return[4,this.basketService.getDefaultBasket()];case 1:return r=a.sent(),i=null==r?void 0:r.subject.value,n=this.getTermsAndCond(e),i?[2,this.basketService.addToBasket({adults:1,basket:i.id,service:e.sourceId.toString(),detail:{arrivalDatetime:t.arrivalDatetime.format(),departDatetime:t.departDatetime.format(),locationCode:e.carPark.code,name:e.carPark.name,requiredInfo:e.requiredInfo,airportIata:t.locationCode,termsAndCond:n},price:e.price,currency:e.currency,searchQuery:t,outboundDate:t.arrivalDatetime.format(),inboundDate:t.departDatetime.format()},r,this.searchService,this.travellers)]:[2,Promise.resolve(!1)]}}))}))},r.prototype.getTermsAndCond=function(e){return[{name:"Name",value:e.carPark.name},{name:"Telephone",value:e.carPark.telephone},{name:"Important Information",value:e.carPark.misc.importantInformation},{name:"Geo-Position",value:"Latitude "+e.carPark.latitude+"; Longitude "+e.carPark.latitude},{name:"Introduction",value:e.carPark.introduction},{name:"Arrival Procedures",value:e.carPark.arrivalProcedure},{name:"Departure Procedure",value:e.carPark.departureProcedure},{name:"Information",value:e.carPark.information},{name:"Maximum Car Size",value:e.carPark.maximumCarSize},{name:"Directions",value:e.carPark.directions}]},r.prototype.updateLowestPrice=function(e){if(!e.length)return null;var t=e[0].currency;return e.reduce((function(e,t){var r=t.price;return e.amount>r&&(e.amount=r),e}),{amount:Number.MAX_SAFE_INTEGER,currencyCode:t})},r.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t={name:""+u.default(),serviceType:te.Parking,searchArgs:e};return this.searchService.saveFavouriteSearch(t)}},r}(c);ut.STORAGE_SESSION_PARAMS="search_parking",ut.STORAGE_SESSION_RESULTS="results_parking",(at=e.RailDirection||(e.RailDirection={})).Outbound="outbound",at.Inbound="inbound",(ot=e.EurostarSearchType||(e.EurostarSearchType={})).return="return",ot.oneWay="oneWay";var lt,ct,dt=Object.freeze({stops:{},totalStops:{},mustInclude:{},classes:{},airlines:{},travelPolicy:{},depatureAirport:{},depatureReturnAirport:{},arrivalAirport:{},arrivalReturnAirport:{},baggage:{},fareTypes:{},price:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},duration:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},returnDuration:{min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER},departureTime:{min:0,max:2359},arrivalTime:{min:0,max:2359},returnDepartureTime:{min:0,max:2359},returnArrivalTime:{min:0,max:2359},flightNumber:""});(lt=e.SortTypesEurostar||(e.SortTypesEurostar={})).CheapestFirst="C",lt.EarliestFirst="E",lt.LatestFirst="L",(ct=e.SortMethod||(e.SortMethod={})).sortByPrice="sortByPrice",ct.sortByDate="sortByDate";var pt=function(r){function i(n,a,o,s,l,c){var d=r.call(this,l,a)||this;d.eurostarFetcher=n,d.basketService=s,d.searchService=c,d.type=te.Eurostar,d.avaliableClasses=new t.BehaviorSubject([]),d.timeCriteriaOptions=new t.BehaviorSubject([]),d.flightOperators=new t.BehaviorSubject([]),d._negotiated=!1,d._nearby_airports=!1,d._sortArray=[{title:"Price",method:e.SortMethod.sortByPrice,icon:"ico-dollar",dir:!0,code:e.SortTypesEurostar.CheapestFirst},{title:"Time",method:e.SortMethod.sortByDate,icon:"ico-calendar",dir:!0,code:e.SortTypesEurostar.EarliestFirst},{title:"Time (Descending)",method:e.SortMethod.sortByDate,icon:"ico-calendar",dir:!0,code:e.SortTypesEurostar.LatestFirst}],d._sortArrayLu=[{title:"Price",method:e.SortMethod.sortByPrice,icon:"ico-dollar",dir:!0,code:e.SortTypesEurostar.CheapestFirst},{title:"Time",method:e.SortMethod.sortByDate,icon:"ico-calendar",dir:!0,code:e.SortTypesEurostar.EarliestFirst}],d._fareTypeArray=[{value:w.Flexible,display:"Flexible"},{value:w.Leisure,display:"Leisure"},{value:w.Lowest,display:"Lowest"},{value:w.Negotiated,display:"Negotiated"},{value:w.NonNegotiated,display:"Non-Negotiated"},{value:w.RequestFareRules,display:"Request Fare Rules"},{value:w.SelectAndPro,display:"Select & Pro"}],d.minimumOutBoundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},d.minimumInBoundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},d.searchTypes=[{value:e.EurostarSearchType.return,display:"Return"},{value:e.EurostarSearchType.oneWay,display:"One-way"}],d.flightsToGroup={},d.grouped=null,d.travellers=null,d.resultsSessionName=i.STORAGE_SESSION_RESULTS,d.multiResultsSessionName=i.STORAGE_SESSION_RESULTS,d._displayAddHotel=!1,d.filters=new t.BehaviorSubject(dt),d.selectedGroupEurostar={item:null,direction:null},d._selectedEurostarFare={item:null,direction:null},d._multiDestination=[],d.minToHour=function(e){return Math.floor(e/60)+"h "+e%60+"m"};var p=l.getSessionItem(i.STORAGE_SESSION_PARAMS)||{tempParams:{},originalUserSearch:{}},h=c.makeEurostarQuery(p.tempParams);d.updateTempParams(h),d._originalUserSearch=p.originalUserSearch,c.shouldAddTravellerSubscription()&&c.travellerInformation.subscribe((function(e){d.travellers=e;var t=d.helpers.selectedTravellers(e,te.Eurostar);d.tempParams.adults=t.adults.length,d.tempParams.children=t.children.length,d.updateTravellers(),d._isValid()})),o.changeUser.subscribe((function(t){d.timeCriteriaOptions.next([e.TimeWindow.Anytime,e.TimeWindow.Arrive,e.TimeWindow.Depart]),d.updateAvaliableClasses()})),d.updateTravellers();var m=l.getSessionItem(d.resultsSessionName)||{results:[],groupData:{},grouped:[],query:{}};d.fullResults=d.helpers.clone(m.results),d.flightsToGroup=m.groupData||{},d.resultQuery=m.query;d.searchService.isFlightsGrouped();d.results.next(m.results||[]);var f=d.helpers.clone(m.results);return f.length&&d.filters.next(d.helpers.createFlightFilters(f[0].journeys,dt)),d._isValid(),d.negotiated=d.tempParams.fareType===w.Negotiated,d}return m(i,r),Object.defineProperty(i.prototype,"displayAddHotel",{get:function(){return this._displayAddHotel},set:function(e){this._displayAddHotel=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"selectedEurostarFare",{get:function(){return this._selectedEurostarFare.item},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"selectedFareClass",{get:function(){var e,t;return null===(t=null===(e=this._selectedEurostarFare)||void 0===e?void 0:e.item)||void 0===t?void 0:t.class},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"timeArray",{get:function(){return this._timeArray=this._timeArray||Array(96).fill(0).map((function(e,t){return{value:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0"),display:Math.floor(t/4).toString().padStart(2,"0")+":"+(t%4*15).toString().padStart(2,"0")}})),this._timeArray},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"preferredCarriers",{get:function(){return this.tempParams.preferredCarriers},set:function(e){this.tempParams.preferredCarriers=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"operator1",{get:function(){return this.tempParams.preferredCarriers[0]},set:function(e){this.tempParams.preferredCarriers[0]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"operator2",{get:function(){return this.tempParams.preferredCarriers[1]},set:function(e){this.tempParams.preferredCarriers[1]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"operator3",{get:function(){return this.tempParams.preferredCarriers[2]},set:function(e){this.tempParams.preferredCarriers[2]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"operator4",{get:function(){return this.tempParams.preferredCarriers[3]},set:function(e){this.tempParams.preferredCarriers[3]=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"minDate",{get:function(){return this._minDate=this._minDate||this.helpers.momentToNgDate(u.default()),this._minDate},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"adults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=Number(e),this.updateTravellers()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"children",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=Number(e),this.updateTravellers()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"departLocation",{get:function(){return this.tempParams.departLocation},set:function(e){this.tempParams.departLocation=e,"string"==typeof e?this._originAirport="":e&&e.gateway?this._originAirport=e.gateway:this._originAirport=null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"queryOriginAiport",{get:function(){return this._originAirport},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"queryDestinationAiport",{get:function(){return this._destinationAirport},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"departDate",{get:function(){return this._outDate},set:function(e){this._outDate=e,this.outBoundDate=this.helpers.ngDateToMoment(this._outDate,this._outTime)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"departTime",{get:function(){return this._outTime},set:function(e){this._outTime=e,this.outBoundDate=this.helpers.ngDateToMoment(this._outDate,this._outTime)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outBoundDate",{get:function(){return this.tempParams.outBoundDate},set:function(e){e=u.default(e),this.tempParams.outBoundDate=e.isValid()?e:null,this.minimumInBoundDate={year:e.year(),month:e.month()+1,day:e.date()},this.tempParams.outBoundDate&&this.tempParams.inboundDate&&this.tempParams.outBoundDate.isAfter(this.tempParams.inboundDate)&&(this.inboundDate=u.default(this.tempParams.outBoundDate).add(1,"day")),this._outDate=this.helpers.momentToNgDate(e),this._outTime=this.helpers.formatTimeColon(e),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"returnDate",{get:function(){return this._inDate},set:function(e){this._inDate=e,this.inboundDate=this.helpers.ngDateToMoment(this._inDate,this._inTime)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"arriveTime",{get:function(){return this._inTime},set:function(e){this._inTime=e,this.inboundDate=this.helpers.ngDateToMoment(this._inDate,this._inTime)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"inboundDate",{get:function(){return this.tempParams.inboundDate},set:function(e){e=u.default(e),this.tempParams.inboundDate=e.isValid()?e:null,this._inDate=this.helpers.momentToNgDate(e),this._inTime=this.helpers.formatTimeColon(e),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"arriveLocation",{get:function(){return this.tempParams.arriveLocation},set:function(e){this.tempParams.arriveLocation=e,"string"==typeof e?this._destinationAirport="":e&&e.gateway?this._destinationAirport=e.gateway:this._destinationAirport=null,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cabinClass",{get:function(){return this.tempParams.cabinClass},set:function(e){this.tempParams.cabinClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"returnCabinClass",{get:function(){return this.tempParams.returnCabinClass},set:function(e){this.tempParams.returnCabinClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"chosenSearchType",{get:function(){return this.tempParams.chosenSearchType},set:function(e){this.tempParams.chosenSearchType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isReturn",{get:function(){return this.tempParams.chosenSearchType===e.EurostarSearchType.return},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outTimeCriteria",{get:function(){return this.tempParams.outTimeCriteria},set:function(e){this.tempParams.outTimeCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"inTimeCriteria",{get:function(){return this.tempParams.inTimeCriteria},set:function(e){this.tempParams.inTimeCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"maxConnections",{get:function(){return this.tempParams.maxConnections},set:function(e){this.tempParams.maxConnections=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"multiDestination",{get:function(){return this.tempParams.multiDestination},set:function(e){this.tempParams.multiDestination=e,this._isValid()},enumerable:!1,configurable:!0}),i.prototype.setMultiDestinationQuery=function(e){var t=this;return this.helpers.clone(e).reduce((function(e,r){var i={};return i.orig=r.orig.gateway,i.dest=r.dest.gateway,i.date=t.helpers.formatIsoDate(r.date),e.push(i),e}),[])},Object.defineProperty(i.prototype,"sortDropdownValues",{get:function(){return this._sortArray},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"sortDropdownValuesLu",{get:function(){return this._sortArrayLu},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fareTypesValues",{get:function(){return this._fareTypeArray},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"fareType",{get:function(){return this.tempParams.fareType},set:function(e){this.tempParams.fareType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"negotiated",{get:function(){return this._negotiated},set:function(e){this._negotiated=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"includeNearbyAirports",{get:function(){return this.tempParams.includeNearbyAirports},set:function(e){this.tempParams.includeNearbyAirports=e},enumerable:!1,configurable:!0}),i.prototype.processResults=function(e){var t=this;if(this.resultQuery=this.getSearchQuery(),delete this.resultQuery.withGrouped,this.filters.next(this.helpers.createFlightFilters(e.journeys,dt)),e&&this.searchService.isFlightsGrouped()){var r=(e.journeys||[]).reduce((function(e,r,i){if(r.outboundFlights.length){var n=t.formatEurostarResults(r.outboundFlights,r.total,i);n.co2PerPassenger=r.co2PerPassenger,n.co2PerItem=r.co2PerItem,n.sourceId=r.sourceId,n.total=r.total,n.duration=t.minToHour(r.outboundTotalDuration),e.outbound.find((function(e){return e.dateDeparture===n.dateDeparture&&e.cabinClass===n.cabinClass}))||e.outbound.push(n)}if(r.inboundFlights.length){var a=t.formatEurostarResults(r.inboundFlights,r.total,i);a.co2PerPassenger=r.co2PerPassenger,a.co2PerItem=r.co2PerItem,a.sourceId=r.sourceId,a.total=r.total,a.duration=t.minToHour(r.inboundTotalDuration),e.inbound.find((function(e){return e.dateDeparture===a.dateDeparture&&e.cabinClass===a.cabinClass}))||e.inbound.push(a)}return e}),{outbound:[],inbound:[]});return r.outbound=r.outbound.reduce(this.matchFares.bind(this),[]),r.inbound=r.inbound.reduce(this.matchFares.bind(this),[]),[r]}return e?[e]:[]},i.prototype.matchFares=function(e,t){var r=e.find((function(e){return e.dateDeparture===t.dateDeparture}));if(r)switch(t.cabinClass){case x.Economy:case x.EconomyNoBags:case x.EconomyRestricted:r.standardFare=t.standardFare;break;case"Premium":r.standardPremierFare=t.standardPremierFare;break;case x.Business:r.businessPremierFare=t.businessPremierFare;break;default:console.log("how did I get here",t.cabinClass)}else e.push(t);return e},i.prototype.formatEurostarResults=function(e,t,r){var i=this,n={dateArrival:null,dateDeparture:null,duration:null,timeArrival:null,timeDeparture:null,co2PerItem:0,co2PerPassenger:0,sourceId:null,total:null,uid:null,cabinClass:null,businessPremierFare:{class:null,fare:null,isDisabled:!0,price:NaN,currency:"GBP",selected:!1},standardFare:{class:null,fare:null,isDisabled:!0,price:NaN,currency:"GBP",selected:!1},standardPremierFare:{class:null,fare:null,isDisabled:!0,price:NaN,currency:"GBP",selected:!1}};return e.forEach((function(e){switch(n.dateArrival=e.dateTimeArriving,n.dateDeparture=e.dateTimeDeparting,n.duration=i.minToHour(e.totalDuration),n.timeArrival=u.default(e.dateTimeArriving).format("HH:mm"),n.timeDeparture=u.default(e.dateTimeDeparting).format("HH:mm"),n.cabinClass=e.cabinClass,n.uid=r,e.cabinClass){case x.EconomyFlexi:case x.EconomyNoBags:case x.EconomyRestricted:case x.Economy:n.standardFare.isDisabled=!1,n.standardFare.fare=e,n.standardFare.price=t.price,n.standardFare.currency=t.currency,n.standardFare.class=e.cabinClass,n.standardFare.selected=!1;break;case"Premium":n.standardPremierFare.isDisabled=!1,n.standardPremierFare.fare=e,n.standardPremierFare.price=t.price,n.standardPremierFare.currency=t.currency,n.standardPremierFare.class=e.cabinClass,n.standardPremierFare.selected=!1;break;case x.Business:n.businessPremierFare.isDisabled=!1,n.businessPremierFare.fare=e,n.businessPremierFare.price=t.price,n.businessPremierFare.currency=t.currency,n.businessPremierFare.class=e.cabinClass,n.businessPremierFare.selected=!1;break;default:console.warn("new class to be implemented: ",e.cabinClass)}})),n},i.prototype.resetQuery=function(e){void 0===e&&(e=!0),this.updateTempParams(this.searchService.makeEurostarQuery()),e&&this._isValid()},i.prototype.resetParams=function(){this.reset(),this.resetQuery()},i.prototype._isValid=function(){this.doChecks&&(this.storageService.setSessionItem(i.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.validationMessages=[],this._originAirport||this.validationMessages.push("Please add in a departutre location"),this._destinationAirport||this.validationMessages.push("Please add in a arrival destination"),this.tempParams.outBoundDate.isAfter(u.default())||this.validationMessages.push("Departure date can not be in the past"),this._originAirport&&this._destinationAirport&&this._destinationAirport===this._originAirport&&this.validationMessages.push("Origin and destination station cannot be the same"),this.isReturn&&this.tempParams.outBoundDate.isSameOrAfter(this.tempParams.inTimeCriteria)&&this.validationMessages.push("Return date must be after the departure date"),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages))},i.prototype.startSearch=function(){if(this.results.next([]),this._isValid(),this.isValid.value){this._originalUserSearch=Object.freeze(this.helpers.clone(this.tempParams)),this.storageService.setSessionItem(i.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch});var e=this.getSearchQuery();return this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.eurostarFetcher.fetchList(this.getSearchQuery()))}return Promise.resolve(!1)},i.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:te.Eurostar,searchArgs:t,travelDate:this.outBoundDate.format(),travellers:this.helpers.getTravellersId(this.travellers)}},i.prototype.updateSerchQuery=function(e){var t=e;return this.departLocation&&(t.departLocation=this.departLocation),this.arriveLocation&&(t.arriveLocation=this.arriveLocation),t},i.prototype.startRecentSearch=function(t){if(t.searchArgs.outboundDate){var r=t.searchArgs.outboundDepartureTimeWindow?t.searchArgs.outboundDepartureTimeWindow:t.searchArgs.outboundArrivalTimeWindow;this.outBoundDate=this.convertRecentSearchDateTime(t.searchArgs.outboundDate,r)}if(t.searchArgs.returnDate){var i=t.searchArgs.returnDepartureTimeWindow?t.searchArgs.returnDepartureTimeWindow:t.searchArgs.returnArrivalTimeWindow;this.inboundDate=this.convertRecentSearchDateTime(t.searchArgs.returnDate,i)}this.fareType=t.searchArgs.fareType,this.maxConnections=t.searchArgs.maxConnections,t.searchArgs.outboundCabinClass&&(this.cabinClass=t.searchArgs.outboundCabinClass[0]),t.searchArgs.returnCabinClass&&(this.returnCabinClass=t.searchArgs.returnCabinClass[0]),this.includeNearbyAirports=t.searchArgs.includeNearbyAirports,this.chosenSearchType=t.searchArgs.returnTrip?e.EurostarSearchType.return:e.EurostarSearchType.oneWay,t.searchArgs.outboundDepartureTimeWindow?this.outTimeCriteria=e.TimeWindow.Depart:t.searchArgs.outboundArrivalTimeWindow?this.outTimeCriteria=e.TimeWindow.Arrive:this.outTimeCriteria=e.TimeWindow.Anytime,t.searchArgs.returnDepartureTimeWindow?this.inTimeCriteria=e.TimeWindow.Depart:t.searchArgs.returnArrivalTimeWindow?this.inTimeCriteria=e.TimeWindow.Arrive:this.inTimeCriteria=e.TimeWindow.Anytime,this._originAirport=t.searchArgs.originAirport,this._destinationAirport=t.searchArgs.destinationAirport,this.arriveLocation=t.searchArgs.arriveLocation,this.departLocation=t.searchArgs.departLocation,this.searchService.startSearches()},i.prototype.makeDepartureTimeWindow=function(t,r){return r===e.TimeWindow.Depart?this.helpers.makeTimeWindow(t,-2,2):null},i.prototype.makeArrivalTimeWindow=function(t,r){return r!==e.TimeWindow.Arrive?null:this.helpers.makeTimeWindow(t,-2,2)},i.prototype.convertRecentSearchDateTime=function(e,t){if(t){var r=t.split("-");return u.default(e).add(u.default.duration(this.helpers.hhmmToTime(r[0]))).clone().add(2,"hour")}return u.default(e)},i.prototype.getSearchQuery=function(){return this.helpers.removeNulls(Object.assign({},{originAirport:this._originAirport,destinationAirport:this._destinationAirport,outboundDate:this.helpers.formatIsoDate(this.tempParams.outBoundDate),outboundDepartureTimeWindow:this.makeDepartureTimeWindow(this.tempParams.outBoundDate,this.tempParams.outTimeCriteria),outboundArrivalTimeWindow:this.makeArrivalTimeWindow(this.tempParams.outBoundDate,this.tempParams.outTimeCriteria)},{passengers:this._passengers,returnTrip:this.isReturn,outboundCabinClass:this.tempParams.cabinClass?[this.tempParams.cabinClass]:null,requireFreeBag:null,maxConnections:this.tempParams.maxConnections,includeNearbyAirports:this.tempParams.includeNearbyAirports,preferredCarriers:this.tempParams.preferredCarriers.map((function(e){return(null==e?void 0:e.code)?e.code:null})),fareType:this.tempParams.fareType,withGrouped:null},this.isReturn?{returnDate:this.helpers.formatIsoDate(this.tempParams.inboundDate),returnDepartureTimeWindow:this.makeDepartureTimeWindow(this.tempParams.inboundDate,this.tempParams.inTimeCriteria),returnArrivalTimeWindow:this.makeArrivalTimeWindow(this.tempParams.inboundDate,this.tempParams.inTimeCriteria),returnCabinClass:this.tempParams.returnCabinClass?[this.tempParams.returnCabinClass]:null}:{}))},i.prototype.updateTravellers=function(){for(var e=[],t=0;t<this.tempParams.adults;t+=1)e.push({type:U.Adult});for(t=0;t<this.tempParams.children;t+=1)e.push({type:U.Child});this._passengers=e,this._isValid()},i.prototype.updateAvaliableClasses=function(){this.avaliableClasses.next([{name:"Any",type:x.Any},{name:"Standard (semi flexible)",type:x.Economy},{name:"Standard premier (semi flexible)",type:x.PremiumEconomy},{name:"Business premier (fully flexible)",type:x.Business}])},i.prototype.sortResults=function(t,r,i){var n=this.helpers.clone(i||this.fullResults);switch(t){case e.SortTypesEurostar.CheapestFirst:n=this.sortByPrice(n,r);break;case e.SortTypesEurostar.EarliestFirst:n=this.sortByDate(n,r);break;default:console.error("+++ Unknown sorting method: "+t+" +++")}this.results.next(n)},i.prototype.sortResultsFlightJourneys=function(t,r,i){void 0===r&&(r=!1);var n=this.helpers.clone(i);switch(t){case e.SortTypesEurostar.CheapestFirst:n=this.sortByPriceFlight(n);break;case e.SortTypesEurostar.EarliestFirst:n=this.sortByDateFlight(n,r);break;case e.SortTypesEurostar.LatestFirst:n=this.sortByDateFlightDecending(n,r);break;default:console.error("+++ Unknown sorting method: "+t+" +++")}return n},i.prototype.sortByPriceFlight=function(e){return e.sort((function(e,t){return Number(e.total.price)-Number(t.total.price)}))},i.prototype.sortByDateFlight=function(e,t){return e.sort((function(e,r){return t?u.default(e.inboundFlights[0].dateTimeDeparting).unix()-u.default(r.inboundFlights[0].dateTimeDeparting).unix():u.default(e.outboundFlights[0].dateTimeDeparting).unix()-u.default(r.outboundFlights[0].dateTimeDeparting).unix()}))},i.prototype.sortByDateFlightDecending=function(e,t){return e.sort((function(e,r){return t?u.default(r.inboundFlights[0].dateTimeDeparting).unix()-u.default(e.inboundFlights[0].dateTimeDeparting).unix():u.default(r.outboundFlights[0].dateTimeDeparting).unix()-u.default(e.outboundFlights[0].dateTimeDeparting).unix()}))},i.prototype.sortByDate=function(e,t){var r=function(e,r){return t?u.default(e.dateDeparture).unix()-u.default(r.dateDeparture).unix():u.default(r.dateDeparture).unix()-u.default(e.dateDeparture).unix()};return[{outbound:e[0].outbound.sort(r),inbound:e[0].inbound.sort(r)}]},i.prototype.sortByPrice=function(e,t){var r=function(e,r){var i=+e.standardFare.price||+e.standardPremierFare.price||+e.businessPremierFare.price,n=+r.standardFare.price||+r.standardPremierFare.price||+r.businessPremierFare.price;return t?i-n:n-i};return[{outbound:e[0].outbound.sort(r),inbound:e[0].inbound.sort(r)}]},i.prototype.updateFromPreviousSearches=function(e){var t;null===(t=e[te.Flight])||void 0===t||t.searchQuery},i.prototype.getTotalBaggage=function(e){var t=0,r=JSON.parse(e.additional);return r&&r.outboundFlights?r.outboundFlights.forEach((function(e){e.baggage.forEach((function(e){e.allowance&&e.allowance>t&&(t=e.allowance)}))})):r&&r.baggageAllowance&&r.baggageAllowance.forEach((function(e){e.baggage.qty&&Number(e.baggage.qty)>t&&(t=Number(e.baggage.qty))})),t},i.prototype.transformMin=function(e){var t=60*Number(e)/100;return(t=t%1<.5?Math.floor(t):Math.ceil(t)).toString().padStart(2,"0")},i.prototype.applyFilters=function(e){var t=this;0===this.fullResults.length&&this.results.next([]);var r,i,n=function(e,t){var r=Object.values(e).filter((function(e){return e.selected}));return r.length?function(e){return!!r.find((function(r){return t(e,r.value)}))}:function(e){return!0}},a=function(e,r){return function(i){var n,a,s=u.default((n=t.helpers).fromObject.apply(n,T([i],o(r,i).split(".")))).get("hour"),l=u.default((a=t.helpers).fromObject.apply(a,T([i],o(r,i).split(".")))).get("minute"),c=Number(""+s.toString().padStart(2,"0")+l.toString().padStart(2,"0"));return c>=e.min&&c<=e.max}},o=function(e,t){return e.replace("OUTBOUND_DEPARTURE","outboundFlights.0").replace("OUTBOUND_ARRIVAL","outboundFlights."+(t.outboundFlights.length-1)).replace("INBOUND_DEPARTURE","inboundFlights.0").replace("INBOUND_ARRIVAL","inboundFlights."+((t.inboundFlights||[]).length-1))},s=function(e){return function(t,r){return t[e]===r}},l=[],c=[];l.push(a(e.arrivalTime,"OUTBOUND_ARRIVAL.dateTimeArriving")),l.push(a(e.departureTime,"OUTBOUND_DEPARTURE.dateTimeDeparting")),l.push((r=e.price,i="total.price",function(e){var n,a=(n=t.helpers).fromObject.apply(n,T([e],o(i,e).split(".")));return a>=r.min&&a<=r.max})),c.push(a(e.returnArrivalTime,"INBOUND_ARRIVAL.dateTimeArriving")),c.push(a(e.returnDepartureTime,"INBOUND_DEPARTURE.dateTimeDeparting"));var d=[];d.push(n(e.classes,s("cabinClass")));var p=[];p.push(n(e.classes,s("cabinClass")));for(var h=function(e,t){return l.reduce((function(t,r){return t=t&&r(e)}),!0)&&(!e.outboundFlights||!!(e.outboundFlights||[]).find((function(e){return!!d.reduce((function(t,r){return t&&r(e)}),!0)})))},m=function(e,t){var r;return c.reduce((function(t,r){return t&&r(e)}),!0)&&(!(null===(r=e.inboundFlights)||void 0===r?void 0:r.length)||!!(e.inboundFlights||[]).find((function(e){return!!p.reduce((function(t,r){return t&&r(e)}),!0)})))},f=this.helpers.clone(this.fullResults),y=0;y<f.length;y++){var g=f[y];g.journeys=g.journeys.filter(h),this.isReturn&&(g.journeys=g.journeys.filter(m)),g.journeys=g.journeys}this.results.next(f)},i.prototype.selectGroupedEurostar=function(t,r,i){var n,a,o,s;return g(this,void 0,void 0,(function(){var u,l,c,d,p;return v(this,(function(h){switch(h.label){case 0:return[4,this.basketService.getDefaultBasket()];case 1:return u=h.sent(),(l=null==u?void 0:u.subject.value)&&this.originalUserSearch.chosenSearchType===e.EurostarSearchType.oneWay&&i===e.FlightDirectionEnum.Outbound?(this.doBooking(u,t,{outboundFlights:[this.makeSchemaFlights(r.fare,"outbound",0)],inboundFlights:[],journeyType:"single"},t.dateDeparture,null,r.price),[2]):(l&&this.originalUserSearch.chosenSearchType===e.EurostarSearchType.return&&(i===e.FlightDirectionEnum.Outbound?(null===(n=this.selectedGroupEurostar)||void 0===n?void 0:n.direction)===e.FlightDirectionEnum.Inbound?(d=this._selectedEurostarFare.item.price>r.price?this._selectedEurostarFare.item.price:r.price,this.doBooking(u,t,{inboundFlights:[this.makeSchemaFlights(this._selectedEurostarFare.item.fare,"inbound",0)],outboundFlights:[this.makeSchemaFlights(r.fare,"outbound",0)],journeyType:"roundtrip"},t.dateDeparture,this.selectedGroupEurostar.item.dateArrival,d),this.resetSelectedFares(),this.basketService.toggleMenu(),this.results.next(this.fullResults.map(this.removeSelectedFlags))):(null===(a=this.selectedGroupEurostar)||void 0===a?void 0:a.direction)===e.FlightDirectionEnum.Outbound?(this.resetSelectedFares(),this.results.next(this.fullResults)):(this.selectedGroupEurostar={item:t,direction:i},this._selectedEurostarFare={item:r,direction:i},c=t.uid,this.results.next(this.fullResults.map((function(e){var t=e.outbound.filter((function(e){return c===e.uid}));return{inbound:e.inbound,outbound:t}})))):i===e.FlightDirectionEnum.Inbound&&((null===(o=this.selectedGroupEurostar)||void 0===o?void 0:o.direction)===e.FlightDirectionEnum.Outbound?(d=this._selectedEurostarFare.item.price>r.price?this._selectedEurostarFare.item.price:r.price,this.doBooking(u,t,{outboundFlights:[this.makeSchemaFlights(this._selectedEurostarFare.item.fare,"outbound",0)],inboundFlights:[this.makeSchemaFlights(r.fare,"inbound",0)],journeyType:"roundtrip"},t.dateDeparture,this.selectedGroupEurostar.item.dateArrival,d),this.resetSelectedFares(),this.basketService.toggleMenu(),this.results.next(this.fullResults.map(this.removeSelectedFlags))):(null===(s=this.selectedGroupEurostar)||void 0===s?void 0:s.direction)===e.FlightDirectionEnum.Inbound?(this.resetSelectedFares(),this.results.next(this.fullResults)):(this.selectedGroupEurostar={item:t,direction:i},this._selectedEurostarFare={item:r,direction:i},p=t.uid,this.results.next(this.fullResults.map((function(e){return{inbound:e.inbound.filter((function(e){return p===e.uid})),outbound:e.outbound}})))))),[2])}}))}))},i.prototype.resetSelectedFares=function(){this.selectedGroupEurostar={direction:null,item:null},this._selectedEurostarFare={direction:null,item:null}},i.prototype.removeSelectedFlags=function(e){return{inbound:e.inbound.map((function(e){return e.standardPremierFare.selected=!1,e.standardFare.selected=!1,e.businessPremierFare.selected=!1,e})),outbound:e.outbound.map((function(e){return e.standardPremierFare.selected=!1,e.standardFare.selected=!1,e.businessPremierFare.selected=!1,e}))}},i.prototype.updateLowestPrice=function(e){if(e.length&&!this.searchService.isFlightsGrouped()){var t=e[0].journeys;if(t.length){var r=t[0].total.currency;return t.reduce((function(e,t){var r=t.total.price;return e.amount>r&&(e.amount=r),e}),{amount:Number.MAX_SAFE_INTEGER,currencyCode:r})}}},i.prototype.doBooking=function(e,t,r,i,n,a){var o=t.sourceId,s=t.co2PerItem,u=t.co2PerPassenger,l=t.total,c={adults:this.adults,basket:e.id,children:this.children,co2PerItem:s,co2PerPassenger:u,currency:l.currency,detail:r,price:a,searchQuery:this.resultQuery,service:o.toString(),outboundDate:i};n&&(c.inboundDate=n),this.basketService.addToBasket(c,e,this.searchService,this.travellers)},i.prototype.makeSchemaFlights=function(e,t,r,i){return Object.assign(Object.assign({},e),{journeyInfo:{flightGroup:t,groupIndex:r,segmentIndex:i}})},i.prototype.createGroupedItem=function(e,t,r,i,n,a){if((null==r?void 0:r.length)&&!e.departDateTime){var o=r[0],s=r[r.length-1];e.originAirport=o.originAirport,e.originAirportName=o.originAirportName,e.destinationAirport=s.destinationAirport,e.destinationAirportName=s.destinationAirportName,e.departDateTime=o.dateTimeDeparting,e.arrivalDateTime=s.dateTimeArriving,e.outboundTotalDuration=i,e.dataSource=t,e.operator=o.operatingCarrier,e.operatorFull=o.operatingCarrierName,e.outlegsCount=r.length,e.outlegs=r,e.outboundFlightNumber=this.helpers.joinFromAttribute("-","operatingFlightNumber",r),e.isReturn=!1}(null==n?void 0:n.length)&&!e.inboundTotalDuration&&(e.inboundTotalDuration=a,e.inlegsCount=n.length,e.inlegs=n,e.inboundFlightNumber=this.helpers.joinFromAttribute("-","operatingFlightNumber",n),e.isReturn=!0)},i.prototype.makeSessionResults=function(e){return{results:[],groupData:[],grouped:[],query:this.resultQuery}},i.prototype.getMinFlightPriceForBrand=function(e){var t=Number.MAX_SAFE_INTEGER;return e.forEach((function(e){var r;t>(null===(r=null==e?void 0:e.total)||void 0===r?void 0:r.price)&&(t=e.total.price)})),t},i.prototype.getMaxFlightPriceForBrand=function(e){var t=0;return e.forEach((function(e){var r;t<(null===(r=null==e?void 0:e.total)||void 0===r?void 0:r.price)&&(t=e.total.price)})),t},i.prototype.isOverNight=function(){var e=this.outBoundDate.date();return this.inboundDate.date()-e>=1},i.prototype.addEurostarJourneysToBasket=function(e){return g(this,void 0,void 0,(function(){var t,r,i,n,a,o,s,l,c,d,p=this;return v(this,(function(h){switch(h.label){case 0:return e.unavailable?[2,Promise.resolve(!1)]:[4,this.basketService.getDefaultBasket()];case 1:return t=h.sent(),(null==t?void 0:t.subject.value)?(r=e.sourceId,i=e.co2PerItem,n=e.co2PerPassenger,a=e.total,o=u.default(e.outboundFlights[0].dateTimeDeparting),s=e.inboundFlights.length?u.default(e.inboundFlights[0].dateTimeDeparting):null,l=this.getTermsAndCond(e),c={outboundFlights:T(e.outboundFlights.map((function(e,t){return p.makeSchemaFlights(e,"outbound",0,t)}))),inboundFlights:T(e.inboundFlights.map((function(e,t){return p.makeSchemaFlights(e,"inbound",0,t)}))),termsAndCond:l,journeyType:"single"},d={adults:this.adults,basket:t.id,children:this.children,co2PerItem:i,co2PerPassenger:n,currency:a.currency,detail:c,price:a.price,searchQuery:this.resultQuery,service:r.toString(),outboundDate:o.format()},s&&(d.inboundDate=s.format(),c.journeyType="roundtrip"),[2,this.basketService.addToBasket(d,t,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},i.prototype.getTermsAndCond=function(e){return[{name:"Penalties",value:""},{name:"Eligibility",value:""},,{name:"Day/time",value:""},{name:"Seasonality",value:""},{name:"Flight Application",value:""},{name:"Advance Reservations/ticketing",value:""},{name:"Maximum Stay",value:""},{name:"Minimum Stay",value:""},{name:"Stopovers",value:""},{name:"Transfers",value:""},{name:"Combinations",value:""},{name:"Blackout Dates",value:""},{name:"Surcharges",value:""},{name:"Accompanied Travel",value:""},{name:"Travel Restrictions",value:""},{name:"Sales Restrictions",value:""},{name:"Hip/mileage Exceptions",value:""},{name:"Ticket Endorsements",value:""},{name:"Children Discounts",value:""},{name:"Tour Conductor Discounts",value:""},{name:"Agent Discounts",value:""},{name:"All Other Discounts",value:""},{name:"Miscellaneous Provisions",value:""},{name:"Fare By Rule",value:""},{name:"Groups",value:""},{name:"Tours",value:""},{name:"Visit Another Country",value:""},{name:"Deposits",value:""},{name:"Voluntary Changes",value:""},{name:"Voluntary Refunds",value:""},{name:"Negotiated Fares",value:""},{name:"Rule Application And Other Conditions",value:""}]},i.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:te.Eurostar,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},i}(c);pt.STORAGE_SESSION_PARAMS="search_eurostar",pt.STORAGE_SESSION_RESULTS="results_eurostar";var ht,mt,ft=function(){function e(){this.data={},this.current={}}return e.prototype.nextJourney=function(){this.data=Object.entries(this.current).reduce((function(e,t){var r=S(t,2),i=r[0],n=r[1];return e[i]=e[i]||{total:0,types:{}},e[i].types=Object.entries(n.types).reduce((function(e,t){var r=S(t,2),i=r[0],n=r[1];return e[i]=Math.max(e[i]||0,n),e}),e[i].types),e[i].total=Object.values(e[i].types).reduce((function(e,t){return e+t}),0),e}),this.data),this.current={}},e.prototype.addFares=function(e,t,r){this.current[e]=this.current[e]||{total:0,types:{}},this.current[e].total+=r.length,this.current[e].types[t]=r.length},e.prototype.getTicketTypes=function(){return Object.entries(this.data).reduce((function(e,t){var r=S(t,2),i=r[0],n=r[1];return e[i]=n.total,e}),{})},e.prototype.workoutIndexes=function(e){return Object.entries(this.data[e].types).sort((function(e,t){var r=S(e,2),i=r[0],n=(r[1],S(t,2)),a=n[0];n[1];return Number(i.split("_")[1])-Number(a.split("_")[1])})).reduce((function(t,r){for(var i=S(r,2),n=i[0],a=i[1],o=0;o<a;o++)t.push([e,n,o.toString()]);return t}),[])},e}();(ht=e.RailSearchCriteria||(e.RailSearchCriteria={})).Depart="Depart After",ht.Arrive="Arrive Before",(mt=e.RailJourneyFareType||(e.RailJourneyFareType={})).Return="Return",mt.Single="Single";var yt,gt=function(i){function n(r,a,o,s,l,c,d,p){var h=i.call(this,l,o)||this;h.Railfetcher=r,h.getRailStationFetcher=a,h.basketService=s,h.searchService=c,h.userService=d,h.modalService=p,h.resultsSessionName=n.STORAGE_SESSION_RESULTS,h.multiResultsSessionName=n.STORAGE_SESSION_RESULTS,h.searchTypes=[{display:"Return",value:q.ReturnJourney},{display:"One-Way",value:q.SingleJourney}],h.classTypes=[{display:"Any",value:X.All},{display:"Standard",value:X.Standard},{display:"First",value:X.First}],h.airportExpressStations=[{code:"HP1-3",name:"Heathrow T1-3 - Paddington"},{code:"HP4",name:"Heathrow T4 - Paddington"},{code:"HP5",name:"Heathrow T5 - Paddington"},{code:"PH1-3",name:"Paddington - Heathrow T1-3"},{code:"PH4",name:"Paddington - Heathrow T4"},{code:"PH5",name:"Paddington - Heathrow T5"},{code:"GV",name:"Gatwick - Victoria"},{code:"VG",name:"Victoria - Gatwick"},{code:"SL",name:"Stansted - Liverpool Street"},{code:"LS",name:"Liverpool Street - Stansted"}],h.airportExpressStationsCodes={"HP1-3":{dep:"HXX",arr:"PAD"},"PH1-3":{dep:"PAD",arr:"HXX"},HP4:{dep:"HAF",arr:"PAD"},PH4:{dep:"PAD",arr:"HAF"},HP5:{dep:"HWV",arr:"PAD"},PH5:{dep:"PAD",arr:"HWV"},GV:{dep:"GTW",arr:"VIC"},VG:{dep:"VIC",arr:"GTW"},SL:{dep:"SSD",arr:"LST"},LS:{dep:"LST",arr:"SSD"}},h.railCriteria=[e.RailSearchCriteria.Depart,e.RailSearchCriteria.Arrive],h.travelCards=[{display:"Young persons railcard",value:"YNG"},{display:"Disability railcard",value:"DIS"},{display:"Family railcard",value:"FAM"},{display:"Forces railcard",value:"HMF"},{display:"Travel agency discount",value:"TAD"}],h.removePassingPointsFromResults=!0,h.type=te.Rail,h._bookRailFromLive=!1,h.cheapest=new t.BehaviorSubject({outboundCheapest:{dualSingleJourneyFares:{price:0,journey:null,fare:null},openReturnJourneyFares:{price:0,journey:null,fare:null},returnJourneyFares:{price:0,journey:null,fare:null},singleJourneyFares:{price:0,journey:null,fare:null}},inboundCheapest:{dualSingleJourneyFares:{price:0,journey:null,fare:null},openReturnJourneyFares:{price:0,journey:null,fare:null},returnJourneyFares:{price:0,journey:null,fare:null},singleJourneyFares:{price:0,journey:null,fare:null}},cheapestClassTicket:{standardClassFare:{price:0,journey:null,fare:null},firstClassFare:{price:0,journey:null,fare:null},inboundStandardClassFare:{price:0,journey:null,fare:null},inboundFirstClassFare:{price:0,journey:null,fare:null}},cheapestClassTicketReturn:{standardClassFare:{price:0,journey:null,fare:null},firstClassFare:{price:0,journey:null,fare:null},inboundStandardClassFare:{price:0,journey:null,fare:null},inboundFirstClassFare:{price:0,journey:null,fare:null}},cheapestClassTicketDual:{standardClassFare:{price:0,journey:null,fare:null},firstClassFare:{price:0,journey:null,fare:null},inboundStandardClassFare:{price:0,journey:null,fare:null},inboundFirstClassFare:{price:0,journey:null,fare:null}}}),h.minOutboundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},h.minInboundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},h.maxDate={year:u.default().add("month",6).year(),month:u.default().add("month",6).month(),day:u.default().add("month",6).date()},h.summary={},h._outbound_date=null,h._outbound_time=null,h._return_date=null,h._return_time=null;var m=l.getSessionItem(n.STORAGE_SESSION_PARAMS)||{query:{},tempParams:{},originalUserSearch:{}};return h.updateTempParams(h.searchService.makeRailQuery(m.tempParams)),h._originalUserSearch=m.originalUserSearch,c.shouldAddTravellerSubscription()&&c.travellerInformation.subscribe((function(e){h.travellers=e;var t=h.helpers.selectedTravellers(e,te.Rail);h.tempParams.noOfAdults=t.adults.length,h.tempParams.noOfChildren=t.children.length,h.travellers=e,h._isValid()})),h._isValid(),h}return m(n,i),Object.defineProperty(n.prototype,"selectedSection",{get:function(){return this._selectedSection},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"selectedTicket",{get:function(){return this._selectedTicket},set:function(e){this._selectedTicket=e,this._selectedTicket?this._selectedSummary=this._findSummary(this._selectedTicket.journey,this.summary.outbound||[]):this._selectedSummary=null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"selectedInboundTicket",{get:function(){return this._selectedInboundTicket},set:function(e){var t=this;this._selectedInboundTicket=e,this._selectedInboundTicket?this._selectedInboundSummary=this.summary.return.find((function(e){return e.journeyHash===t._selectedTicket.journey.journeyHash})):this._selectedSummary=null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"bookRailFromLive",{get:function(){return this._bookRailFromLive},set:function(e){this._bookRailFromLive=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"openReturn",{get:function(){return this.tempParams.chosenSearchType===q.OpenReturnJourney},set:function(e){this.tempParams.chosenSearchType=e?q.OpenReturnJourney:q.ReturnJourney,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenSearchType",{get:function(){return this.tempParams.chosenSearchType},set:function(e){this.tempParams.chosenSearchType=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"noOfAdults",{get:function(){return this.tempParams.noOfAdults},set:function(e){this.tempParams.noOfAdults=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"noOfChildren",{get:function(){return this.tempParams.noOfChildren},set:function(e){this.tempParams.noOfChildren=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"travellingTo",{get:function(){return this.tempParams.travellingTo},set:function(e){var t;this.tempParams.travellingTo=e,this._travellingTo="",(null===(t=null==e?void 0:e.railstation)||void 0===t?void 0:t.id)&&(this._travellingTo=e.railstation.id),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"travellingFrom",{get:function(){return this.tempParams.travellingFrom},set:function(e){var t;this.tempParams.travellingFrom=e,this._travellingFrom="",(null===(t=null==e?void 0:e.railstation)||void 0===t?void 0:t.id)&&(this._travellingFrom=e.railstation.id),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenRailClass",{get:function(){return this.tempParams.chosenSearchClass},set:function(e){this.tempParams.chosenSearchClass=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"chosenSearchClass",{get:function(){return this.tempParams.chosenSearchClass},set:function(e){this.tempParams.chosenSearchClass=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"extraTime",{get:function(){return this.tempParams.extraTime},set:function(e){this.tempParams.extraTime=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"via",{get:function(){return this.tempParams.via},set:function(e){this.tempParams.via=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"viaLocation",{get:function(){return this.tempParams.viaLocation},set:function(e){var t;this.tempParams.viaLocation=e,this._viaLocation="",(null===(t=null==e?void 0:e.railstation)||void 0===t?void 0:t.id)&&(this._viaLocation=e.railstation.id),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outBoundDateTime",{get:function(){return this.tempParams.outBoundDateTime},set:function(e){this.tempParams.outBoundDateTime=e,e&&e.isValid()&&(this._outbound_date=this.helpers.momentToNgDate(e),this._outbound_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"0700"),this.minInboundDate={year:e.year(),month:e.month()+1,day:e.date()},this.outBoundDateTime&&this.inBoundDateTime&&this.outBoundDateTime.isAfter(this.inBoundDateTime)&&(this.inBoundDateTime=this.inBoundDateTime.set("date",e.date()).set("month",e.month()).set("year",e.year())),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outboundCriteria",{get:function(){return this.tempParams.outboundCriteria},set:function(e){this.tempParams.outboundCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"inBoundDateTime",{get:function(){return this.tempParams.inBoundDateTime},set:function(e){this.tempParams.inBoundDateTime=e,e&&e.isValid()&&(this._return_date=this.helpers.momentToNgDate(e),this._return_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"1600"),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outbound_date",{get:function(){return this._outbound_date},set:function(e){this._outbound_date=e,this._updateOutboundDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"outbound_time",{get:function(){return this._outbound_time},set:function(e){this._outbound_time=e,this._updateOutboundDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"return_date",{get:function(){return this._return_date},set:function(e){this._return_date=e,this._updateReturnDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"return_time",{get:function(){return this._return_time},set:function(e){this._return_time=e,this._updateReturnDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"returnCriteria",{get:function(){return this.tempParams.returnCriteria},set:function(e){this.tempParams.returnCriteria=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"carnetTicket",{get:function(){return this.tempParams.carnetTicket},set:function(e){this.tempParams.carnetTicket=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"disableAutoDiscounts",{get:function(){return this.tempParams.disableAutoDiscounts},set:function(e){this.tempParams.disableAutoDiscounts=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"prioritiseByPrice",{get:function(){return this.tempParams.prioritiseByPrice},set:function(e){this.tempParams.prioritiseByPrice=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"applyRailcards",{get:function(){return this.tempParams.applyRailcards},set:function(e){this.tempParams.applyRailcards=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"railCards",{get:function(){return this.tempParams.railCards},set:function(e){this.tempParams.railCards=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"timeArray",{get:function(){return this._timeArray=this._timeArray||Array(48).fill(0).map((function(e,t){return{value:Math.floor(t/2).toString().padStart(2,"0")+(t%2*30).toString().padStart(2,"0"),display:Math.floor(t/2).toString().padStart(2,"0")+":"+(t%2*30).toString().padStart(2,"0")}})),this._timeArray},enumerable:!1,configurable:!0}),n.prototype.getAirportExpressStations=function(){return this.airportExpressStations},Object.defineProperty(n.prototype,"airportExpressStation",{get:function(){return this.tempParams.airportExpressStation},set:function(e){this.tempParams.airportExpressStation=e,this._setAirportExpressStations(),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isAirportExpress",{get:function(){return this.tempParams.isAirportExpress},set:function(e){this.tempParams.isAirportExpress=e,this._isValid()},enumerable:!1,configurable:!0}),n.prototype.setAirportExpressStationIds=function(e){var t=e.departureLocationId,r=e.arrivalLocationId;t&&r&&(this._travellingFrom=t,this._travellingTo=r,this._isValid())},n.prototype._findSummary=function(e,t){return t.find((function(t){return t.journeyHash===e.journeyHash}))},n.prototype.updateLowestPrice=function(e){return null},n.prototype.processResults=function(e){var t=this,r=function(e){var t;return Object.assign(Object.assign({},e),{type:null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.toLowerCase(),selected:!1,selectable:!0})},i=function(e){return t.helpers.clone(e).sort((function(e,t){var r=u.default(e.departDateTime),i=u.default(t.departDateTime);return r.isBefore(i)?-1:r.isAfter(i)?1:0})).map((function(e){var i=function(e,t){return e.price-t.price},n=(e.dualSingleJourneyFares||[]).sort(i).map(r),a=(e.openReturnJourneyFares||[]).sort(i).map(r),o=(e.returnJourneyFares||[]).sort(i).map(r),s=(e.singleJourneyFares||[]).sort(i).map(r),u=n.map(r),l=a.map(r),c=o.map(r),d=s.map(r);return Object.assign(Object.assign({},e),{dualSingleJourneyFares:t.helpers.arrayToObjectArray(u,["type",["terms.ticketTypeCode","price"]]),openReturnJourneyFares:t.helpers.arrayToObjectArray(l,["type",["terms.ticketTypeCode","price"]]),returnJourneyFares:t.helpers.arrayToObjectArray(c,["type",["terms.ticketTypeCode","price"]]),singleJourneyFares:t.helpers.arrayToObjectArray(d,["type",["terms.ticketTypeCode","price"]])})}))};return e.map((function(e){t.summary=e.summary;var r=i(e.outbound||[]),n=i(e.return||[]),a=t.makeFareNames([r||[],n||[]]),o=function(e,r){var i=a[r],n=i.getTicketTypes();return Object.entries(n).reduce((function(r,n){var a=S(n,2),o=a[0];a[1];return r[o]=i.workoutIndexes(o).map((function(r){return t.helpers.fieldFromObject(e,r)})),r}),{})},s=function(e){return Object.assign(Object.assign({},e),{returnJourneyFares:o(e.returnJourneyFares,"returnJourneyFares"),openReturnJourneyFares:o(e.openReturnJourneyFares,"openReturnJourneyFares"),dualSingleJourneyFares:o(e.dualSingleJourneyFares,"dualSingleJourneyFares"),singleJourneyFares:o(e.singleJourneyFares,"singleJourneyFares")})},u=r.map(s),l=n.map(s),c=t.updatePrices(u,{cheapestTickets:{dualSingleJourneyFares:{price:0,journey:null,fare:null},openReturnJourneyFares:{price:0,journey:null,fare:null},returnJourneyFares:{price:0,journey:null,fare:null},singleJourneyFares:{price:0,journey:null,fare:null}},cheapestClassTicket:{standardClassFare:{price:0,journey:null,fare:null},firstClassFare:{price:0,journey:null,fare:null},inboundStandardClassFare:{price:0,journey:null,fare:null},inboundFirstClassFare:{price:0,journey:null,fare:null}},outboundClassTicket:{standardClassFare:{price:0,journey:null,fare:null},firstClassFare:{price:0,journey:null,fare:null},inboundStandardClassFare:{price:0,journey:null,fare:null},inboundFirstClassFare:{price:0,journey:null,fare:null}}},!1),d=t.updatePrices(l,{cheapestTickets:{dualSingleJourneyFares:{price:0,journey:null,fare:null},openReturnJourneyFares:{price:0,journey:null,fare:null},returnJourneyFares:{price:0,journey:null,fare:null},singleJourneyFares:{price:0,journey:null,fare:null}},cheapestClassTicket:c.cheapestClassTicket,outboundClassTicket:c.cheapestClassTicket},!0);return t.cheapest.next({outboundCheapest:c.cheapestTickets,inboundCheapest:d.cheapestTickets,cheapestClassTicket:d.cheapestClassTicket,cheapestClassTicketReturn:c.outboundClassTicket,cheapestClassTicketDual:d.outboundClassTicket}),Object.assign(Object.assign({},e),{outbound:u,return:l})}))},n.prototype.makeFareNames=function(e){var t=this;return["returnJourneyFares","openReturnJourneyFares","dualSingleJourneyFares","singleJourneyFares"].reduce((function(r,i){return r[i]=t._makeFareNames(e,i),r}),{returnJourneyFares:new ft,openReturnJourneyFares:new ft,dualSingleJourneyFares:new ft,singleJourneyFares:new ft})},n.prototype._makeFareNames=function(e,t){return s.default.flatten(e||[]).reduce((function(e,r){return r?(Object.entries(r[t]||{}).forEach((function(t){var r=S(t,2),i=r[0],n=r[1];Object.entries(n).forEach((function(t){var r=S(t,2),n=r[0],a=r[1];e.addFares(i,n,a)}))})),e.nextJourney(),e):e}),new ft)},n.prototype.updatePrices=function(t,r,i){var n=function(e,t,r){if(!t||0===t.length)return e;var i=t[0].price;return e.price>0&&e.price<i?e:{price:i,journey:r,fare:t[0]}};return t.reduce((function(t,r){var a,o,u,l,c=function(e,t){return e.price-t.price},d=s.default.flatten(Object.values(r.dualSingleJourneyFares)).filter((function(e){return e&&e.class===X.Standard})),p=s.default.flatten(Object.values(r.dualSingleJourneyFares)).filter((function(e){return e&&e.class===X.First})),h=s.default.flatten(Object.values(r.openReturnJourneyFares)).filter((function(e){return e&&e.class===X.Standard})),m=s.default.flatten(Object.values(r.openReturnJourneyFares)).filter((function(e){return e&&e.class===X.First})),f=s.default.flatten(Object.values(r.returnJourneyFares)).filter((function(e){return e&&e.class===X.Standard})),y=s.default.flatten(Object.values(r.returnJourneyFares)).filter((function(e){return e&&e.class===X.First})),g=s.default.flatten(Object.values(r.singleJourneyFares)).filter((function(e){return e&&e.class===X.Standard})),v=s.default.flatten(Object.values(r.singleJourneyFares)).filter((function(e){return e&&e.class===X.First})),b=T(h,f,g),S=T(d,b).sort(c),C=T(m,y,v),D=T(p,C).sort(c);if(i||(b.sort(c),D.sort(c)),t.cheapestTickets.dualSingleJourneyFares=n(t.cheapestTickets.dualSingleJourneyFares,s.default.flatten(Object.values(r.dualSingleJourneyFares)).filter((function(e){return!!e})),r),t.cheapestTickets.openReturnJourneyFares=n(t.cheapestTickets.openReturnJourneyFares,s.default.flatten(Object.values(r.openReturnJourneyFares)).filter((function(e){return!!e})),r),t.cheapestTickets.returnJourneyFares=n(t.cheapestTickets.returnJourneyFares,s.default.flatten(Object.values(r.returnJourneyFares)).filter((function(e){return!!e})),r),i){if(t.cheapestClassTicket.inboundStandardClassFare=n(t.cheapestClassTicket.inboundStandardClassFare,S,r),t.cheapestClassTicket.inboundFirstClassFare=n(t.cheapestClassTicket.inboundFirstClassFare,D,r),t.outboundClassTicket.inboundStandardClassFare=n(t.outboundClassTicket.inboundStandardClassFare,b,r),t.outboundClassTicket.inboundFirstClassFare=n(t.outboundClassTicket.inboundFirstClassFare,C,r),(null===(o=null===(a=t.cheapestClassTicket.standardClassFare)||void 0===a?void 0:a.fare)||void 0===o?void 0:o.singleOrReturn)===e.RailJourneyFareType.Single){var P=n(t.cheapestClassTicket.inboundStandardClassFare,d,r);t.cheapestClassTicket.standardClassFare.price>t.outboundClassTicket.standardClassFare.price?t.cheapestClassTicket.standardClassFare=t.outboundClassTicket.standardClassFare:P.price>t.cheapestClassTicket.inboundStandardClassFare.price&&(t.cheapestClassTicket.inboundStandardClassFare=P)}if((null===(l=null===(u=t.cheapestClassTicket.firstClassFare)||void 0===u?void 0:u.fare)||void 0===l?void 0:l.singleOrReturn)===e.RailJourneyFareType.Single){P=n(t.cheapestClassTicket.inboundFirstClassFare,p,r);t.cheapestClassTicket.firstClassFare.price>t.outboundClassTicket.firstClassFare.price?t.cheapestClassTicket.firstClassFare=t.outboundClassTicket.firstClassFare:P.price>t.cheapestClassTicket.inboundFirstClassFare.price&&(t.cheapestClassTicket.inboundFirstClassFare=P)}}else t.cheapestClassTicket.standardClassFare=n(t.cheapestClassTicket.standardClassFare,S,r),t.cheapestClassTicket.firstClassFare=n(t.cheapestClassTicket.firstClassFare,D,r),t.outboundClassTicket.standardClassFare=n(t.outboundClassTicket.standardClassFare,b,r),t.outboundClassTicket.firstClassFare=n(t.outboundClassTicket.firstClassFare,C,r);return t}),r)},n.prototype.selectTicket=function(t,r,i,n,a,o){var s,l,c,p,h,m;return void 0===o&&(o=!1),g(this,void 0,void 0,(function(){var f,y,g,b,S,T,C,D;return v(this,(function(v){switch(v.label){case 0:return i.selectable?this.selectedTicket&&this.selectedTicket.journey.journeyHash===r.journeyHash&&this.selectedTicket.fare.fareHash===i.fareHash?(this.selectedTicket=null,this._applyFilter(),[2]):(f=this.selectedTicket,this.alternativeWellbeing=this.userService.getUserFavoriteObject(Ke.AlternativeRailItineraryEnabled),f&&!o&&this.alternativeWellbeing?(y=f.journey,g=r,b=u.default(y.arriveDateTime).diff(u.default(y.departDateTime),"hours",!0),S=u.default(g.arriveDateTime).diff(u.default(g.departDateTime),"hours",!0),T=u.default(g.departDateTime).diff(u.default(y.departDateTime),"day"),[4,this.checkAlternativeHours(b+S,T)]):[3,2]):[2];case 1:return v.sent()&&this.selectTicket(t,r,i,n,a,!0),[3,25];case 2:switch(C=this.originalUserSearch,a){case"singleJourneyFares":return[3,3];case"returnJourneyFares":return[3,7];case"dualSingleJourneyFares":return[3,13];case"openReturnJourneyFares":return[3,19]}return[3,23];case 3:return(null===(s=null==r?void 0:r.ticketExtras)||void 0===s?void 0:s.length)>1?[4,this.modalService.open(d.RailTicketsDialogComponent,{centered:!0},{outboundRailJourneyOption:r})]:[3,5];case 4:D=v.sent(),r.ticketExtras=D||[],v.label=5;case 5:return[4,this.addSingleJourneyToBasket(n,C,r,i)];case 6:return v.sent(),this.selectedTicket=null,[3,24];case 7:return t!==e.RailDirection.Outbound?[3,8]:(this.selectedTicket={journey:r,fare:i},[3,12]);case 8:return this.selectedTicket?(null===(c=null===(l=this.selectedTicket.journey)||void 0===l?void 0:l.ticketExtras)||void 0===c?void 0:c.length)>1?[4,this.modalService.open(d.RailTicketsDialogComponent,{centered:!0},{outboundRailJourneyOption:this.selectedTicket.journey})]:[3,10]:[3,12];case 9:D=v.sent(),f.journey.ticketExtras=D||[],v.label=10;case 10:return[4,this.addReturnJourneyToBasket(n,C,this.selectedTicket.journey,r,this.selectedTicket.fare,i)];case 11:v.sent(),this.selectedTicket=null,v.label=12;case 12:return[3,24];case 13:return t!==e.RailDirection.Outbound?[3,14]:(this.selectedTicket={journey:r,fare:i},[3,18]);case 14:return this.selectedTicket?(null===(h=null===(p=this.selectedTicket.journey)||void 0===p?void 0:p.ticketExtras)||void 0===h?void 0:h.length)>1?[4,this.modalService.open(d.RailTicketsDialogComponent,{centered:!0},{outboundRailJourneyOption:this.selectedTicket.journey})]:[3,16]:[3,18];case 15:D=v.sent(),console.log(D),f.journey.ticketExtras=D||[],v.label=16;case 16:return[4,this.addDualSingleToBasket(n,C,this.selectedTicket.journey,r,this.selectedTicket.fare,i)];case 17:v.sent(),this.selectedTicket=null,v.label=18;case 18:return[3,24];case 19:return(null===(m=null==r?void 0:r.ticketExtras)||void 0===m?void 0:m.length)>1?[4,this.modalService.open(d.RailTicketsDialogComponent,{centered:!0},{outboundRailJourneyOption:r})]:[3,21];case 20:D=v.sent(),console.log(D),r.ticketExtras=D||[],v.label=21;case 21:return[4,this.addOpenReturnToBasket(n,C,r,i)];case 22:return v.sent(),this.selectedTicket=null,[3,24];case 23:a,v.label=24;case 24:this._applyFilter(),v.label=25;case 25:return[2]}}))}))},n.prototype.checkAlternativeHours=function(e,t){return g(this,void 0,void 0,(function(){var r;return v(this,(function(i){switch(i.label){case 0:return r=this.searchService.searches[te.Rail],this.alternativeWellbeing.enable&&Number(this.alternativeWellbeing.hours)>0&&r.chosenSearchType===q.ReturnJourney&&e>=Number(this.alternativeWellbeing.hours)&&0===t&&this.noOfAdults+this.noOfChildren<=4?[4,this.modalService.open(d.AlternativeRailModalComponent)]:[3,2];case 1:return i.sent()?(this.selectedTicket=null,this._applyFilter(),this.performAlternativeRailAndHotelSearch(),[2,!1]):[2,!0];case 2:return[2,!0];case 3:return[2]}}))}))},n.prototype.performAlternativeRailAndHotelSearch=function(){console.log("+++ Creating the Alternative Search Params +++");var t=this.searchService.search_objects[te.Hotel],r=this.searchService.search_objects[te.Rail];t.chosen=!0,r.chosen=!0,t.priority=r.priority;var i=this.searchService.searches[te.Hotel],n=this.searchService.searches[te.Rail];n.inBoundDateTime=this.searchService.searches[te.Rail].inBoundDateTime.add(1,"day"),i.location_type_select=e.LocationTypes.TrainStation,i.location=n.travellingTo,i.trainsStation=n.travellingTo.railstation,i.checkin_date=n.outBoundDateTime,i.checkout_date=n.inBoundDateTime,i.no_of_occupants=n.noOfAdults+n.noOfChildren,i.no_of_rooms=1,i.distance=10,this.searchService.startSearches(e.WellbeingEnum.WELLBEING)},n.prototype.selectTicketNoAdd=function(t,r,i,n,a){var o;return g(this,void 0,void 0,(function(){var n,s;return v(this,(function(u){if(!i.selectable)return console.warn("+++ Rail fare is not selectable +++"),[2];if(n=this.selectedTicket&&this.selectedTicket.journey.journeyHash===r.journeyHash&&this.selectedTicket.fare.fareHash===i.fareHash,s=t===e.RailDirection.Inbound&&(this.selectedInboundTicket&&this.selectedInboundTicket.journey.journeyHash===r.journeyHash&&this.selectedInboundTicket.fare.fareHash===i.fareHash),n||t===e.RailDirection.Inbound&&s)return console.warn("+++ Journey and fare are already selected - breaking out +++"),this._selectedInboundTicket=null,n&&(this.selectedTicket=null,this.applyFilter()),[2];switch((this._selectedSection&&this._selectedSection!==a||"returnJourneyFares"===this._selectedSection&&(null===(o=this.selectedTicket)||void 0===o?void 0:o.fare.identifiers.fareIdentifier)!==i.identifiers.fareIdentifier)&&(this.selectedTicket=null,this._selectedInboundTicket=null),this._selectedSection=a,this.originalUserSearch,a){case"singleJourneyFares":this.selectedTicket={journey:r,fare:i};break;case"returnJourneyFares":case"dualSingleJourneyFares":t===e.RailDirection.Outbound?this.selectedTicket={journey:r,fare:i}:this.selectedTicket&&(this.selectedInboundTicket={journey:r,fare:i});break;case"openReturnJourneyFares":this.selectedTicket={journey:r,fare:i};break;default:a}return this.applyFilter(),[2]}))}))},n.prototype.addToBasket=function(e,t,r,i,n,a){return g(this,void 0,void 0,(function(){return v(this,(function(o){switch(o.label){case 0:return t.chosenSearchType!==q.SingleJourney?[3,2]:[4,this.addSingleJourneyToBasket(e,t,r,i)];case 1:return o.sent(),[3,7];case 2:return"openReturnJourneyFares"!==this.selectedSection?[3,4]:[4,this.addOpenReturnToBasket(e,t,r,i)];case 3:return o.sent(),[3,7];case 4:return"Return"!==i.singleOrReturn?[3,5]:[2,this.addReturnJourneyToBasket(e,t,r,a,i,n)];case 5:return[4,this.addDualSingleToBasket(e,t,r,a,i,n)];case 6:o.sent(),o.label=7;case 7:return[2,!1]}}))}))},n.prototype.addOpenReturnToBasket=function(e,t,r,i){return g(this,void 0,void 0,(function(){return v(this,(function(n){return[2,this.addSingleJourneyToBasket(e,t,r,i)]}))}))},n.prototype.addDualSingleToBasket=function(e,t,r,i,n,a){var o,s;return g(this,void 0,void 0,(function(){var u,l,c,d,p,h,m,f,y;return v(this,(function(g){switch(g.label){case 0:return u=this.getSearchQuery(t),(null===(o=null==i?void 0:i.ticketExtras)||void 0===o?void 0:o.length)&&(l=this.createTicketExtrasObject(i.ticketExtras[0])),(null===(s=null==r?void 0:r.ticketExtras)||void 0===s?void 0:s.length)&&(c=this.createTicketExtrasObject(r.ticketExtras[0])),[4,this.basketService.getDefaultBasket()];case 1:return d=g.sent(),p=null==d?void 0:d.subject.value,h=this.getTermsAndCond(n,r,i),p?(m=this.getLegsFromRailJourneyOption(r),f=this.getLegsFromRailJourneyOption(i),y={basket:p.id,service:e,detail:{ticketQueueList:(r.ticketQueueList||[]).map((function(e){return{id:e.id,name:e.name,type:e.type}})),accountsList:(r.accountsList||[]).map((function(e){return{id:e.id,description:e.description}})),outwardDetail:{arrivalDateTime:r.arriveDateTime,arrivalStationName:r.to,departureDateTime:r.departDateTime,departureStationName:r.from,supplierTickets:[{supplierName:n.providerName,ticketDescription:n.type,price:n.price,legs:m}]},inwardDetail:{arrivalDateTime:i.arriveDateTime,arrivalStationName:i.to,departureDateTime:i.departDateTime,departureStationName:i.from,supplierTickets:[{supplierName:a.providerName,ticketDescription:a.type,legs:f}]},transactionIdentifier:n.identifiers.transactionIdentifier,outbound:{fareIdentifiers:[n.identifiers.fareIdentifier],journeyIdentifier:n.identifiers.journeyIdentifier,isDualSingleReturn:!0,journeyLegs:this.removedScheduledPlatformFromCallingPoints(r.journeyLegs)},return:{fareIdentifiers:[a.identifiers.fareIdentifier],journeyIdentifier:a.identifiers.journeyIdentifier,isDualSingleReturn:!0,journeyLegs:this.removedScheduledPlatformFromCallingPoints(i.journeyLegs)},termsAndCond:h},adults:u.adults,price:Number(Number(n.price+a.price).toFixed(2)),currency:n.currency,searchQuery:u,co2PerItem:r.co2PerItem,co2PerPassenger:r.co2PerPassenger,outboundDate:r.arriveDateTime,inboundDate:i.arriveDateTime},l&&(y.detail.return.ticketExtras=l),c&&(y.detail.outbound.ticketExtras=c),[2,this.basketService.addToBasket(y,d,this.searchService,this.travellers)]):[2,Promise.resolve()]}}))}))},n.prototype.findCheapestTicket=function(){return 0},n.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeRailQuery()),this._isValid()},n.prototype._setAirportExpressStations=function(){var e=this.airportExpressStationsCodes[this.airportExpressStation];console.log("--- Parsed Station is :",e),e&&(this._travellingFrom=e.dep,this._travellingTo=e.arr)},n.prototype._isValid=function(){var e,t;if(this.doChecks){this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.validationMessages=[];var r=u.default();this._travellingFrom||this.validationMessages.push("Please Enter a From Location."),this._travellingTo||this.validationMessages.push("Please Enter a To Location."),(null===(e=this.outBoundDateTime)||void 0===e?void 0:e.isBefore(r))&&this.validationMessages.push("Departure Date/Time cannot be in the past."),this.chosenSearchType===q.ReturnJourney&&(null===(t=this.inBoundDateTime)||void 0===t?void 0:t.isSameOrBefore(this.outBoundDateTime))&&this.validationMessages.push("Return Date/Time must be after Departure Date/Time"),this.via&&(this.tempParams.viaLocation||this.validationMessages.push("Please enter a via location.")),this.tempParams.noOfAdults+this.tempParams.noOfChildren<1&&this.validationMessages.push("There must be at least 1 traveller"),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages)}},n.prototype.startSearch=function(){if(this.results.next([]),this.isValid.value){var e=this.getSearchQuery(this.tempParams);return this._originalUserSearch=Object.freeze(this.helpers.clone(this.tempParams)),this.storageService.setSessionItem(n.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.Railfetcher.fetchList(e))}return Promise.resolve(!1)},n.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:te.Rail,searchArgs:t,travelDate:this.outBoundDateTime.format(),travellers:this.helpers.getTravellersId(this.travellers)}},n.prototype.updateSerchQuery=function(e){var t,r,i,n,a=e;return this.isAirportExpress&&(a.isAirportExpress=this.isAirportExpress),this.airportExpressStation&&(a.airportExpressStation=this.airportExpressStation),this.travellingFrom&&(a.travellingFrom=this.travellingFrom),this.travellingTo&&(a.travellingTo=this.travellingTo),this.viaLocation&&(a.viaLocation=this.viaLocation),a.outboundStationCode=null===(r=null===(t=this.travellingFrom)||void 0===t?void 0:t.railstation)||void 0===r?void 0:r.stationCode,a.inboundStationCode=null===(n=null===(i=this.travellingTo)||void 0===i?void 0:i.railstation)||void 0===n?void 0:n.stationCode,a},n.prototype.startRecentSearch=function(e){var t,r;if(this.chosenSearchType=e.searchArgs.journeyType,this.chosenSearchClass=e.searchArgs.class,this.extraTime=e.searchArgs.extraTimeToChange,this.isAirportExpress=e.searchArgs.isAirportExpress,this.airportExpressStation=e.searchArgs.airportExpressStation,this.outBoundDateTime=e.searchArgs.outboundDepartureDateTime?u.default(e.searchArgs.outboundDepartureDateTime):u.default(e.searchArgs.outboundArrivalDateTime),this.outboundCriteria=this.getCriteria(e.searchArgs.outboundDepartureDateTime,e.searchArgs.outboundArrivalDateTime),e.searchArgs.journeyType===q.ReturnJourney&&(this.inBoundDateTime=e.searchArgs.returnDepartureDateTime?u.default(e.searchArgs.returnDepartureDateTime):u.default(e.searchArgs.returnArrivalDateTime),this.returnCriteria=this.getCriteria(e.searchArgs.returnDepartureDateTime,e.searchArgs.returnArrivalDateTime)),this.applyRailcards=!!(null===(r=null===(t=e.searchArgs)||void 0===t?void 0:t.railCardQualifiers)||void 0===r?void 0:r.length),this.applyRailcards&&(this.railCards=e.searchArgs.railCardQualifiers),this.travellingTo=e.searchArgs.travellingTo,this.travellingFrom=e.searchArgs.travellingFrom,e.searchArgs.viaLocation&&(this.via=!0,this.viaLocation=e.searchArgs.viaLocation),e.searchArgs.isAirportExpress){var i={departureLocationId:e.searchArgs.departureLocationId,arrivalLocationId:e.searchArgs.arrivalLocationId};this.setAirportExpressStationIds(i)}e.searchArgs.journeyType===q.OpenReturnJourney&&(this.openReturn=!0),this.searchService.startSearches()},n.prototype._updateOutboundDateTime=function(){if(this._outbound_date&&this._outbound_time){var e=this.helpers.ngDateToMoment(this._outbound_date,this._outbound_time);this.outBoundDateTime=e.isValid()?e:null,this._isValid()}},n.prototype._updateReturnDateTime=function(){if(this._return_date&&this._return_time){var e=this.helpers.ngDateToMoment(this._return_date,this._return_time);this.inBoundDateTime=e.isValid()?e:null,this._isValid()}},n.prototype.getSearchQuery=function(t){var r,i,n,a,o,s,u;this.isAirportExpress&&this.openReturn&&(this.openReturn=!1);var l={countryCode:"GB",journeyType:t.chosenSearchType,adults:t.noOfAdults,arrivalLocationId:null===(i=null===(r=t.travellingTo)||void 0===r?void 0:r.railstation)||void 0===i?void 0:i.id,departureLocationId:null===(a=null===(n=t.travellingFrom)||void 0===n?void 0:n.railstation)||void 0===a?void 0:a.id,children:t.noOfChildren,class:t.chosenSearchClass,extraTimeToChange:t.extraTime,outboundArrivalDateTime:this.helpers.formatGraphQLDateTime(t.outBoundDateTime),outboundDepartureDateTime:this.helpers.formatGraphQLDateTime(t.outBoundDateTime),returnArrivalDateTime:this.helpers.formatGraphQLDateTime(t.inBoundDateTime),returnDepartureDateTime:this.helpers.formatGraphQLDateTime(t.inBoundDateTime),viaLocationId:null===(s=null===(o=t.viaLocation)||void 0===o?void 0:o.railstation)||void 0===s?void 0:s.id,railCardQualifiers:null===(u=t.railCards)||void 0===u?void 0:u.map((function(e){return e.code}))};switch(0===t.noOfChildren&&(l.children=null),""===this._viaLocation&&(l.viaLocationId=null),t.outboundCriteria){case e.RailSearchCriteria.Depart:l.outboundArrivalDateTime=null;break;case e.RailSearchCriteria.Arrive:l.outboundDepartureDateTime=null;break;default:console.warn("+++ Unknown Criteria: "+this.tempParams.outboundCriteria+" +++")}switch(t.returnCriteria){case e.RailSearchCriteria.Depart:l.returnArrivalDateTime=null;break;case e.RailSearchCriteria.Arrive:l.returnDepartureDateTime=null;break;default:console.warn("+++ Unknown Criteria: "+this.tempParams.returnCriteria+" +++")}switch(t.chosenSearchType){case q.SingleJourney:case q.OpenReturnJourney:l.returnDepartureDateTime=null,l.returnArrivalDateTime=null}return t.isAirportExpress&&(l.arrivalLocationId=this._travellingTo,l.departureLocationId=this._travellingFrom),this.helpers.removeNulls(l)},n.prototype.getCriteria=function(t,r){return t?e.RailSearchCriteria.Depart:r?e.RailSearchCriteria.Arrive:null},n.prototype.updateFromPreviousSearches=function(e){},n.prototype.getRailStation=function(e,i){return 3===e.length?(null==i||i.next(!0),this.getRailStationFetcher.fetchList({code:e}).pipe(r.tap((function(){return null==i?void 0:i.next(!1)})),r.take(1))):t.of()},n.prototype.getSelectedRailJourneyFare=function(){return null},n.prototype.getLegsFromRailJourneyOption=function(e){var t=[];return(null==e?void 0:e.journeyLegs.length)&&(t=e.journeyLegs.map((function(e){return{operator:e.operator,departureDateTime:e.departDateTime,departureStationName:e.depart,arrivalDateTime:e.arriveDateTime,arrivalStationName:e.arrive}}))),t},n.prototype.addSingleJourneyToBasket=function(e,t,r,i){var n;return g(this,void 0,void 0,(function(){var a,o,s,u,l,c,d;return v(this,(function(p){switch(p.label){case 0:return a=this.getSearchQuery(t),(null===(n=null==r?void 0:r.ticketExtras)||void 0===n?void 0:n.length)&&(o=this.createTicketExtrasObject(r.ticketExtras[0])),[4,this.basketService.getDefaultBasket()];case 1:return s=p.sent(),u=null==s?void 0:s.subject.value,l=this.getTermsAndCond(i,r),u?(c=this.getLegsFromRailJourneyOption(r),d={basket:u.id,service:e.toString(),detail:{ticketQueueList:(r.ticketQueueList||[]).map((function(e){return{id:e.id,name:e.name,type:e.type}})),accountsList:(r.accountsList||[]).map((function(e){return{id:e.id,description:e.description}})),outwardDetail:{arrivalDateTime:r.arriveDateTime,arrivalStationName:r.to,departureDateTime:r.departDateTime,departureStationName:r.from,supplierTickets:[{supplierName:i.providerName,ticketDescription:i.type,price:i.price,legs:c}]},transactionIdentifier:i.identifiers.transactionIdentifier,outbound:{fareIdentifiers:[i.identifiers.fareIdentifier],journeyIdentifier:i.identifiers.journeyIdentifier,journeyLegs:this.removedScheduledPlatformFromCallingPoints(r.journeyLegs)},termsAndCond:l},adults:a.adults,price:i.price,currency:i.currency,searchQuery:a,co2PerItem:r.co2PerItem,co2PerPassenger:r.co2PerPassenger,outboundDate:r.departDateTime},o&&(d.detail.outbound.ticketExtras=o),[2,this.basketService.addToBasket(d,s,this.searchService,this.travellers)]):[2,Promise.resolve()]}}))}))},n.prototype.addReturnJourneyToBasket=function(e,t,r,i,n,a){var o;return g(this,void 0,void 0,(function(){var s,u,l,c,d,p,h,m;return v(this,(function(f){switch(f.label){case 0:return s=this.getSearchQuery(t),(null===(o=null==r?void 0:r.ticketExtras)||void 0===o?void 0:o.length)&&(u=this.createTicketExtrasObject(r.ticketExtras[0])),[4,this.basketService.getDefaultBasket()];case 1:return l=f.sent(),c=null==l?void 0:l.subject.value,d=this.getTermsAndCond(n,r,i),c?(p=this.getLegsFromRailJourneyOption(r),h=this.getLegsFromRailJourneyOption(i),m={basket:c.id,service:e,detail:{ticketQueueList:(r.ticketQueueList||[]).map((function(e){return{id:e.id,name:e.name,type:e.type}})),accountsList:(r.accountsList||[]).map((function(e){return{id:e.id,description:e.description}})),outwardDetail:{arrivalDateTime:r.arriveDateTime,arrivalStationName:r.to,departureDateTime:r.departDateTime,departureStationName:r.from,supplierTickets:[{supplierName:n.providerName,ticketDescription:n.type,price:n.price,legs:p}]},inwardDetail:{arrivalDateTime:i.arriveDateTime,arrivalStationName:i.to,departureDateTime:i.departDateTime,departureStationName:i.from,supplierTickets:[{supplierName:a.providerName,ticketDescription:a.type,legs:h}]},transactionIdentifier:n.identifiers.transactionIdentifier,outbound:{fareIdentifiers:[n.identifiers.fareIdentifier],journeyIdentifier:n.identifiers.journeyIdentifier,journeyLegs:this.removedScheduledPlatformFromCallingPoints(r.journeyLegs)},return:{fareIdentifiers:[a.identifiers.fareIdentifier],journeyIdentifier:a.identifiers.journeyIdentifier,journeyLegs:this.removedScheduledPlatformFromCallingPoints(i.journeyLegs)},termsAndCond:d},adults:s.adults,price:n.price,currency:n.currency,searchQuery:s,co2PerItem:r.co2PerItem,co2PerPassenger:r.co2PerPassenger,outboundDate:r.arriveDateTime,inboundDate:i.arriveDateTime},u&&(m.detail.outbound.ticketExtras=u),[2,this.basketService.addToBasket(m,l,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},n.prototype.removedScheduledPlatformFromCallingPoints=function(e){for(var t=0;t<e.length;t++)for(var r=e[t],i=0;i<r.callingPoints.length;i++){delete r.callingPoints[i].scheduledPlatform}return e},n.prototype.createTicketExtrasObject=function(e){var t=this.noOfChildren*(null==e?void 0:e.childAmount)+this.noOfAdults*e.adultAmount;return[{type:e.identifiers.type,location:e.identifiers.location,date:e.identifiers.date,price:t}]},n.prototype.calculateTimeDifferenceInMins=function(e){return this.helpers.getTimeDifference(e.arriveDateTime,e.departDateTime).toString()},n.prototype.ticketIsAnETicket=function(){return null},n.prototype.applyFilter=function(){this._applyFilter()},n.prototype._applyFilter=function(){var t=this,r=function(e,r){var i=t._findSummary(r,t.summary.return);return t._selectedSummary?function(r){return r.map((function(r){var n,a,o,s;return r?Object.assign(Object.assign({},t.helpers.addRailActionRules(Object.assign({},r),[null===(n=t._selectedSummary[e][t.selectedTicket.fare.fareHash])||void 0===n?void 0:n.ruleDataWhenSelectedWith[r.fareHash],i?null===(a=i[e][r.fareHash])||void 0===a?void 0:a.ruleDataWhenSelectedAlone:null])),{selected:r.fareHash===t.selectedTicket.fare.fareHash,selectable:!!(null===(s=null===(o=t._selectedSummary[e][t.selectedTicket.fare.fareHash])||void 0===o?void 0:o.allowedWith)||void 0===s?void 0:s.includes(r.fareHash))}):null}))}:function(r){return r.map((function(r){return r?Object.assign(Object.assign({},t.helpers.addRailActionRules(Object.assign({},r),i?[i[e][r.fareHash].ruleDataWhenSelectedAlone]:[])),{selected:!1,selectable:!0}):null}))}},i=function(e,r,i){return function(n){var a=t._findSummary(r,t.summary[i]);return n.map((function(r){return r?t.helpers.addRailActionRules(Object.assign(Object.assign({},r),{selected:t.selectedTicket&&r.fareHash===t.selectedTicket.fare.fareHash}),a?[a[e][r.fareHash].ruleDataWhenSelectedAlone]:[]):null}))}};this.results.next(this.helpers.clone(this.fullResults).reduce((function(n,a){var o=Object.assign(Object.assign({},a),{outbound:(a.outbound||[]).map((function(r){return Object.assign(Object.assign({},r),{dualSingleJourneyFares:t.helpers.map(r.dualSingleJourneyFares||{},i("dualSingleJourneyFares",r,e.RailDirection.Outbound)),returnJourneyFares:t.helpers.map(r.returnJourneyFares||{},i("returnJourneyFares",r,e.RailDirection.Outbound)),openReturnJourneyFares:t.helpers.map(r.openReturnJourneyFares||{},i("openReturnJourneyFares",r,e.RailDirection.Outbound))})})),return:(a.return||[]).map((function(e){return Object.assign(Object.assign({},e),{returnJourneyFares:t.helpers.map(e.returnJourneyFares||{},r("returnJourneyFares",e)),dualSingleJourneyFares:t.helpers.map(e.dualSingleJourneyFares||{},r("dualSingleJourneyFares",e)),singleJourneyFares:t.helpers.map(e.singleJourneyFares||{},i("singleJourneyFares",e,"return")),openReturnJourneyFares:t.helpers.map(e.openReturnJourneyFares||{},i("openReturnJourneyFares",e,"return"))})}))});return n.push(o),n}),[]))},n.prototype.getTermsAndCond=function(e,t,r){return[{name:"Ticket Type Class",value:e.terms.ticketTypeClass},{name:"Ticket Type Conditions Description",value:e.terms.ticketTypeConditionsDescription},{name:"Valid Return Rule",value:e.terms.validReturnRule},{name:"Ticket Type Name",value:e.terms.ticketTypeName},{name:"Change Rule",value:e.terms.changeRule},{name:"Pre Booking Requirement",value:e.terms.preBookingRequirement},{name:"Railcard Discount",value:e.terms.railcardDiscount},{name:"Ticket Type Code",value:e.terms.ticketTypeCode},{name:"Child Discount",value:e.terms.childDiscount},{name:"Valid Out Rule",value:e.terms.validOutRule},{name:"Start Date",value:t.departDateTime},{name:"End Date",value:t.arriveDateTime},{name:"Journey Break Rule",value:e.terms.journeyBreakRule},{name:"Refund Cancellation Rule",value:e.terms.refundCancellationRule},{name:"Journey Type",value:e.terms.journeyType},{name:"Tod Available",value:e.terms.todAvailable},{name:"Return Start Date",value:null==r?void 0:r.departDateTime},{name:"Return End Date",value:null==r?void 0:r.arriveDateTime}]},n.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(this.tempParams),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:te.Rail,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},n}(c);gt.STORAGE_SESSION_PARAMS="search_rail",gt.STORAGE_SESSION_RESULTS="rail_results",gt.PASSING_POINT="Passing",(yt=e.ages||(e.ages={})).Child="Child",yt.Youth="Youth",yt.Adult="Adult",yt.Senior="Senior";var vt,bt,St=function(){function e(){}return e.hasItem=function(e){return!!e},e.fullname=function(e){return[e.title,e.forename,e.surname].filter(this.hasItem).join(" ")},e.makeTravellerObjectFromUser=function(e){return{id:e.user_id.toString(),forename:e.forename,surname:e.surname,email:e.username,title:e.title,isChild:!1,isInfant:!1,childDOB:null,guest:!1,name:e.surname+" "+e.forename}},e.equals=function(e,t){return e.email===t.email},e.compare=function(t,r){var i=e.fullname(t),n=e.fullname(r);return i===n?0:i<n?-1:1},e}();(vt=e.SortTypesIrl||(e.SortTypesIrl={})).CheapestFirst="C",vt.EarliestFirst="E",vt.LatestFirst="L",(bt=e.ClassType||(e.ClassType={})).Class_1="1",bt.Class_2="2",bt.Second_Class="2nd Class",bt.First_Class="1st Class";var Tt=function(t){function i(r,n,a,o,s,l){var c=t.call(this,s,a)||this;c.Irlfetcher=r,c.irlDiscountCardsFetcher=n,c.basketService=o,c.searchService=l,c.resultsSessionName=i.STORAGE_SESSION_RESULTS,c.multiResultsSessionName=i.STORAGE_SESSION_RESULTS,c._sortArray=[{title:"Price",methodRef:e.SortMethod.sortByPrice,icon:"ico-dollar"},{title:"Time",methodRef:e.SortMethod.sortByDate,icon:"ico-calendar"}],c.searchTypes=[{display:"Return",value:G.ReturnJourney},{display:"One-Way",value:G.SingleJourney}],c.classTypes=[{display:"Any",value:V.All},{display:"Standard",value:V.Standard},{display:"First",value:V.First}],c.ageRanges=[{key:e.ages.Child,value:"Child (0-3)"},{key:e.ages.Child,value:"Child (4-5)"},{key:e.ages.Child,value:"Child (6-11)"},{key:e.ages.Youth,value:"Youth (12-14)"},{key:e.ages.Youth,value:"Youth (15-25)"},{key:e.ages.Adult,value:"Adult (26-59)"},{key:e.ages.Youth,value:"Senior (60+)"}],c.travelCards=[{display:"Young persons railcard",value:"YNG"},{display:"Disability railcard",value:"DIS"},{display:"Family railcard",value:"FAM"},{display:"Forces railcard",value:"HMF"},{display:"Travel agency discount",value:"TAD"}],c.type=te.InternationalRail,c.minOutboundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},c.minInboundDate={year:u.default().year(),month:u.default().month()+1,day:u.default().date()},c._supplier=null,c._countryCode=null,c._class=null,c._outboundDepartureDateTime=null,c._departureLocationId=null,c._arrivalLocationId=null,c._adults=0,c._children=0,c._cheapestStandard=null,c._cheapestFirst=null,c._returnDepartureDateTime=null,c._ageRange=null,c._priceDir=!1,c._dateDir=!1,c._irlDiscountCardsArray=[],c._outbound_date=null,c._outbound_time=null,c._return_date=null,c._return_time=null,c._offline=!1,c._irlClass=V.All,c._journeytype=G.SingleJourney;var d=s.getSessionItem(i.STORAGE_SESSION_PARAMS)||{query:{},tempParams:{},originalUserSearch:{}};c.updateTempParams(c.searchService.makeIrlQuery(d.tempParams)),c._originalUserSearch=d.originalUserSearch,l.shouldAddTravellerSubscription()&&l.travellerInformation.subscribe((function(t){c.travellers=t,c.travellers[0]&&!c.travellers[0].ageType&&(c.travellers[0].ageType=e.ages.Adult);var r=c.helpers.selectedTravellers(t,te.InternationalRail);c.tempParams.adults=r.adults.length,c.tempParams.children=r.children.length,c.travellers=t,c._isValid()})),c._isValid();var p=s.getSessionItemAsList(c.resultsSessionName)||[];return c._cheapestResultPrice=c.updateLowestPrice(p),c.results.next(p||[]),c}return m(i,t),Object.defineProperty(i.prototype,"outboundJourneyOptions",{get:function(){return this._outboundJourneyOptions},set:function(e){this._outboundJourneyOptions=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outboundTicket",{get:function(){return this._outboundTicket},set:function(e){this._outboundTicket=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"noOfAdults",{get:function(){return this.tempParams.adults},set:function(e){this.tempParams.adults=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"noOfChildren",{get:function(){return this.tempParams.children},set:function(e){this.tempParams.children=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"travellingTo",{get:function(){return this.tempParams.arrivalLocationId},set:function(e){var t;this.tempParams.arrivalLocationId=e,this._travellingTo="",(null===(t=null==e?void 0:e.railstation)||void 0===t?void 0:t.id)&&(this._travellingTo=e.railstation.id),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"travellingFrom",{get:function(){return this.tempParams.departureLocationId},set:function(e){var t,r=this;this.tempParams.departureLocationId=e,this._travellingFrom="",(null===(t=null==e?void 0:e.railstation)||void 0===t?void 0:t.id)&&(this._travellingFrom=e.railstation.id,this.supplier=e.railstation.supplier,this.getIrlDiscountCards().subscribe((function(e){r.irlDiscountCardsArray=e}))),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"supplier",{get:function(){return this._supplier},set:function(e){this._supplier=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"countryCode",{get:function(){return this._countryCode},set:function(e){this._countryCode=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"class",{get:function(){return this._class},set:function(e){this._class=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outboundDepartureDateTime",{get:function(){return this._outboundDepartureDateTime},set:function(e){this.tempParams.outboundDepartureDateTime=e,e&&e.isValid()&&(this._outboundDepartureDateTime=e,this._outbound_date=this.helpers.momentToNgDate(e),this._outbound_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"0700"),this._updateOutboundDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"departureLocationId",{get:function(){return this._departureLocationId},set:function(e){this._departureLocationId=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"arrivalLocationId",{get:function(){return this._arrivalLocationId},set:function(e){this._arrivalLocationId=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"adults",{get:function(){return this._adults},set:function(e){this._adults=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"children",{get:function(){return this._children},set:function(e){this._children=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cheapestStandard",{get:function(){return this._cheapestStandard},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cheapestFirst",{get:function(){return this._cheapestFirst},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"returnDepartureDateTime",{get:function(){return this._returnDepartureDateTime},set:function(e){this.tempParams.returnDepartureDateTime=e,e&&e.isValid()&&(this._returnDepartureDateTime=e,this._return_date=this.helpers.momentToNgDate(e),this._return_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"1600"),this._updateReturnDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"ageRange",{get:function(){return this._ageRange},set:function(e){this._ageRange=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"priceDir",{get:function(){return this._priceDir},set:function(e){this._priceDir=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dateDir",{get:function(){return this._dateDir},set:function(e){this._dateDir=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"chosenSearchClass",{get:function(){return this.tempParams.class},set:function(e){this.tempParams.class=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"discountCard",{get:function(){return this.tempParams.irlDiscountCards},set:function(e){this.tempParams.irlDiscountCards=e,this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"irlDiscountCardsArray",{get:function(){return this._irlDiscountCardsArray},set:function(e){this._irlDiscountCardsArray=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outBoundDateTime",{get:function(){return this.tempParams.outboundDepartureDateTime},set:function(e){this.tempParams.outboundDepartureDateTime=u.default(e),this.minInboundDate={year:e.year(),month:e.month()+1,day:e.date()},e&&e.isValid()&&(this._outbound_date=this.helpers.momentToNgDate(e),this._outbound_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"0700"),this.outBoundDateTime&&this.inBoundDateTime&&this.outBoundDateTime.isAfter(this.inBoundDateTime)&&(this.inBoundDateTime=this.outBoundDateTime.clone().add(1,"day")),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"inBoundDateTime",{get:function(){return this.tempParams.returnDepartureDateTime},set:function(e){this.tempParams.returnDepartureDateTime=e,e&&e.isValid()&&(this._return_date=this.helpers.momentToNgDate(e),this._return_time=u.default(e).format("HHmm")?u.default(e).format("HHmm"):"1600"),this._isValid()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outbound_date",{get:function(){return this._outbound_date},set:function(e){this._outbound_date=e,this._updateOutboundDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"outbound_time",{get:function(){return this._outbound_time},set:function(e){this._outbound_time=e,this._updateOutboundDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"return_date",{get:function(){return this._return_date},set:function(e){this._return_date=e,this._updateReturnDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"return_time",{get:function(){return this._return_time},set:function(e){this._return_time=e,this._updateReturnDateTime()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"timeArray",{get:function(){return this._timeArray=this._timeArray||Array(48).fill(0).map((function(e,t){return{value:Math.floor(t/2).toString().padStart(2,"0")+(t%2*30).toString().padStart(2,"0"),display:Math.floor(t/2).toString().padStart(2,"0")+":"+(t%2*30).toString().padStart(2,"0")}})),this._timeArray},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"offline",{get:function(){return this._offline},set:function(e){this._offline=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"irlClass",{get:function(){return this._irlClass},set:function(e){this._irlClass=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"journeyType",{get:function(){return this._journeytype},set:function(e){this._journeytype=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"sortDropdownValues",{get:function(){return this._sortArray},enumerable:!1,configurable:!0}),i.prototype.processResults=function(e){var t;return null===(t=e[0])||void 0===t||t.outbound.forEach((function(e){e.providers[0].ticketOptions.map((function(e,t){return e.selected=!1,e.ShowDetail=!1,e.uid=e.identifiers.journeyIdentifier+"_"+(t+1),e}))})),Object.freeze(e),e},i.prototype.resetQuery=function(){this.updateTempParams(this.searchService.makeIrlQuery()),this._isValid()},i.prototype._isValid=function(){var e;this.storageService.setSessionItem(i.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.validationMessages=[];var t=u.default();this._travellingFrom||this.validationMessages.push("Please Enter a From Location."),this._travellingTo||this.validationMessages.push("Please Enter a To Location."),(null===(e=this.outBoundDateTime)||void 0===e?void 0:e.isBefore(t))&&this.validationMessages.push("Departure Date/Time cannot be in the past."),this.tempParams.adults+this.tempParams.children<1&&this.validationMessages.push("There must be at least 1 traveller"),this.isValid.next(0===this.validationMessages.length),this.messages.next(this.validationMessages)},i.prototype.startSearch=function(){if(this.results.next([]),this.isValid.value){var e=this.getSearchQuery();return this._originalUserSearch=Object.freeze(Object.assign({},this.tempParams)),this.storageService.setSessionItem(i.STORAGE_SESSION_PARAMS,{tempParams:this.tempParams,originalUserSearch:this.originalUserSearch}),this.searchService.saveRecentSearch(this.getRecentSearchQuery(e)),this._startSearch(this.Irlfetcher.fetchList(e).pipe(r.map((function(e){return e}))))}return Promise.resolve(!1)},i.prototype.getRecentSearchQuery=function(e){var t=this.updateSerchQuery(e);return{serviceType:te.InternationalRail,searchArgs:t,travelDate:this.outBoundDateTime.format(),travellers:this.helpers.getTravellersId(this.travellers)}},i.prototype.updateSerchQuery=function(e){var t=e;return this.travellingFrom&&(t.travellingFrom=this.travellingFrom),this.travellingTo&&(t.travellingTo=this.travellingTo),t},i.prototype.startRecentSearch=function(e){this.journeyType=e.searchArgs.journeyType,this.irlClass=e.searchArgs.class,this.travellingTo=e.searchArgs.travellingTo,this.travellingFrom=e.searchArgs.travellingFrom,this.outBoundDateTime=u.default(e.searchArgs.outboundDepartureDateTime),e.searchArgs.journeyType===G.ReturnJourney&&(this.inBoundDateTime=u.default(e.searchArgs.returnDepartureDateTime)),this.searchService.startSearches()},i.prototype._updateOutboundDateTime=function(){if(this._outbound_date&&this._outbound_time){var e=this.helpers.ngDateToMoment(this._outbound_date,this._outbound_time);this.outBoundDateTime=e.isValid()?e:null,this._isValid()}},i.prototype._updateReturnDateTime=function(){if(this._return_date&&this._return_time){var e=this.helpers.ngDateToMoment(this._return_date,this._return_time);this.inBoundDateTime=e.isValid()?e:null,this._isValid()}},i.prototype.getSearchQuery=function(){var t=this;this.noOfAdults=this.travellers.filter((function(t){return t.ageType===e.ages.Adult||t.ageType===e.ages.Youth||t.ageType===e.ages.Senior})).length,this.noOfChildren=this.travellers.filter((function(t){return t.ageType===e.ages.Child})).length,!this.supplier&&this.travellingFrom.name&&(this.supplier=this.travellingFrom.railstation.supplier,this.getIrlDiscountCards().subscribe((function(e){t.irlDiscountCardsArray=e})));var r={supplier:this.supplier,countryCode:"GB",irlDiscountCards:this.discountCard?this.discountCard.id:null,class:this.irlClass,outboundDepartureDateTime:this.tempParams.outboundDepartureDateTime,departureLocationId:this._travellingFrom,arrivalLocationId:this._travellingTo,adults:this.tempParams.adults,children:this.tempParams.children,returnDepartureDateTime:this.tempParams.returnDepartureDateTime,journeyType:this.journeyType};switch(0===this.tempParams.children&&(r.children=null),this.tempParams.journeyType){case G.SingleJourney:r.returnDepartureDateTime=null}return this.helpers.removeNulls(r)},i.prototype.updateFromPreviousSearches=function(e){},i.prototype.updateCanCombine=function(e){var t=this;(e.identifiers.allowedWith||[]).forEach((function(r){t._canCombine[e.type][r.journeyIdentifier]?t._canCombine[e.type][r.journeyIdentifier].push(r.fareIdentifier):t._canCombine[e.type][r.journeyIdentifier]=[r.fareIdentifier]}))},i.prototype.getLegsFromIrlJourneyOption=function(e){var t=[];return(null==e?void 0:e.segments.length)&&(t=e.segments.map((function(t){return{operator:t.operator||e.providers[0].providerId,departureDateTime:t.departDateTime,departureStationName:t.depart,arrivalDateTime:t.arriveDateTime,arrivalStationName:t.arrive}}))),t},i.prototype.getSelectedIrlTicketOption=function(e,t,r){return e.providers[r].ticketOptions.find((function(e){return e.type===t.type&&(e.price===t.price||e.identifiers.fareIdentifier===t.identifiers.fareIdentifier)}))},i.prototype.addSingleJourneyToBasket=function(e,t,r,i){return g(this,void 0,void 0,(function(){var n,a,o,s,u,l;return v(this,(function(c){switch(c.label){case 0:return[4,this.basketService.getDefaultBasket()];case 1:return n=c.sent(),(a=null==n?void 0:n.subject.value)?(o=this.getSelectedIrlTicketOption(i,r,0),s=this.getLegsFromIrlJourneyOption(i),u=this.getTermsAndCond(i),l={basket:a.id,service:e,detail:{outwardDetail:{arrivalDateTime:i.arriveDateTime,arrivalStationName:i.to,arrivalStationCode:i.toCode,departureDateTime:i.departDateTime,departureStationName:i.from,departureStationCode:i.fromCode,supplierTickets:[{supplierName:i.providers[0].name,ticketDescription:o.type,price:o.price,legs:s}]},transactionIdentifier:i.identifiers.transactionIdentifier,outbound:{fareIdentifiers:[o.identifiers.fareIdentifier],journeyIdentifier:o.identifiers.journeyIdentifier},supplier:i.providers[0].providerId,termsAndCond:u},adults:t.adults,price:o.price,currency:o.currency,searchQuery:t,outboundDate:i.departDateTime},[2,this.basketService.addToBasket(l,n,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},i.prototype.addReturnJourneyToBasket=function(e,t,r,i){return g(this,void 0,void 0,(function(){var r,n,a,o,s,u,l,c,d;return v(this,(function(p){switch(p.label){case 0:return r=this.outboundTicket,n=this.outboundJourneyOptions,[4,this.basketService.getDefaultBasket()];case 1:return a=p.sent(),(o=null==a?void 0:a.subject.value)?(s=this.getSelectedIrlTicketOption(n,r,0),u=this.getLegsFromIrlJourneyOption(n),l=this.getLegsFromIrlJourneyOption(i),c=this.getTermsAndCond(n),d={basket:o.id,service:e,detail:{outwardDetail:{arrivalDateTime:n.arriveDateTime,arrivalStationName:n.to,arrivalStationCode:n.toCode,departureStationCode:n.fromCode,departureDateTime:n.departDateTime,departureStationName:n.from,supplierTickets:[{supplierName:n.providers[0].name,ticketDescription:s.type,price:s.price,legs:u}]},inwardDetail:{arrivalDateTime:i.arriveDateTime,arrivalStationName:i.to,arrivalStationCode:i.toCode,departureStationCode:i.fromCode,departureDateTime:i.departDateTime,departureStationName:i.from,supplierTickets:[{supplierName:i.providers[0].name,ticketDescription:s.type,legs:l}]},transactionIdentifier:r.identifiers.transactionIdentifier,outbound:{fareIdentifiers:[s.identifiers.fareIdentifier],journeyIdentifier:s.identifiers.journeyIdentifier},supplier:n.providers[0].providerId,termsAndCond:c},adults:t.adults,price:s.price,currency:s.currency,searchQuery:t,outboundDate:n.departDateTime},this.filterSelected(),[2,this.basketService.addToBasket(d,a,this.searchService,this.travellers)]):[2,Promise.resolve(!1)]}}))}))},i.prototype.updateLowestPrice=function(e){if(!e.length)return null;var t=e[0].outbound[0].providers[0].cheapestTicket.currency;return{amount:this.findCheapestTicket(e),currencyCode:t}},i.prototype.findCheapestTicket=function(e){var t=this;if(this._cheapestFirst=null,this._cheapestStandard=null,!e.length)return null;var r=[];return e.map((function(e){e.outbound.map((function(e){e.providers.map((function(e){var i=e.cheapestTicket.price;e.ticketOptions.map((function(e){var n,a,o=e.price,s=e.class;"First"===s&&((null===(n=t._cheapestFirst)||void 0===n?void 0:n.price)>o||!t._cheapestFirst)?t._cheapestFirst=e:"Standard"===s&&((null===(a=t._cheapestStandard)||void 0===a?void 0:a.price)>o||!t._cheapestStandard)&&(t._cheapestStandard=e),o===i&&r.push(i)}))}))}))})),Math.min.apply(Math,T(r))},i.prototype.sortByPrice=function(){var e=this;this.priceDir=!this.priceDir;var t=this.filterSelected(this._isFiltered),r=function(t,r){return e.priceDir?t.providers[0].cheapestTicket.price-r.providers[0].cheapestTicket.price:r.providers[0].cheapestTicket.price-t.providers[0].cheapestTicket.price};t[0].outbound=t[0].outbound.sort(r),t[0].return=t[0].return.sort(r),this.results.next(t)},i.prototype.sortByDate=function(){var e=this;this.dateDir=!this.dateDir;var t=this.filterSelected(this._isFiltered),r=function(t,r){return e.dateDir?u.default(t.departDateTime).unix()-u.default(r.departDateTime).unix():u.default(r.departDateTime).unix()-u.default(t.departDateTime).unix()};t[0].outbound=t[0].outbound.sort(r),t[0].return=t[0].return.sort(r),this.results.next(t)},i.prototype.addOutboundAndFilter=function(e,t){this.outboundJourneyOptions=t,this.outboundTicket=e,this.filterSelected(!0)},i.prototype.filterSelected=function(e){var t=this;void 0===e&&(e=!1);var r=this.helpers.clone(this.fullResults);return e?(this._isFiltered=!0,r[0].outbound=[r[0].outbound.find((function(e){return e.departDateTime===t._outboundJourneyOptions.departDateTime&&e.arriveDateTime===t._outboundJourneyOptions.arriveDateTime}))],r[0].outbound[0].providers[0].ticketOptions=r[0].outbound[0].providers[0].ticketOptions.reduce((function(e,r){return r.uid===t._outboundTicket.uid&&(r.selected=!0,e.push(r)),e}),[])):(this._isFiltered=!1,this.outboundJourneyOptions=null,this.outboundTicket=null,r[0].outbound.forEach((function(e){e.providers[0].ticketOptions.map((function(e){return e.selected=!1,e.ShowDetail=!1,e}))}))),this.results.next(r),r},i.prototype.getIrlDiscountCards=function(){var e=this.supplier;return this.irlDiscountCardsFetcher.fetchList({supplier:e})},i.prototype.getTermsAndCond=function(e){var t,r;return[{name:"Fare Rules",value:null===(r=null===(t=null==e?void 0:e.providers[0])||void 0===t?void 0:t.ticketOptions[0])||void 0===r?void 0:r.fareRules}]},i.prototype.saveSearch=function(){if(this.isValid.value){var e=this.getSearchQuery(),t=this.updateSerchQuery(e),r={name:""+u.default(),serviceType:te.InternationalRail,searchArgs:t};return this.searchService.saveFavouriteSearch(r)}},i}(c);Tt.STORAGE_SESSION_PARAMS="search_irl",Tt.STORAGE_SESSION_RESULTS="irl_results",Tt.PASSING_POINT="Passing";var Ct,Dt,Pt={type:"string"},_t={type:"object",properties:{countryCode:Pt,areaCode:Pt,number:Pt,extension:Pt},required:["countryCode","areaCode","number","extension"]},At={type:"object",properties:{numberOrName:Pt,street:Pt,town:Pt,county:Pt,postcode:Pt,countryCode:Pt},required:["numberOrName","street","town","county","postcode","countryCode"]},kt=function(){function e(e){this.helpers=e,this.details={numberOrName:"",street:"",town:"",county:"",postcode:"",countryCode:"GB"},this.bookingAddress=new t.BehaviorSubject([])}return e.prototype.updateDetails=function(e){var t=this;this.bookingAddress.next(e.map((function(e){return t.helpers.sanatizeReturns(t.details,e)})))},e}(),Ft=function(){function e(e){this.helpers=e,this.details={countryCode:"",areaCode:"",number:"",extension:""},this.bookingPhoneNumber=new t.BehaviorSubject([])}return e.prototype.updateDetails=function(e){var t=this;this.bookingPhoneNumber.next(e.map((function(e){return t.helpers.sanatizeReturns(t.details,e)})))},e}(),Ot=function(){function e(e,t,r,i,n,a){this.user=e,this.getUserFetcher=t,this.helpers=r,this.perPassengerPhoneNumber=i,this.perPassengerAddress=n,this.perPassengerSupplementaryBookingInfoSchema=a,this.userDetails=null,this.userInfo={id:e.id,address:null,phoneNumber:null,supplementaryInfo:null}}return Object.defineProperty(e.prototype,"id",{get:function(){return this.user.id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userAddress",{get:function(){return null===this.userInfo.address&&this.setUpUserInfo(),this.userInfo.address},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userPhoneNumber",{get:function(){var e;return null===(null===(e=this.userInfo)||void 0===e?void 0:e.phoneNumber)&&this.setUpUserInfo(),this.userInfo.phoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userSupplementaryInfo",{get:function(){return null===this.userInfo.supplementaryInfo&&this.setUpUserInfo(),this.userInfo.supplementaryInfo},enumerable:!1,configurable:!0}),e.prototype.setUpUserInfo=function(){var e=this;this.userInfo.address=new kt(this.helpers),this.userInfo.phoneNumber=new Ft(this.helpers),this.userInfo.supplementaryInfo=this.perPassengerSupplementaryBookingInfoSchema,this.user.id&&this.getUserFetcher.fetchOne({id:this.user.id}).pipe(r.take(1)).subscribe((function(t){t&&(e.userDetails=t,e.userInfo.address.updateDetails(null==t?void 0:t.addresses),e.userInfo.phoneNumber.updateDetails(null==t?void 0:t.phoneNumbers))}))},e}(),Rt=function(){function t(e,t,r){var i=this;this.basketItem=e,this.helpers=t,this.hasDetails=!1,this.basketItem.perPassengerSupplementaryBookingInfoSchema=e.perPassengerSupplementaryBookingInfoSchema?this.processSchema(this.basketItem.perPassengerSupplementaryBookingInfoSchema):null,this.userInfo=this.basketItem.users.map((function(e){return new Ot(e,r,t,i.basketItem.perPassengerPhoneNumber,i.basketItem.perPassengerAddress,i.basketItem.perPassengerSupplementaryBookingInfoSchema)})),this.address=new kt(this.helpers),this.phoneNumber=new Ft(this.helpers),this.basketItem.perItemSupplementaryBookingInfoSchema=this.basketItem.perItemSupplementaryBookingInfoSchema?this.processSchema(this.basketItem.perItemSupplementaryBookingInfoSchema||{}):null}return Object.defineProperty(t.prototype,"perItemAddress",{get:function(){return!!this.basketItem.perItemAddress},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perItemPhoneNumber",{get:function(){return!!this.basketItem.perItemPhoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perItemSupplementarySchema",{get:function(){return this.basketItem.perItemSupplementaryBookingInfoSchema},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perPassengerAddress",{get:function(){return!!this.basketItem.perPassengerAddress},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perPassengerPhoneNumber",{get:function(){return!!this.basketItem.perPassengerPhoneNumber},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perPassengerSupplementaryBookingInfoSchema",{get:function(){return this.basketItem.perPassengerSupplementaryBookingInfoSchema},enumerable:!1,configurable:!0}),t.prototype.processSchema=function(t){var r=this;return console.warn("processing: ",t),t=this.helpers.clone(t),this.hasDetails=this.perItemAddress||this.perItemPhoneNumber||this.perPassengerAddress||this.perPassengerPhoneNumber,Object.keys(t.properties||{}).forEach((function(i){console.log("here: ",i),r.hasDetails=!0;var n=t.properties[i];"object"===n.type&&(n.format=r.addRailFormat(i)||e.SchemaFormat.object,t.properties[i]=Object.assign(Object.assign({},r.processSchema(n)),{format:r.addRailFormat(i)||e.SchemaFormat.object})),n.format=n.format||r.schemaWidgetToFormat(n.widget)||r.schemaTypeToFormat(n.type),n.oneOf&&n.oneOf.length>0&&"railSeating"!==n.format&&(n.format=e.SchemaFormat.select)})),console.log("+++ has Details: "+this.hasDetails+" +++"),t},t.prototype.schemaWidgetToFormat=function(t){switch(t){case e.Widgets.COUNTRY_CODE:return e.SchemaFormat.countryCode;default:return null}},t.prototype.addRailFormat=function(t){switch(t){case e.SchemaFormat.additionalSeatPreference:return e.SchemaFormat.additionalSeatPreference;case e.SchemaFormat.seatPrefGroups:return e.SchemaFormat.seatPrefGroups;default:return null}},t.prototype.schemaTypeToFormat=function(t){switch(t){case"string":return e.SchemaFormat.string;case"integer":return e.SchemaFormat.integer;case"object":return e.SchemaFormat.object;case"array":return e.SchemaFormat.array;case"boolean":return e.SchemaFormat.boolean;default:return e.SchemaFormat.string}},t.prototype.createSupplemtalBookingInformation=function(e){var t=this,r={basketItem:this.basketItem.id,userInfo:[],supplementaryInfo:{},paymentMethodDetails:{}};return void 0!==e.perItemAddress&&(r.address=this.helpers.toStrings(e.perItemAddress,At)),void 0!==e.perItemPhoneNumber&&(r.phoneNumber=this.helpers.toStrings(e.perItemPhoneNumber,_t)),void 0!==e.perItemSupplementarySchema&&(r.supplementaryInfo=this.helpers.toStrings(e.perItemSupplementarySchema,this.perItemSupplementarySchema)),r.userInfo=this.userInfo.map((function(r,i){var n={id:r.id,supplementaryInfo:{}},a=e["user_"+i]||{};return void 0!==a.perPassengerAddress&&(n.address=t.helpers.toStrings(a.perPassengerAddress,At)),void 0!==a.perPassengerPhoneNumber&&(n.phoneNumber=t.helpers.toStrings(a.perPassengerPhoneNumber,_t)),void 0!==a.perPassengerSupplementaryBookingInfoSchema&&(n.supplementaryInfo=t.helpers.toStrings(a.perPassengerSupplementaryBookingInfoSchema,t.perPassengerSupplementaryBookingInfoSchema)),n})),r},t}();(Ct=e.IncludedType||(e.IncludedType={})).Leg="leg",Ct.Photo="photo",Ct.PhotoAttachment="photo_attachment",Ct.Upa="upa",(Dt=e.IrlDirection||(e.IrlDirection={})).Outbound="out",Dt.Inbound="in";var Et=function(e){function t(t,r,i){var n=e.call(this,r)||this;return n.query=t,n.helpers=i,n}return m(t,e),t.prototype.fetchOne=function(e){return this.processCall(this.query.fetch(this.helpers.removeNulls(e)))},t}(p),It=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return null==e?void 0:e.data.applyJITFlightRules},t}(Et),Nt=function(e){function t(t,r,i){var n=e.call(this,i)||this;return n.query=t,n.helpers=r,n}return m(t,e),t.prototype.fetchList=function(e){return this.processCall(this.query.fetch(this.helpers.removeNulls(e)))},t.prototype.fetchKeyedObject=function(e,t){var i=this;return this.processCall(this.query.fetch(t)).pipe(r.map((function(t){return t?i.helpers.arrayToObject(t,e):null})))},t.prototype.fetchKeyedObjectArray=function(e,t){var i=this;return this.processCall(this.query.fetch(t)).pipe(r.map((function(t){return t?i.helpers.arrayToObjectArray(t,[e]):null})))},t}(p),Bt=function(e){function i(t,r,i){return e.call(this,t,r,i)||this}return m(i,e),i.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.applyJITHotelRules.result},i.prototype.processCall=function(e){var i=this;return e.pipe(r.take(1),r.map((function(e){return i.checkError(e.errors),i.getDataFromResult(e)})),r.catchError((function(e){return i.checkError(e),t.of({})})))},i}(Nt),Lt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.getUserBasket},t}(Et),Mt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchCabHire)||void 0===r?void 0:r.results},t}(Nt),jt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.carHireAvailabilityDetailRequest},t}(Nt),wt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchCarHire)||void 0===r?void 0:r.results},t}(Nt),xt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getConfermaOfficeNames},t}(Nt),Ut=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getConfermaOffice},t}(Et),Vt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=e.data)||void 0===t?void 0:t.getConfermaQuicklist)||void 0===r?void 0:r.results},t}(Nt),Gt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchEurostar)||void 0===r?void 0:r.results},t}(Nt),Ht=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.getFlightFareRules},t}(Nt),Qt=function(e){function t(t,r,i,n){var a=e.call(this,t,r,i)||this;return a.environment=n,a}return m(t,e),t.prototype.fetchList=function(t){var r,i;return(null===(r=this.environment)||void 0===r?void 0:r.groupMax)>0&&(t.groupMax=null===(i=this.environment)||void 0===i?void 0:i.groupMax),e.prototype.fetchList.call(this,t)},t.prototype.getDataFromResult=function(e){var t,r,i,n;return Object.assign(Object.assign({},null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchFlightsV2)||void 0===r?void 0:r.results),{ruleActionSummary:null===(n=null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.searchFlightsV2)||void 0===n?void 0:n.ruleActionSummary})},t}(Nt),Jt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getCOVIDMicrositeToken},t}(Nt),Wt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getRailcards},t}(Nt),Yt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getRailLiveDepartures},t}(Nt),Kt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getRailStation},t}(Nt),zt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getRiskAlerts},t}(Nt),Xt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.getUserCompanyOffices},t}(Nt),qt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUserCurrentCarbonAllowance},t}(Nt),Zt=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUserRecentSearches},t}(Nt),$t=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUserBaskets},t}(Nt),er=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUserMIAutoSuggestValues},t}(Nt),tr=function(e){function i(t,r,i){return e.call(this,t,r,i)||this}return m(i,e),i.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getMultipleHotelsAvailability.results},i.prototype.processCall=function(e){var i=this;return e.pipe(r.take(1),r.map((function(e){return i.checkError(e.errors),i.getDataFromResult(e)})),r.catchError((function(e){return i.checkError(e),t.of({})})))},i}(Nt),rr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchHotels)||void 0===r?void 0:r.results},t}(Nt),ir=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getIRLDiscountCards},t}(Nt),nr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchIRL)||void 0===r?void 0:r.results},t}(Nt),ar=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchLounges)||void 0===r?void 0:r.results},t}(Nt),or=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchParking)||void 0===r?void 0:r.results},t}(Nt),sr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t,r;return null===(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchRail)||void 0===r?void 0:r.results},t}(Nt),ur=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.searchAirlines},t}(Et),lr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.searchAirports},t}(Et),cr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.searchCities},t}(Nt),dr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.searchConfermaCities},t}(Et),pr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getCarHireDepots},t}(Nt),hr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.searchHotelChains},t}(Nt),mr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.searchIRLSupplierStations},t}(Nt),fr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return[null===(t=e.data)||void 0===t?void 0:t.getPostcodeDetails]},t}(Nt),yr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.searchRailStations},t}(Nt),gr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.searchUserCanBookFor},t}(Nt),vr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getUserAddresses},t}(Nt),br=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUser},t}(Et),Sr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getUserMessages},t}(Nt),Tr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getUserServices},t}(Nt),Cr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.getUserUIConfigs.all},t}(Nt),Dr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.getFlightSeatMap},t}(Nt),Pr=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.getUserFavouriteSearches},t}(Nt),_r=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=e.data)||void 0===t?void 0:t.getConfermaRoomImages},t}(Nt),Ar=function(e){function t(t,r,i){return e.call(this,t,r,i)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.emailBasket},t}(Nt),kr=function(){};kr.WHITE_CHARS=/[\r\n\t\s]/gm,kr.CAPS=/([A-Z])/g,kr.EMAIL_VALIDATOR=/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/,kr.UK_POSTCODE=/^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z]))))\s?[0-9][A-Za-z]{2})$/,kr.EMAIL_REGEX="^(([^<>()\\[\\]\\.,;:\\s@']+(\\.[^<>()\\[\\]\\.,;:\\s@']+)*)|('.+'))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}))$";var Fr,Or=function(e){function t(t,r,i,n,a){void 0===a&&(a="Invalid username or password. Please try again");var o=e.call(this,a)||this;return o.reason=t,o.data=r,o.statusText=i,o.error=n,o.name="LoginError",o}return m(t,e),t}(Error);(Fr=e.LoginErrorReason||(e.LoginErrorReason={}))[Fr.PASSWORD_EXPIRED=0]="PASSWORD_EXPIRED",Fr[Fr.PASSWORD_CHANGE=1]="PASSWORD_CHANGE",Fr[Fr.LOGED_IN=2]="LOGED_IN",Fr[Fr.AUTH_ERROR=3]="AUTH_ERROR",Fr[Fr.SSO=4]="SSO";var Rr,Er=function(){function e(e,t,r){this.username=e,this.password=t,this.overwrite="",r&&(this.overwrite="1")}return e.prototype.getAgent=function(){return"Agent="+encodeURIComponent(this.username.toLowerCase())},e.prototype.getPasswd=function(){return"Passwd="+encodeURIComponent(this.password)},e.prototype.getToken=function(){return"token="+encodeURIComponent(this.token)},e.prototype.getTokenStr=function(){try{return this.getAgent()+"&"+this.getPasswd()+"&overwrite="+this.overwrite+"&"+this.getToken()}catch(e){console.error("Sorry there is no enough information to get token string.")}},e.prototype.getChangePassTokenStr=function(){try{return("\n "+this.getAgent()+"&\n oldpasswd="+encodeURIComponent(this.oldPassword)+"&\n newpasswd="+encodeURIComponent(this.password)+"&\n cnfpasswd="+encodeURIComponent(this.confirmPassword)+"&\n "+this.getToken()).replace(kr.WHITE_CHARS,"")}catch(e){console.error("Sorry there is no enough information to get token string.",e)}},e.prototype.getResetPassTokenStr=function(){try{return("\n newpasswd="+encodeURIComponent(this.password)+"&\n cnfpasswd="+encodeURIComponent(this.confirmPassword)+"&\n "+this.getToken()).replace(kr.WHITE_CHARS,"")}catch(e){console.error("Sorry there is no enough information to get token string.",e)}},e}(),Ir=function(){function e(e,r,i,n){this.helpers=r,this.basketService=i,this.getUserFetcher=n,Object.assign(this,{subject:new t.BehaviorSubject(Object.assign(Object.assign({},e),{prices:{},mixedCurrency:!1,count:0,miGroups:[],basketInfoMiDetails:[],suppInfo:[]})),tempid:e.id,id:e.id,title:e.title,prices:{},mixedCurrency:!1,count:0,miGroups:[],basketInfoMiDetails:[],suppInfo:[]}),this.next(e)}return e.prototype.destructor=function(){this.subject.complete()},e.prototype.next=function(e){var t,r=this;if((e=this.helpers.clone(e)).status!==_.Approved||void 0!==e.basketItems[0].perItemPhoneNumber){this.id=e.id,this.title=e.title;var i=Object.assign(Object.assign({},e),(e.basketItems||[]).reduce((function(e,t,i){var n,a;return e.prices[t.currency]||(e.prices[t.currency]=0),e.prices[t.currency]+=t.price,e.suppInfo.push(new Rt(t,r.helpers,r.getUserFetcher)),t.miGroupsAvailable&&t.miGroupsAvailable.length>0&&e.miGroups.push({type:t.service.type,options:t.miGroupsAvailable,basketItem:t,value:t.miGroupSelected||""}),(null===(n=t.managementInfo)||void 0===n?void 0:n.length)>0&&(null===(a=t.users)||void 0===a?void 0:a.length)>0&&e.basketInfoMiDetails.push(new Te(t,r.basketService,r.helpers)),e}),{prices:{},mixedCurrency:!1,count:(null===(t=e.basketItems)||void 0===t?void 0:t.length)||0,miGroups:[],basketInfoMiDetails:[],suppInfo:[]}));i.mixedCurrency=Object.keys(i.prices).length>1,this.subject.next(i)}else this.basketService.getBasket({convertCurrencyTo:"GBP",id:e.id,withSupplemental:!0}).subscribe((function(e){r.next(e)}))},e}(),Nr=function(){function i(r,i,n,a,o,s,u,l,c,d,p,h,m,f,y,g,v,b,S,T,C,D,P,_){var A=this;this.acceptNewPriceUpdater=r,this.addItemToBasketUpdater=i,this.addUserToBasketItem=n,this.basketCreator=a,this.basketFetcher=o,this.bookBasketUpdater=s,this.deleteBasketUpdater=u,this.getMiAutoSugestionFetcher=l,this.helpers=c,this.removeItemFromBasketUpdater=d,this.revalidateBasketUpdater=p,this.setBasketItemMiGroupUpdater=h,this.setBasketItemMiValueUpdater=m,this.validateMiFreeValue=f,this.sendBasketForApprovalUpdater=y,this.getUserFetcher=g,this.getUserBasketsFetcher=v,this.SetBasketItemLeadPassenger=b,this.moveItemToADifferentBasket=S,this.updateBasketNotesUpdater=T,this.updateBasketTitleUpdater=C,this.setPaymentMethodUpdater=D,this.userService=P,this.modalService=_,this.currentBaskets=[],this.highlightBasketItemsEmitter=new t.Subject,this.basketChangeEmitter=new t.BehaviorSubject(""),this.baskets=new t.BehaviorSubject([]),this.basketList=[{type:te.Flight,text:"FLIGHTS",price:0},{type:te.Rail,text:"RAIL",price:0},{type:te.Hotel,text:"HOTELS",price:0},{type:te.Cab,text:"TAXIS",price:0},{type:te.Car,text:"CARS",price:0},{type:te.Eurostar,text:"EUROSTAR",price:0},{type:te.InternationalRail,text:"INTERNATIONAL RAIL",price:0},{type:te.Parking,text:"PARKING",price:0},{type:te.Lounge,text:"LOUNGES",price:0},{type:te.Coach,text:"COACH",price:0},{type:te.FastTrack,text:"FAST_TRACK",price:0}],this.basketPrices=new t.BehaviorSubject({total:null,list:this.basketList}),this.menuState=e.MenuSlideEnum.OUT,this.userService.changeUser.subscribe({next:function(e){A.reset()}})}return Object.defineProperty(i.prototype,"currentBasketID",{get:function(){return this.basketChangeEmitter.value},set:function(e){e!==this.currentBasketID&&this.basketChangeEmitter.next(e)},enumerable:!1,configurable:!0}),i.prototype.reset=function(){var e=this;this.userService.getfullUserDetails(!1).userData.value?this.getUserBasketsFetcher.fetchList({basketStatus:_.Open,user:this.userService.getfullUserDetails(!0).userData.value.user_id.toString()}).pipe(r.take(1)).subscribe((function(t){var r=t.map((function(t){if(t){var r=e.findBasket(t.id);return r||(r=new Ir(t,e.helpers,e,e.getUserFetcher),e.currentBaskets.push(r)),r}}));e.baskets.next(r),r.length>0?e.currentBasketID=r[0].id:e.currentBasketID=null,e.basketChangeEmitter.next(e.currentBasketID)}),(function(e){console.error(e)})):(this.currentBaskets.forEach((function(e){return e.subject.unsubscribe()})),this.currentBaskets=[],this.currentBasketID=null,this.baskets.next(this.currentBaskets),this.basketChangeEmitter.next(this.currentBasketID))},i.prototype.getAllOpenBaskets=function(e){return g(this,void 0,void 0,(function(){var t=this;return v(this,(function(i){return[2,this.getUserBasketsFetcher.fetchList({basketStatus:_.Open,user:e}).pipe(r.take(1),r.map((function(e){return e.length&&e.forEach((function(e){if(!t.findBasket(e.id)){var r=new Ir(e,t.helpers,t,t.getUserFetcher);t.currentBaskets.push(r)}})),e}))).toPromise()]}))}))},i.prototype.addToBasket=function(e,t,i,n){return void 0===n&&(n=[]),g(this,void 0,void 0,(function(){var a=this;return v(this,(function(o){return e.convertCurrencyTo="GBP",(null==n?void 0:n.length)>0&&(e.users=this.helpers.makeUsers(n),e.leadPassenger=e.users[0].id),e.outboundDate=e.outboundDate?new Date(this.helpers.formatIsoDateTime(e.outboundDate)):e.outboundDate,e.inboundDate=e.inboundDate?new Date(this.helpers.formatIsoDateTime(e.inboundDate)):e.inboundDate,(e=this.checkDetails(e))&&t&&this.addItemToBasketUpdater.updateOne(e).pipe(r.take(1)).subscribe((function(r){t.next(Object.assign(Object.assign({},t.subject.value),r));var n=a.userService.findService(e.service).type;i.search_objects[n].booking_chosen=!0,i.search_objects[n].chosen=!1;var o=r.basketItems;a.highlightBasketItemsEmitter.next(o),a.basketChangeEmitter.next(a.currentBasketID)}),(function(e){console.error(e),t.subject.next(t.subject.value)})),[2,!1]}))}))},i.prototype.loadBasket=function(e){var t=this.findBasket(e);t||(t=new Ir({id:e,basketItems:[]},this.helpers,this,this.getUserFetcher),this.currentBaskets.push(t)),this.basketFetcher.fetchOne({convertCurrencyTo:"GBP",id:e}).subscribe((function(e){t.next(e)}))},i.prototype.subsribeToBasket=function(e,t){var r=this.findBasket(e);r&&r.subject.subscribe(t)},i.prototype.removeExpiredItems=function(e){var t=this;this.findBasket(e).subject.value.basketItems.filter((function(e){return 0!==e.latestValidationPriceDifference||e.expired})).forEach((function(r){t.removeBasketItem(e,r)}))},i.prototype.removeBasketItem=function(e,t){return g(this,void 0,void 0,(function(){var r,i,n=this;return v(this,(function(a){switch(a.label){case 0:return r=this.findBasket(e),t.service.type!==te.Hotel?[3,4]:(i=r.subject.value.basketItems.filter((function(e){return t.detail.hotelId===e.detail.hotelId&&t.detail.rooms[0].id===e.detail.rooms[0].id&&t.detail.rooms[0].checkIn===e.detail.rooms[0].checkIn&&t.detail.rooms[0].checkOut===e.detail.rooms[0].checkOut}))).length>1?[4,this.modalService.open(d.WarningRemoveModalComponent)]:[3,2];case 1:return a.sent(),i.forEach((function(t){n.removeItemFromBasketUpdater.updateOne({convertCurrencyTo:"GBP",basketItem:t.id}).subscribe((function(t){r.next(Object.assign(Object.assign({},r.subject.value),t)),n.basketChangeEmitter.next(e)}))})),[3,3];case 2:this.removeItemFromBasketUpdater.updateOne({convertCurrencyTo:"GBP",basketItem:t.id}).subscribe((function(t){r.next(Object.assign(Object.assign({},r.subject.value),t)),n.basketChangeEmitter.next(e)})),a.label=3;case 3:return[3,5];case 4:this.removeItemFromBasketUpdater.updateOne({convertCurrencyTo:"GBP",basketItem:t.id}).subscribe((function(t){r.next(Object.assign(Object.assign({},r.subject.value),t)),n.basketChangeEmitter.next(e)})),a.label=5;case 5:return[2]}}))}))},i.prototype.getDefaultBasket=function(e){return void 0===e&&(e=!1),g(this,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return null,[4,this.findOrCreateBasket(this.currentBasketID,e).then((function(e){return e}))];case 1:return[2,t.sent()]}}))}))},i.prototype.findBasket=function(e){return this.currentBaskets.find((function(t){return t.id===e||t.tempid===e}))},i.prototype.findOrCreateBasket=function(e,t){return void 0===t&&(t=!1),g(this,void 0,void 0,(function(){var r,i;return v(this,(function(n){switch(n.label){case 0:return r=null,e?[3,7]:[4,this.getAllOpenBaskets(this.userService.getfullUserDetails(!0).userData.value.user_id.toString())];case 1:return(null==(i=n.sent())?void 0:i.length)?[3,3]:[4,this.createBasket()];case 2:return r=n.sent(),[3,6];case 3:return"BOOKED"!==(r=this.findBasket(i[0].id)).subject.value.status||t?[3,5]:(console.warn("+++ Retrieved basket is in booked status - creating a new one +++"),[4,this.createBasket()]);case 4:r=n.sent(),this.currentBaskets.push(r),n.label=5;case 5:this.baskets.next(this.currentBaskets),n.label=6;case 6:return[3,8];case 7:r=this.findBasket(e),n.label=8;case 8:return[2,r]}}))}))},i.prototype.createBasket=function(){return g(this,void 0,void 0,(function(){var e,t,r;return v(this,(function(i){switch(i.label){case 0:return e={id:"TEMPID_"+u.default().unix().toString(),owner:null,reference:null,title:null,notes:null,createdAt:null,updatedAt:null,basketItems:[],status:null,validated:!1},t=new Ir(e,this.helpers,this,this.getUserFetcher),[4,this.createBasketOnDB(t)];case 1:return r=i.sent(),this.currentBaskets.push(r),this.baskets.next(this.currentBaskets),this.basketChangeEmitter.next(r.id),[2,r]}}))}))},i.prototype.createBasketOnDB=function(e){var t=this;return new Promise((function(i,n){t.basketCreator.updateOne({}).pipe(r.take(1)).subscribe((function(t){e.id=t.id,e.next(t),i(e)}),(function(e){n(e)}),(function(){}))}))},i.prototype.toggleMenu=function(){this.menuState===e.MenuSlideEnum.IN||this.menuState===e.MenuSlideEnum.FLAT?this.menuState=e.MenuSlideEnum.OUT:this.menuState=e.MenuSlideEnum.IN},i.prototype.closeMenu=function(){this.menuState=e.MenuSlideEnum.IN},i.prototype.getLatestBasketItemForTypes=function(e){return(e||[]).reduce((function(e,t){return e[t.service.type]=t,e}),{})},i.prototype.checkDetails=function(e){var t=this.userService.findService(e.service);if(!t)return console.error("Unable to find service for basket item : "+e.service),null;var r=new l.default;r.addFormat("js-date-time",(function(e){return"object"==typeof e&&e.hasOwnProperty("toISOString")&&(e=e.toISOString()),!isNaN(Date.parse(e))})),r.addFormat("railSeating",(function(e){return!0}));var i=r.compile(t.detailSchema),n=r.compile(t.searchQuerySchema);if(e.searchQuery=this.helpers.sanitizeMomentDates(e.searchQuery),e.detail=this.helpers.removeNulls(e.detail),!n(e.searchQuery)){var a="Item searchQuery is not valid for "+t.name+" search schema.";return console.warn("searchSchema",t.searchQuerySchema),console.warn("item.searchQuery",e.searchQuery),console.warn("Search Query Validation errors",n.errors),this.modalService.open(d.ModalErrorComponent,{},{error:a}),null}if(!i(e.detail)){a="Item detail is not valid for "+t.name+" detail schema.";return console.warn("detailSchema",t.detailSchema),console.warn("item.detail",e.detail),console.warn("Detail errors",i.errors),this.modalService.open(d.ModalErrorComponent,{},{error:a}),null}return e},i.prototype.getNumberItemsForBasket=function(e){return void 0===e&&(e=null),(null==(e=e||this.findBasket(this.currentBasketID))?void 0:e.subject.value.basketItems.length)||0},i.prototype.removeBasket=function(e){var i=this;if(e)return this.deleteBasketUpdater.updateOne({id:e}).pipe(r.take(1),r.switchMap((function(r){var n,a;return null===(n=i.findBasket(e))||void 0===n||n.destructor(),i.currentBaskets=i.currentBaskets.filter((function(t){return t.id!==e})),i.baskets.next(i.currentBaskets),e===i.currentBasketID&&(i.currentBasketID=(null===(a=i.currentBaskets[0])||void 0===a?void 0:a.id)||null,i.basketChangeEmitter.next(i.currentBasketID)),t.of(r)})))},i.prototype.continueSearchAndBook=function(e,t,r){var i=this.getLatestBasketItemForTypes(e),n=r.getHighestSearchPriorityObject(i);return n?(r.searches[n.type].updateFromPreviousSearches(i),[n.searchUrl]):t},i.prototype.addTravellers=function(e,t,r,i){var n=this;void 0===i&&(i=0);var a=this.findBasket(e);if(i<r.length){var o=r[i],s=o.isChild?Y.Child:o.isInfant?Y.Infant:Y.Adult;this.addUserToBasketItem.updateOne({convertCurrencyTo:"GBP",basketItem:t.id,users:[{id:o.id,passengerType:s}],withSupplemental:!1}).subscribe((function(){}),(function(){}),(function(){n.addTravellers(a.id,t,r,i+1)}))}else this.basketFetcher.fetchOne({convertCurrencyTo:"GBP",id:a.id}).subscribe((function(e){a.subject.next(Object.assign(Object.assign({},a.subject.value),e))}),(function(e){}),(function(){a.next(a.subject.value)}))},i.prototype.setLeadPassenger=function(e,t,r,i){var n=this;void 0===i&&(i=0);var a=this.findBasket(e);i<1?this.SetBasketItemLeadPassenger.updateOne({convertCurrencyTo:"GBP",id:t.id,user:r.id,withSupplemental:!1}).subscribe((function(){}),(function(){}),(function(){n.setLeadPassenger(a.id,t,r,i+1)})):this.basketFetcher.fetchOne({convertCurrencyTo:"GBP",id:a.id}).subscribe((function(e){a.subject.next(Object.assign(Object.assign({},a.subject.value),e))}),(function(e){}),(function(){a.next(a.subject.value)}))},i.prototype.updateBasket=function(e,t){var i=this;return new Promise((function(n,a){t.pipe(r.take(1)).subscribe((function(t){i.findBasket(e).next(t),n()}),(function(t){console.error(t);var r=i.findBasket(e);r.next(r.subject.value),a(t)}),(function(){}))}))},i.prototype.revalidate=function(e){this.updateBasket(e,this.revalidateBasketUpdater.updateOne({convertCurrencyTo:"GBP",id:e}))},i.prototype.setBasketItemMiGroup=function(e,t,r){this.updateBasket(e,this.setBasketItemMiGroupUpdater.updateOne({convertCurrencyTo:"GBP",basketItem:t,group:r}))},i.prototype.acceptNewPrice=function(e,t){this.updateBasket(e,this.acceptNewPriceUpdater.updateOne({convertCurrencyTo:"GBP",id:t.id}))},i.prototype.validateFreeValeMi=function(e,t){var r=this;return new Promise((function(i,n){r.validateMiFreeValue.test({mi:e.id,freeValue:t}).subscribe(i,n)}))},i.prototype.setMiFreeValue=function(e,t,i,n){void 0===n&&(n=null);var a=this.findBasket(e),o={convertCurrencyTo:"GBP",mi:t.id,miFreeValue:i};n&&(o.user=n),this.setBasketItemMiValueUpdater.updateOne(o).pipe(r.take(1)).subscribe((function(e){a.next(e)}),(function(e){}),(function(){a.next(a.subject.value)}))},i.prototype.setMiSelectedValue=function(e,t,r,i){void 0===i&&(i=null);var n={convertCurrencyTo:"GBP",mi:t.id,miValue:r};i&&(n.user=i),this.updateBasket(e,this.setBasketItemMiValueUpdater.updateOne(n))},i.prototype.getMiAutoSugestions=function(e,t,i){return null==i||i.next(!0),this.getMiAutoSugestionFetcher.fetchList({mi:e,partialLabel:t}).pipe(r.tap((function(e){null==i||i.next(!1)})))},i.prototype.saveMiData=function(e,t){t.forEach((function(t){t.miPerItem.forEach((function(t){t.save(e,null)})),t.users.forEach((function(r){t.miPerUser[r].managementInfo.forEach((function(t){t.save(e,r)}))}))}))},i.prototype.sendBasketForApproval=function(e){return this.updateBasket(e,this.sendBasketForApprovalUpdater.updateOne({convertCurrencyTo:"GBP",basket:e}).pipe(r.take(1)))},i.prototype.setBasketItemPaymentOption=function(e,t,r){return this.updateBasket(e.id,this.setPaymentMethodUpdater.updateOne({convertCurrencyTo:"GBP",basketItem:t.id,paymentMethod:r}))},i.prototype.bookBasket=function(e,t){return this.updateBasket(e,this.bookBasketUpdater.updateOne({convertCurrencyTo:"GBP",id:e,supplementaryInfo:t}))},i.prototype.moveBasketItem=function(e,t,r){var i=this;this.moveItemToADifferentBasket.updateOne({convertCurrencyTo:"GBP",basketItem:t.id,newBasket:r}).subscribe((function(){i.loadBasket(e),i.loadBasket(r)}))},i.prototype.updateBasketNotes=function(e,t){this.updateBasket(e,this.updateBasketNotesUpdater.updateOne({convertCurrencyTo:"GBP",id:e,notes:t}))},i.prototype.updateBasketTitle=function(e,t){this.updateBasket(e,this.updateBasketTitleUpdater.updateOne({convertCurrencyTo:"GBP",id:e,newTitle:t}))},i.prototype.getBasket=function(e){return this.basketFetcher.fetchOne(e)},i.prototype.atLeastOneSearchChosen=function(){return!!this.currentBaskets.filter((function(e){return e.subject.value.basketItems.length})).length},i.prototype.getBasketStats=function(e){var t,r,i,n=this,a=(null===(i=null===(r=null===(t=this.baskets.value[e])||void 0===t?void 0:t.subject)||void 0===r?void 0:r.value)||void 0===i?void 0:i.prices)||{},o=Object.keys(a)[0];return o?(this.basketPrices.value.currency=o,this.basketPrices.value.total=this.baskets.value[e].subject.value.prices[o]):this.basketPrices.value.total=0,this.basketPrices.value.list.forEach((function(t){var r,i,a;t.price=null===(a=null===(i=null===(r=n.baskets.value[e])||void 0===r?void 0:r.subject)||void 0===i?void 0:i.value)||void 0===a?void 0:a.basketItems.filter((function(e){return e.service.type===t.type})).reduce((function(e,t){return e+t.price}),0)})),this.basketPrices},i}(),Br="results_hotel_avallibility",Lr=function(){function e(e,r,i,n){this.avalibilityFethcer=e,this.sessionStorage=r,this.helpers=i,this.environment=n,this.data=null,this.behaviours={},this.toFetch=[],this.fetching=new t.BehaviorSubject(!1),this.currencies={}}return e.prototype.readFromSession=function(){var e=this,r=this.sessionStorage.getSessionItem(Br)||{};return Object.values(r).forEach((function(r){e.behaviours[r.hotelId]=new t.BehaviorSubject(r)})),r},e.prototype.reset=function(){var e=this;this.data={},this.currencies={},this.toFetch=[],this.fetching.next(!1),this.sessionStorage.removeSessionItem(Br),Object.values(this.data).forEach((function(t){e.behaviours[t.hotelId].complete(),delete e.behaviours[t.hotelId]})),this.behaviours={}},e.prototype.getAvailabilityForId=function(e,r){var i;if(null===(i=null==r?void 0:r.availableRates)||void 0===i?void 0:i.rooms){if(this.behaviours[e.hotel])return this.behaviours[e.hotel];this.behaviours[e.hotel]=new t.BehaviorSubject(null);var n=r.availableRates;return n.minprice=r.availableRates.rooms[0]?r.availableRates.rooms[0].total:0,n.maxprice=n.minprice?r.availableRates.rooms[r.availableRates.rooms.length-1].total:0,this.behaviours[e.hotel].next(n),this.behaviours[e.hotel]}return this.data=this.data||this.readFromSession(),this.behaviours[e.hotel]||this._getAvailabilityForId(e)},e.prototype.getAvailabilityValue=function(e){var t;return this.data=this.data||this.readFromSession(),(null===(t=this.behaviours[e.id])||void 0===t?void 0:t.value)||{}},e.prototype.updateHotel=function(e){return e.availableRates||(e.availableRates=this.getAvailabilityValue(e)),e},e.prototype.setHotelAvalability=function(e){return e.availableRates||(null==e?void 0:e.availableRates.hotelId)&&(this.data[e.availableRates.hotelId]=e.availableRates,this.behaviours[e.availableRates.hotelId].next(e.availableRates)),e},e.prototype._getAvailabilityForId=function(e){return this.timeout&&(window.clearTimeout(this.timeout),this.timeout=0),this.fetching.value||(this.timeout=window.setTimeout(this.fetchAvalilbility.bind(this),this.environment.autoFetchHotelTimeout)),this.toFetch.push(e),!this.fetching.value&&this.toFetch.length>=this.environment.numberOfHotelsToFetch&&this.fetchAvalilbility(),this.behaviours[e.hotel]=new t.BehaviorSubject(null),this.behaviours[e.hotel]},e.prototype.fetchAvalilbility=function(){var e=this;this.fetching.next(!0),this.timeout&&(window.clearTimeout(this.timeout),this.timeout=0);var t=this.toFetch.slice(0,this.environment.numberOfHotelsToFetch);this.toFetch=this.toFetch.slice(this.environment.numberOfHotelsToFetch),console.log("Hotels still to fetch",this.toFetch.length);var i={hotel:t.map((function(e){return e.hotel})),currency:t[0].currency,endDate:t[0].endDate,startDate:t[0].startDate,occupants:t[0].occupants,rooms:t[0].rooms};this.avalibilityFethcer.fetchList(i).pipe(r.take(1)).subscribe((function(t){t.forEach((function(t){(t=e.helpers.clone(t)).rooms=(t.rooms||[]).filter((function(e){return e.total>0})).map((function(t){return(t=e.helpers.clone(t)).LocalPrice=t.currencyConversion?t.currencyConversion.localTotal:t.total,t.LocalCurrency=t.currencyConversion?t.currencyConversion.localCode:t.currencyCode,t})),t.currencies=t.rooms.reduce((function(t,r){return r.currencyConversion&&(t[r.currencyConversion.convertedCode]=t[r.currencyConversion.convertedCode]||{maxprice:Number.MIN_VALUE,minprice:Number.MAX_VALUE},t[r.currencyConversion.convertedCode].maxprice=Math.max(t[r.currencyConversion.convertedCode].maxprice,r.currencyConversion.convertedTotal),t[r.currencyConversion.convertedCode].minprice=Math.min(t[r.currencyConversion.convertedCode].minprice,r.currencyConversion.convertedTotal),e.currencies[r.currencyConversion.convertedCode]=e.currencies[r.currencyConversion.convertedCode]||{maxprice:Number.MIN_VALUE,minprice:Number.MAX_VALUE},e.currencies[r.currencyConversion.convertedCode].minprice=Math.ceil(Math.min(e.currencies[r.currencyConversion.convertedCode].minprice,r.currencyConversion.convertedTotal)),e.currencies[r.currencyConversion.convertedCode].maxprice=Math.ceil(Math.max(e.currencies[r.currencyConversion.convertedCode].maxprice,r.currencyConversion.convertedTotal))),t}),{});var r=t.rooms.map(e.helpers.mapFieldFromObject("total"));r.length||r.push(0),t.minprice=Math.min.apply(Math,T(r)),t.maxprice=Math.max.apply(Math,T(r)),t.rooms=t.rooms,(null==t?void 0:t.hotelId)&&e.behaviours[t.hotelId]&&(e.data[t.hotelId]=t,e.behaviours[t.hotelId].next(t))})),e.sessionStorage.setSessionItem(Br,t),e.toFetch.length>0?setTimeout((function(){e.fetchAvalilbility()}),e.environment.hotelAvalibilityTimeout):e.fetching.next(!1)}),(function(t){return console.error("+++ Error recovering hotel availabilty: "+t+" - reseting availabilty +++"),e.fetching.next(!1),null}))},e.prototype.maxPriceForCurrency=function(e){return(this.currencies[e]||{maxprice:Number.MAX_VALUE,minprice:Number.MIN_VALUE}).maxprice},e.prototype.numberOfHotelsWithPrice=function(){var e,t,r=0;if(this.data)try{for(var i=b(Object.entries(this.data)),n=i.next();!n.done;n=i.next()){var a=S(n.value,2),o=(a[0],a[1]);(null==o?void 0:o.prpn)&&r++}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},e}(),Mr=function(){function e(){}return e.prototype.serialize=function(e){return Object.keys(e).reduce((function(t,r){return(t.length?t+"&":"")+r+"="+encodeURIComponent("object"==typeof e[r]?JSON.stringify(e[r]):e[r])}),"")},e}(),jr="USER_SIGNEDOUT",wr=function(){function e(e,r,i,n,a,o,s){this.getUserFetcher=e,this.userUiConfigsFetcher=r,this.userProductsFetcher=i,this.userMessagesFetcher=n,this.baseConfirmMessagesUpdater=a,this.storageService=o,this.helpers=s,this.fullUserDetails={bookingAllowedFor:"",messages:new t.BehaviorSubject(null),travllerObject:new t.BehaviorSubject(null),userConfigs:new t.BehaviorSubject(null),userData:new t.BehaviorSubject(null),userServices:new t.BehaviorSubject(null)},this.changeUser=new t.BehaviorSubject(null)}return e.prototype.setUser=function(e){var t=this,r=this.fullUserDetails.userData.value;r&&r.username===e.username||(this.userUiConfigsFetcher.fetchKeyedObject("key").subscribe((function(e){t.fullUserDetails.userConfigs.next(e),t.checkEmitUser()}),(function(e){console.error(e)})),this.userProductsFetcher.fetchKeyedObjectArray("type").subscribe((function(e){t.fullUserDetails.userServices.next(e),t.checkEmitUser()})),this.userMessagesFetcher.fetchList().subscribe((function(e){t.fullUserDetails.messages.next(e),t.checkEmitUser()}),(function(e){console.error(e)})),this.fullUserDetails.travllerObject.next(St.makeTravellerObjectFromUser(e))),this.fullUserDetails.userData.next(e),this.storageService.setSessionItem("lightning_user_data",e)},e.prototype.checkEmitUser=function(){this.fullUserDetails.userConfigs.value&&this.fullUserDetails.userData.value&&this.fullUserDetails.userServices.value&&this.fullUserDetails.messages.value&&this.changeUser.next(this.fullUserDetails)},e.prototype.getfullUserDetails=function(e){return void 0===e&&(e=!1),this._getFullUserDetails()},e.prototype._getFullUserDetails=function(){return this.fullUserDetails||this.storageService.getSessionItem("lightning_user_data")},e.prototype.getUserDropdownInfo=function(){var e={name:"Unable to retrieve name.",email:"Unable to rerieve email",account_type:"Unknown",title:""},t=this.getUsersFullname(),r=this.getUserEmail(),i=this.getUserBookingType(),n=this.getUserTitle();return t&&(e.name=t),r&&(e.email=r),i&&(e.account_type=i),n&&(e.title=n),e},e.prototype.getUserTitle=function(){var e=this.getfullUserDetails();return e&&e.userData?e.userData.value.title:""},e.prototype.getUserForename=function(){var e=this.getfullUserDetails();return e&&e.userData?e.userData.value.forename:""},e.prototype.getUserSurname=function(){var e=this.getfullUserDetails();return e&&e.userData?e.userData.value.surname:""},e.prototype.getFullPhoneNumber=function(){this.getfullUserDetails();return""},e.prototype.getUserEmail=function(){var e=this.getfullUserDetails();return e&&e.userData?e.userData.value.username:""},e.prototype.getUserBookingType=function(){var e=this.getfullUserDetails();return e&&e.userData?e.userData.value.booker_type:null},e.prototype.getUsersFullname=function(){var e=this.getfullUserDetails();return!(!e||!e.userData)&&e.userData.value.forename+" "+e.userData.value.surname},e.prototype.getUsersTitleAndFullName=function(){var e=this.getfullUserDetails();return!(!e||!e.userData)&&e.userData.value.title+" "+e.userData.value.forename+" "+e.userData.value.surname},e.prototype.getUserFavoriteValue=function(e,t){void 0===t&&(t=ze.non);var r=this.fullUserDetails.userConfigs.value;return this.helpers.fromObject(r,e.value,"config",e.value)},e.prototype.getUserFavoriteObject=function(e){var t=this.fullUserDetails.userConfigs.value;return this.helpers.fromObject(t,e.value,"config")},e.prototype.getUserFavoriteNumber=function(e,t){void 0===t&&(t=ze.non);var r=this.fullUserDetails.userConfigs.value;return this.helpers.fromObject(r,e.value,"config","value")},e.prototype.isUserFavoriteSet=function(e,t){void 0===t&&(t=ze.non);var r=this.fullUserDetails.userConfigs.value;return this.helpers.fromObject(r,e.value,"config","value")},e.prototype.createSelfTraveller=function(){return this.fullUserDetails.travllerObject.value},e.prototype.travellerIsUser=function(e){return!1},e.prototype.emptyUserData=function(){this.fullUserDetails.userData.next(null),this.fullUserDetails.userConfigs.next(null),this.fullUserDetails.userServices.next(null),this.fullUserDetails.messages.next(null),this.changeUser.next(this.fullUserDetails)},e.prototype.createGuestUser=function(e,t,r,i,n,a,o,s,u,l,c){return{isChild:u,isInfant:l,childDOB:c,guest:!0,id:"",forename:t,surname:r,email:i,title:e,name:[e,t,r].join(" ")}},e.prototype.userIsClient=function(){return!0},e.prototype.hasIgnorePolicy=function(){return!1},e.prototype.useAgentCanBookFor=function(){return!0},e.prototype.canBook=function(e){var t=this.fullUserDetails.userServices.value;return t&&!!t[e]},e.prototype.isTraveller=function(){return this.fullUserDetails.userData.value.booker_type===k.Traveller},e.prototype.userIsAgent=function(){return this.fullUserDetails.userData.value.booker_type===k.Company},e.prototype.userIsAdmin=function(){return this.fullUserDetails.userData.value.admin},e.prototype.userIsCompanyAdmin=function(){return this.fullUserDetails.userData.value.company_admin},e.prototype.isSelfBook=function(){return this.fullUserDetails.userData.value.booker_type===k.SelfBook},e.prototype.isBooker=function(){return this.fullUserDetails.userData.value.booker_type===k.Booker},e.prototype.getUserId=function(){return this.fullUserDetails.userData.value.user_id},e.prototype.userHasServiceProvider=function(e,t){return!!this.fullUserDetails.userServices.value&&!!(this.fullUserDetails.userServices.value[e]||[]).find((function(e){return e.name===t}))},e.prototype.findService=function(e){return this.fullUserDetails.userServices.value?this.helpers.findService(this.fullUserDetails.userServices.value,e):null},e.prototype.getUserMessages=function(){return this.userMessagesFetcher.fetchList()},e.prototype.confirmMessages=function(e){return this.baseConfirmMessagesUpdater.updateOne({messages:e})},e.prototype.getUser=function(){var e=this.getfullUserDetails();return this.getUserFetcher.fetchOne({id:e.userData.value.user_id.toString()})},e}(),xr=function(){function i(e,t,r,i,n,a,o){this.userService=e,this.modalService=t,this.http=r,this.router=i,this.eventMessenager=n,this.storageService=a,this.environment=o,this.loading=!1,this.isLoggedIn=!1,this.redirectUrl="",this.refreshPromise=null}return i.prototype.checkLogin=function(){return this.refreshToken()},i.prototype.refreshToken=function(){var t=this;return this.refreshPromise=this.refreshPromise||new Promise((function(i,n){t.clearRefresh(),t.http.formEncodedPostNoErrorHandling(e.URLS.Refresh,{}).pipe(r.take(1),r.map((function(e){return t.handleResponse(e)}))).subscribe((function(e){if("string"==typeof e){if(i(!1),"login"!==t.router.url)t.modalService.open(d.BaseModalComponent,{},{title:"Auto Logout",body:"",isLoading:!1,options:{buttonCancel:!1,buttonOk:!0,buttonOkText:"Continue"}}).then((function(){t.logout(),i(!1)}))}else i(!0),t.setRefresh()}),(function(e){i(!1)}))})).then((function(e){return t.refreshPromise=null,e})).catch((function(e){throw t.refreshPromise=null,e})),this.refreshPromise},i.prototype.clearRefresh=function(){this.timeoutSubscription&&(clearTimeout(this.timeoutSubscription),this.timeoutSubscription=null)},i.prototype.setRefresh=function(){this.timeoutSubscription=window.setTimeout(this.refreshToken.bind(this),1e3*this.environment.authRefreshTimeout)},i.prototype.login=function(t,i,n){var a=this;return this.userService.emptyUserData(),this.storageService.clearSessionData(),this.clearRefresh(),this.http.formEncodedPostNoErrorHandling(e.URLS.AccessToken,{username:t,password:i}).pipe(r.take(1),r.map((function(e,t){return a.setRefresh(),a.handleResponse(e)})))},i.prototype.handleResponse=function(e){return"object"==typeof e&&e.jwt&&(this.userService.setUser(e.jwtObject),delete e.jwt,delete e.jwtObject),e},i.prototype.cookieLogin=function(e){return t.of(null)},i.prototype.logout=function(){var t=this;this.userService.isUserFavoriteSet(Ke.SSO_no_password);this.clearRefresh(),this.isLoggedIn=!1,this.userService.emptyUserData(),this.storageService.clearSessionData(),this.http.post(e.URLS.LOGOUT_URL).subscribe((function(e){e.LogoutSuccess||console.warn("You're not logged in, cannot log out.")}),(function(){t.eventMessenager.emit(jr,{}),t.userService.isUserFavoriteSet(Ke.SSO_no_password)?t.router.navigate(["logOutDigitsUser"]):t.router.navigate(["logon"])}))},i.prototype.changePassword=function(e){return t.of(null)},i.prototype.resetPassword=function(t,r){return this.http.formEncodedPost(e.URLS.RESET_PASSWORD,{passwordResetToken:t,newPassword:r})},i.prototype.recoverPassword=function(t){return this.http.formEncodedPost(e.URLS.RECOVER_PASSWORD_URL,{username:""+t},"text")},i.prototype.handleError=function(e){var t={error:e};this.modalService.open(d.ModalErrorComponent,{},t)},i}(),Ur=function(){function e(){this.openModalEvent=new t.Subject}return e.prototype.open=function(e,t,r){var i=this;return void 0===t&&(t=null),void 0===r&&(r=null),new Promise((function(n,a){i.openModalEvent.next({type:e,data:r||{},options:t||{},results:n})}))},e.prototype.subscribe=function(e){return this.openModalEvent.subscribe(e)},e}(),Vr=function(){function e(e,r,i){var n,a;this.getUserBasketsFetcher=e,this.searchUserCanBookFor=r,this.cancelBookingUpdater=i,this.baskets=new t.BehaviorSubject([]),this._basketStatusIconClasses=((n={})[_.Approved]="ico-tick",n[_.AwaitingApproval]="ico-clock",n[_.BookingFailed]="ico-deny",n[_.Disapproved]="ico-deny",n[_.Open]="ico-calendar",n[_.PartiallyBooked]="ico-deny",n[_.Booked]="ico-deny",n),this._serviceTypeIconClasses=((a={})[te.Cab]="ico-m-taxi",a[te.Car]="ico-car",a[te.Coach]="ico-bus",a[te.Flight]="ico-flight",a[te.Hotel]="ico-bed",a[te.FastTrack]="",a[te.InternationalRail]="ico-rail",a[te.Lounge]="ico-material ico-lounge",a[te.Parking]="ico-material ico-parking",a[te.Rail]="ico-rail",a[te.Eurostar]="ico-rail",a)}return e.prototype.getUserBaskets=function(e,t){var i=this;t.next(!0),this.getUserBasketsFetcher.fetchList(e).pipe(r.take(1)).subscribe((function(e){i.baskets.next(e),t.next(!1)}),(function(e){console.error(e),t.next(!1)}))},e.prototype.getSearchUserCanBookFor=function(e,i){return e.length>2?(i.next(!0),this.searchUserCanBookFor.fetchList({email:e}).pipe(r.take(1),r.map((function(e){return i.next(!1),e})))):t.of([])},e.prototype.getServiceTypeFilters=function(e){var t,r,i=[];try{for(var n=b(Object.entries(e.search_objects)),a=n.next();!a.done;a=n.next()){var o=S(a.value,1)[0];i.push(o)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return i},e.prototype.getBasketStatusFilters=function(){var e=[];return Object.values(_).forEach((function(t){return e.push(t)})),e},e.prototype.getServiceTypeFilterVanityName=function(e){switch(e){case te.Cab:return"Taxi";case te.InternationalRail:return"European Rail";default:return e}},e.prototype.getBasketStatusIconClass=function(e){return this._basketStatusIconClasses[e]||"ico-exclamation"},e.prototype.getServiceTypeIconClass=function(e){return this._serviceTypeIconClasses[e.service.type]||"ico-exclamation"},e.prototype.getTotalPriceForBasketItems=function(e){return e.reduce((function(e,t){return e+t.price}),0)},e.prototype.getTravellerNamesFromBasketItems=function(e){var t=[];return e.map((function(e){return e.users.map((function(e){return t.push(e.forename+" "+e.surname)}))})),t=T(new Set(t))},e.prototype.allBasketItemsMatchStatus=function(e,t){return e.every((function(e){return e.status===t}))},e.prototype.getHotelAddress=function(e){var t=e.county,r=e.postcode,i=e.streetName,n=e.town,a=[];return i&&a.push(i),n&&a.push(n),t&&a.push(t),r&&a.push(r),a.join(", ")},e.prototype.getHotelLocation=function(e){var t=e.county,r=e.town,i=[];return r&&i.push(r),t&&i.push(t),i.join(", ")},e.prototype.cancelBooking=function(e){return this.cancelBookingUpdater.updateOne({basketItem:e})},e}(),Gr=[{cName:"Afghanistan",dCode:"93",cCode:"AF"},{cName:"Aland Islands",dCode:"358",cCode:"AX"},{cName:"Albania",dCode:"355",cCode:"AL"},{cName:"Algeria",dCode:"213",cCode:"DZ"},{cName:"AmericanSamoa",dCode:"1684",cCode:"AS"},{cName:"Andorra",dCode:"376",cCode:"AD"},{cName:"Angola",dCode:"244",cCode:"AO"},{cName:"Anguilla",dCode:"1264",cCode:"AI"},{cName:"Antarctica",dCode:"672",cCode:"AQ"},{cName:"Antigua and Barbuda",dCode:"1268",cCode:"AG"},{cName:"Argentina",dCode:"54",cCode:"AR"},{cName:"Armenia",dCode:"374",cCode:"AM"},{cName:"Aruba",dCode:"297",cCode:"AW"},{cName:"Australia",dCode:"61",cCode:"AU"},{cName:"Austria",dCode:"43",cCode:"AT"},{cName:"Azerbaijan",dCode:"994",cCode:"AZ"},{cName:"Bahamas",dCode:"1242",cCode:"BS"},{cName:"Bahrain",dCode:"973",cCode:"BH"},{cName:"Bangladesh",dCode:"880",cCode:"BD"},{cName:"Barbados",dCode:"1246",cCode:"BB"},{cName:"Belarus",dCode:"375",cCode:"BY"},{cName:"Belgium",dCode:"32",cCode:"BE"},{cName:"Belize",dCode:"501",cCode:"BZ"},{cName:"Benin",dCode:"229",cCode:"BJ"},{cName:"Bermuda",dCode:"1441",cCode:"BM"},{cName:"Bhutan",dCode:"975",cCode:"BT"},{cName:"Bolivia, Plurinational State of",dCode:"591",cCode:"BO"},{cName:"Bosnia and Herzegovina",dCode:"387",cCode:"BA"},{cName:"Botswana",dCode:"267",cCode:"BW"},{cName:"Brazil",dCode:"55",cCode:"BR"},{cName:"British Indian Ocean Territory",dCode:"246",cCode:"IO"},{cName:"Brunei Darussalam",dCode:"673",cCode:"BN"},{cName:"Bulgaria",dCode:"359",cCode:"BG"},{cName:"Burkina Faso",dCode:"226",cCode:"BF"},{cName:"Burundi",dCode:"257",cCode:"BI"},{cName:"Cambodia",dCode:"855",cCode:"KH"},{cName:"Cameroon",dCode:"237",cCode:"CM"},{cName:"Canada",dCode:"1",cCode:"CA"},{cName:"Cape Verde",dCode:"238",cCode:"CV"},{cName:"Cayman Islands",dCode:" 345",cCode:"KY"},{cName:"Central African Republic",dCode:"236",cCode:"CF"},{cName:"Chad",dCode:"235",cCode:"TD"},{cName:"Chile",dCode:"56",cCode:"CL"},{cName:"China",dCode:"86",cCode:"CN"},{cName:"Christmas Island",dCode:"61",cCode:"CX"},{cName:"Cocos (Keeling) Islands",dCode:"61",cCode:"CC"},{cName:"Colombia",dCode:"57",cCode:"CO"},{cName:"Comoros",dCode:"269",cCode:"KM"},{cName:"Congo",dCode:"242",cCode:"CG"},{cName:"Congo, The Democratic Republic of the Congo",dCode:"243",cCode:"CD"},{cName:"Cook Islands",dCode:"682",cCode:"CK"},{cName:"Costa Rica",dCode:"506",cCode:"CR"},{cName:"Cote d'Ivoire",dCode:"225",cCode:"CI"},{cName:"Croatia",dCode:"385",cCode:"HR"},{cName:"Cuba",dCode:"53",cCode:"CU"},{cName:"Cyprus",dCode:"357",cCode:"CY"},{cName:"Czech Republic",dCode:"420",cCode:"CZ"},{cName:"Denmark",dCode:"45",cCode:"DK"},{cName:"Djibouti",dCode:"253",cCode:"DJ"},{cName:"Dominica",dCode:"1767",cCode:"DM"},{cName:"Dominican Republic",dCode:"1849",cCode:"DO"},{cName:"Ecuador",dCode:"593",cCode:"EC"},{cName:"Egypt",dCode:"20",cCode:"EG"},{cName:"El Salvador",dCode:"503",cCode:"SV"},{cName:"Equatorial Guinea",dCode:"240",cCode:"GQ"},{cName:"Eritrea",dCode:"291",cCode:"ER"},{cName:"Estonia",dCode:"372",cCode:"EE"},{cName:"Ethiopia",dCode:"251",cCode:"ET"},{cName:"Falkland Islands (Malvinas)",dCode:"500",cCode:"FK"},{cName:"Faroe Islands",dCode:"298",cCode:"FO"},{cName:"Fiji",dCode:"679",cCode:"FJ"},{cName:"Finland",dCode:"358",cCode:"FI"},{cName:"France",dCode:"33",cCode:"FR"},{cName:"French Guiana",dCode:"594",cCode:"GF"},{cName:"French Polynesia",dCode:"689",cCode:"PF"},{cName:"Gabon",dCode:"241",cCode:"GA"},{cName:"Gambia",dCode:"220",cCode:"GM"},{cName:"Georgia",dCode:"995",cCode:"GE"},{cName:"Germany",dCode:"49",cCode:"DE"},{cName:"Ghana",dCode:"233",cCode:"GH"},{cName:"Gibraltar",dCode:"350",cCode:"GI"},{cName:"Greece",dCode:"30",cCode:"GR"},{cName:"Greenland",dCode:"299",cCode:"GL"},{cName:"Grenada",dCode:"1473",cCode:"GD"},{cName:"Guadeloupe",dCode:"590",cCode:"GP"},{cName:"Guam",dCode:"1671",cCode:"GU"},{cName:"Guatemala",dCode:"502",cCode:"GT"},{cName:"Guernsey",dCode:"44",cCode:"GG"},{cName:"Guinea",dCode:"224",cCode:"GN"},{cName:"Guinea-Bissau",dCode:"245",cCode:"GW"},{cName:"Guyana",dCode:"595",cCode:"GY"},{cName:"Haiti",dCode:"509",cCode:"HT"},{cName:"Holy See (Vatican City State)",dCode:"379",cCode:"VA"},{cName:"Honduras",dCode:"504",cCode:"HN"},{cName:"Hong Kong",dCode:"852",cCode:"HK"},{cName:"Hungary",dCode:"36",cCode:"HU"},{cName:"Iceland",dCode:"354",cCode:"IS"},{cName:"India",dCode:"91",cCode:"IN"},{cName:"Indonesia",dCode:"62",cCode:"ID"},{cName:"Iran, Islamic Republic of Persian Gulf",dCode:"98",cCode:"IR"},{cName:"Iraq",dCode:"964",cCode:"IQ"},{cName:"Ireland",dCode:"353",cCode:"IE"},{cName:"Isle of Man",dCode:"44",cCode:"IM"},{cName:"Israel",dCode:"972",cCode:"IL"},{cName:"Italy",dCode:"39",cCode:"IT"},{cName:"Jamaica",dCode:"1876",cCode:"JM"},{cName:"Japan",dCode:"81",cCode:"JP"},{cName:"Jersey",dCode:"44",cCode:"JE"},{cName:"Jordan",dCode:"962",cCode:"JO"},{cName:"Kazakhstan",dCode:"77",cCode:"KZ"},{cName:"Kenya",dCode:"254",cCode:"KE"},{cName:"Kiribati",dCode:"686",cCode:"KI"},{cName:"Korea, Democratic People's Republic of Korea",dCode:"850",cCode:"KP"},{cName:"Korea, Republic of South Korea",dCode:"82",cCode:"KR"},{cName:"Kuwait",dCode:"965",cCode:"KW"},{cName:"Kyrgyzstan",dCode:"996",cCode:"KG"},{cName:"Laos",dCode:"856",cCode:"LA"},{cName:"Latvia",dCode:"371",cCode:"LV"},{cName:"Lebanon",dCode:"961",cCode:"LB"},{cName:"Lesotho",dCode:"266",cCode:"LS"},{cName:"Liberia",dCode:"231",cCode:"LR"},{cName:"Libyan Arab Jamahiriya",dCode:"218",cCode:"LY"},{cName:"Liechtenstein",dCode:"423",cCode:"LI"},{cName:"Lithuania",dCode:"370",cCode:"LT"},{cName:"Luxembourg",dCode:"352",cCode:"LU"},{cName:"Macao",dCode:"853",cCode:"MO"},{cName:"Macedonia",dCode:"389",cCode:"MK"},{cName:"Madagascar",dCode:"261",cCode:"MG"},{cName:"Malawi",dCode:"265",cCode:"MW"},{cName:"Malaysia",dCode:"60",cCode:"MY"},{cName:"Maldives",dCode:"960",cCode:"MV"},{cName:"Mali",dCode:"223",cCode:"ML"},{cName:"Malta",dCode:"356",cCode:"MT"},{cName:"Marshall Islands",dCode:"692",cCode:"MH"},{cName:"Martinique",dCode:"596",cCode:"MQ"},{cName:"Mauritania",dCode:"222",cCode:"MR"},{cName:"Mauritius",dCode:"230",cCode:"MU"},{cName:"Mayotte",dCode:"262",cCode:"YT"},{cName:"Mexico",dCode:"52",cCode:"MX"},{cName:"Micronesia, Federated States of Micronesia",dCode:"691",cCode:"FM"},{cName:"Moldova",dCode:"373",cCode:"MD"},{cName:"Monaco",dCode:"377",cCode:"MC"},{cName:"Mongolia",dCode:"976",cCode:"MN"},{cName:"Montenegro",dCode:"382",cCode:"ME"},{cName:"Montserrat",dCode:"1664",cCode:"MS"},{cName:"Morocco",dCode:"212",cCode:"MA"},{cName:"Mozambique",dCode:"258",cCode:"MZ"},{cName:"Myanmar",dCode:"95",cCode:"MM"},{cName:"Namibia",dCode:"264",cCode:"NA"},{cName:"Nauru",dCode:"674",cCode:"NR"},{cName:"Nepal",dCode:"977",cCode:"NP"},{cName:"Netherlands",dCode:"31",cCode:"NL"},{cName:"Netherlands Antilles",dCode:"599",cCode:"AN"},{cName:"New Caledonia",dCode:"687",cCode:"NC"},{cName:"New Zealand",dCode:"64",cCode:"NZ"},{cName:"Nicaragua",dCode:"505",cCode:"NI"},{cName:"Niger",dCode:"227",cCode:"NE"},{cName:"Nigeria",dCode:"234",cCode:"NG"},{cName:"Niue",dCode:"683",cCode:"NU"},{cName:"Norfolk Island",dCode:"672",cCode:"NF"},{cName:"Northern Mariana Islands",dCode:"1670",cCode:"MP"},{cName:"Norway",dCode:"47",cCode:"NO"},{cName:"Oman",dCode:"968",cCode:"OM"},{cName:"Pakistan",dCode:"92",cCode:"PK"},{cName:"Palau",dCode:"680",cCode:"PW"},{cName:"Palestinian Territory, Occupied",dCode:"970",cCode:"PS"},{cName:"Panama",dCode:"507",cCode:"PA"},{cName:"Papua New Guinea",dCode:"675",cCode:"PG"},{cName:"Paraguay",dCode:"595",cCode:"PY"},{cName:"Peru",dCode:"51",cCode:"PE"},{cName:"Philippines",dCode:"63",cCode:"PH"},{cName:"Pitcairn",dCode:"872",cCode:"PN"},{cName:"Poland",dCode:"48",cCode:"PL"},{cName:"Portugal",dCode:"351",cCode:"PT"},{cName:"Puerto Rico",dCode:"1939",cCode:"PR"},{cName:"Qatar",dCode:"974",cCode:"QA"},{cName:"Romania",dCode:"40",cCode:"RO"},{cName:"Russia",dCode:"7",cCode:"RU"},{cName:"Rwanda",dCode:"250",cCode:"RW"},{cName:"Reunion",dCode:"262",cCode:"RE"},{cName:"Saint Barthelemy",dCode:"590",cCode:"BL"},{cName:"Saint Helena, Ascension and Tristan Da Cunha",dCode:"290",cCode:"SH"},{cName:"Saint Kitts and Nevis",dCode:"1869",cCode:"KN"},{cName:"Saint Lucia",dCode:"1758",cCode:"LC"},{cName:"Saint Martin",dCode:"590",cCode:"MF"},{cName:"Saint Pierre and Miquelon",dCode:"508",cCode:"PM"},{cName:"Saint Vincent and the Grenadines",dCode:"1784",cCode:"VC"},{cName:"Samoa",dCode:"685",cCode:"WS"},{cName:"San Marino",dCode:"378",cCode:"SM"},{cName:"Sao Tome and Principe",dCode:"239",cCode:"ST"},{cName:"Saudi Arabia",dCode:"966",cCode:"SA"},{cName:"Senegal",dCode:"221",cCode:"SN"},{cName:"Serbia",dCode:"381",cCode:"RS"},{cName:"Seychelles",dCode:"248",cCode:"SC"},{cName:"Sierra Leone",dCode:"232",cCode:"SL"},{cName:"Singapore",dCode:"65",cCode:"SG"},{cName:"Slovakia",dCode:"421",cCode:"SK"},{cName:"Slovenia",dCode:"386",cCode:"SI"},{cName:"Solomon Islands",dCode:"677",cCode:"SB"},{cName:"Somalia",dCode:"252",cCode:"SO"},{cName:"South Africa",dCode:"27",cCode:"ZA"},{cName:"South Sudan",dCode:"211",cCode:"SS"},{cName:"South Georgia and the South Sandwich Islands",dCode:"500",cCode:"GS"},{cName:"Spain",dCode:"34",cCode:"ES"},{cName:"Sri Lanka",dCode:"94",cCode:"LK"},{cName:"Sudan",dCode:"249",cCode:"SD"},{cName:"SuricName",dCode:"597",cCode:"SR"},{cName:"Svalbard and Jan Mayen",dCode:"47",cCode:"SJ"},{cName:"Swaziland",dCode:"268",cCode:"SZ"},{cName:"Sweden",dCode:"46",cCode:"SE"},{cName:"Switzerland",dCode:"41",cCode:"CH"},{cName:"Syrian Arab Republic",dCode:"963",cCode:"SY"},{cName:"Taiwan",dCode:"886",cCode:"TW"},{cName:"Tajikistan",dCode:"992",cCode:"TJ"},{cName:"Tanzania, United Republic of Tanzania",dCode:"255",cCode:"TZ"},{cName:"Thailand",dCode:"66",cCode:"TH"},{cName:"Timor-Leste",dCode:"670",cCode:"TL"},{cName:"Togo",dCode:"228",cCode:"TG"},{cName:"Tokelau",dCode:"690",cCode:"TK"},{cName:"Tonga",dCode:"676",cCode:"TO"},{cName:"Trinidad and Tobago",dCode:"1868",cCode:"TT"},{cName:"Tunisia",dCode:"216",cCode:"TN"},{cName:"Turkey",dCode:"90",cCode:"TR"},{cName:"Turkmenistan",dCode:"993",cCode:"TM"},{cName:"Turks and Caicos Islands",dCode:"1649",cCode:"TC"},{cName:"Tuvalu",dCode:"688",cCode:"TV"},{cName:"Uganda",dCode:"256",cCode:"UG"},{cName:"Ukraine",dCode:"380",cCode:"UA"},{cName:"United Arab Emirates",dCode:"971",cCode:"AE"},{cName:"United Kingdom",dCode:"44",cCode:"GB"},{cName:"United States",dCode:"1",cCode:"US"},{cName:"Uruguay",dCode:"598",cCode:"UY"},{cName:"Uzbekistan",dCode:"998",cCode:"UZ"},{cName:"Vanuatu",dCode:"678",cCode:"VU"},{cName:"Venezuela, Bolivarian Republic of Venezuela",dCode:"58",cCode:"VE"},{cName:"Vietnam",dCode:"84",cCode:"VN"},{cName:"Virgin Islands, British",dCode:"1284",cCode:"VG"},{cName:"Virgin Islands, U.S.",dCode:"1340",cCode:"VI"},{cName:"Wallis and Futuna",dCode:"681",cCode:"WF"},{cName:"Yemen",dCode:"967",cCode:"YE"},{cName:"Zambia",dCode:"260",cCode:"ZM"},{cName:"Zimbabwe",dCode:"263",cCode:"ZW"}],Hr=[{gateway:"ZYA",destination:"Amsterdam (ZYA)"},{gateway:"QDH",destination:"Ashford International (Kent) (QDH)"},{gateway:"ZYR",destination:"Brussels Midi (ZYR)"},{gateway:"XQE",destination:"Ebbsfleet International (Kent) (XQE)"},{gateway:"XDB",destination:"Lille Europe (XDB)"},{gateway:"QQS",destination:"London St Pancras International (QQS)"},{gateway:"XED",destination:"Marne La Vallee (Disneyland) (XED)"},{gateway:"XPG",destination:"Paris Gare du Nord (XPG)"},{gateway:"QRH",destination:"Rotterdam (QRH)"}];(Rr=e.TravellerSearchTypes||(e.TravellerSearchTypes={})).email="email",Rr.name="name",Rr.employeeNumber="employeeNumber";var Qr=function(){function i(e,r,n,a,o,u,l,c,d,p,h,m,f,y,g,v,b,S,T,C,D,P,_,A,k,F,O,R,E,I,N,B,L,M,j,w,x,U,V,G,H,Q,J,W,Y,K,z,X,q,Z,$,ee,re,ie,ne,ae,oe){var se,ue=this;this.searchAirportsFetcher=e,this.searchAirlinesFetcher=r,this.storageService=n,this.userService=a,this.modalService=o,this.router=u,this.helpers=l,this.hotelAvalibilityService=c,this.citiesFetcher=d,this.confermaCitiesFetcher=p,this.postcodeFetcher=h,this.railStationFetcher=m,this.saveUserAddressUpdater=f,this.userAddressesFetcher=y,this.basketService=g,this.getUserCompanyOfficesFetcher=v,this.searchHotelChainsFetcher=b,this.getConfermaRoomImagesFetcher=S,this.baseValidateIsPostcodeValidTester=T,this.depotFetcher=C,this.confermaOfficeNamesFetcher=D,this.confermaOfficeFetcher=P,this.baseDeleteUserAddressUpdater=_,this.baseDeleteRecentSearchUpdater=A,this.baseSaveRecentSearchUpdater=k,this.getUserCurrentCarbonAllowanceFetcher=F,this.baseSaveFavouriteSearchUpdater=O,this.getRailStationFetcher=V,this.riskAlertsFetcher=H,this.getUserRecentSearchesFetcher=J,this.getRailCardsFetcher=W,this.getCovidMicrositeTokenFetcher=Y,this.searchUsersCanBookForFetcher=z,this.searchIrlStationsFetcher=X,this.irlDiscountCardsFetcher=q,this.getFlightFareRulesFetcher=Z,this.getFlightSeatMapFetcher=$,this.getRailLiveDeparturesFetcher=ee,this.getUserFavouriteSearchesFetcher=ne,this.deleteFavouriteSearchUpdater=ae,this.emailBasketFetcher=oe,this.traveller_error=!1,this.travellerInformation=new t.BehaviorSubject([]),this.errors=new t.BehaviorSubject([]),this.searchLoadingDone=new t.BehaviorSubject(!1),this.searchTimedOut=new t.BehaviorSubject(!1),this.newSearchStarted=new t.BehaviorSubject(!1),this.firstLoad=!0,this.highest_search_priority=8,this.show_errors=!1,this.travellerValidationMessages=[],this.search_loading=!1,this.search_airport_loading=!1,this.selectedTravellers=[],this.selectedPlaces=[],this.countries=Gr,this.eurostations=s.default.toArray(Hr),console.log("Enterpise search service being inited"),this.searches=((se={})[te.Lounge]=new nt(E,l,g,n,this),se[te.Parking]=new ut(I,l,g,n,this),se[te.Flight]=new $e(B,l,a,g,n,this,ie,o),se[te.Hotel]=new it(L,l,a,R,c,g,n,this,N,Q,V,re),se[te.Car]=new Ue(M,j,l,g,n,this),se[te.Cab]=new xe(w,l,n,this,g),se[te.InternationalRail]=new Tt(U,q,l,g,n,this),se[te.FastTrack]=null,se[te.Coach]=null,se[te.Rail]=new gt(x,V,l,g,n,this,a,o),se[te.Eurostar]=new pt(K,l,a,g,n,this),se),console.log("Newly created search objects: ",this.searches),this.search_objects=this.helpers.clone(this.init_search_objects()),this.selectedTravellers=this.storageService.getSessionItemAsList(i.SESSION_TRAVELLER),this.travellerInformation.next(this.selectedTravellers),a.fullUserDetails.userServices.subscribe((function(e){e&&(ue.search_objects=Object.keys(ue.search_objects).reduce((function(t,r){return t[r].enabled=!!e&&!!e[r],t}),ue.search_objects))})),Array.isArray(this.countries)&&(this.countries=this.countries.sort((function(e,t){return e.cName<t.cName?-1:e.cName>t.cName?1:0}))),G.autoLogoutConfig=this.getAutoLogoutConfig()}return i.prototype.reset=function(){this.resetAllSearchItems(),this.basketService.reset()},i.prototype.resetAllSearchItems=function(){Object.values(this.searches).forEach((function(e){null==e||e.reset()})),this.removeAllTravellers(),this.resetSearchObjects()},i.prototype.getUserCurrentCarbonAllowance=function(e,t){t&&t.next(!0);var i={user:e};return this.getUserCurrentCarbonAllowanceFetcher.fetchList(i).pipe(r.take(1),r.map((function(e){return e})))},i.prototype.getRiskAlerts=function(e,t,i,n){n&&n.next(!0);var a={minLevel:e,maxLevel:t,countryIsoCode:i};return this.riskAlertsFetcher.fetchList(a).pipe(r.take(1),r.map((function(e){return n&&n.next(!1),e})))},i.prototype.getAirportsList=function(e,i,n,a,o,s){var u=this;if(e.length>2){n&&n.next(!0);var l={query:e};return i&&(l.countryCode=i),"boolean"==typeof a&&(l.hasLounge=a),"boolean"==typeof o&&(l.hasParking=o),"boolean"==typeof s&&(l.hasFastTrack=s),this.searchAirportsFetcher.fetchOne(l).pipe(r.take(1),r.map((function(e){if(n&&n.next(!1),e&&e.generalMatches)return u.helpers.clone(e.generalMatches).map((function(e){var t,r,i;return{destination:e.name,gateway:e.iata,terminals:u.processTerminals(e.terminals),country:null===(t=null==e?void 0:e.locationDetails)||void 0===t?void 0:t.country,postcode:null===(r=null==e?void 0:e.locationDetails)||void 0===r?void 0:r.postcode,countryCode:null===(i=null==e?void 0:e.locationDetails)||void 0===i?void 0:i.countryCode}}))})))}return t.of([])},i.prototype.getAirlinesList=function(e,i){var n=this;if(e.length>=2){i&&i.next(!0);var a={query:e};return this.searchAirlinesFetcher.fetchOne(a).pipe(r.take(1),r.map((function(e){if(i&&i.next(!1),e&&e.generalMatches)return n.helpers.clone(e.generalMatches).map((function(e){return{code:e.iata,name:e.name}}))})))}return t.of([])},i.prototype.getAirportLocations=function(t,i,n,a,o,s){return this.getAirportsList(t,i,n,a,o,s).pipe(r.map((function(t){return t.map((function(t){return{name:t.destination,type:e.LocationTypes.Airport,airport:t}}))})))},i.prototype.getCityLocations=function(e,t,r,i){if(!(e.length<=2))return i?this.getConfermaCityLocations(e,t,r):this._getCityLocations(e,t,r)},i.prototype._getCityLocations=function(t,i,n){null==n||n.next(!0);var a={query:t};i&&(a.countryCode=i);return this.citiesFetcher.fetchList(a).pipe(r.take(1),r.map((function(t){var r=t.map((function(t){return{name:t.name,longitude:t.coordinates.longitude,latitude:t.coordinates.latitude,type:e.LocationTypes.City,countryCode:t.countryCode,id:t.id}}));return null==n||n.next(!1),r})))},i.prototype.getConfermaCityLocations=function(t,i,n){null==n||n.next(!0);var a={cityName:t};i&&(a.countryCode=i);return this.confermaCitiesFetcher.fetchOne(a).pipe(r.take(1),r.map((function(t){var r=t.suggestions.map((function(t){return{name:t.name,longitude:t.longitude,latitude:t.latitude,type:e.LocationTypes.City,countryCode:t.countryCode}}));return null==n||n.next(!1),r})))},i.prototype.getCarHireDepots=function(e,t,r,i){null==i||i.next(!0);var n={latitude:e,longitude:t};return r&&(n.radius=r),this.depotFetcher.fetchList(n)},i.prototype.getPostcodeList=function(i){return kr.UK_POSTCODE.test(i)?this.postcodeFetcher.fetchList({postcode:i}).pipe(r.map((function(t){return t.map((function(t){return{name:t.postcode,type:e.LocationTypes.Postcode,latitude:t.latitude,longitude:t.longitude}}))}))):t.of([])},i.prototype.addToSelectedPlaces=function(e){this.selectedPlaces.push(e)},i.prototype.getSelectedPlaceById=function(e){return this.selectedPlaces.find((function(t){return t.place_id===e}))},i.prototype.getConfirmaOffices=function(i){if((null==i?void 0:i.length)>2){return this.confermaOfficeNamesFetcher.fetchList().pipe(r.take(1),r.map((function(t){return(null==t?void 0:t.results)?t.results.map((function(t){return{name:t.name,type:e.LocationTypes.Office,id:t.id}})):[]})))}return t.of([])},i.prototype.getOfficeLocations=function(i){if(i.length>2){return this.getUserCompanyOfficesFetcher.fetchList().pipe(r.take(1),r.map((function(t){return t.map((function(t){return{name:t.name,office:t.addresses[0],type:e.LocationTypes.Office}}))})))}return t.of([])},i.prototype.getStationLocations=function(i,n){return i.length>2?(null==n||n.next(!0),this.railStationFetcher.fetchList({query:i}).pipe(r.take(1),r.map((function(t){return n&&n.next(!1),t?t.map((function(t){return{type:e.LocationTypes.TrainStation,name:t.name,railstation:t}})):[]})))):t.of([])},i.prototype.searchIrlStationsLocations=function(i,n){return i.length>2?(null==n||n.next(!0),this.searchIrlStationsFetcher.fetchList({query:i}).pipe(r.take(1),r.map((function(t){return n&&n.next(!1),t.map((function(t){return{type:e.LocationTypes.TrainStation,name:t.name+" ("+t.supplier+")",railstation:t}}))})))):t.of([])},i.prototype.getHotelLocationsList=function(e,i,n){return e.length>2?kr.UK_POSTCODE.test(e)?this.getPostcodeList(e):((null==n?void 0:n.value)||n.next(!0),t.forkJoin([this.getAirportLocations(e,i,n),this.getCityLocations(e,i,n),this.getStationLocations(e,n),this.getConfirmaOffices(e)]).pipe(r.map((function(e){return(null==n?void 0:n.value)&&n.next(!1),e.reduce((function(e,t){return e.push.apply(e,T(t)),e}),[])})))):t.of([])},i.prototype.getStationsAndAirportsList=function(e,i,n){return e.length>2?((null==n?void 0:n.value)||n.next(!0),t.forkJoin([this.getAirportLocations(e,i,n),this.getStationLocations(e,n)]).pipe(r.map((function(e){return(null==n?void 0:n.value)&&n.next(!1),e.reduce((function(e,t){return e.push.apply(e,T(t)),e}),[])})))):t.of([])},i.prototype.removeTraveller=function(e){this._removeTraveller(e),this.storageService.setSessionItem(i.SESSION_TRAVELLER,this.selectedTravellers),this.updateTravellerInformation()},i.prototype._removeTraveller=function(e){this.selectedTravellers=this.selectedTravellers.filter((function(t){return!St.equals(t,e)}))},i.prototype.removeAllTravellers=function(){var e=this;console.log("remove all travellers called!"),console.log(this.selectedTravellers),this.selectedTravellers||(this.selectedTravellers=[]),this.selectedTravellers.forEach((function(t){e._removeTraveller(t)})),this.storageService.setSessionItem(i.SESSION_TRAVELLER,this.selectedTravellers),this.updateTravellerInformation()},i.prototype.addTraveller=function(e){this.travellerAlreadyAdded(e)||this.currentNoOfTravellersGreaterOrEqualToMax()||(this.selectedTravellers.push(e),this.storageService.setSessionItem(i.SESSION_TRAVELLER,this.selectedTravellers),this.updateTravellerInformation())},i.prototype.currentNoOfTravellersGreaterOrEqualToMax=function(){return this.selectedTravellers.length>=this.maxTravellers()},i.prototype.maxTravellers=function(){return this.canUseTravellerProfile()?1:8},i.prototype.travellerAlreadyAdded=function(e){return!!this.selectedTravellers.find((function(t){return St.equals(t,e)}))},i.prototype.canUseTravellerProfile=function(){return!1},i.prototype.getCurrentNoOfTravellers=function(){return this.selectedTravellers.length},i.prototype.updateTravellerInformation=function(){this.storageService.setSessionItem(i.SESSION_TRAVELLER,this.selectedTravellers),this.travellerInformation.next(T(this.selectedTravellers))},i.prototype.determineHighestSearchPriority=function(){return this.highest_search_priority=this._getHighestSearchPriorityObject().highest},i.prototype.getHighestSearchPriorityObject=function(e){return this._getHighestSearchPriorityObject(e).currentItem},i.prototype._getHighestSearchPriorityObject=function(e){return void 0===e&&(e={}),Object.values(this.search_objects).reduce((function(t,r){var i=t.highest,n=t.currentItem;if(r.chosen&&r.priority<i){if(!e[r.type])return{highest:r.priority,currentItem:r};r.chosen=!1}return{highest:i,currentItem:n}}),{highest:Number.MAX_SAFE_INTEGER,currentItem:null})},i.prototype.getSelectedOptions=function(){var e=this;return Object.keys(this.search_objects).reduce((function(t,r){return e.search_objects[r].chosen&&t.push(r),t}),[])},i.prototype.hasSimpleGuests=function(){return!1},i.prototype.setGetMeThereSearchObjects=function(){console.log("+++ Setting GetMeThere Search Objects +++"),this.search_objects=this.helpers.clone(this.getMeThereSearchObjects())},i.prototype.resetSearchParams=function(){console.log("Reseting Search Params!"),this.search_objects=this.helpers.clone(this.init_search_objects()),this.storageService.setSessionItem(i.SESSION_TRAVELLER,this.search_objects),Object.values(this.searches).forEach((function(e){e.reset()}))},i.prototype.canSearch=function(e){return this.determineHighestSearchPriority(),!!(this.search_objects[e]&&(console.log("can search here"),this.search_objects[e].chosen&&this.hasHighestSearchPriority(this.search_objects[e].priority)))&&(console.log(e+" can be searched"),!0)},i.prototype.hasHighestSearchPriority=function(e){return this.determineHighestSearchPriority(),e<=this.highest_search_priority},i.prototype.getAllErrorMessages=function(){var e=this.travellerValidationMessages;return this.search_objects[te.Lounge].chosen&&this.canSearch(te.Lounge)&&e.push.apply(e,T(this.searches[te.Lounge].validationMessages)),this.search_objects[te.Car].chosen&&this.canSearch(te.Car)&&e.push.apply(e,T(this.searches[te.Car].validationMessages)),this.search_objects[te.Rail].chosen&&this.canSearch(te.Rail)&&e.push.apply(e,T(this.searches[te.Rail].validationMessages)),this.search_objects[te.Parking].chosen&&this.canSearch(te.Parking)&&e.push.apply(e,T(this.searches[te.Parking].validationMessages)),this.search_objects[te.Cab].chosen&&this.canSearch(te.Cab)&&e.push.apply(e,T(this.searches[te.Cab].validationMessages)),this.search_objects[te.Hotel].chosen&&this.canSearch(te.Hotel)&&e.push.apply(e,T(this.searches[te.Hotel].validationMessages)),this.errors.next(e),e},i.prototype.travellersContainUser=function(){var e=this;return!!this.selectedTravellers.find((function(t){return t.id===e.userService.getUserId().toString()}))},i.prototype.validateTravellers=function(){switch(this.travellerValidationMessages=[],this.userService.fullUserDetails.userData.value.booker_type){case k.SelfBook:1===this.selectedTravellers.length&&this.travellersContainUser()||this.travellerValidationMessages.push("Current user must be a traveller");break;case k.BookerWithSelf:this.selectedTravellers.length<1&&this.travellersContainUser()||(this.travellerValidationMessages.push("Please add your self."),this.traveller_error=!0);break;case k.Booker:case k.Company:case k.CompanyGroup:case k.Office:case k.Tmc:case k.Root:this.selectedTravellers.length>=1||(this.travellerValidationMessages.push("Please select at least one traveller"),this.traveller_error=!0);break;default:return this.travellerValidationMessages.push("Unrecognised user type! - Please contact support."),!1}return 0===this.travellerValidationMessages.length},i.prototype.findPaxInTravellers=function(e){return this.selectedTravellers.find((function(t){return e===t.email}))},i.prototype.validateForms=function(){var e=this._findSearchObtect();return this.getAllErrorMessages(),!!e&&(this.errors.next(this.searches[e.type].messages.value),this.validateTravellers()&&this.searches[e.type].isValid.value)},i.prototype._findSearchObtect=function(){var e=this;return Object.values(this.search_objects).find((function(t){return!!t&&t.priority===e.highest_search_priority&&t.chosen}))},i.prototype.startSearches=function(e){var t,r=this;this.newSearchStarted.next(!0),this.search_loading=!0,(t=this._findSearchObtect())&&(t.chosen=!0),e?this.router.navigate([e]):t&&!this.router.url.includes(t.resultUrl)&&this.router.navigate([t.resultUrl]);try{Promise.all(Object.values(this.searches).map((function(e){return e&&r.search_objects[e.type]&&r.search_objects[e.type].chosen?e.startSearch():Promise.resolve(!1)}))).finally((function(){r.search_loading=!1,r.searchLoadingDone.next(!0)}))}catch(e){console.error(e),this.search_loading=!1,this.searchLoadingDone.next(!0)}},i.prototype.getTaxiStationLocations=function(e,r){return e.length<3?t.of([]):t.of([{destination:"Manchester Airpot",isairport:!0,supplier_code:"MAN",address:"Manchester Airport",postcode:"M90 1QX"},{destination:"Manchester Piccadilly",isairport:!1,supplier_code:"MMAN",address:"Manchester Piccadilly",postcode:"M1 2PZ"},{destination:"London Heathrow",isairport:!0,supplier_code:"LHR",address:"London Heathrow Airport",postcode:"TW6 1EW"}])},i.prototype.getAddresses=function(e){return t.of([{House:"Cecil Court",Street:"28-36 Cecil Road",Town:"Hale",PostCode:"WA15 9PB",Country:"UK"}])},i.prototype.getUserAddresses=function(e){return this.userAddressesFetcher.fetchList().pipe(r.take(1),r.map((function(e){return e.map((function(e){return{ID:e.id,House:e.numberOrName,Street:e.street,Town:e.town,PostCode:e.postcode,Country:e.countryCode}}))})))},i.prototype.deleteUserAddressByID=function(e){return this.baseDeleteUserAddressUpdater.updateOne({id:e})},i.prototype.getHotelChain=function(e,i){if(e.length>2){null==i||i.next(!0);return this.searchHotelChainsFetcher.fetchList({query:e}).pipe(r.take(1),r.map((function(e){var t=e.map((function(e){return{name:e}}));return null==i||i.next(!1),t})))}return t.of([])},i.prototype.getOfficeNames=function(e){return this.confermaOfficeNamesFetcher.fetchList().pipe(r.take(1),r.map((function(e){var t;if(e)return null===(t=null==e?void 0:e.results)||void 0===t?void 0:t.map((function(e){return{id:e.id,name:e.name}}))})))},i.prototype.getOffice=function(e){return e?this.confermaOfficeFetcher.fetchOne({officeId:e}).pipe(r.take(1),r.map((function(e){if(e)return e.results}))):t.of()},i.prototype.getRailCards=function(){return this.getRailCardsFetcher.fetchList().pipe(r.take(1),r.map((function(e){if(e)return e.map((function(e){return{name:e.name,code:e.code}})).sort((function(e,t){return e.name.localeCompare(t.name)}))})))},i.prototype.getAirportByCode=function(e){return e?this.searchAirportsFetcher.fetchOne({query:e}).pipe(r.take(1),r.map((function(e){return e}))):t.of()},i.prototype.init_search_objects=function(){return{}},i.prototype.getMeThereSearchObjects=function(){return{}},i.prototype.getSelectedtravellers=function(){return this.selectedTravellers},i.prototype.resetSearchObjects=function(){this.search_objects=this.helpers.clone(this.init_search_objects())},i.prototype.processTerminals=function(e){var t=[];return e.includes("1")||e.includes("2")||e.includes("3")||e.includes("4")||e.includes("5")?(t.push({key:"Any Terminal",value:"Any"}),e.forEach((function(e){t.push({key:"Terminal "+e,value:""+e})}))):1===e.length?t.push({key:e[0]+" Terminal",value:"Any"}):(t.push({key:"Any Terminal",value:"Any"}),e.forEach((function(e){t.push({key:e+" Terminal",value:""+e})}))),t},i.prototype.saveUserAddress=function(e){return g(this,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return e?[4,this.saveUserAddressUpdater.updateOne(e).toPromise()]:[3,2];case 1:return[2,t.sent()];case 2:return[2]}}))}))},i.prototype.canBook=function(e){return!!this.userService.canBook(e)},i.prototype.isPostcodeVaild=function(e){return this.baseValidateIsPostcodeValidTester.test({postcode:e})},i.prototype.makeCabHireQuery=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i={adults:0,airport:null,children:0,countryCode:null,departs:this.helpers.makeMomentDayTime(),fromAddress:null,fromStation:null,fromLocationType:e.TaxiFormMode.ADDRESS,infants:0,toAddress:null,toStation:null,toLocationType:e.TaxiFormMode.ADDRESS,vehicleType:F.Any,viasFrom:null,viasTo:null};return this.helpers.sanatizeReturns(i,Object.assign.apply(Object,T([{}],t)),["departs"])},i.prototype.makeCarHireQuery=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={adults:0,airCon:null,carClass:null,carType:null,children:0,chosenVendor:null,chosenDistance:"5",cityDropoff:null,cityDropoffDepot:null,cityPickup:null,cityPickupDepot:null,dropoff_country:"GB",dropoff_datetime:null,dropoff_location:null,estimatedMileage:null,locationType:null,pickup_country:null,pickup_datetime:null,pickup_location:null,postcodeDropoff:null,postcodeDropoffRaw:null,postcodePickup:null,postcodePickupRaw:null,return_to_pickup:!0,transmission:null};return this.helpers.sanatizeReturns(r,Object.assign.apply(Object,T([{}],e)),["pickup_datetime","dropoff_datetime"])},i.prototype.makeFlightQuery=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this.helpers.makeMomentDayTime(),n=this.helpers.makeMomentDayTime(1),a=this.helpers.momentRoundMinutes(i,30),o=this.helpers.momentRoundMinutes(n,30),s={adults:0,arriveLocation:null,cabinClass:x.Any,children:0,chosenSearchType:null,departLocation:null,fareType:w.Flexible,inboundDate:a,inTimeCriteria:e.TimeWindow.Depart,maxConnections:null,includeNearbyAirports:!1,multiDestination:[],outBoundDate:o,outTimeCriteria:e.TimeWindow.Depart,preferredCarriers:[null,null,null,null],returnCabinClass:x.Any};return this.helpers.sanatizeReturns(s,Object.assign.apply(Object,T([{}],t)),["outBoundDate","inboundDate"])},i.prototype.makeHotelQuery=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i={checkin_date:u.default().set("hour",23).set("minute",59),checkout_date:u.default().add(1,"day").set("hour",23).set("minute",59),country:{cCode:"GB",cName:"United Kingdom"},currency:"GBP",distance:5,hotel_availability:null,hotel_chain:null,hotel_name:null,location_type_select:e.LocationTypes.Airport,location:null,no_of_occupants:1,no_of_rooms:1,office:null,postcode:null,prefered_hotels_only:!1,trainsStation:null};return this.helpers.sanatizeReturns(i,Object.assign.apply(Object,T([{}],t)),["checkin_date","checkout_date"])},i.prototype.makeLoungesQuery=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={adults:0,arrivalDatetime:u.default(),children:0,infants:0,locationCode:null,terminal:null};return this.helpers.sanatizeReturns(r,Object.assign.apply(Object,T([{}],e)),["arrivalDatetime"])},i.prototype.makeParkingQuery=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.helpers.makeMomentDayTime(),i=this.helpers.makeMomentDayTime(1),n=this.helpers.momentRoundMinutes(r,30),a=this.helpers.momentRoundMinutes(i,30),o={arrivalDatetime:n,carParkedForYou:null,departDatetime:a,locationCode:null,meetAndGreet:null,onAirport:null,outFlightNumber:null,parkAndRide:null,parkAndStroll:null,recommended:null,terminal:null};return this.helpers.sanatizeReturns(o,Object.assign.apply(Object,T([{}],e)),["arrivalDatetime","departDatetime"])},i.prototype.makeRailQuery=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this.helpers.momentRoundMinutes(u.default(),30),n={airportExpressStation:null,applyRailcards:!1,carnetTicket:!1,chosenSearchClass:X.All,chosenSearchType:q.ReturnJourney,disableAutoDiscounts:!1,extraTime:!1,inBoundDateTime:i,isAirportExpress:!1,noOfAdults:0,noOfChildren:0,outboundCriteria:e.RailSearchCriteria.Depart,outBoundDateTime:i,prioritiseByPrice:!1,returnCriteria:e.RailSearchCriteria.Depart,travellingFrom:null,travellingTo:null,via:!1,viaLocation:null,railCards:null};return this.helpers.sanatizeReturns(n,Object.assign.apply(Object,T([{}],t)),["inBoundDateTime","outBoundDateTime"])},i.prototype.makeIrlQuery=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.helpers.momentRoundMinutes(u.default(),30),i={supplier:null,countryCode:"",journeyType:G.ReturnJourney,class:null,outboundDepartureDateTime:r,departureLocationId:null,arrivalLocationId:null,adults:0,children:0,returnDepartureDateTime:r,irlDiscountCards:null};return this.helpers.sanatizeReturns(i,Object.assign.apply(Object,T([{}],e)),["returnDepartureDateTime","outboundDepartureDateTime"])},i.prototype.makeEurostarQuery=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this.helpers.makeMomentDayTime(),n=this.helpers.makeMomentDayTime(1),a=this.helpers.momentRoundMinutes(i,30),o=this.helpers.momentRoundMinutes(n,30),s={adults:0,arriveLocation:null,cabinClass:x.Any,children:0,chosenSearchType:e.EurostarSearchType.return,departLocation:null,fareType:w.Flexible,inboundDate:a,inTimeCriteria:e.TimeWindow.Depart,maxConnections:null,includeNearbyAirports:!1,multiDestination:[],outBoundDate:o,outTimeCriteria:e.TimeWindow.Depart,preferredCarriers:[null,null,null,null],returnCabinClass:x.Any};return this.helpers.sanatizeReturns(s,Object.assign.apply(Object,T([{}],t)),["outBoundDate","inboundDate"])},i.prototype.shouldAddTravellerSubscription=function(){return!1},i.prototype.getAutoLogoutConfig=function(){return{}},i.prototype.shouldFetchAllOffices=function(){return!1},i.prototype.isFlightsGrouped=function(){return!1},i.prototype.getCountryFullNameFromCountryCode=function(e){for(var t=0;t<this.countries.length;t++){var r=this.countries[t];if(r.cCode===e)return r.cName}return"Unknown"},i.prototype.getUserRecentSearches=function(e,t){null==t||t.next(!0);var i={serviceType:e};return this.getUserRecentSearchesFetcher.fetchList(i).pipe(r.take(1),r.map((function(e){var r=e.map((function(e){return{id:e.id,name:e.name,serviceType:e.serviceType,searchArgs:e.searchArgs,createdAt:e.createdAt,updatedAt:e.updatedAt,travelDate:e.travelDate,travellers:e.travellers}}));return null==t||t.next(!1),r})))},i.prototype.getUserFavouriteSearches=function(e,t){null==t||t.next(!0);var i={serviceType:e};return this.getUserFavouriteSearchesFetcher.fetchList(i).pipe(r.take(1),r.tap((function(e){null==t||t.next(!1)})))},i.prototype.deleteRecentSearchByID=function(e){return this.baseDeleteRecentSearchUpdater.updateOne({id:e})},i.prototype.deleteFavouriteSearchByID=function(e){return this.deleteFavouriteSearchUpdater.updateOne({id:e})},i.prototype.saveRecentSearch=function(e){e&&this.baseSaveRecentSearchUpdater.updateOne(e).pipe(r.take(1)).subscribe()},i.prototype.getCovidMicrositeToken=function(){return this.getCovidMicrositeTokenFetcher.fetchList()},i.prototype.lookupEurostarStations=function(e){return console.log("term| ",e),""===e?t.of(this.eurostations):t.of(this.eurostations.filter((function(t){return t.destination.toLowerCase().indexOf(e.toLowerCase())>-1})))},i.prototype.searchTravellers=function(t,i){var n=this,a=this.userService.getUserBookingType();if(this.traveller_error=!1,a&&a!==k.SelfBook&&a!==k.Traveller&&t.length>=1){var o=t.toLowerCase().match(/([\w])+/g),s={};switch(i){case e.TravellerSearchTypes.name:s.userName=o.length>1?o[0]:t;break;case e.TravellerSearchTypes.email:s.email=t;break;case e.TravellerSearchTypes.employeeNumber:s.employeeId=t}return this.searchUsersCanBookForFetcher.fetchList(s).pipe(r.map((function(e){return e?n.helpers.clone(e).sort((function(e,t){return e.surname<t.surname?-1:e.surname>t.surname?1:0})):[]})))}},i.prototype.getFlightFareRules=function(e){return this.getFlightFareRulesFetcher.fetchList({flight:e})},i.prototype.getRailLiveDepartures=function(e,t){return this.getRailLiveDeparturesFetcher.fetchList({stationCode:e,departDateTime:t})},i.prototype.getFlightSeatMap=function(e){return this.getFlightSeatMapFetcher.fetchList({flight:e}).pipe(r.map((function(e){if(e)return e.results})))},i.prototype.saveFavouriteSearch=function(e){return this.baseSaveFavouriteSearchUpdater.updateOne(e)},i.prototype.getConfermaRoomImages=function(e){if(e)return this.getConfermaRoomImagesFetcher.fetchList({hotelId:e}).pipe(r.take(1))},i.prototype.emailBasket=function(e){return this.emailBasketFetcher.fetchList({id:e})},i}();Qr.SESSION_TRAVELLER="search_travellers";var Jr=function(){},Wr=function(){function t(e,t){this.modalOpenerService=e,this._jwtToken=null,this.timer=null,this.timeoutDuration=3600,this.autoLogoutConfig={},this.timeOutDuration=t.autoLogoutTime}return Object.defineProperty(t.prototype,"timeOutDuration",{set:function(e){this.timeoutDuration=60*e-60},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"jwtToken",{set:function(e){e!==this.jwtToken&&(this._jwtToken=e)},enumerable:!1,configurable:!0}),t.prototype._updateTimer=function(){var e=this;window.clearTimeout(this.timer),this.timer=null,console.log("Resetting auto log out"),this.timer=window.setTimeout((function(){e.checkToLogout()}),6e4)},t.prototype.checkToLogout=function(){var t=this;u.default().unix(),this.lastUpdated.unix(),this.timeoutDuration;u.default().unix()-this.lastUpdated.unix()>this.timeoutDuration?(this.timer=null,this.lastUpdated=u.default(),this.modalOpenerService.open(d.AutoLogout,this.autoLogoutConfig,{}).then((function(r){r!==e.LogoutEnum.LOGOUT?t._updateTimer():t._jwtToken=null}))):this._updateTimer()},t}(),Yr=function(){function e(e,t){this.httpService=e,this.helpers=t}return e.prototype.getAmenitiesForFlight=function(e){return new t.BehaviorSubject([])},e.prototype.parseAmenities=function(e){var t=e.linked,r=function(e,t){return t.find((function(t){return t.id==e}))};return e.data.map((function(e){var i=r(e.links.segments[0],t.segments);return{seat:r(i.links.seat.toString(),t.seats),wifi:r(i.links.wifi.toString(),t.wifis),power:r(i.links.power.toString(),t.entertainments),entertainment:r(i.links.entertainment.toString(),t.entertainments),fresh_food:r(i.links.fresh_food.toString(),t.fresh_foods),beverage:r(i.links.beverage.toString(),t.beverages),layout:r(i.links.layout.toString(),t.layouts),aircraft:r(i.links.aircraft.toString(),t.aircrafts)}}))},e.prototype.convertClassString=function(e){switch(e){case"ECONOMY":return"ECON";case"PREMIUM ECONOMY":return"PREMECON";case"BUSINESS":return"BUSINESS";case"FIRST":return"FIRST";default:return"ECON"}},e.prototype.getUpasForFlight=function(e){var r=this,i=new t.BehaviorSubject([]);return e.LegDetails.map((function(e){return{segments:[{dep:e.depPoint,arr:e.arrPoint,carrier:e.touropID,flt_no:e.transNo.substr(e.touropID.length),dep_date:r.helpers.formatIsoDate(r.helpers.yymmddToMoment(e.dateDep)),cabin_id:r.convertClass(e.seatClassBasic.toUpperCase())}]}})),i},e.prototype.convertClass=function(e){switch(e){case"ECONOMY":return 1;case"PREMIUM ECONOMY":return 2;case"BUSINESS":return 3;case"FIRST":return 4;default:return 1}},e.prototype.parseResponse=function(e){var t=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.join("_")},r=function(e){return e.attributes},i=e.included.reduce((function(e,r){return e[t(r.type,r.id)]=r,e}),{}),n=function(e){return i[function(e){return t(e.type,e.id)}(e)]};return e.data.relationships.legs.data.map((function(e){var t=n(e).relationships.leg_fares.data.map(n).filter((function(e){return!!e.relationships.fare.data}));return{brands:t.map((function(e){return n(e.relationships.fare.data)})).map(r),upas:t.map((function(e){return e.relationships.leg_fare_segments.data.map(n)})).map((function(e){return e.map((function(e){return e.relationships.upas.data.map(n).map((function(e){return{id:e.id,details:r(e)}})).reduce((function(e,t){return e[t.id]=t.details,e}),{})}))}))}}))},e}();f([Ne(),y("design:type",Function),y("design:paramtypes",[Object]),y("design:returntype",t.BehaviorSubject)],Yr.prototype,"getAmenitiesForFlight",null),f([Ne(),y("design:type",Function),y("design:paramtypes",[Object]),y("design:returntype",t.BehaviorSubject)],Yr.prototype,"getUpasForFlight",null);var Kr=function(e){function t(t,r){var i=e.call(this,r)||this;return i.query=t,i}return m(t,e),t.prototype.test=function(e){return this.processCall(this.query.fetch(e))},t}(p),zr=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.validateUserMIFreeValue},t}(Kr),Xr=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.isPostcodeValid},t}(Kr),qr=function(e){function t(t,r){var i=e.call(this,r)||this;return i.query=t,i}return m(t,e),t.prototype.updateOne=function(e){return this.processCall(this.query.mutate(e))},t}(p),Zr=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.acceptNewPrice},t}(qr),$r=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.addItemToBasket},t}(qr),ei=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.addUserToBasketItem},t}(qr),ti=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.bookBasket},t}(qr),ri=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.createBasket},t}(qr),ii=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.moveItemToADifferentBasket},t}(qr),ni=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.deleteBasket},t}(qr),ai=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.removeItemFromBasket},t}(qr),oi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.deleteUserAddress},t}(qr),si=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.deleteRecentSearch},t}(qr),ui=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.revalidateBasket},t}(qr),li=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.saveUserAddress},t}(qr),ci=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.sendBasketForApproval},t}(qr),di=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.setBasketItemLeadPassenger},t}(qr),pi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.setBasketItemMIGroup},t}(qr),hi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.setBasketItemMIValue},t}(qr),mi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.updateBasketTitle},t}(qr),fi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.baseUpdateBasketNotes},t}(qr),yi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.saveRecentSearch},t}(qr),gi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){return e.data.setBasketItemPaymentMethod},t}(qr),vi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.confirmMessages},t}(qr),bi=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.cancelBooking},t}(qr),Si=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.saveFavouriteSearch},t}(qr),Ti=function(e){function t(t,r){return e.call(this,t,r)||this}return m(t,e),t.prototype.getDataFromResult=function(e){var t;return null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.deleteFavouriteSearch},t}(qr);e.AbstractHttpCallService=Mr,e.AddressImpl=kt,e.AuthInfo=Er,e.BaseAcceptNewPriceUpdater=Zr,e.BaseAddItemToBasketUpdater=$r,e.BaseAddUserToBasketItemUpdater=ei,e.BaseApplyJitFlightRulesFetcher=It,e.BaseBookBasketUpdater=ti,e.BaseCabhireQuoteFetcher=Mt,e.BaseCancelBookingUpdater=bi,e.BaseCarHireAvailabilityDetailFetcher=jt,e.BaseCarhireQuoteFetcher=wt,e.BaseConfermaOfficeFetcher=Ut,e.BaseConfermaOfficeNamesFetcher=xt,e.BaseConfirmMessagesUpdater=vi,e.BaseCreateBasketUpdater=ri,e.BaseDeleteBasketUpdater=ni,e.BaseDeleteFavouriteSearchUpdater=Ti,e.BaseDeleteRecentSearchUpdater=si,e.BaseDeleteUserAddressUpdater=oi,e.BaseEmailBasketFetcher=Ar,e.BaseEnterpriseBasketService=Nr,e.BaseEnterpriseMyBookingsService=Vr,e.BaseEnterpriseSearch=c,e.BaseEnterpriseSearchService=Qr,e.BaseEnvironment=Ge,e.BaseEurostarQuoteFetcher=Gt,e.BaseEventMessenager=Je,e.BaseFlightQuoteFetcher=Qt,e.BaseGetBasketFetcher=Lt,e.BaseGetConfermaRoomImagesFetcher=_r,e.BaseGetCovidMicrositeTokenFetcher=Jt,e.BaseGetFlightFareRulesFetcher=Ht,e.BaseGetFlightSeatMapFetcher=Dr,e.BaseGetMiAutoSugestionFetcher=er,e.BaseGetRailLiveDeparturesFetcher=Yt,e.BaseGetRailStationFetcher=Kt,e.BaseGetRailcardsFetcher=Wt,e.BaseGetRiskAlertsFetcher=zt,e.BaseGetUserBasketsFetcher=$t,e.BaseGetUserCompanyOfficesFetcher=Xt,e.BaseGetUserCurrentCarbonAllowanceFetcher=qt,e.BaseGetUserFavouriteSearchesFetcher=Pr,e.BaseGetUserFetcher=br,e.BaseGetUserRecentSearchesFetcher=Zt,e.BaseHelperRoutines=je,e.BaseHotelAvalibilityQuoteFetcher=tr,e.BaseHotelAvalibilityService=Lr,e.BaseHotelQuoteFetcher=rr,e.BaseHotelRulesFetcher=Bt,e.BaseIrlDiscountCardFetcher=ir,e.BaseIrlQuoteFetcher=nr,e.BaseLogonService=xr,e.BaseLoungeQuoteFetcher=ar,e.BaseModalOpenerService=Ur,e.BaseNetworkCall=p,e.BaseParkingQuoteFetcher=or,e.BaseRailQuoteFetcher=sr,e.BaseRemoveItemFromBasketUpdater=ai,e.BaseRevalidateBasketUpdater=ui,e.BaseRouteHappyService=Yr,e.BaseSaveFavouriteSearchUpdater=Si,e.BaseSaveRecentSearchUpdater=yi,e.BaseSaveUserAddressUpdater=li,e.BaseSearchAirlinesFetcher=ur,e.BaseSearchAirportsFetcher=lr,e.BaseSearchCityFetcher=cr,e.BaseSearchConfermaCityFetcher=dr,e.BaseSearchConfermaQuicklistFetcher=Vt,e.BaseSearchDepotFetcher=pr,e.BaseSearchHotelChainsFetcher=hr,e.BaseSearchIrlStationsFetcher=mr,e.BaseSearchPostcodeFetcher=fr,e.BaseSearchRailStationsFetcher=yr,e.BaseSearchUsersCanBookForFetcher=gr,e.BaseSendBasketForApprovalUpdater=ci,e.BaseSetBasketItemLeadPassengerUpdater=di,e.BaseSetBasketItemMiGroupUpdater=pi,e.BaseSetBasketItemMiValueUpdater=hi,e.BaseSetPaymentOptionUpdater=gi,e.BaseStorageService=Jr,e.BaseUpdateBasketNoteUpdater=fi,e.BaseUpdateBasketTitleUpdater=mi,e.BaseUserAddressesFetcher=vr,e.BaseUserMessagesFetcher=Sr,e.BaseUserProductsFetcher=Tr,e.BaseUserService=wr,e.BaseUserUiConfigsFetcher=Cr,e.BaseValidateIsPostcodeValidTester=Xr,e.BaseValidateMiFreeValueTester=zr,e.BaseWebTokenService=Wr,e.BasemoveBasketItemToBasket=ii,e.BasketInfoMiDetailsImpl=Te,e.BookableBasket=Re,e.CabHireEnterpriseSearch=xe,e.CarhireEnterpriseSearch=Ue,e.DEFAULT_FLIGHT_FILTERS=Ye,e.EurostarEnterpriseSearch=pt,e.FlightEnterpriseSearch=$e,e.HotelEnterpriseSearch=it,e.HotelFilters=rt,e.IRLEnterpriseSearch=Tt,e.InternalBasket=Ir,e.LimitedCache=Ie,e.LoginError=Or,e.LoungesEnterpriseSearch=nt,e.MAX_TRAVELLERS=8,e.ManagementInfoAndIsValid=fe,e.Memorise=Ne,e.ModalTypes=d,e.ParkingEnterpriseSearch=ut,e.PhoneNumberImpl=Ft,e.RailEnterpriseSearch=gt,e.RegExps=kr,e.SupplementaryBookingInfoImpl=Rt,e.Suppliers=ze,e.TravellerObject=St,e.USER_SIGNEDIN="USER_SIGNEDIN",e.USER_SIGNEDOUT=jr,e.UserFavorurite=Ke,e.UserInfoImpl=Ot,e.ValidatorChecker=ne,e.defaultValidations=st,e.excludedExpression=Fe,e.filtersKeys={chain:"chain",preferred:"preferred",amenitytype:"amenitytype",distanceRange:"distanceRange",extra:"extra",hotelName:"hotelName",priceRange:"priceRange",breakfastType:"breakfastType"},e.includedExpression=ke,e.makeManagamentInfo=Se,e.maxTravellerWellbeing=4,e.ɵ0=He,e.ɵd=Nt,e.ɵe=Et,e.ɵf=qr,e.ɵg=Kr,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
16
16
|
//# sourceMappingURL=sabstravtech-obtservices-base.umd.min.js.map
|