var device_t_id_element=document.getElementById("device_TransactionId"),haDonateMilesModule,haMilesMaximizerModule,module;if(device_t_id_element!=null){var a_hostUrl=HA.Accertify_Host_Url,a_sid=HA.Accertify_Sid,d=(new Date).getTime(),a_tid="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=(d+Math.random()*16)%16|0;return d=Math.floor(d/16),(n=="x"?t:t&3|8).toString(16)});device_t_id_element.value=a_tid;window._cc=window._cc||[];_cc.push(["ci",{sid:a_sid,tid:a_tid}]);_cc.push(["run",("https:"==document.location.protocol?"https://":"http://")+a_hostUrl]),function(){var n=document.createElement("script"),t;n.type="text/javascript";n.async=!0;n.src=("https:"==document.location.protocol?"https://":"http://")+a_hostUrl+"/cc.js?sid="+a_sid+"&ts="+(new Date).getTime();t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t)}()}(function(n){"use strict";function u(n){n+="=";for(var i=document.cookie.split(/;\s*/),t=i.length-1;t>=0;t--)if(!i[t].indexOf(n))return i[t].replace(n,"")}var t=u("website#lang"),f="en-us",r,i;t!=null&&t!=="en"&&(f=t);r=window.HA!=null&&window.HA.hawaiianAppDeps!=null?window.HA.hawaiianAppDeps:[];i=n.module("hawaiianApp",["ng.shims.placeholder","ngSanitize","oc.lazyLoad","haConfigModule","haUtilsModule","haGlobalsModule","haName","haJson","ngPromiseExtras","haDataModule","haScrollModule","haDraggableModule","haRevealOnLoadModule","selectOnClickModule","currencyNoDecimalsFilter","haRoundingFiltersModule","addIconFilter","haErrorsModule","haFootNoteModule","haFileModule","haKeyboardModule","haToggleModule","noClickFocusModule","haWindowEventsModule","haCurrencyModule","haLocalizeNameModule","haLocalizeDateModule","haPasswordStrengthModule","haFormValidationModule","haCarouselModule","haCalendarModule","haCalendar2Module","haCalendarEventsModule","shareWidgetModule","haDateInputModule","haLocationInputModule","haGenericLocationInputModule","haRecentSearchesModule","haHelpAndTipsModule","haBookStickyProgressBarModule","haAlertModule","haDynamicModalModule","haCreditCardTypesModule","haBreadcrumbModule","haAvatarSelectionModule","haCustomDropdownModule","haAvatarModule","haTooltipModule","haGlobalAlertModule","haGlobalMessageModule","haMapNavigatorModule","haErrorPageModule","haProgressBarModule","haStickyBookingWidgetModule","haPassengerCountModule","haCalendarEventsService","haCustomerSelectionsService","haFavoritesService","haHelpAndTipsService","haModalService","haPassengersService","haSearchCacheService","haSegmentService","haUserService","haGlobalHeaderModule","exploreHeroModule","exploreMapModule","haBookFlightResultsModule","haBookFlightResultsEndOnEndModule","haGlobalFooterModule","haFlightHopModule","haItineraryModule","haBookingHeroModule","haAccountSignInModule","haAccountRegistrationModule","haReceiptModule","haReceiptEndOnEndModule","haPaymentMethodsModule","haProfileSettingsModule","haPurchaseMilesModule","haCheckoutModule","haTermsConditionsModule","haManageTravelersModule","haCorporateTravelersModule","haMyTripsModule","haCustomDirectivesModule","haMyDashboardModule","haPurchaseConfirmationModule","haInsufficientMilesModule","haBookInsufficientMilesModule","haFlightStatusModule","travelCreditRedemptionModule","haAccountLandingModule","haPrintConfirmationModule","haMyTripsItineraryDetailsModule","haEcDowngradeModalModule","haReshopSelectionModalModule","haMileageStatementModule","haGlobalAlertsModule","haSearchResultsModule","haFeaturedDealsModule","haMainImageContentBlockModule","haCmsChildNavFrontPageModule","haCmsChildNavSubPageModule","haPhotoGalleryModule","haCmsSubpageBannerHeadlineModule","haCmsDetailPageBannerHeadlineModule","haCmsBodyCopyAdModule","haCmsFullWidthPromotionModule","haAdvancedSearchModule","haCmsRichTextEditorModule","haShareMilesModule","haMemberPhoneInfoModule","haContactUsModule","haContactUsTopicsModule","haCashBagModule","haChinaRewardsModule","haMemberPersonalInfoModule","haMemberDobModule","haSecurityQuestionAnswerModule","haPaymentModule","haPaymentCdeModule","haMemberAddressModule","haMemberAddressModule2","haMemberSubscriptionsModule","haCmsBodyCopyWithSidebarModule","haHotelPackagesModule","haMilesMaximizerModule","haDonateMilesModule","haPremierClubModule","haThumbGalleryModule","haLowFareSearchModule","haFlexiblePriceViewModule","haPriceApiModule","haAncillariesModule","haEcertAPI","ui.mask","ui.keypress","ui.bootstrap.pagination","hmTouchEvents","ngTouch","ngAnimate","duScroll","haPerformanceStatsModule","haDateUtilsModule","haBookingFormModule","haDatepickerModule","haEmitErrorModule","haIsWorkingModule","haAirportsModule","haInputName","haRequestPastMilesModule","haSitecoreModule","haScopeModule","haViewModelModule","haRequestPastMilesModule","formValidation","haMemberDiscountsModule","haSecondaryHeaderModule","haGiftCardModule","haFlightScheduleModule","haContactUsModule","haTravelGoalModule","haMyReceiptsModule","HaConfirmWhenDirtyModule","haTripSummaryModule","promoDetailsModule","haNeatFormsModule","haCartrawlerFormsModule","haTrueUpModule","haEcertEtcoModule","haBarclaysModule","ui.bootstrap.tabs","haNitpModule","haMyDashboardModule","ui.bootstrap.accordion","haPersonalMessageModule","haAffiliateModule","haAncillaryUpsellsModule","haAncillaryUpsellsMytripsModule","haPaxModule","haWatchTrailerModule","haAdvanceToNextInputService","haPurchasedAncillariesModule","haNitpDashboardModule","haPremierClubDashboardModule","HaFavoriteModule","haScrollSpyModule","haContextualHelpModule","uinqueFilter","haRegexModule","haFoodlandRegistrationModule","haButtonSpinnerModule","haUpcomingTripsDashboardModule","haPaymentTypesService","haPaymentMethodsAPI","haCountUpModule","haContentModalModule","haDomModalModule","haStoriesModule","haLoadingSpinnerModule","haEventsCalendarModule","focusOnDisplayModule","haShareItineraryModule","haMyAccountAPI","haPaxServiceModule","haStickyModule","haHomepageStoriesAndEventsModule","haAriaLiveModule","haBirthdateModule","haPaymentTypeMasterPassModule","haElementDirectivesModule","haClearDataModule","haElementDirectivesModule","haItineraryDetailsPaxInfoModule","haRangeModule","haProgressBreadcrumbModule","haVerticalSeatmapModule","haVerticalSeatSelectionModule","haStickyMessageBarModule","haVerticalSeatmapPreviewModule","haPrimaryNavAccountMenuModule","haPrimaryNavAlertsModule","haKisaTermsModule","haBodyExtensionModule","haSessionTimeoutAPI","haMobileService","haTableReflowModule","haAirportOrAddressInputModule","haHotelsInputModule","haRVFormModule","haRestrictSpacesModule","haInFlightReceiptsModule","haAirportTimezonesModule","haDurationModule","haReAuthServiceModule","haUpgradeModalModule","haNativeAppModalModule","haFormNativeappLinkSmsModule","haPersistentNativeAppBannerModule","haNativeUpsellBannerModule","haDisableOnClickModule","haAncillaryUpsellsServiceModule","haUpsellGridModule","TitleCaseModule","haEncryptionModule","haLaunchDarklyModule","haTimedHideModule","haDealTilesModule","haResponsiveAttributeModule","haPairLinksModule"].concat(r));i.config(["$logProvider","$sceProvider","$anchorScrollProvider","$provide","$ocLazyLoadProvider","uiMask.ConfigProvider",function(n,t,i,r,u,f){var e=window.location.search.indexOf("debug")>=0,o=window.location.hostname.indexOf("local")===0;n.debugEnabled(e||o);t.enabled(!1);i.disableAutoScrolling();u.config({debug:e||o,events:!1,modules:[{name:"haGoogleMapModule",files:["/Scripts/app/components/ha-google-map.js"]},{name:"haShareButtonModule",files:["/Scripts/app/components/ha-share-button.js"]},{name:"haDocsModule",files:["/Scripts/app/controllers/ha-docs.js"]},{name:"haExpertBookingModule",files:["/Scripts/app/modules/ha-expert-booking.js","/Scripts/app/services/ha-expert-booking-service.js","/Scripts/app/modules/ha-expert-booking-input.js","/Scripts/app/modules/ha-expert-booking-review.js","/Scripts/app/modules/ha-expert-booking-summary.js","/Scripts/app/modules/ha-expert-booking-table.js","/Scripts/app/modules/ha-expert-booking-payment.js"]},{name:"haCartrawlerOneWayFormsModule",files:["/Scripts/app/controllers/ha-cartrawler-oneway-forms.js"]}]});r.decorator("ngModelDirective",["$delegate",function(n){var t=n[0],i=t.controller;return t.controller=["$scope","$element","$attrs","$injector",function(n,t,r,u){var f=r.name,e;f!=null&&f.indexOf("{{")>-1&&(e=u.get("$interpolate"),r.$set("name",e(f)(n)));u.invoke(i,this,{$scope:n,$element:t,$attrs:r})}],n}]);r.decorator("formDirective",["$delegate",function(n){var t=n[0],i=t.controller;return t.controller=["$scope","$element","$attrs","$injector",function(n,t,r,u){var f=r.name||r.ngForm,e;f!=null&&f.indexOf("{{")>-1&&(e=u.get("$interpolate"),r.$set("name",e(f)(n)));u.invoke(i,this,{$scope:n,$element:t,$attrs:r})}],n}]);f.clearOnBlur(!1)}]);i.run(["$q","$rootScope","$location","$anchorScroll","haModal","haGlobals","haCitiesSvc","haSecondaryHeaderSvc","haUtils","haMobileSvc","haConfig",function(t,i,r,u,f,e,o,s,h,c,l){function a(){r.hash()&&u()}typeof Promise=="undefined"&&(window.Promise=function(n){var i=t.defer();return n(function(n){i.resolve(n)},function(n){i.reject(n)}),i.promise},Promise.resolve=function(n){return new Promise(function(t){t(n)})},Promise.reject=t.reject,Promise.all=t.all);i.haModal=f;i.haCitiesSvc=o;i.haSecondaryHeaderSvc=s;a();i.$on("$locationChangeSuccess",function(){a()});e(["$langCode","$language","$currency"],function(n,t,r){l.setLanguageCode(n);i.$language=t;i.$currency=r});i.constructor.prototype.getMediaImage=function(n){return h.getImageFromSiteCoreString(n)};i.getTemplateUrl=l.getTemplateUrl;i.getRazorTemplateUrl=l.getRazorTemplateUrl;i.getImgUrl=l.getImgUrl;i.csrf=window.tokens;i.moment=moment;i.isMobile=c.determineIsMobile();n.element(window).bind("resize",function(){i.isMobile=c.determineIsMobile();i.$apply()})}])})(angular),function(n){"use strict";var t=n.module("haMemberAddressModule",[]);t.directive("haMemberAddress",["haGlobals",function(t){var i=function(i,r){function u(u){u&&(i.displayAddress3=u==="JPN"||u==="CHN"||u==="TWN"||u==="KOR",i.displayStateDropDown=!1,t("jsonCountryStates",function(t){var r=$(t).filter(function(){return typeof this!="undefined"&&this.Value===u}),f;r.length>0&&r[0].IsStatesListAvailable===!0?(i.displayStateDropDown=!0,i.stateDropDownDataSource=[],n.forEach(r[0].States,function(n){i.stateDropDownDataSource.push({name:n.Name,value:n.Value})}),i.MemberAddress.State!=null&&(f=$(i.stateDropDownDataSource).filter(function(){return this.value===(i.MemberAddress.State.value||i.MemberAddress.State)}).get(0),i.MemberAddress.State=f?f:"")):(i.displayStateDropDown=!1,i.stateColWidth=3,i.cityColWidth=9,i.MemberAddress.State instanceof Object&&(i.MemberAddress.State=""))}),i.isDisabled&&r(function(){$("[ha-member-address]").find("input").prop("disabled",!0);$("[ha-member-address]").find("select").prop("disabled",!0)},0))}t(["jsonMemberAddress","isDisabled"],function(n,t){i.MemberAddress=n;i.isDisabled=t;i.isDisabled&&r(function(){$("[ha-member-address]").find("input").prop("disabled",!0);$("[ha-member-address]").find("select").prop("disabled",!0)},0)});i.displayStateDropDown=!0;i.stateDropDownDataSource=[];i.displayAddress3=!1;i.stateColWidth=3;i.cityColWidth=9;var f=7;i.$on("AddressInfoDetails",function(n,t){var r=t.AddressInfo;i.MemberAddress=r;u(i.MemberAddress.Country)});i.MemberAddress.Country==null&&t("defaultCountry",function(n){i.MemberAddress.Country=n});i.$watch("stateDropDownDataSource",function(n){var t,r,u;if(n){for(t=0,r=0;r<n.length;r++)u=n[r].name.length,t=u>t?u:t;t>f&&(i.stateColWidth=6,i.cityColWidth=6)}});i.$watch("MemberAddress.Country",function(n){u(n)})};return i.$inject=["$scope","$timeout"],{restrict:"A",scope:!0,controller:i}}]);t.directive("zipCodeCountryCheck",["haGlobals","haUtils",function(n,t){return{require:"ngModel",link:function(i,r,u,f){r.on("blur",function(){i.ValidateZipCode()});i.ValidateZipCode=function(){i.isValid()||r.val()&&r.val()!==""&&u.country&&u.country!==""&&n("jsonMemberAddress",function(n){var t=$(n.CountryStateDropDown).filter(function(){return this!==undefined&&this.Value.toLowerCase()===u.country.toLowerCase()}),i;t.length?(i=new RegExp(t[0].PinCodeRegex),i.test(r.val())?(f.$setValidity("ZipCodeCountryCheck",!0),r.parent().scope()!=null&&r.parent().scope().validate!=null&&r.parent().scope().validate()):(f.$setValidity("ZipCodeCountryCheck",!1),r.parent().scope()!=null&&r.parent().scope().invalidate!=null&&r.parent().scope().invalidate())):(f.$setValidity("ZipCodeCountryCheck",!0),r.parent().scope()!=null&&r.parent().scope().validate!=null&&r.parent().scope().validate())})};var e=t.debounce(function(){t.safeApply(i,function(){f.$setValidity("ZipCodeCountryCheck",!0);i.ValidateZipCode()})},500,!1);i.$watch(u.ngModel,e);i.$on("validateForm",function(){i.ValidateZipCode()});u.$observe("country",function(n){n&&i.ValidateZipCode()});i.isValid=function(){var i,n,t;if(r.controller("ngModel").$error){i=!1;n=r.controller("ngModel").$error;for(t in n)if(n.hasOwnProperty(t)&&t!=="ZipCodeCountryCheck"&&n[t]===!0){i=!0;break}return i}return!1};i.ValidateZipCode()}}}])}(angular),function(n){"use strict";var t=n.module("haMemberAddressModule2",["haUtilsModule","haGeoDataModule"]);t.directive("haMemberAddress2",["$log","$timeout","haUtils","haGlobals","haGeoDataSvc",function(t,i,r,u,f){var e=function(n,t,i){r.attachPartialVM(n,i,"AddressVM")},o=["$scope","$rootScope",function(r,e){var h,l;u(["formName","namePrefix"],function(n,t){h=n;l=t});r.countries&&r.countries.length!==0||u("countryData",function(n){r.countries=f.setCountryData(n)});n.extend(r,{addressStyle:f.getAddressStyle,hasPostalCode:f.hasPostalCode,postalRegex:f.getPostalCodeRegex,phoneRegex:f.getPhoneNumberRegex,cityRegex:f.getCityRegex,getStatesAndCities:function(n,e){var s=r.VM.State,h=function(i){t.debug("_invalidPostalCode",i);r.stateData=null;r.VM.State=null;r.cityData=null;r.VM.City=null;f.hasPostalCode(n)&&(r.registration&&(r.registration["MemberAddress.ZipCode"].$touched=!0),r.PremierClubForm&&(r.PremierClubForm["EnrolleeDetails.MemberAddress.ZipCode"].$touched=!0),r.ContactInformationForm&&(r.ContactInformationForm["MemberAddress.ZipCode"].$touched=!0))},l=r.VM.City;r.lookupSpinner=!0;f.getStateAndCities(n,e).then(function(e){r.lookupSpinner=!1;e.IsValid||h();var a=e.States.length>0;a?(r.VM.Country.IsoCode==="USA"&&u("_MemberAddress_PostalCode",function(n){i(function(){r[n.formName][n.namePrefix+"ZipCode"].$setValidity("notFound",!0)},800)}),r.stateData=e.States,r.cityData=e.Cities,r.VM.PostalCodeKey=e.PostalCodeKey,r.VM!=null&&r.VM.State!=null&&typeof r.VM.State=="string"&&r.VM.State.length>0?r.VM.State=o(e.States,r.VM.State):e.States!=null&&e.States.length===1&&(r.VM.State=e.States[0]),r.VM!=null&&r.VM.State==null&&r.VM.StateKey&&(r.VM.State=c(e,r.VM.StateKey)),r.VM!=null&&r.VM.City!=null&&typeof r.VM.City=="string"&&r.VM.City.length>0?r.VM.City=o(e.Cities,r.VM.City):e.Cities!=null&&e.Cities.length===1?r.VM.City=e.Cities[0]:e.Cities!=null&&e.Cities.length>1&&(r.VM.City=o(e.Cities,l))):(r.VM.Country.IsoCode==="USA"&&u("_MemberAddress_PostalCode",function(n){r[n.formName][n.namePrefix+"ZipCode"].$setValidity("notFound",!1)}),r.lookupSpinner=!0,f.getStates(n).then(function(n){r.lookupSpinner=!1;r.stateData=n;r.VM!=null&&(r.VM.State!=null&&(r.VM.State=o(n,r.VM.State)),r.VM.State==null&&(r.VM.State=o(n,s)),r.VM.State==null&&r.VM.StateKey&&(r.VM.State=c(n,r.VM.StateKey)),r.VM.City!=null&&(r.VM.City=o(n.Cities,r.VM.City)))},function(n){t.debug("getStates",n)}));r.$emit("$haMemberAddressReady")})},hideStateInput:function(){return r.stateData!=null&&r.stateData.length===0||f.noStates()},useCityDropdown:function(){return r.cityData!=null&&r.cityData.length>0},resetAddress:function(n){n!=null&&(r.stateData=null,r.cityData=null,r.VM!=null&&(r.VM.ZipCode=null,r.VM.State=null,r.VM.City=null,r.VM.Address1=null,r.VM.Address2=null,r.VM.Address3=null),r[h]!=null&&r[h].$setPristine())}});var s=function(n){for(var t=0;t<r.countries.length;t++)if(r.countries[t].IsoCode===n){r.VM.Country=r.countries[t];break}},o=function(n,t){if(n!=null&&t!=null&&typeof t=="string")for(var i=0;i<n.length;i++)if(n[i].Name!=null&&n[i].Name.toLowerCase()===t.toLowerCase()||n[i].DisplayName!=null&&n[i].DisplayName.toLowerCase()===t.toLowerCase())return n[i];return null},c=function(n,t){if(n!=null&&t!=null&&typeof t=="number")for(var i=0;i<n.length;i++)if(n[i].Key===t)return n[i];return null};r.$watch("VM",function(n){n!=null&&(r.VM.Country!=null&&r.VM.Country!==""?s(r.VM.Country):r.VM.CountryCode!=null?s(r.VM.CountryCode):(r.VM.Country==null||r.VM.Country==="")&&u("defaultCountryISO",s),r.VM.AccountDetail!=null&&r.VM.AccountDetail.ZipCode!=null&&(r.VM.ZipCode=r.VM.AccountDetail.ZipCode))});r.$watch("VM.CountryKey",function(n){(n===-1||n===-2)&&u("defaultCountryISO",s)});r.$watch("VM.Country",function(n){if(f.setActiveCountry(n),n!=null){var t=r.VM.Country;t==null||f.hasPostalCode(t.Key)||r.getStatesAndCities(t.Key);r.VM.Country.IsoCode!=null&&e.$broadcast("countryChanged",r.VM.Country.IsoCode)}});r.$watch("VM.ZipCode",function(n){if(n!=null){var t=r.VM.Country;t!=null&&r.getStatesAndCities(t.Key,n)}})}];return{restrict:"A",scope:!0,link:e,controller:o}}])}(angular),function(n){"use strict";var t;try{t=n.module("haMemberPhoneInfoModule")}catch(i){t=n.module("haMemberPhoneInfoModule",["haUtilsModule"])}t.directive("haMemberPhoneinfo",["haGlobals","$window",function(n,t){var i=t.defaultPhoneCountryCode,r=function(t){var e,r;t.showphone2=!1;t.showphone3=!1;t.secondPhoneMandatory=!1;t.thirdPhoneMandatory=!1;var u=10,o=[],f=0,s=[],h="not-set";for(n(["jsonMemberPhoneInfo"],function(n){t.PhoneDetails=n.PhoneDetails;h=n.CountryCodeDropDown;o=n.CountryCodeDropDown.map(function(n){return n.MaxPhoneLength});u=Math.max.apply(this,o);s=$.makeArray($(n.CountryCodeDropDown).filter(function(){return typeof this!="undefined"&&this.Value!==""})).map(function(n){return n.MinPhoneLength})}),e=[{CountryCode:i,Number:"",Type:""},{CountryCode:i,Number:"",Type:""},{CountryCode:i,Number:"",Type:""}],r=0;r<t.PhoneDetails.length;r++)+t.PhoneDetails[r].Type==1?e[0]=t.PhoneDetails[r]:+t.PhoneDetails[r].Type==3?e[1]=t.PhoneDetails[r]:+t.PhoneDetails[r].Type==2&&(e[2]=t.PhoneDetails[r]);t.PhoneDetails=e;f=Math.min.apply(this,s);t.phoneOneMinLength=f;t.phoneOneMaxLength=u;t.phoneSecondMinLength=f;t.phoneSecondMaxLength=u;t.phoneThirdMinLength=f;t.phoneThirdMaxLength=u;t.$watch("PhoneDetails[0].CountryCode",function(n){var i=t.getMaxAndMinPhoneLength(n);t.phoneOneMaxLength=i.maxLength;t.phoneOneMinLength=i.minLength});t.getMaxAndMinPhoneLength=function(n){if(n&&n!==""){var t=$(h).filter(function(){return typeof this!="undefined"&&this.Value===n});return t.length?{minLength:t[0].MinPhoneLength,maxLength:t[0].MaxPhoneLength}:{minLength:f,maxLength:u}}return{minLength:f,maxLength:u}};t.$watch("PhoneDetails[1].CountryCode",function(n){var i=t.getMaxAndMinPhoneLength(n);t.phoneSecondMaxLength=i.maxLength;t.phoneSecondMinLength=i.minLength;t.setSecondPhonemandatory()});t.$watch("PhoneDetails[1].Number",function(){t.setSecondPhonemandatory()});t.setSecondPhonemandatory=function(){t.secondPhoneMandatory=!t.PhoneDetails[1].CountryCode||t.PhoneDetails[1].Number&&t.PhoneDetails[1].Number!==""?!0:!1};t.setThirdPhonemandatory=function(){t.thirdPhoneMandatory=!t.PhoneDetails[2].CountryCode||t.PhoneDetails[2].Number&&t.PhoneDetails[2].Number!==""?!0:!1};t.$watch("PhoneDetails[2].CountryCode",function(n){var i=t.getMaxAndMinPhoneLength(n);t.phoneThirdMaxLength=i.maxLength;t.phoneThirdMinLength=i.minLength;t.setThirdPhonemandatory()});t.$watch("PhoneDetails[2].Number",function(){t.setThirdPhonemandatory()});t.$on("validatePhone",function(){t.contactInfoSubmit()});t.contactInfoSubmit=function(){t.PhoneDetails[0].CountryCode!==""&&t.PhoneDetails[0].Number!=null&&t.PhoneDetails[0].Number.length>0||t.PhoneDetails[1].CountryCode!==""&&t.PhoneDetails[1].Number!=null&&t.PhoneDetails[1].Number.length>0||t.PhoneDetails[2].CountryCode!==""&&t.PhoneDetails[2].Number!=null&&t.PhoneDetails[2].Number.length>0?t.$parent.ReflectPhoneRequired(!1):t.$parent.ReflectPhoneRequired(!0)}};return r.$inject=["$scope"],{restrict:"A",scope:!0,controller:r}}])}(angular),function(n){"use strict";var t;try{t=n.module("haMemberPhoneInfoModule")}catch(i){t=n.module("haMemberPhoneInfoModule",["haUtilsModule","haGeoDataModule"])}t.directive("haMemberPhoneInfo2",["$timeout","haGlobals","haUtils","haGeoDataSvc",function(t,i,r,u){var f=function(f,e,o){function c(t){var i=[],r;return n.forEach(t,function(n,r){var f,e,o;(typeof t[r].Type=="number"&&(t[r].Type=t[r].Type.toString()),f=t[r].CountryCode,f!=null&&(e=u.lookupCountryByCode(f),e!=null&&(t[r].CountryKey=e.Key)),t[r].Number!=null)&&(o=u.getPhoneNumberRegex(t[r].CountryKey),t[r].Number.match(o)&&i.push(t[r]))}),i.length||(r=u.lookupCountryByCode(s),r!=null?i.push({Type:null,CountryCode:s,CountryKey:r.Key,Number:null}):i.push({Type:null,CountryCode:null,CountryKey:null,Number:null})),i}var h=3,s;f.hideAddPhoneLink=!1;i("defaultPhoneCountryCode",function(n){s=n});n.extend(f,{phoneRegex:u.getPhoneNumberRegex,countryCodeData:u.getPhoneCountryCodes()});r.attachPartialVM(f,o,"PhoneDetailVM",{},function(n){n.PhoneDetails=c(n.PhoneDetails)});f.addPhoneNumber=function(){f.VM.PhoneDetails.length<h&&(f.VM.PhoneDetails.push({Type:null,CountryCode:s,Number:null}),t(function(){$("#phoneType"+(f.VM.PhoneDetails.length-1)).focus()},0))};f.removePhoneNumber=function(n){f.VM.PhoneDetails.length>1&&f.VM.PhoneDetails.splice(n,1)};f.canAddPhones=function(){return f.VM!=null&&f.VM.PhoneDetails!=null&&f.VM.PhoneDetails.length<h};f.update=function(n){var i=f.VM.PhoneDetails[n].CountryCode,t;i!=null&&(t=u.lookupCountryByCode(i),t!=null&&(f.VM.PhoneDetails[n].CountryKey=t.Key))};f.$on("countryChanged",function(t,i){s=i;n.forEach(f.VM.PhoneDetails,function(n,t){(n.Number===null||n.Number==="")&&(n.CountryCode=i,f.update(t))})})};return{restrict:"A",scope:!0,link:f}}])}(angular),function(n){"use strict";var t=n.module("haMemberPersonalInfoModule",[]);t.directive("haMemberPersonalinfo",["haGlobals",function(n){var t=function(t,i){n("jsonMemberPersonalInfo",function(n){function r(n){var t,i;return n!=null&&(t=n.toLowerCase(),i=/\b([a-z']+)\b/gi,t=t.replace(i,function(n){return n.charAt(0).toUpperCase()+n.substring(1)})),t}t.MemberPersonalInfo=n;t.MemberPersonalInfo.Suffix=r(t.MemberPersonalInfo.Suffix);t.MemberPersonalInfo.FirstName===null&&t.MemberPersonalInfo.LastName===null&&(t.IsReadOnly=!1);t.MemberPersonalInfo.DOBMonthDropDown.shift();t.MemberPersonalInfo.DOBYearDropDown.shift();t.MemberPersonalInfo.isMinor=t.restrictMinors&&!!i.get("HM_MINOR_REG_RESTRICTED")})};return t.$inject=["$scope","$cookies"],{restrict:"A",scope:!0,controller:t}}])}(angular),function(n){"use strict";var t=n.module("haMemberDobModule",["haUtilsModule"]);t.directive("haMemberDob",["$log","$cookies","haFeatureFlags",function(n,t,i){var r=["$scope",function(n){function r(){var t=n.getDOB();n.MemberPersonalInfo.SelectedDOB=n.getDOB();t!==n.dobText&&(n.dobText=t);n.getIsMinor()&&(n.MemberPersonalInfo.isMinor=!0,n.restrictMinors&&!n.setIsMinor&&(n.setIsMinor=!0,o()))}function o(){if(n.restrictMinors&&!t.get(f)){var i=new Date;i.setDate(i.getDate()+1);t.put(f,!0,{expires:i})}}var f="HM_MINOR_REG_RESTRICTED",e,u;n.getDOB=function(){return[n.VM.dobMonth,n.VM.dobDay,n.VM.dobYear].join("/")};n.$watch("VM.dobDay",function(n,t){n!==t&&r()});n.$watch("VM.dobMonth",function(n,t){n!==t&&r()});n.$watch("VM.dobYear",function(n,t){n!==t&&r()});e=i.get("AGE_LIMIT_TO_DISPLAY_GUARDIAN_INFO",20)*365.25*864e5;n.getIsMinor=function(){if(n.VM.dobYear&&n.VM.dobMonth&&n.VM.dobDay){var t=parseInt(n.VM.dobDay),i=parseInt(n.VM.dobMonth)-1,r=parseInt(n.VM.dobYear),u=new Date(r,i,t),f=Date.now()-u.getTime();return f<e}return!1};u=function(){if(n.MemberPersonalInfo.DateOfBirth&&n.MemberPersonalInfo.DateOfBirth!==null&&n.MemberPersonalInfo.DateOfBirth!==""){var t=n.MemberPersonalInfo.DateOfBirth.split("/");n.VM={};t&&t.length===3&&(n.VM.dobMonth=t[0],n.VM.dobDay=t[1],n.VM.dobYear=t[2]);n.dobText=n.MemberPersonalInfo.DateOfBirth;r()}};n.$on("VMReady",function(){u()});n.MemberPersonalInfo&&u()}];return{restrict:"A",scope:!0,controller:r}}])}(angular),function(n){"use strict";var t=n.module("haMemberSubscriptionsModule",["haUtilsModule"]);t.directive("haMemberSubscriptions",["haGlobals","haUtils",function(n,t){var i=function(i,r,u){t.attachPartialVM(i,u,"EmailSubscriptionsVM",{LowFaresAndDeals:!0,ENewsLetters:!1,HMPartners:!1});n(["isHMMember"],function(n){i.isHMMember=n})};return{restrict:"A",scope:!0,link:i}}])}(angular),function(n){"use strict";var t=n.module("haContactUsModule",["haMemberPhoneInfoModule","haGeoDataModule"]);t.directive("haContactUs",["$rootScope","$timeout","haGlobals","haGeoDataSvc",function(t,i,r,u){return{restrict:"A",scope:!0,link:function(t){r("jsonContactUs",function(n){if($.extend(t,n),t.TravelInfoVM.TravelDate){var i=new Date(t.TravelInfoVM.TravelDate);isNaN(i.getTime())||(t.TravelInfoVM.TravelDate=i)}});r(["jsonMemberPhoneInfo","countryData"],function(n,i){t.jsonMemberPhoneInfo=n;t.countries=u.setCountryData(i)});t.$$childHead.$watch("NoEmailAddress",function(n){n&&(t.ContactInfoVM.EmailAddress="")});t.ReflectPhoneRequired=n.noop;t.clearPlaceholders=function(n){for(var i=n.target.querySelectorAll(".empty"),t=0;t<i.length;t++)i[t].value=""}}}}])}(angular),function(n){"use strict";var t=n.module("haCashBagModule",[]);t.directive("haCashBag",["haGlobals",function(t){var i=function(i){i.Error="";t("jsonCashBagModel",function(t){i.model=n.extend({},t);i.model.FromLocationCode=t.DestinationLocation.Cities[1].Code;i.model.DestinationLocationCode=t.DestinationLocation.Cities[0].Code;i.model.TripType=i.model.TripType===0||i.model.TripType===2?"2":"1";i.model.FromBoardingDate&&(i.model.FromBoardingDate=moment(i.model.FromBoardingDate).toDate());i.model.DestinationBoardingDate&&(i.model.DestinationBoardingDate=moment(i.model.DestinationBoardingDate).toDate());i.model.Passengers===null&&(i.model.Passengers=[]);i.model.Passengers.length===0&&i.model.Passengers.push({FirstName:"",LastName:"",MembershipNumber:""})});t("errorMessage",function(n){n!==""&&(i.Error=n)});i.addPax=function(){i.model.Passengers.push({FirstName:"",LastName:"",MembershipNumber:""})};var r=function(){var n=i.model.FromLocationCode===i.model.DestinationLocationCode;i.okCashBagForm.FromLocationCode&&i.okCashBagForm.DestinationLocationCode&&(i.okCashBagForm.FromLocationCode.$setValidity("unique",!n),i.okCashBagForm.DestinationLocationCode.$setValidity("unique",!n))};i.$watch("model.FromLocationCode",function(){r()});i.$watch("model.DestinationLocationCode",function(){r()});i.range_datepicker_config={double_wide:!0,start:"[name='FromBoardingDatePicker']",end:"[name='DestinationBoardingDatePicker']",range_start:moment(new Date("2014/8/1")),range_end:moment().startOf("day"),format:"YYYY/MM/DD"};i.$watch("model.Passengers[0].MembershipNumber",function(){i.DuplicateMembershipCheck(0)});i.$watch("model.Passengers[1].MembershipNumber",function(){i.DuplicateMembershipCheck(1)});i.$watch("model.Passengers[2].MembershipNumber",function(){i.DuplicateMembershipCheck(2)});i.$watch("model.Passengers[3].MembershipNumber",function(){i.DuplicateMembershipCheck(3)});i.DuplicateMembershipCheck=function(n){if(i.okCashBagForm["Passengers["+n+"].MembershipNumber"]!==undefined)if(i.model.Passengers[n].MembershipNumber){for(var t=0;t<i.model.Passengers.length;t++)if(t!==n&&i.model.Passengers[n].MembershipNumber===i.model.Passengers[t].MembershipNumber){i.okCashBagForm["Passengers["+n+"].MembershipNumber"].$setValidity("duplicate",!1);return}i.okCashBagForm["Passengers["+n+"].MembershipNumber"].$setValidity("duplicate",!0)}else i.okCashBagForm["Passengers["+n+"].MembershipNumber"].$setValidity("duplicate",!0)}},r;return i.$inject=["$scope"],r=function(n,t){setTimeout(function(){n.theFormName=t.attr("name");n.theForm=n[n.theFormName]},0)},{restrict:"A",scope:!0,controller:i,link:r}}])}(angular),function(n){"use strict";var t=n.module("haChinaRewardsModule",[]);t.directive("haChinaRewards",["haGlobals",function(n){var t=function(t){t.FlightInfoVM={};t.TravellerList=[];t.EmailAddress="";t.PhoneNumber="";t.ConfirmationCode="";t.CityList=[];t.FlightInfoVM.DepartureCityCode="";t.FlightInfoVM.ReturnCityCode="";t.FlightInfoVM.DepartureFlightNumber="";t.FlightInfoVM.ReturnFlightNumber="";t.FlightInfoVM.DepartureDatePicker="";t.FlightInfoVM.ReturnDatePicker="";t.FlightInfoVM.DepartureDate="";t.FlightInfoVM.ReturnDate="";t.range_datepicker_config={double_wide:!0,start:"[name='FlightInfoVM.DepartureDatePicker']",end:"[name='FlightInfoVM.ReturnDatePicker']",range_start:moment(new Date("2014/9/1")),range_end:moment().startOf("day"),format:"YYYY/MM/DD"};n("jsonChinaRewardsModel",function(n){$.extend(t,n);t.TravellerList===null&&(t.TravellerList=[]);t.FlightInfoVM===null&&(t.FlightInfoVM={DepartureCityCode:"PEK",ReturnCityCode:"HNL"});t.FlightInfoVM.TripType=t.TripType===0||t.TripType===2?"2":"1";t.FlightInfoVM.DepartureDate&&(t.FlightInfoVM.DepartureDate=moment(t.FlightInfoVM.DepartureDate).toDate());t.FlightInfoVM.ReturnDate&&(t.FlightInfoVM.ReturnDate=moment(t.FlightInfoVM.ReturnDate).toDate())});t.TravellerList.length===0&&t.TravellerList.push({FirstName:"",LastName:"",MembershipNumber:""});t.$on("haFormValidationSuccess",function(n,i){t.Validated===!1&&t.formClicked===!1&&(i.event.preventDefault(),t.formClicked=!0,t.formScope=i.formScope)});t.setClear=function(){$("body, html").animate({scrollTop:$('input[type="text"]:first').offset().top-120},"slow");setTimeout(function(){$('input[type="text"]:first').focus();t.TripType=2},300)};t.addPax=function(){t.TravellerList.push({FirstName:"",LastName:"",MembershipNumber:""})};var i=function(){var n=t.FlightInfoVM.DepartureCityCode===t.FlightInfoVM.ReturnCityCode;t.ChinaRewardsForm["FlightInfoVM.DepartureCityCode"]&&t.ChinaRewardsForm["FlightInfoVM.ReturnCityCode"]&&(t.ChinaRewardsForm["FlightInfoVM.DepartureCityCode"].$setValidity("unique",!n),t.ChinaRewardsForm["FlightInfoVM.ReturnCityCode"].$setValidity("unique",!n))};t.$watch("FlightInfoVM.DepartureCityCode",function(){i()});t.$watch("FlightInfoVM.ReturnCityCode",function(){i()})},i;return t.$inject=["$scope"],i=function(n,t){setTimeout(function(){n.theFormName=t.attr("name");n.theForm=n[n.theFormName]},0)},{restrict:"A",scope:!0,controller:t,link:i}}])}(angular),function(n){"use strict";var t=n.module("haSecurityQuestionAnswerModule",["haUtilsModule"]);t.directive("haSecurityQuestionAnswer",["haGlobals","haUtils",function(t,i){var r=function(r,u,f){r.securityQAdataSource=[];r.securityQAdataSourceFirst=[];r.securityQAdataSourceSecond=[];r.securityQAdataSourceThird=[];r.securityQAPlaceHolder="";t(["securityQuestionDisabled"],function(n){r.securityQuestionDisabled=n});i.attachPartialVM(r,f,"SecurityQuestionVM",{SecurityQuestionAnswers:[]},function(t){while(3>t.SecurityQuestionAnswers.length)t.SecurityQuestionAnswers.push({QuestionID:"",Answer:""});t.SecurityQuestionsDropDown!=null&&t.SecurityQuestionsDropDown.length!==0&&(n.forEach(t.SecurityQuestionsDropDown,function(n){n.Value===""?r.securityQAPlaceHolder=n.Name:r.securityQAdataSource.push({name:n.Name,value:n.Value})}),r.securityQAdataSourceFirst=r.securityQAdataSource,r.securityQAdataSourceSecond=r.securityQAdataSource,r.securityQAdataSourceThird=r.securityQAdataSource,o());r.needExplainMaskString=!1;for(var i=0;i<t.SecurityQuestionAnswers.length;i++)t.SecurityQuestionAnswers[i].Answer&&t.SecurityQuestionAnswers[i].Answer.length>0&&(r.needExplainMaskString=!0)});var o=function(){r.$watch("VM.SecurityQuestionAnswers[0].QuestionID",function(){r.question1set?r.$broadcast("securityQuestionChanged","VM.SecurityQuestionAnswers[0].QuestionID"):r.question1set=!0;r.VM.SecurityQuestionAnswers!=null&&r.VM.SecurityQuestionAnswers.length>0&&(r.securityQAdataSourceSecond=e(r.securityQAdataSource,[r.VM.SecurityQuestionAnswers[0].QuestionID,r.VM.SecurityQuestionAnswers[2].QuestionID]),r.securityQAdataSourceThird=e(r.securityQAdataSource,[r.VM.SecurityQuestionAnswers[0].QuestionID],r.VM.SecurityQuestionAnswers[1].QuestionID))});r.$watch("VM.SecurityQuestionAnswers[1].QuestionID",function(){r.question2set?r.$broadcast("securityQuestionChanged","VM.SecurityQuestionAnswers[1].QuestionID"):r.question2set=!0;r.VM.SecurityQuestionAnswers!=null&&r.VM.SecurityQuestionAnswers.length>0&&(r.securityQAdataSourceFirst=e(r.securityQAdataSource,[r.VM.SecurityQuestionAnswers[1].QuestionID,r.VM.SecurityQuestionAnswers[2].QuestionID]),r.securityQAdataSourceThird=e(r.securityQAdataSource,[r.VM.SecurityQuestionAnswers[0].QuestionID,r.VM.SecurityQuestionAnswers[1].QuestionID]))});r.$watch("VM.SecurityQuestionAnswers[2].QuestionID",function(){r.question3set?r.$broadcast("securityQuestionChanged","VM.SecurityQuestionAnswers[2].QuestionID"):r.question3set=!0;r.VM.SecurityQuestionAnswers!=null&&r.VM.SecurityQuestionAnswers.length>0&&(r.securityQAdataSourceSecond=e(r.securityQAdataSource,[r.VM.SecurityQuestionAnswers[0].QuestionID,r.VM.SecurityQuestionAnswers[2].QuestionID]),r.securityQAdataSourceFirst=e(r.securityQAdataSource,[r.VM.SecurityQuestionAnswers[1].QuestionID,r.VM.SecurityQuestionAnswers[2].QuestionID]))})},e=function(n,t){return n.filter(function(n){return n.value!==t[0]&&n.value!==t[1]})}};return{restrict:"A",scope:!0,link:r}}]);t.directive("typeSwitch",function(){return{restrict:"A",scope:{answer:"=ngModel"},link:function(n,t,i){function r(n){return Number(n.match(/\d/g).join(""))}n.answerIndex=r(i.name);n.receivedMasked=!1;n.$watch("answer",function(i){!n.existingAnswer&&i&&i.length&&(n.existingAnswer=i,i==="**********"&&(n.receivedMasked=!0,t.attr("type","password")))});n.$on("securityQuestionChanged",function(i,u){r(u)===n.answerIndex&&(n.stayCleared=!0,t.val("").attr("type","text"),n.answer="")});t.on("focus",function(){n.receivedMasked&&(t.val("").attr("type","text"),n.answer="")});t.on("blur",function(){n.receivedMasked&&t.val().length===0&&!n.stayCleared&&n.$apply(function(){n.answer=n.existingAnswer;t.val(n.existingAnswer).attr("type","password")})})}}})}(angular),function(n){"use strict";var t=n.module("haPaymentModule",[]);t.directive("haPayment",["haGlobals",function(t){var i=function(i){function u(){return/^3[47][0-9]{13}$/.test(i.CCInfo.CardNumber)||i.CCInfo.CardType==="AX"}i.CCTypes=[];i.SavedCards=[];i.CCInfo={};i.oldCardType="";i.SavePaymentMethod=!1;i.ExpirationMonths=[];i.ExpirationMonthsDatasource=[];i.ExpirationYears=[];i.monthPlaceHolder="";i.yearPlaceHolder="";i.HideSaveCardInfoForLaterUse=!0;t("jsonCCTypes",function(n){i.CCTypes=n});t("jsonCCInfo",function(n){i.CCInfo=n.CCInfo;i.SavePaymentMethod=n.SavePaymentMethod});t("jsonSavedCards",function(n){i.SavedCards=n});t("jsonHideSaveCardInfoForLaterUse",function(n){i.HideSaveCardInfoForLaterUse=n});t("ccExpirationMonths",function(t){n.forEach(t,function(n){n.Value!==""?(i.ExpirationMonths.push({name:n.Name,value:n.Value}),i.ExpirationMonthsDatasource.push({name:n.Name,value:n.Value})):i.monthPlaceHolder=n.Name})});t("ccExpirationYears",function(t){n.forEach(t,function(n){n.Value!==""?i.ExpirationYears.push({name:n.Name,value:n.Value}):i.yearPlaceHolder=n.Name})});i.$watch("CCInfo.ExpirationYear",function(t){var u=parseInt(t,10),f=(new Date).getFullYear(),r;u===f?(r=(new Date).getMonth()+1,i.ExpirationMonths=[],n.forEach(i.ExpirationMonthsDatasource,function(n){parseInt(n.value,10)>=r&&(i.ExpirationMonths.push(n),parseInt(i.CCInfo.ExpirationMonth)<r&&(i.CCInfo.ExpirationMonth=""))})):i.ExpirationMonths=i.ExpirationMonthsDatasource});i.ccvLength=function(){return u()?4:3};i.GetCardName=function(n){if(i.CCTypes.length>0){var t=$(i.CCTypes).filter(function(){return this.Value===n}).get(0);return t?t.Name:n}return n};i.truncateCC=function(n){return n.substr(n.length-4)};var r=$("<div/>").html("&bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; ").text();i.CCInfo.CardNumber!==null&&(i.CCInfo.CardNumber=r+i.truncateCC(i.CCInfo.CardNumber));i.IsBarclayReturn&&(i.CCInfo.ExpirationMonth!==null&&(i.CCInfo.ExpirationMonth=$.grep(i.ExpirationMonths,function(n){return n.value===i.CCInfo.ExpirationMonth})[0]),i.CCInfo.ExpirationYear!==null&&(i.CCInfo.ExpirationYear=$.grep(i.ExpirationYears,function(n){return n.value===i.CCInfo.ExpirationYear})[0]));i.cardLength=function(){return i.CCInfo.CCId>0&&i.CCInfo.CardNumber.indexOf(r)!==-1?19:16};i.isUseCard=function(){return i.CCInfo.CCId>0&&i.CCInfo.CardNumber.indexOf(r)!==-1};i.useCard=function(t){var u=n.copy(t);i.CCInfo=u.CCInfo;i.CCInfo.ExpirationMonth=$.grep(i.ExpirationMonths,function(n){return n.value===i.CCInfo.ExpirationMonth})[0];i.CCInfo.ExpirationYear=$.grep(i.ExpirationYears,function(n){return n.value===i.CCInfo.ExpirationYear})[0];i.CCInfo.CardNumber=r+i.truncateCC(i.CCInfo.CardNumber);i.oldCardType=i.CCInfo.CardType;i.$broadcast("AddressInfoDetails",{AddressInfo:u.BillingAddress});i.$broadcast("$closeCustomDropdown")};i.$on("ClearCCInfo",function(){i.CCInfo.CardNumber="";i.CCInfo.CardType="";i.CCInfo.ExpirationMonth="";i.CCInfo.ExpirationYear=""})};return i.$inject=["$scope"],{restrict:"A",scope:!0,controller:i}}]);t.directive("haValidateCardType",["haGlobals",function(n){return{link:function(t,i,r){var u=i.find("input"),f=u.controller("ngModel");u.on("blur",function(){t.ValidateCardType()});r.$observe("cardType",function(n){n&&t.ValidateCardType()});t.$watch(u.attr("ng-model"),function(){t.safeApply(function(){f.$setValidity("ValidCardType",!0)})});t.ValidateCardType=function(){if(!t.isValid()){var e=$("<div/>").html("&bull;").text();u.val()&&u.val()!==""&&u.val().indexOf(e)===-1&&r.cardType&&r.cardType!==""?n(r.cardSource,function(n){var t=$(n).filter(function(){return this!==undefined&&this.Value.toLowerCase()===r.cardType.toLowerCase()}),u;t.length?(u=new RegExp(t[0].CCRegex),u.test(i.find("input").val())?f.$setValidity("ValidCardType",!0):(f.$setValidity("ValidCardType",!1),i.removeClass("ng-pristine").addClass("ng-dirty"))):f.$setValidity("ValidCardType",!0)}):r.oldCardType&&r.oldCardType!==""&&r.cardType!==r.oldCardType?(u.controller("ngModel").$setValidity("ValidCardType",!1),i.removeClass("ng-pristine").addClass("ng-dirty")):f.$setValidity("ValidCardType",!0)}};t.safeApply=function(n){var t=this.$root.$$phase;t==="$apply"||t==="$digest"?n&&typeof n=="function"&&n():this.$apply(n)};t.isValid=function(){var i,n,t;if(f.$error){i=!1;n=f.$error;for(t in n)if(n.hasOwnProperty(t)&&t!=="ValidCardType"&&n[t]===!0){i=!0;break}return i}return!1}}}}]);t.directive("ccNumber",function(){return{require:"ngModel",link:function(n,t,i,r){r.$parsers.push(function(t){return n.check(t)});t.on("focus mouseup keyup",function(){if(i.savedcc==="true")return this.select(),!1});var u=$("<div/>").html("&bull;").text();n.check=function(n){var f,o,s;if(n===undefined)return"";if(f="",i.savedcc==="true"?(o="[^0-9 "+u+"]",s=new RegExp(o,"g"),f=n.replace(s,"")):f=n.replace(/[^0-9]/g,""),f!==n){var e=t[0],h=0,c=0,l=!1;try{h=e.selectionStart;c=e.selectionEnd+f.length-n.length}catch(a){l=!0}if(r.$setViewValue(f),r.$render(),!l)try{e.setSelectionRange(h,c)}catch(a){}}return f}}}})}(angular),function(n){"use strict";var t=n.module("haPaymentCdeModule",["haPaymentMethodsAPI"]);t.directive("haPaymentCde",["haGlobals","$window","haPaymentMethodsAPI",function(t,i,r){var u=function(u,f,e){var o,h,s;u.SavedCards=[];u.CCInfo={};u.BillingAddress={};u.SavePaymentMethod=!1;u.ExpirationMonths=[];u.ExpirationYears=[];u.monthPlaceHolder="";u.yearPlaceHolder="";u.HideSaveCardInfoForLaterUse=!0;u.isSavedCard=!1;u.ShowCDEFormSubmitFailError=!1;o=f.formName;t("jsonCCInfo",function(n){u.CCInfo=n.CCInfo;u.SavePaymentMethod=n.SavePaymentMethod});t("jsonSavedCards",function(n){u.SavedCards=n});t(["jsonHideSaveCardInfoForLaterUse","isLimitCountry","isCustomSubmitFailError"],function(n,t,i){u.HideSaveCardInfoForLaterUse=n;u.isLimitCountry=t;i||window.sessionStorage.getItem("showCDESubmitFailError")&&(window.sessionStorage.removeItem("showCDESubmitFailError"),u.ShowCDEFormSubmitFailError=!0)});t("ccExpirationMonths",function(t){n.forEach(t,function(n){n.Value!==""?u.ExpirationMonths.push({name:n.Name,value:n.Value}):u.monthPlaceHolder=n.Name})});t("ccExpirationYears",function(t){n.forEach(t,function(n){n.Value!==""?u.ExpirationYears.push({name:n.Name,value:n.Value}):u.yearPlaceHolder=n.Name})});$scs.get("ReviewAndPay").then(function(n){u.strings=n});u.truncateCC=function(n){return n.substr(n.length-4)};h="&bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; ";s=$("<div/>").html(h).text();u.IsBarclayReturn&&(u.CCInfo.CardNumber!==null&&(u.IsBarclaysApplied=!0,u.CCInfo.MaskedCardNumber=s+u.truncateCC(u.CCInfo.CardNumber)),u.CCInfo.ExpirationMonth!==null&&(u.CCInfo.ExpirationMonth=$.grep(u.ExpirationMonths,function(n){return n.value===u.CCInfo.ExpirationMonth})[0]),u.CCInfo.ExpirationYear!==null&&(u.CCInfo.ExpirationYear=$.grep(u.ExpirationYears,function(n){return n.value===u.CCInfo.ExpirationYear})[0]));u.useCard=function(n){u.loadingSavedCard=!0;u.loadingSavedCardFailed=!1;u.invalidCountryCard=!1;u.invalidCardType=!1;r.getCDESavedCard(n.CCInfo.CCId).success(function(n){n&&n.CCInfo&&n.BillingAddress?u.isLimitCountry&&n.BillingAddress.Country!=="USA"&&n.BillingAddress.Country!=="CAN"?(u.loadingSavedCard=!1,u.invalidCountryCard=!0):u.isLimitCountry&&n.CCInfo.CardType==="TP"?(u.loadingSavedCard=!1,u.invalidCardType=!0):(u.CCInfo=n.CCInfo,u.CCInfo.MaskedCardNumber=s+u.truncateCC(u.CCInfo.CardNumber),u.CCInfo.ExpirationMonth=$.grep(u.ExpirationMonths,function(n){return n.value===u.CCInfo.ExpirationMonth})[0],u.CCInfo.ExpirationYear=$.grep(u.ExpirationYears,function(n){return n.value===u.CCInfo.ExpirationYear})[0],u.BillingAddress=n.BillingAddress,e(function(){u.$broadcast("AddressInfoDetails",{AddressInfo:n.BillingAddress})},0),u.loadingSavedCard=!1,u.isSavedCard=!0):(u.loadingSavedCard=!1,u.loadingSavedCardFailed=!0)}).error(function(){u.loadingSavedCard=!1;u.loadingSavedCardFailed=!0});u.$broadcast("$closeCustomDropdown")};u.useDifferentCard=function(){u.isSavedCard=!1;u.IsBarclaysApplied=!1;u.CCInfo={CCId:0};u.BillingAddress={}};u.$on("CDESubmit",function(){if(u.isSavedCard||u.IsBarclaysApplied||u.totalZero)e(function(){$("#"+o).submit()},0);else{var n=document.getElementById("formIFrame");if(!u.$eval(o+".$valid"))return n.contentWindow.postMessage("validate",iframeOrigin),e(function(){u.$eval(o+".$validate()")},0),!1;n.contentWindow.postMessage("submit",iframeOrigin)}});i.addEventListener("message",function(t){var f,r,i;t.origin===iframeOrigin&&(t.data.substring(0,7)==="resize:"?(f=t.data.split(":"),f.length===2&&n.element("#formIFrame").height(f[1])):t.data==="submitted"?u.$emit("CDEPaymentSubmitted"):t.data==="error"?u.$emit("CDEPaymentSubmitError"):t.data==="submitFail"?(window.sessionStorage.setItem("showCDESubmitFailError",!0),window.onbeforeunload=function(){window.scrollTo(0,0)},window.location.reload()):t.data.substring(0,9)==="complete:"?(r=t.data.substring(9,t.data.length),i=JSON.parse(r),u.SavePaymentMethod=i.SavePaymentMethod,u.CCInfo.FirstName=i.CCInfo.FirstName,u.CCInfo.LastName=i.CCInfo.LastName,u.CCInfo.CardNumber=i.CCInfo.CardNumber,u.CCInfo.CCV=i.CCInfo.Cvv,u.CCInfo.CardType=i.CCInfo.CardType,u.CCInfo.ExpirationMonth=i.CCInfo.ExpirationMonth,u.CCInfo.ExpirationYear=i.CCInfo.ExpirationYear,u.CCInfo.BinNumber=i.CCInfo.BinNumber,u.CCInfo.NickName=u.SavePaymentMethod?i.CCInfo.NickName:null,u.BillingAddress.Country=i.BillingAddress.Country,u.BillingAddress.Address1=i.BillingAddress.Address1,u.BillingAddress.Address2=i.BillingAddress.Address2,u.BillingAddress.Address3=i.BillingAddress.Address3,u.BillingAddress.City=i.BillingAddress.City,u.BillingAddress.State=i.BillingAddress.State,u.BillingAddress.ZipCode=i.BillingAddress.ZipCode,e(function(){$("#"+o).submit()},0)):t.data.substring(0,14)==="barclaysCheck:"?(r=t.data.substring(14,t.data.length),i=JSON.parse(r),u.$emit("BarclaysCreditpreApprovalCheck",i)):t.data.substring(0,14)==="barclaysApply:"&&(r=t.data.substring(14,t.data.length),i=JSON.parse(r),u.$emit("BarclaysApplyNow",i)))});u.$watch(o+".$valid",function(n,t){if(t!==undefined&&n!==t){var i=document.getElementById("formIFrame"),r=n?"valid":"invalid";i&&i.contentWindow.postMessage(r,iframeOrigin)}});u.$watch("giftCardResponse.BookingBalance",function(){u.isSavedCard=!1})},f;return u.$inject=["$scope","$attrs","$timeout"],f=function(n,t){var i="/PaymentAuthorization?rand="+(Math.floor(Math.random()*9999)+1);(n.$switch("Global:EnableVIC")||n.$root.vicilicious)&&(i+="&vicilicious=true");$(t).find("#formIFrame").prop("src",i)},{restrict:"A",scope:!0,link:f,controller:u}}])}(angular),function(n){"use strict";var t=n.module("haCmsRichTextEditorModule",[]);t.directive("haCmsRichTextEditor",["$compile",function(n){var t=function(n){n.$emit("$haCmsRichTextEditorReady")},i;return t.$inject=["$scope"],i=function(t,i){var u,f,r;i.find("a").each(function(i,r){var u=$(r).attr("href");typeof u=="string"&&u.indexOf("#")===0&&($(r).attr("ha-scroll-to",u.slice(1)),n(r)(t))});u=$(i);f=u.closest(".column");f.length>0&&(r=u.closest(".two-column-sublayout"),r.length>0&&r.find(".rich-text-col").length===0&&(r.find(".column").removeClass("default-split"),f.addClass("rich-text-col")))},{restrict:"A",scope:!0,link:i,controller:t}}])}(angular),function(n){"use strict";var t=n.module("haAdvancedSearchModule",[]);t.directive("haAdvancedSearch",["haSitecoreStrings","haGlobals","$interpolate",function(n,t,i){var r=function(r){t("ETCOResponseModel",function(t){r.ETCOResponseModel=t;n.get("ReservationsTravelCreditRedemption.GetOffAllRoutesText").then(function(n){r.ecertTitle=i(n)(r)})});r.enableHotelsWidget=r.$switch("BookingWidget:enablehotelwidget");r.enableCarsWidget=r.$switch("BookingWidget:enablecarwidget");r.enablePackagesWidget=r.$switch("BookingWidget:enablepackageswidget");r.$on("$bookingWidgetReady",function(){$(".advWidgetFooter").show();$(".initLoader").hide()});r.$emit("$haAdvancedSearchReady");r.doSubmit=function(){setTimeout(function(){$('form[name="flightSearch"]').trigger("submit")},0)}},u;return r.$inject=["$scope"],u=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:u,controller:r}}])}(angular),function(n){"use strict";var t=n.module("haCmsFullWidthPromotionModule",[]);t.directive("haCmsFullWidthPromotion",function(){var n=function(n){n.$emit("$haCmsFullWidthPromotionReady")},t;return n.$inject=["$scope"],t=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t=n.module("haCmsBodyCopyAdModule",[]);t.directive("haCmsBodyCopyAd",function(){var n=function(n){n.$emit("$haCmsBodyCopyAdReady")},t;return n.$inject=["$scope"],t=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t=n.module("haCmsDetailPageBannerHeadlineModule",[]);t.directive("haCmsDetailPageBannerHeadline",function(){var n=function(n){n.$emit("$haCmsDetailPageBannerHeadlineReady")},t;return n.$inject=["$scope"],t=function(n){n.exampleMethod=function(){return n};n.$on("hacontactusEmailSuccess",function(t,i){(i.showMessageFlag==="SUCCESS"||i.showMessageFlag==="FAIL")&&(n.showmessageContentFlag=i.showMessageFlag,n.showmessageContent=i.showMessage)})},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t=n.module("haCmsSubpageBannerHeadlineModule",["haBreadcrumbModule","shareWidgetModule"]);t.directive("haCmsSubpageBannerHeadline",function(){var n=function(n){n.$emit("$haCmsSubpageBannerHeadlineReady")},t;return n.$inject=["$scope"],t=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t=n.module("haPhotoGalleryModule",["haCarouselModule"]);t.directive("haPhotoGallery",["haGlobals",function(n){var t=function(n){n.$emit("$haPhotoGalleryReady")},i;return t.$inject=["$scope"],i=function(t,i){t.showPhotoGallery=function(){t.isVisible=!0;setTimeout(r(),200)};t.exampleMethod=function(){return t};t.PhotoGallery=[];n("PhotoGalleryVM",function(n){t.PhotoGallery=n});t.slides=i.find(".ha-carousel-slide");t.closeBtnClick=function(){t.isVisible=!1};var r=function(){if($(".ha-photo-gallery .is-mobile").css("display")==="none"){var n=$(window).height();$(".ha-photo-gallery img").css("max-height",n-100);$(".ha-photo-gallery .ha-carousel-slide").css("height",n);$(".ha-photo-gallery .ha-carousel-slide .main-content .paddle").css("height",n)}};$(window).resize(function(){r()});t.showPhotoGallery();r()},{restrict:"A",scope:!0,link:i,controller:t}}])}(angular),function(n){"use strict";var t=n.module("haCmsChildNavSubPageModule",[]);t.directive("haCmsChildNavSubPage",function(){var n=function(n){var t,r,i,u;for(n.$emit("$haCmsChildNavSubPageReady"),t=$(".child-nav-tile"),r=[],i=0;i<t.length;i++)u=$(t[i]),r.push(u.height());t.css("height",Math.max.apply(null,r))},t;return n.$inject=["$scope"],t=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t=n.module("haCmsChildNavFrontPageModule",[]);t.directive("haCmsChildNavFrontPage",function(){var n=function(n){var i,r,t,u;for(n.$emit("$haCmsChildNavFrontPageReady"),i=$(".child-nav-tile"),r=[],t=0;t<i.length;t++)u=$(i[t]),r.push(u.height());$(".child-nav-tile").css("height",Math.max.apply(null,r))},t;return n.$inject=["$scope"],t=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t=n.module("haMainImageContentBlockModule",[]);t.directive("haMainImageContentBlock",function(){var n=function(n){n.$emit("$haMainImageContentBlockReady")},t;return n.$inject=["$scope"],t=function(n,t){n.slides=t.find(".ha-carousel-slide");n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t=n.module("haFeaturedDealsModule",["haCarouselModule"]);t.directive("haFeaturedDeals",[function(){var t=function(t,i,r){var u=n.fromJson(r.dealsData),h=u.DealTiles?u.DealTiles.length:99,f,o,e,s;for(t.toLabelText=r.toLabelText,t.fromLabelText=r.fromLabelText,t.perPersonLabelText=r.perPersonLabelText,t.referenceMark=r.referenceMark,t.defaultColumns=12/u.PerPage,h<3&&(t.defaultColumns=6),t.dealType=u.TileSize||"Small",t.deals=u.DealTiles,f=[],o=-1,e=0;e<t.deals.length;e++)s=t.deals[e],e%u.PerPage==0&&(f.push({group:[]}),o++),f[o].group.push(s);t.dealGroups=f;t.slides=f};return{restrict:"A",scope:!0,link:t}}]);t.directive("haPromoTile",["$rootScope","$filter","$timeout","haConfig",function(n,t,i,r){var u=function(r,u,f){var e=r.$eval(f.model),o,s;r.model=e;e.bgImage={"background-image":"url('"+e.BackgroundImageURL+"')"};e.iconUrl={"background-image":"url('"+e.IconURL+"')"};e.promoType=e.TripType===1?r.oneWayLabelText:r.roundTripLabelText;r.dealType=e.TripType===3?"RichText":r.dealType;e.LowestFare=Math.min(e.MainCabinBasicFare||Number.POSITIVE_INFINITY,e.Fare);r.referenceMark=r.referenceMark||"*";n.footnotes&&n.footnotes.numeric&&n.references||(n.footnotes={numeric:[]},n.references={});n.references[e.DisclaimerGuid]?e.DisclaimerReferenceMark=n.references[e.DisclaimerGuid]:e.Disclaimer&&(n.references[e.DisclaimerGuid]=r.referenceMark+(Object.keys(n.references).length+1),e.DisclaimerReferenceMark=n.references[e.DisclaimerGuid],o=e.LowestFare&&e.LowestFare===e.MainCabinBasicFare,s=o?e.MainCabinBasicDisclaimer:e.Disclaimer,n.footnotes.numeric.push({id:"*"+(n.footnotes.numeric.length+1),text:s}));r.navigateTo=function(n){i(function(){var i;if(!r.isAnimating){if(n.CallToActionType>0){var u=";dd="+t("date")(n.DepartureDate,"MM/dd/yyyy"),f=+e.TripType==1?";rd="+t("date")(n.ReturnDate,"MM/dd/yyyy"):"",o=["searchDetails=o=",n.OriginAirportCode,";d=",n.DestinationAirportCode,u,f,";a=1;c=0;tt=",+n.TripType==0?"1":"2"].join("");i="/book/home?"+o}else i=n.CTALinkURL;location.href=i}},10)}};return{restrict:"A",scope:!0,link:u,templateUrl:r.getTemplateUrl("ha-promo-tile-base-template.html")}}])}(angular),function(n){"use strict";var t=n.module("haSearchResultsModule",[]);t.directive("haSearchResults",["haGlobals","haGlobalHeaderAPI",function(n,t){var i=function(i){i.googleResult=null;n("GoogleSearchResult",function(n){i.googleResult=n});i.$emit("$haSearchResultsReady");i.pagecount=0;i.totalrecords=0;i.pages=[];i.selectedpage=1;i.startPageIndex=1;var r=0;i.IsServiceErrors=!1;i.ServiceErrorMessage="";i.UpdateAll=function(){if(i.googleResult!=null)if(i.googleResult.ErrorMessage)i.IsServiceErrors=!0,i.ServiceErrorMessage=i.googleResult.ErrorMessage;else if(i.googleResult.ErrorMessage==null&&i.googleResult.items!=null){if(i.pagesize=+i.googleResult.queries.request[0].count,i.initialSearchText=i.googleResult.queries.request[0].searchTerms,i.lastSearchText=i.initialSearchText,i.totalrecords=i.googleResult.queries.request[0].totalResults,r=Math.ceil(i.totalrecords/i.pagesize),i.totalPageCount=r,document.body.dispatchEvent(new CustomEvent("SearchResultFired",{detail:i.totalrecords})),r<i.pagesize&&(i.pagesize=r),i.pagecount=r,i.pagesize<=i.pagecount){i.pages.splice(0,15);for(var n=i.startPageIndex;n<=i.pagesize;n++)i.pages.push(n);i.selectedpage=i.pages[0];i.selectedpage===1&&(i.setPrvDisabled=!0);i.pages.length<=1&&(i.setNxtDisabled=!0)}i.googleResult.items!=null&&(i.SearchIndex=i.googleResult.queries.request[0],i.SearchTerms=parseInt(i.googleResult.queries.request[0].startIndex,10)+parseInt(i.SearchIndex.count,10)-1,i.itemsPerPage=i.googleResult.items.length)}};i.NextOrPreviousOrNewSearchText=function(n){t.searchGoogle(n).success(function(n){n.ErrorMessage?(i.IsServiceErrors=!0,i.ServiceErrorMessage=n.ErrorMessage):n&&(i.googleResult=n,i.SearchIndex=i.googleResult.queries.request[0],i.SearchTerms=parseInt(i.googleResult.queries.request[0].startIndex)+parseInt(i.SearchIndex.count)-1);i.$root.isMobile||$("body, html").animate({scrollTop:350},"slow")})};i.NavigateToPage=function(n){var t,r,u;n>1?(i.selectedpage=n,t=i.SearchIndex.searchTerms,r=(i.selectedpage-1)*i.itemsPerPage+1,t=t+"&start="+r+"&sa=N",i.googleResult.SearchPhrase=i.SearchIndex.searchTerms,i.NextOrPreviousOrNewSearchText(t),i.disableNextPagination(),i.disablePreviousPagination()):(i.selectedpage=n,u=i.SearchIndex.searchTerms,i.NextOrPreviousOrNewSearchText(u))};i.nextResult=function(){var n=i.SearchIndex.searchTerms,t=i.selectedpage*i.itemsPerPage+1;n=n+"&start="+t+"&sa=N";i.googleResult.SearchPhrase=i.SearchIndex.searchTerms;i.NextOrPreviousOrNewSearchText(n);i.disableNextPagination()};i.newPreviousResult=function(){var n=i.SearchIndex.searchTerms,t=(i.selectedpage-2)*i.itemsPerPage+1;n=n+"&start="+t+"&sa=N";i.googleResult.SearchPhrase=i.SearchIndex.searchTerms;i.NextOrPreviousOrNewSearchText(n);i.selectedpage--;i.disablePreviousPagination();i.disableNextPagination()};i.NavigateByStep=function(n){var t=i.selectedpage,r,u,f;if(n==="next"){if(!i.setNxtDisabled&&i.selectedpage<10)if(t>=i.pagesize&&t<=i.totalPageCount){for(i.pa=i.pages.splice(1,1),i.pages.splice(0,15),r=i.pa[0];r<=i.pagesize+1;r++)i.pages.push(r);i.nextResult();i.pagesize++;t++;i.selectedpage=t;i.selectedpage>1&&(i.setPrvDisabled=!1)}else i.nextResult(),t++,i.selectedpage=t,i.selectedpage>1&&(i.setPrvDisabled=!1)}else if(n==="prev"&&!i.setPrvDisabled)if(t>=i.pagesize)if(u=i.pages[0],u--,u>0){for(i.pa=i.pages.splice(9,1),i.pages.splice(0,15),f=u;f<=i.pagesize-1;f++)i.pages.push(f);i.newPreviousResult();i.pagesize--;t--;i.selectedpage=t}else i.newPreviousResult(),t--,i.selectedpage=t;else i.newPreviousResult(),t--,i.selectedpage=t};i.searchSubmitBtnClick=function(){if(i.googleResult.SearchPhrase===i.lastSearchText)return!1;var n=i.googleResult.SearchPhrase;n!==""&&n!==i.lastSearchText&&(i.lastSearchText=n,t.searchGoogle(n).success(function(n){if(n.ErrorMessage||n.TranslateServiceError!=="")i.IsServiceErrors=!0,i.ServiceErrorMessage=n.ErrorMessage,document.body.dispatchEvent(new CustomEvent("SearchResultFired",{detail:"0"}));else if(n){i.googleResult=n;i.IsServiceErrors=!1;i.setNxtDisabled=!1;i.pagesize=+i.googleResult.queries.request[0].count;i.pagecount=i.pagesize;i.UpdateAll();var t=i.googleResult.queries.request[0].totalResults;document.body.dispatchEvent(new CustomEvent("SearchResultFired",{detail:t}))}i.$root.isMobile||$("body, html").animate({scrollTop:350},"slow")}))};i.UpdateAll()},r;return i.$inject=["$scope"],r=function(n,t){n.exampleMethod=function(){return n};n.$searchInput=t.find(".search-field");n.$searchSubmitBtn=t.find(".search-submit-btn");n.lastindex=t.find(".last-index");n.firstindex=t.find(".first-index");n.pages.length<=1?(n.setNxtDisabled=!0,n.lastindex.addClass("disabled")):n.setNxtDisabled=!1;n.setPrvDisabled=!0;n.firstindex.addClass("disabled");n.onSearchFieldKeyup=function(){n.googleResult.SearchPhrase===""?n.$searchSubmitBtn.addClass("disabled"):n.$searchSubmitBtn.removeClass("disabled")};n.disableNextPagination=function(){n.pagecount>n.selectedpage?(n.lastindex.removeClass("disabled"),n.setNxtDisabled=!1):n.pagecount<=n.selectedpage+1?(n.lastindex.addClass("disabled"),n.setNxtDisabled=!0):n.setNxtDisabled=!1};n.disablePreviousPagination=function(){n.selectedpage>=2?n.selectedpage<=n.startPageIndex?(n.firstindex.addClass("disabled"),n.setPrvDisabled=!0):n.selectedpage>=2&&(n.firstindex.removeClass("disabled"),n.setPrvDisabled=!1):n.selectedpage<=1&&(n.firstindex.addClass("disabled"),n.setPrvDisabled=!0)};n.activePage=function(){}},{restrict:"A",scope:!0,link:r,controller:i}}])}(angular),function(n){"use strict";var t=n.module("haGlobalAlertsModule",[]);t.directive("haGlobalAlerts",[function(){var n=["$scope","$rootScope",function(n,t){t.haGlobalAlerts={};this.updateHeight=function(n){t.haGlobalAlerts.clientHeight=n}}];return{restrict:"A",require:"haGlobalAlerts",controller:n,link:function(n,t,i,r){var f=t[0],u;r.updateHeight(t.innerHeight());u=!0;n.$watch(function(){return t.innerHeight()},function(n,t){(u||n!==t)&&(u=!1,r.updateHeight(n))})}}}])}(angular),function(n){"use strict";var t=n.module("haMileageStatementModule",[]);t.directive("haMileageStatement",["haGlobals","$filter","filterFilter","haModal",function(t,i,r,u){var f=function(f){f.MileageActivityList=[];f.sortcol="PostedDate";f.mobilesort="PostedDate-Descending";f.reverse=!0;f.sorticon="sort--down";f.pages=[];f.keyword={search:"",activityType:"X",dateType:540};f.pgInfo={currentPage:1,pageNumber:20,maxSize:10};var e=0;f.stringToDate=function(n){return new Date(n)};f.getHelpContent=function(){u("",{id:"mileage-statement-help",backdrop:"true",template:n.element(".getHelpContent")})};f.changePageCount=function(){var n=r(f.InitialMileageActivityList,f.keyword.search),t=i("activityFlt")(n,f.keyword.activityType),u=i("lastDate")(t,f.keyword.dateType);f.totalrecords=u.length};t(["MileageStatementModelJson","milesAbbText"],function(n,t){if(n.MilageActivityDetails!=null){f.pagesize=n.MileageActivityPerPage;e=Math.ceil(f.totalrecords/f.pagesize);f.pagecount=e;for(var i=1;i<=e;i++)f.pages.push(i);f.InitialMileageActivityList=n.MilageActivityDetails;f.changePageCount()}f.AccountInfo=n.AccountInfo;f.MileageSummary=n.MileageSummary;f.milesAbbText=t});f.changeSort=function(n){f.sortcol===n?(f.reverse=!f.reverse,f.sorticon=f.sorticon==="sort--up"?"sort--down":"sort--up"):(f.reverse=!0,f.sorticon="sort--down");f.sortcol=n};f.$watch("mobilesort",function(n,t){if(t!==undefined&&n!==t){var i=n.split("-");i.length===2&&(f.sortcol=i[0],f.reverse=i[1]==="Descending",f.sorticon=f.reverse?"sort--down":"sort--up")}})};return f.$inject=["$scope"],{restrict:"A",scope:!0,controller:f}}]).filter("activityFlt",[function(){return function(t,i){if(!t)return[];var r=[];return n.forEach(t,function(n){n.ActivityFilter&&n.ActivityFilter.indexOf(i)!==-1&&r.push(n)}),r}}]).filter("lastDate",[function(){return function(t,i){if(!t)return[];var r=[],u=new Date;return n.forEach(t,function(n){var t=new Date(n.ActivityDateDisplay),f=Math.abs(u.getTime()-t.getTime()),e=Math.ceil(f/864e5);e<=+i&&r.push(n)}),r}}]).filter("positivePlus",function(){return function(n){var t=parseInt(n);return t>0?"+"+n:n}})}(angular),function(n){"use strict";var t=n.module("haReshopSelectionModalModule",[]);t.directive("haReshopSelectionModal",function(){var n=function(n){n.$emit("$haReshopSelectionModalReady")},t;return n.$inject=["$scope"],t=function(n,t){n.exampleMethod=function(){return n};n.$paxSelect=t.find(".pax-select");n.$flightSelect=t.find(".flight-select");n.$seeFlightsBtn=t.find(".see-flights-btn");n.$continueBtn=t.find(".continue-btn");n.selectedPax=[0,1];n.selectedLegs=[];n.closeChangeFlightsBtnClick=function(){t.hide()};n.continueBtnClick=function(){n.transitionFromPaxToFlights()};n.transitionFromPaxToFlights=function(){n.$paxSelect.addClass("hide");n.$flightSelect.addClass("expand")};n.enableContinueBtn=function(t){t?n.$continueBtn.removeClass("disabled"):n.$continueBtn.addClass("disabled")};n.togglePaxSelect=function(t){n.isPaxSelected(t)?n.removePax(t):n.addPax(t);n.enableContinueBtn(n.selectedPax.length>0)};n.addPax=function(t){n.selectedPax.indexOf(t)===-1&&n.selectedPax.push(t)};n.removePax=function(t){n.selectedPax.indexOf(t)!==-1&&n.selectedPax.splice(n.selectedPax.indexOf(t),1)};n.isPaxSelected=function(t){return n.selectedPax.indexOf(t)>=0};n.showFlightControlsForLeg=function(i){n.$currentLegControls=t.find(".leg-"+i+"-controls");n.isLegSelected(i)?(n.removeLeg(i),n.$currentLegControls.removeClass("expand")):(n.addLeg(i),n.$currentLegControls.addClass("expand"));n.enableSeeFlightsBtn(n.selectedLegs.length>0)};n.enableSeeFlightsBtn=function(t){t?n.$seeFlightsBtn.removeClass("disabled"):n.$seeFlightsBtn.addClass("disabled")};n.addLeg=function(t){n.selectedLegs.indexOf(t)===-1&&n.selectedLegs.push(t)};n.removeLeg=function(t){n.selectedLegs.indexOf(t)!==-1&&n.selectedLegs.splice(n.selectedLegs.indexOf(t),1)};n.isLegSelected=function(t){return n.selectedLegs.indexOf(t)>=0}},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t=n.module("haEcDowngradeModalModule",[]);t.directive("haEcDowngradeModal",function(){var n=function(n){n.$emit("$haEcDowngradeModalReady")},t;return n.$inject=["$scope"],t=function(n,t){n.exampleMethod=function(){return n};n.closeECDowngradeBtnClick=function(){t.removeClass("is-open")};n.continueDowngradeBtnClick=function(){n.closeECDowngradeBtnClick();n.callEditSeatConfirmationService()};n.selectECSeatBtnClick=function(){t.removeClass("is-open")}},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t,i,r=1,u=n.module("haMyTripsItineraryDetailsModule",["haItineraryAPI"]);u.directive("haMyTripsItineraryDetails",["$timeout","haGlobals","haConfig","haItineraryAPI","$http","$window","haUtils","haHttpService","$location","$anchorScroll","haDateUtils","$document","haPassengersService","haAirportTimezones",function(u,f,e,o,s,h,c,l,a,v,y,p,w,b){var k=h.ItineraryDetailsJson,d=function(s,y,p,d,g){var rt,ut,tt,nt,it;if(s.inFlightEntertainmentInfo=null,s.planeCodes={},f("HA",function(n){n&&n.SCStrings&&n.SCStrings.entertainment_data&&(s.inFlightEntertainmentInfo=n.SCStrings.entertainment_data)}),f("PlaneCodes",function(n){s.planeCodes=n}),f("ItineraryDetailsJson",function(t){var i,u,f;if(l.GET("/planes/configuration").success(function(t){var i=function(n){for(var r,u=t||[],i=0,f=u.length;i<f;i++)if(r=u[i],$.inArray(n,r.codes)>-1)return r;return undefined};n.forEach(s.VM.Segments,function(t){n.forEach(t.Flights,function(n){var t=i(n.EquipmentType);!t||!t.name||(n.EquipmentType=t.name)})})}),PartnerAirlinesContent!=null&&(s.partnerAirlinesContent=PartnerAirlinesContent),t!=null){for(s.VM=t,s.VM.lastnameFirst=lastnameFirst,s.VM&&s.VM.IsMilesMaximizerEligible&&document.body.dispatchEvent(new CustomEvent("MilesMaximizerOffered")),s.requestsentcheck=!1,s.RemovalSuccess=!1,s.cancelCurrencyMatch=!0,s.purchaseCurrencyMatch=!0,s.cancelClicked=[],s.purchaseClicked=[],s.VM.HoldTripsList=t.HoldTrip,s.VM.HoldTripsList==null&&(s.VM.HoldTripsList=[]),i=0;i<s.VM.HoldTripsList.length;i++)s.VM.HoldTripsList[i].tripType="held",s.VM.HoldTripsList[i].Removed=!1;s.VM.SavedAndHeldTrips=s.VM.HoldTripsList;t.MaxRecordsPerPage!==""&&(r=t.MaxRecordsPerPage);s.upcomingTripsLimit=r;s.savedHeldTripsLimit=r;p.Passengers=t.Travellers;p.HasPaidSeat=t.HasPaidSeat;u=!0;t.Tickets!=null&&t.Tickets.length>0&&n.forEach(t.Tickets,function(t){u&&t.ETicket!=null&&t.ETicket.length>0&&n.forEach(t.ETicket,function(n){n.Status===0&&(s.ticketNo=n.Value,u=!1)})});n.forEach(p.Passengers,function(n){n.DOB!=null&&(n.DOB=moment(n.DOB).toDate())});t.VacationPackageHotelDetail.Address!=null&&t.VacationPackageHotelDetail.Room.length>0&&(s.hotel=t.VacationPackageHotelDetail,s.hotel!=null&&(s.VM.ReservationCode=s.hotel.ConfirmationNumber,s.hideChangeSeats=!1,s.hideUpdateTravelerInfo=!0,s.hideViewOrPrintReceipt=!0,s.showCallUsToChange=!0));s.IsOnlineUpgradeEligible=!1;n.forEach(t.Segments,function(t){n.forEach(t.Flights,function(n){n.IsOnlineUpgradeEligible&&(s.IsOnlineUpgradeEligible=!0)})});f=p.Passengers.filter(function(n){return n.IsLoggedinPassenger})[0];f===undefined&&(s.IsOnlineUpgradeEligible=!1)}}),f("ItineraryReceiptJson",function(n){n!=null&&(s.VM.ReservationCode=n.ReservationCode)}),s.inFlightEntertainmentInfo!==null&&s.inFlightEntertainmentInfo.airplanes!==undefined&&s.inFlightEntertainmentInfo.airplanes!=="")for(rt in s.planeCodes)if(ut=s.planeCodes[rt],tt=s.inFlightEntertainmentInfo.airplanes.filter(function(n){if(typeof n.codes!="undefined")return n.codes.filter(function(n){return n.value===ut}).length>0}).length>0,tt){s.VM.IsEntertainment=tt;break}$scs.get("UPGRADE_MODAL").then(function(n){n.starthoursbeforedeparture!==undefined&&n.endhoursbeforedeparture!==undefined&&(s.upgradeStart=Number(n.starthoursbeforedeparture),s.upgradeEnd=Number(n.endhoursbeforedeparture))});s.openUpgradeModal=function(){s.VM.allLegs=Array.prototype.concat.apply([],s.VM.Segments.map(function(n){return n.Flights}));g(e.getTemplateUrl("ha-upgrade-modal.html"),{id:"upgrade-modal",backdrop:"true",scope:s,extendScope:{trip:s.VM,parent_view:"itinerary"},cancel:{label:"Close",fn:function(){s.resetModalData()}}})};$scs.get("Car_Ancillary").then(function(n){s.scContent=n});s.redirectToCarSupplierSite=function(){var t=s.scContent.supplierpartnerid,i=k.lstAncillaryPurchases[0].SupplierConfirmCode,r=k.LastName,u=c.getLocale(s.$root.$language),f={pid:t,profileAddition:!0,locale:u,lastName:r,confNumber:i},n=s.scContent.supplierloyaltywebsiteurl;n+=c.createQueryString(f);window.location.href=n};s.resetModalData=function(){n.forEach(s.VM.allLegs,function(n){n.selected=!1;n.platinum_pax=!1;n.optional_pax=""})};s.getDepartDateFromStartDate=function(){var n=moment(k.PeriodStartDateRaw).toDate();return n.getMonth()+1+"/"+n.getDate()+"/"+n.getFullYear()};s.hideChangeSeats=k.IsScheduleChange||k.IsMainCabinBasicItinerary||k.HasUCSegments||!w.isAdultInFlight(p.Passengers,s.getDepartDateFromStartDate());s.addToCalendar=function(){s.$broadcast("$closeCustomDropdown");s.googleCalendarLinks=[];var i=[],r="Flights.ics",t="";$scs.get("UPCOMING_TRIPS").then(function(t){n.forEach(s.VM.flightAndSeat,function(n,r){b.getAirportTimeZone(n.flightInfo.DepartureCityCode).then(function(u){var l=moment.tz.guess(),a=parseInt(n.flightInfo.DepartureTimeMilitaryTime.substring(0,2)),v=parseInt(n.flightInfo.DepartureTimeMilitaryTime.substring(2,4)),d=parseInt(n.flightInfo.ArrivalTimeMilitaryTime.substring(0,2)),g=parseInt(n.flightInfo.ArrivalTimeMilitaryTime.substring(2,4)),h,c,f,e,o;n.flightInfo.FlightDuration.length>4?(h=parseInt(n.flightInfo.FlightDuration.substring(0,2)),c=parseInt(n.flightInfo.FlightDuration.substring(4,6))):(h=0,c=parseInt(n.flightInfo.FlightDuration.substring(1,3)));f=moment.tz(n.flightInfo.DepatureDateRaw,u.timezone);e=moment.tz(n.flightInfo.DepatureDateRaw,u.timezone);f.add(a,"hours");f.add(v,"minutes");o=f.clone().tz(l).format("YYYYMMDDTHHmm00");e.add(a+h,"hours");e.add(v+c,"minutes");var y=e.clone().tz(l).format("YYYYMMDDTHHmm00"),w=t.addtocalendardetailflightinfo+" "+moment(n.flightInfo.DepatureDateRaw).format("MM/DD/YYYY")+" "+n.flightInfo.FlightNumber+" "+n.flightInfo.DepartureCityCode+"➞"+n.flightInfo.ArrivalCityCode+" "+n.flightInfo.DepartureTime+" ("+u.timezone+").",b=t.addtocalendardetailmanage+" "+window.host+"/manage.",k=t.addtocalendardetailcontact+" "+window.host+"/contact-us.",p=w+" "+b+" "+k;s.googleCalendarLinks[r]="https://www.google.com/calendar/render?action=TEMPLATE&text="+n.flightInfo.DepartureCityCode+"➞"+n.flightInfo.ArrivalCityCode+"&dates="+o+"/"+y+"&location="+n.flightInfo.DepartureCity+"&details="+p;i.push("BEGIN:VEVENT\nDTSTAMP:"+o+"\nORGANIZER;CN=Hawaiian Airlines:MAILTO::support@hawaiianairlines.com\nDTSTART:"+o+"\nDTEND:"+y+"\nLOCATION:"+n.flightInfo.DepartureCity+"\nSUMMARY:"+n.flightInfo.DepartureCityCode+"➞"+n.flightInfo.ArrivalCityCode+", "+n.flightInfo.FlightDuration+"\nDESCRIPTION:"+p+"\nEND:VEVENT\n")})})});s.downloadICS=function(){var f,e,u;t="BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Hawaiian Airlines//NONSGML v1.0//EN\n";n.forEach(i,function(n){t+=n});t+="END:VCALENDAR";f=new Blob([t],{type:"text/calendar"});e=URL.createObjectURL(f);window.navigator&&window.navigator.msSaveBlob?window.navigator.msSaveBlob(f,r):(u=document.createElement("a"),u.href="data:text/calendar;charset=utf-8,"+encodeURIComponent(t),u.download=r,document.body.appendChild(u),u.click(),u.remove())};$("html").hasClass("lte-ie9")||navigator.userAgent.match("CriOS")||(s.icsSupported=!0);s.lang=p.$language;g(e.getTemplateUrl("ha-add-to-calendar-modal.cshtml"),{id:"addToCalendarModal",backdrop:!0,modalLock:!1,scope:s})};s.print=function(){s.dismissDropdown();u(function(){window.print()},1e3)};s.dismissDropdown=function(){s.$broadcast("$closeCustomDropdown")};s.scrollToAnchor=function(n){a.hash(n);v()};nt=window.location.hash.substr(2);nt&&nt.length&&(nt==="print"?s.print():s.scrollToAnchor(nt));s.createLegs=function(n){d.createLegs(n,!1)};s.addLeg=function(){p.selections.legs.push({});d.setLegDate(p.selections.legs.length-1)};s.updateLegDates=function(){d.updateLegDates()};s.$emit("$haMyTripsItineraryDetailsReady");s.$on("$haDataLoaded",function(){s.currency=s.Currency;s.isMileagePricing=s.isMileagePricing;s.isMileagePricing&&(s.currency="MILES");s.$broadcast("calcTaxes")});p.$on("grandTotal",function(n,t){s.grandTotal=t()[s.Currency]});it="my-trips-modify-pax";s.modifyPax=function(){p.editTravelerSuccess=!1;g("/MyAccount/EditPassengerInfo/EditPassengerInfo",{id:it})};s.optionalCancellationEmailAddress="";s.confirmedOptionalCancellationEmailAddress="";s.optionalEmailAddressMatch=!0;s.showSscModal=function(){s.waiverModalBehaviour="default";g(e.getTemplateUrl("ha-ssc-modal.html"),{id:"ha-ssc-modal",backdrop:"true",scope:s,modalLock:!0,size:"custom-modal-width"})};s.updateOptionalAdditionalEmailAddressField=function(){s.optionalCancellationEmailAddress=document.getElementById("optionalEmailAddress").value};s.updateConfirmedOptionalCancellationEmailAddress=function(){s.confirmedOptionalCancellationEmailAddress=document.getElementById("confirmOptionalEmailAddress").value};s.optionalEmailAddressesMatch=function(){s.optionalEmailAddressMatch=s.optionalCancellationEmailAddress!==s.confirmedOptionalCancellationEmailAddress?!1:!0};s.submitCancellation=function(n,t){s.submitting=!0;o.CancelWaiverPnr(n,t,s.optionalCancellationEmailAddress).success(function(n){n&&n.success?(s.waiverModalBehaviour="success",s.submitting=!1,document.body.dispatchEvent(new CustomEvent("successCancelModal",{detail:{isCancelled:!0}}))):(s.waiverModalBehaviour="failure",s.submitting=!1,document.body.dispatchEvent(new CustomEvent("failureCancelModal",{detail:{isCancelled:!1}})))}).error(function(){s.waiverModalBehaviour="failure";s.submitting=!1;document.body.dispatchEvent(new CustomEvent("failureCancelModal",{detail:{isCancelled:!1}}))})};s.postSuccessWaiverCancellation=function(){h.location.href=isLoggedIn?"/my-account":"/my-account/my-trips/manage-trip-itinerary"};s.confirmRemoveHeldTrip=function(t){var i=p.$new(!0,s);i.RemoveHoldTripIndex=t;s.VM.SavedAndHeldTrips[i.RemoveHoldTripIndex].PNRCurrencyCode!==s.VM.CookiesCurrencyCode?(s.cancelCurrencyMatch=!1,s.cancelClicked[i.RemoveHoldTripIndex]=!0,s.currencyMismatchPNR=s.VM.SavedAndHeldTrips[i.RemoveHoldTripIndex].ReservationCode,s.heldCurrency=s.VM.SavedAndHeldTrips[i.RemoveHoldTripIndex].PNRCurrencyCode,s.siteCurrency=s.VM.CookiesCurrencyCode):(s.cancelCurrencyMatch=!0,i.removeHeldTrip=function(){var n={cancelHoldTripRQ:{RecordLocator:s.VM.SavedAndHeldTrips[i.RemoveHoldTripIndex].ReservationCode,LastName:s.VM.LastName}};i.RequestingRemoval=!0;s.VM.RemoveRequestSent=!1;l.POST("/MyAccount/ItineraryDetails/CancelHoldTrip",n).success(function(n){s.loading=!1;s.VM.RemoveRequestSent=!0;i.RequestingRemoval=!1;s.RemovalSuccess=n.PNRCancelStatus;s.holdremovedorig=s.VM.SavedAndHeldTrips[i.RemoveHoldTripIndex].OriginCityCode;s.holdremoveddest=s.VM.SavedAndHeldTrips[i.RemoveHoldTripIndex].DestinationCityCode;s.VM.SavedAndHeldTrips[i.RemoveHoldTripIndex].Removed=!0;i.$modalCancel()}).error(function(){s.VM.RemoveRequestSent=!0;s.RemovalSuccess=!1;i.RequestingRemoval=!1;i.$modalCancel()})},g("/Areas/MyAccount/Views/Renderings/Shared/_Held_Trips.cshtml",{id:"cancel-held-trip",backdrop:"true",template:n.element(".remove-held-booking"),scope:i}),s.RemovalSuccess=!1)};s.checkCurrency=function(n){s.VM.SavedAndHeldTrips[n].PNRCurrencyCode!==s.VM.CookiesCurrencyCode?(s.purchaseCurrencyMatch=!1,s.purchaseClicked[n]=!0,s.currencyMismatchPNR=s.VM.SavedAndHeldTrips[n].ReservationCode,s.heldCurrency=s.VM.SavedAndHeldTrips[n].PNRCurrencyCode,s.siteCurrency=s.VM.CookiesCurrencyCode):(s.submitting=!0,s.purchaseCurrencyMatch=!0,h.location.href="/Book/Itinerary/HeldItinerary?enc=1&pnr="+s.VM.SavedAndHeldTrips[n].EncryptedReservationCode+"&lastName="+s.VM.SavedAndHeldTrips[n].EncryptedLastName)};s.SearchNewFlights=function(t){t.preventDefault();$(".LoadingTextReshop").css("display","block");n.forEach(s.ChangeFlightModel.travellerInfo,function(n,t){n.IsSelectedPax=s.selectedPax.indexOf(t)>-1?!0:!1});var i;n.forEach(s.ChangeFlightModel.ChangeFlight,function(t,r){s.selectedLegs.indexOf(r)>-1&&(t.isSelectedFlight=!1,i=s.ChangeFlightModel.ChangeFlight[r],i&&n.isDate(i.OriginDateTime)&&(t.OriginDate=moment(i.OriginDateTime).format("MM/DD/YYYY"),t.isSelectedFlight=!0))});o.UpdatePaxAndFlightDetails(s.ChangeFlightModel).success(function(t){t.IsSuccess?($(".LoadingTextReshop").css("display","none"),s.isInvalidSearch=!1,s.isFlightSearchMsg="",n.element("#changeFlightForm").submit()):(s.isInvalidSearch=!0,s.isFlightSearchMsg=t.Message,$(".LoadingTextReshop").css("display","none"))}).error(function(){})};s.GetReceiptInfo=function(){o.GetReceiptInfo(s.ticketNo).then(function(t){t=t.data||t;t.responseBaseModel.IsSuccess?(n.forEach(t.ChangeFlight,function(n){n.OriginDateTime=new Date(parseInt(n.OriginDateTime.match(/\d+/)[0],10));n.DestinationDateTime=new Date(parseInt(n.DestinationDateTime.match(/\d+/)[0],10))}),n.forEach(t.OldFlightDetails,function(n){n.OriginDateTime=new Date(parseInt(n.OriginDateTime.match(/\d+/)[0],10));n.DestinationDateTime=new Date(parseInt(n.DestinationDateTime.match(/\d+/)[0],10))}),s.ChangeFlightModel=t,s.trips=t.ChangeFlight,s.tripsOld=t.OldFlightDetails,s.paxDetails=t.travellerInfo,s.selectedPax=[],n.forEach(t.travellerInfo,function(n,t){s.selectedPax.push(t)}),s.enableContinueBtn(s.selectedPax.length>0),s.Initialize(),s.loading=!1):(t.ErrorMsgDescription!=null&&t.ErrorMsgDescription.length>0&&(p.errorMsg=t.ErrorMsgDescription,p.hasError=!0),s.closeReshopModal())},function(n){n.ErrorMsgDescription.length>0&&(p.errorMsg=n.ErrorMsgDescription,p.hasError=!0);s.closeReshopModal()});$(".ha-modal").animate({scrollTop:0},"slow");u(function(){p.$apply()},0)};s.showItineraryHelp=function(){g("",{id:"itinerary-help",backdrop:"true",template:n.element(".getHelpContent")})};s.displayReshopModal=function(){s.reshopModal=g(e.getTemplateUrl("ha-reshop-selection-modal.html"),{backdrop:!0,id:"reshop-selection",scope:s,cancel:{label:"Close",fn:function(){s.resetReshopModal()}}})};s.Initialize=function(){s.createLegs(s.trips.length);var t=0;n.forEach(s.trips,function(){p.selections.legs[t].origin=s.trips[t].OriginCityCode;p.selections.legs[t].originCityData={};p.selections.legs[t].originCityData.Code=s.trips[t].OriginCityCode;p.selections.legs[t].destination=s.trips[t].DestinationCityCode;p.selections.legs[t].destinationCityData={};p.selections.legs[t].destinationCityData.Code=s.trips[t].DestinationCityCode;var n=new Date(s.trips[t].OriginDateTime);p.selections.legs[t].date={year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate()};t++})};p.editTravelerSuccess=!1;p.editPax=function(t,r){p.editingPax=!0;p.hasError=!1;p.editTravelerSuccess=!1;p.EditTraveler=n.copy(t);p.EditTraveler.index=r;p.EditTraveler.HasHMNumber=t.HMNumber&&t.HMNumber.length>0?"Yes":"No";n.forEach(p.Passengers,function(n,t){p.Passengers[t].Editing=t===r?!0:!1});i=r;u(function(){p.$apply();g({id:"update-pax-info",backdrop:"true",templateUrl:"/editPaxMobile.html",scope:s})},0)};t=s.Passengers;p.saveTraveler=function(i,r){u(function(){var f,e,h;p.errorMsg="";p.hasError=!1;f=new Date(i.TravelDate);f=f.getMonth()+1+"/"+f.getDate()+"/"+f.getFullYear();i.HMNumber=i.HasHMNumber==="Yes"?i.HMNumber:null;p.currentTraveler=n.copy(i);p.currentTraveler.TravelDate=f;e=$(r.target);h=e.scope()[e.attr("name")];h.$valid?(p.working=!0,o.updatePassengerInfo(s.VM.ReservationCode,p.currentTraveler).success(function(r){s.$broadcast("$modalCancel","update-pax-info");r.Travellers!=null&&r.Travellers.length>0&&r.IsSuccess?(p.Passengers=r.Travellers,n.forEach(p.Passengers,function(n){n.DOB!=null&&(n.DOB=new Date(parseInt(n.DOB.substr(6))));n.TravelDate=i.TravelDate}),t=r.Travellers,p.working=!1,p.Passengers[p.EditTraveler.index].Editing=!1,p.editingPax=!1,p.editTravelerSuccess=!0,p.hasError=!1):(p.working=!1,p.editTravelerSuccess=!1,r.ErrorMsgDescription.length>0&&(p.errorMsg=r.ErrorMsgDescription,p.hasError=!0))}).error(function(n){p.working=!1;p.editTravelerSuccess=!1;n.ErrorMsgDescription.length>0&&(p.errorMsg=n.ErrorMsgDescription,p.hasError=!0)}),$(".ha-modal").animate({scrollTop:0},"slow"),u(function(){p.$apply()},0)):(p.working=!1,p.editTravelerSuccess=!1)},0)};p.cancelEditPax=function(){p.hasError=!1;p.editingPax=!1;$(".ha-modal").animate({scrollTop:0},"slow")};p.$on("haModalClosed",function(n,t){if(t===it){p.working=!1;p.hasError=!1;p.editTravelerSuccess=!1;p.editingPax=!1;for(var i=0;i<p.Passengers.length;i++)p.Passengers[i].Editing=!1}});s.$on("OnlineUpgradeRqSuccess",function(n,t){s.isReloading=!0;l.POST("/MyAccount/ItineraryDetails/GetItineraryVM",{pnr:t.ReservationCode,lastName:t.LastName}).then(function(n){n.status===200&&(s.VM.AreAllSegmentsOnlineUpgraded=n.data.AreAllSegmentsOnlineUpgraded,s.VM.OnlineUpgradePassengers=n.data.OnlineUpgradePassengers,s.VM.Segments=n.data.Segments);s.isReloading=!1})});s.showChangeSeatsPage=function(){c.checkForInfant(s.VM)?c.checkIfTicketedInfant(s.VM)?h.location.href="/my-account/my-trips/select-or-upgrade-seats":s.infantChangeSeatsError=!0:h.location.href="/my-account/my-trips/select-or-upgrade-seats"}},g;return d.$inject=["$scope","haItineraryAPI","$rootScope","haCustomerSelections","haModal"],g=function(t,i,r){function e(n){u(function(){t.calendarOpen[n]=!1},500)}function h(){p.off("click.closeCalendar");p.on("click.closeCalendar",function(i){var r=$(i.target);r.closest(".originDestinationWrap0").length||(p.off("click.closeCalendar"),n.forEach(t.calendarOpen,function(n,t){e(t)}),t.$digest())})}t.modalData=JSON.parse(r.modalData);t.continueButtonDisabled=!0;t.paxHide=!1;t.flightSelectExpand=!1;t.seeFlightsDisabled=!0;t.selectedPax=[];t.selectedLegs=[];t.isInvalidSearch=!1;t.isFlightSearchMsg="";t.isChecked=!0;t.isSuccess=t.VM.isSuccess||c.checkForInfant(t.VM)&&c.checkIfTicketedInfant(t.VM);t.showReshopModal=function(){t.displayReshopModal();t.loading=!0;u(function(){o.IsEligibleForChangeFlight().then(function(n){n=n.data||n;n.IsEligible?t.GetReceiptInfo():!n.ErrorCode&&c.checkForInfant(t.VM)&&c.checkIfTicketedInfant(t.VM)?t.GetReceiptInfo():(t.Message=n.Message,t.closeReshopModal())},function(){t.Message="Unable to determine eligibility";t.closeReshopModal()})},0)};t.closeReshopModal=function(n){t.$modalCancel(n);t.$modalClose&&t.$modalClose()};t.resetReshopModal=function(){t.paxHide=!1;t.flightSelectExpand=!1;$("#changeflight").css("display","block");t.selectedLegs=[];t.loading=!1};t.closeChangeFlightsBtnClick=function(){t.$modalClose&&t.$modalClose()};t.hasUnselectedChildPax=!1;t.continueBtnClick=function(){if(t.continueButtonDisabled)return!1;var i=0,r=!1,u=!1;t.hasUnselectedChildPax=!1;n.forEach(t.paxDetails,function(n){i++;n.Type==="CHD"&&(u=!0);n.IsSelectedPax||(r=!0);i===t.paxDetails.length&&(u&&r?t.hasUnselectedChildPax=!0:t.transitionFromPaxToFlights())})};t.transitionFromPaxToFlights=function(){t.paxHide=!0;t.flightSelectExpand=!0};t.enableContinueBtn=function(n){t.continueButtonDisabled=!n};t.togglePaxSelect=function(n,i){i===!0||i==="true"||(t.isPaxSelected(n)?t.removePax(n):t.addPax(n),t.enableContinueBtn(t.selectedPax.length>0))};t.addPax=function(n){t.selectedPax.indexOf(n)===-1&&t.selectedPax.push(n)};t.removePax=function(n){t.selectedPax.indexOf(n)!==-1&&t.selectedPax.splice(t.selectedPax.indexOf(n),1)};t.isPaxSelected=function(n){return t.selectedPax.indexOf(n)>=0};t.showFlightControlsForLeg=function(n,r){r===!0||r==="true"||(t.$currentLegControls=i.find(".leg-"+n+"-controls"),t.isLegSelected(n)?(t.showLeg=undefined,t.removeLeg(n)):(t.showLeg=n,t.addLeg(n)),t.enableSeeFlightsBtn(t.selectedLegs.length>0))};t.enableSeeFlightsBtn=function(n){t.seeFlightsDisabled=n?!1:!0};t.addLeg=function(n){t.selectedLegs.indexOf(n)===-1&&t.selectedLegs.push(n)};t.removeLeg=function(n){t.selectedLegs.indexOf(n)!==-1&&t.selectedLegs.splice(t.selectedLegs.indexOf(n),1)};t.isLegSelected=function(n){return t.selectedLegs.indexOf(n)>=0};t.activateWidget=function(){i.removeClass("closed");i.addClass("expanded");u(function(){i.addClass("active");i.find("[ha-carousel]").each(function(){$(this).scope().gotoSlide(2)})},1e3)};t.calendarOpen=[];n.forEach(t.trips,function(){t.calendarOpen.push(!1)});t.currentDateChoice="departDate";t.departDate="";t.idx=0;t.$on("dateInputFocused",function(n,i,r){t.idx=r;t.calendarOpen[r]=!0;h()});t.$on("setDate",function(i,r){t.trips[t.idx].OriginDateTime=r;n.forEach(t.calendarOpen,function(n,t){e(t)});t.$digest()});var f=new Date,s=new Date((new Date).setDate(f.getDate()+331)),l=s.getMonth(),a=f.getMonth();t.monthsToShow=12-a+l;t.getIsUnavailable=function(n){return y.isBefore(n,f)||y.isAfter(n,s)};t.isShowRightUpsell=t.VM.lstAncillaryUpSellsRight&&t.VM.lstAncillaryUpSellsRight.length>0&&!t.VM.IsGroupPNR},{restrict:"A",scope:!0,link:g,controller:d}}]);u.directive("validTravelerNo",function(){return{require:"ngModel",link:function(r,u,f,e){r.$watch(f.ngModel,function(n){e.$setValidity("duplicateTravelerNo",!0);r.isValidTravelerNo=!1;r.checkDuplicateTravelerNo(n);e.$setValidity("duplicateTravelerNo",!r.isValidTravelerNo)});r.checkDuplicateTravelerNo=function(u){n.forEach(t,function(n){n.KnownTravelerNumber&&t[i].KnownTravelerNumber!==n.KnownTravelerNumber&&u===n.KnownTravelerNumber&&(r.isValidTravelerNo=!0)})}}}});u.directive("validHmNumber",["haItineraryAPI",function(n){return{require:"ngModel",link:function(r,u,f,e){r.$watch(f.ngModel,function(r){e.$setValidity("hmNumberNotFound",!0);var u=r==="",f=!u&&r!=null&&r.length===9,o=!u&&!/^\d+$/.test(r);u||!f||o||n.isValidHMAccount(r,t[i].FirstName,t[i].LastName).success(function(n){n!=null&&n==="false"?e.$setValidity("hmNumberNotFound",!1):e.$setValidity("hmNumberNotFound",!0)}).error(function(){e.$setValidity("hmNumberNotFound",!1)})})}}}])}(angular),function(n){"use strict";var t=n.module("haPrintConfirmationModule",[]);t.directive("haPrintConfirmation",function(){var n=function(n,t,i){n.$emit("$haPrintConfirmationReady");n.$on("$haDataLoaded",function(){t.add(n.Passengers);n.selectedSegments=n.Trips[0].Segments;n.currency=n.Currency;n.isMileagePricing&&(n.currency="MILES");n.$broadcast("calcTaxes")});i.$on("grandTotal",function(t,i){n.grandTotal=i});n.taxDetails=!0},t;return n.$inject=["$scope","haPassengersService","$rootScope"],t=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t=n.module("haAccountLandingModule",[]);t.directive("haAccountLanding",function(){var n=function(n){n.$emit("$haAccountLandingReady")},t;return n.$inject=["$scope"],t=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t=n.module("travelCreditRedemptionModule",["haEcertAPI"]);t.directive("travelCreditRedemption",["$location","haEcertAPI","haGlobals","haConfig","haModal",function(t,i,r,u,f){var e=function(e){r(["monthDropDown","yearDropDown","dayDropDown"],function(n,t){e.monthDropDown=n;e.yearDropDown=t});e.dayDropDown=function(n,t){while(n--)t[n]=(n+1).toString();return t}(31,[]);e.yearDropDown=function(n,t){while(n--)t[n]=(n+(new Date).getFullYear()-2).toString();return t}(3,[]);e.$emit("$travelCreditRedemptionReady");e.travelCreditModel={};e.isLoading=!1;var o={},s=t.absUrl().slice(t.absUrl().indexOf("?")+1).split("&");n.forEach(s,function(n){var t=n.split("=");t[0]&&t[1]&&(o[t[0]]=t[1])});!o.invalid||(e.hasError=!0,e.errorCode=101);e.submitClicked=function(t,r){e.hasError=!1;e.errorCode=null;t.preventDefault();r.$valid&&(e.isLoading=!0,i.getPassengerCredit(e.travelCreditModel).success(function(t){e.isLoading=!1;t.ETCOStatus===6?window.location.href="/Book/Home":t.ETCOStatus===8?(e.pnrModel={},e.pnrList=n.copy(t.Passengers),f(u.getTemplateUrl("duplicate-PNR-modal.html"),{id:"duplicate-PNR-modal",backdrop:"true",scope:e})):(e.hasError=!0,e.errorCode=t.ETCOStatus);t.HasServiceError===!0&&(e.hasError=!0,e.errorCode=100,e.errorMessage=t.ErrorCode)}).error(function(){e.isLoading=!1;e.hasError=!0}))};e.selectPassenger=function(){e.isLoading=!0;i.selectDuplicatePassenger(e.pnrModel.pnr).success(function(n){n.IsValid?window.location.href="/Book/Home":(e.isLoading=!1,e.hasError=!0,e.errorCode="custom",e.errorMessage=n.ErrorMessage,e.$modalCancel())}).error(function(){e.isLoading=!1})};e.showResultsHelp=function(){i.fetchPopup("GetHelpPopup").success(function(n){f({id:"results-help",backdrop:"true",template:n})})}};return e.$inject=["$scope"],{restrict:"A",scope:!0,controller:e}}])}(angular),function(n){"use strict";var t=n.module("haFlightStatusModule",[]);t.directive("haFlightStatus",["haGlobals","$window",function(t,i){var r=i.serverShortDate,u=function(i,u){if(t("jsonFSModel",function(n){i.FSByFlightNoModel=n}),typeof Storage!="undefined")try{sessionStorage.flightStatus=!0}catch(e){}i.createLegs=function(n){u.createLegs(n,!1)};setTimeout(function(){n.element("#DepartureDate").click()},1e3);i.FlightDelayStatus={latedeparture:"Late Departure",latearrival:"Late Arrival",delayed:"Delayed",cancelled:"Cancelled"};i.FlightOnTimeStatus={ontime:"on Time",earlyarrival:"Early Arrival"};i.departureDateToday=typeof r!="undefined"?new Date(r):new Date;i.departureDateTomorrow=typeof r!="undefined"?new Date(r):new Date;i.departureDateYesterday=typeof r!="undefined"?new Date(r):new Date;i.departureDateTomorrow.setDate(i.departureDateToday.getDate()+1);i.departureDateYesterday.setDate(i.departureDateToday.getDate()-1);var f=new Date;i.DepartureDate=[f.getMonth()+1,f.getDate(),f.getFullYear()].join("/");t("jsonFlightResultModel",function(n){i.OperatedBy=n.OperatedBy;i.FlightNo=n.FlightNumber;i.Origin=n.Origin;i.Destination=n.Destination;i.FlightStatus=n.FlightStatus;i.AircraftType=n.AircraftType;i.EquipmentType=n.EquipmentType;n.FlightStatus==="Delayed"?i.FlightStatusStyle="delayed":n.FlightStatus==="Arrived"||n.FlightStatus==="Landed"?i.FlightStatusStyle="arrived":n.FlightStatus==="Scheduled"||n.FlightStatus==="Delayed"||n.FlightStatus==="Cancelled"?i.FlightStatusStyle="scheduled":(n.FlightStatus==="Recovery"||n.FlightStatus==="Diverted"||n.FlightStatus==="In Air"||n.FlightStatus==="Expected"||n.FlightStatus==="Departed")&&(i.FlightStatusStyle="active");n.FlightOnTimeStatus!=null&&n.FlightOnTimeStatus!==""&&(i.FlightStatusIndicator=n.FlightOnTimeStatus,i.FlightStatusIndicator in i.FlightDelayStatus?i.OnTimeStatusStyle="delayed":i.FlightStatusIndicator in i.FlightOnTimeStatus&&(i.OnTimeStatusStyle="ontime"));i.ScheduledDepartureTime=n.ScheduledDepartureTime;i.ScheduledArrivalTime=n.ScheduledArrivalTime;i.ActualDepartureTime=n.ActualDepartureTime;i.EstimatedArrivalTime=n.EstimatedArrivalTime;i.ScheduledDepartureDate=n.ScheduledDepartureDate;i.ScheduledArrivalDate=n.ScheduledArrivalDate;i.ActualDepartureDate=n.ActualDepartureDate;i.EstimatedArrivalDate=n.EstimatedArrivalDate;i.ScheduledDepartureTerminal=n.ScheduledDepartureTerminal;i.ScheduledDepartureGate=n.ScheduledDepartureGate;i.ScheduledArrivalGate=n.ScheduledArrivalGate;i.ActualArrivalTerminal=n.ActualArrivalTerminal;i.MapURL=n.MapURL;i.MapHideStyle=n.FlightStatus==="In Air"?"map-hidden":"";i.FlightDelayDuration=n.FlightDelayDuration==null||n.FlightDelayDuration==="00:00"?"":n.FlightDelayDuration})},f;return u.$inject=["$scope","haCustomerSelections"],f=function(n,i){t("jsonFSByRouteModel",function(t){n.flightsByRouteVM=t});n.$index=0;n.$arrived=i.find(".arrived");n.$active=i.find(".active");n.$scheduled=i.find(".scheduled");n.$arrivedExpandControl=i.find(".arrived-expand-control");n.$activeExpandControl=i.find(".active-expand-control");n.$scheduledExpandControl=i.find(".scheduled-expand-control");n.arrivedIsExpanded=!1;n.activeIsExpanded=!1;n.scheduledIsExpanded=!1;n.mapIsHidden=!0;n.convertToDate=function(n){return new Date(n)};n.expandBtnClick=function(t){t==="arrived"?n.expandArrived(n.arriveIsExpanded):t==="active"?n.expandActive(n.activeIsExpanded):t==="scheduled"&&n.expandScheduled(n.scheduledIsExpanded)};n.expandArrived=function(t){t?n.closeArrived():n.openArrived()};n.openArrived=function(){n.arriveIsExpanded=!0;n.$arrived.addClass("expand");n.$arrivedExpandControl.removeClass("fontIcon20-circlePlus");n.$arrivedExpandControl.addClass("fontIcon20-circleMinus")};n.closeArrived=function(){n.arriveIsExpanded=!1;n.$arrived.removeClass("expand");n.$arrivedExpandControl.removeClass("fontIcon20-circleMinus");n.$arrivedExpandControl.addClass("fontIcon20-circlePlus")};n.expandActive=function(t){t?n.closeActive():n.openActive()};n.openActive=function(){n.activeIsExpanded=!0;n.$active.addClass("expand");n.$activeExpandControl.removeClass("fontIcon20-circlePlus");n.$activeExpandControl.addClass("fontIcon20-circleMinus")};n.closeActive=function(){n.activeIsExpanded=!1;n.$active.removeClass("expand");n.$activeExpandControl.removeClass("fontIcon20-circleMinus");n.$activeExpandControl.addClass("fontIcon20-circlePlus")};n.expandScheduled=function(t){t?n.closeScheduled():n.openScheduled()};n.openScheduled=function(){n.scheduledIsExpanded=!0;n.$scheduled.addClass("expand");n.$scheduledExpandControl.removeClass("fontIcon20-circlePlus");n.$scheduledExpandControl.addClass("fontIcon20-circleMinus")};n.closeScheduled=function(){n.scheduledIsExpanded=!1;n.$scheduled.removeClass("expand");n.$scheduledExpandControl.removeClass("fontIcon20-circleMinus");n.$scheduledExpandControl.addClass("fontIcon20-circlePlus")};n.mapToggleBtnClick=function(t){n.$currentMapToggle=i.find(".map-toggle-"+t);n.$currentMap=i.find(".flight-status-map-"+t);n.$currentMapToggle.hasClass("map-hidden")?(n.$currentMapToggle.removeClass("map-hidden"),n.$currentMapToggle.addClass("map-shown"),n.$currentMap.addClass("expand")):(n.$currentMapToggle.removeClass("map-shown"),n.$currentMapToggle.addClass("map-hidden"),n.$currentMap.removeClass("expand"))};n.createLegs(2);n.openOnLoad=function(){n.$active!==null&&n.$active!==undefined&&n.flightsByRouteVM!==undefined&&n.flightsByRouteVM.ArrivedFlights.length>0?n.openArrived():n.$active!==null&&n.$active!==undefined&&n.flightsByRouteVM!==undefined&&n.flightsByRouteVM.ActiveFlights.length>0?n.openActive():n.$scheduled!==null&&n.$scheduled!==undefined&&n.flightsByRouteVM!==undefined&&n.flightsByRouteVM.ScheduledFlights.length>0&&n.openScheduled()};n.$emit("$haFlightStatusReady");n.openOnLoad()},{restrict:"A",scope:!0,link:f,controller:u}}])}(angular),function(n){"use strict";var t=n.module("haInsufficientMilesModule",[]);t.directive("haInsufficientMiles",["haGlobals",function(n){var t=function(t,i,r){n("EaWard",function(n){$.extend(t,n);t.PurchaseMilesCost=n;t.currency=t.PurchaseMilesCost.Currency});t.$emit("$haInsufficientMilesReady");t.$pax=r},i;return t.$inject=["$scope"],i=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:i,controller:t}}])}(angular),function(n){"use strict";var t=n.module("haPurchaseConfirmationModule",[]);t.directive("haPurchaseConfirmation",["haGlobals",function(t){var i=function(i,r,u,f,e,o,s){function l(){r.isMobile||s.get("CONFIRMATION_NATIVE_APP_BANNER").then(function(n){i.nativeAppBannerCookie="checkInOrConfirmationNativeAppBanner";i.nativeAppBannerHeader=n.header;i.nativeAppBannerLinkText=n.linktext;i.nativeAppBannerCookieDays=n.cookiedays;i.nativeAppBannerEnabled=!!n.enable}).catch(function(n){console.log(n)})}i.SpeedyEnrollAccountNumber=[];i.IsSpeedEnrollVerified="";i.$pax=f;i.$pax.passengers=[];i.selectedSegments=[];i.IsPartialSuccess=!1;i.confirmedPaxList=[];i.declinedPaxList=[];i.confirmedPaxListTxt="";i.declinedPaxListTxt="";i.andText="";i.encryptedPNR="";i.encryptedLastName="";t("andText",function(n){i.andText=n||"and"});t(["encryptedPNR","encryptedLastName"],function(n,t){i.encryptedPNR=n;i.encryptedLastName=t});t("modelJson",function(n){i.VM=n;i.VM&&i.VM.IsMilesMaximizerEligible&&document.body.dispatchEvent(new CustomEvent("MilesMaximizerOffered"));i.VM.lstAncillaryUpSells=n.lstAncillaryUpSells;i.VM.PurchasedAncillaries=[{Type:"Hotel",Title:"Kihei Beach Marriot Resort & Spa",ReferenceNumberText:"",ReferenceNumber:"",IconClassName:"hotel-tab",ImageURL:"https://s3.amazonaws.com/uploads.hipchat.com/77785/1355952/e6FvRjou0h4ao0F/kihei-beach.jpg",DetailsDictionary:[{Key:"Check-in",Value:"Sun, Aug 3, 2014"},{Key:"Check-out",Value:"Sun, Aug 10, 2014"},{Key:"Nights",Value:"7"},{Key:"Room(s)",Value:"Ocean View Lahaina Kai Tower - 1 King Bed, Ocian View Lahaina Kai Tower - 2 Queen Beds"},{Key:"Room 1",Value:"Elizabeth Lee"},{Key:"Room 2",Value:"John Lee"},{Key:"Address",Value:"2365 Kaanapali Parkway, Lahaina, HI 96761"}],Terms:""},{Type:"Rental Car Reservation",Title:"Hertz: Tesla Roadster",ReferenceNumberText:"Car Rental Reference Number:",ReferenceNumber:"US292179320",IconClassName:"car-tab",ImageURL:"https://s3.amazonaws.com/uploads.hipchat.com/77785/1355952/7k4Vu24h1WjJwXl/hertz-tesla.jpg",DetailsDictionary:[{Key:"Driver",Value:"Charlie Becket"},{Key:"Pick-up",Value:"Sun, Aug 3, 2014"},{Key:"Drop-off",Value:"Sun, Aug 10, 2014"},{Key:"Location",Value:"Maui - Kahului Airport (OGG)"},{Key:"Cost",Value:"$495 (Estimated Total)"}],Terms:"To avail the offer, you must be 25 years or older. Eum haero quidne saepius opto. Paratus a bis jugis blandit acsi distineo esse ut accumsan. Ad consequat venio refoveo at quis lucidus neque suscipere praesent. Vulputate paulatim saluto volutpat indoles velit eum pala ulciscor lucidus valetudo oppeto. Indoles comis wisi probo et elit. <br><a href>FAQ<\/a> | <a href>Terms and Conditions<\/a>"},{Type:"Shuttle",Title:"The Maui Hotel Shuttle",ReferenceNumberText:"Maui Hotel Shuttle Reference Number:",ReferenceNumber:"TRANSFER-M83920",IconClassName:"shuttle",ImageURL:"https://s3.amazonaws.com/uploads.hipchat.com/77785/1355952/FaChb3jeiGEBrUR/Hawaii-Kauai-Jan-2010-23b.JPG",DetailsDictionary:[{Key:"Date",Value:"Sun, Aug 3, 2014"},{Key:"Route",Value:"Kahului Airport to your hotel. Includes your return trip from hotel to Kahului Airport."},{Key:"Travelers",Value:"3"}],Terms:""}]});var c=!i.VM.lstAncillaryUpSells||i.VM.lstAncillaryUpSells&&!i.VM.lstAncillaryUpSells.length,h=c||i.VM.IsRefundableFare||i.VM.IsOrbitzBooking;i.accordionState={};i.accordionState.isOpenItinerary=h;i.accordionState.changeSeatsAccordionGroup=h;i.accordionState.eticketAccordionGroup=h;i.accordionState.isOpenCost=h;i.openItinerary=function(){i.submitting=!0;window.location.href="/my-account/my-trips/manage-trip-itinerary?enc=1&p="+i.encryptedPNR+"&lastName="+i.encryptedLastName};i.getConfirmedPaxList=function(){for(var t="",n=0;n<i.confirmedPaxList.length;n++)t+=i.confirmedPaxList[n],n<i.confirmedPaxList.length-2?t+=", ":n<i.confirmedPaxList.length-1&&(t+=i.andText+" ");return t};i.getDeclinedPaxListTxt=function(){for(var t="",n=0;n<i.declinedPaxList.length;n++)t+=i.declinedPaxList[n],n<i.declinedPaxList.length-3?t+=", ":n<i.declinedPaxList.length-2&&(t+=i.andText+" ");return t};t("confirmModel",function(t){$.extend(i,t.ConfirmationItinerary);i.IsChangeFlightBooking=t.IsChangeFlightBooking;i.IsHoldBooking=t.IsHoldBooking;i.IsSeatAssignmentError=t.IsSeatAssignmentError;i.IsSpeedEnrollVerified=t.IsItinerarySpeedEnrollSuccess;i.IsTripInsurancePurchased=t.IsTripInsurancePurchased;i.TripSummary.TripInsurance&&(i.TripSummary.TripInsurance.IsTripInsuranceSelected=t.IsTripInsurancePurchased);i.showPriceDecreaseAlert=t.APHMessages!=null&&t.APHMessages.MessageType===3;t.IsTripInsurancePurchased&&(i.IsTripInsurancePurchaseSuccess=t.IsTripInsurancePurchaseSuccesss,i.IsTripInsurancePurchaseError=t.IsTripInsurancePurchaseError,i.ShowTripInsuranceSection=t.ShowTripInsuranceSection);i.IsCarTrawlerPurchased=t.IsCarTrawlerPurchased;t.IsCarTrawlerPurchased&&(i.IsCarTrawlerPurchaseSuccesss=t.IsCarTrawlerPurchaseSuccesss,i.IsCarTrawlerPurchaseError=t.IsCarTrawlerPurchaseError);i.IsRequirePayment=t.IsRequirePayment;t.HoldEndDate!=null&&(i.HoldEndDate=t.HoldEndDate);i.IsAirportShuttlePurchased=t.IsAirportShuttlePurchased;t.IsAirportShuttlePurchased&&(i.IsAirportShuttlePurchaseSuccesss=t.IsAirportShuttlePurchaseSuccesss,i.IsAirportShuttlePurchaseError=t.IsAirportShuttlePurchaseError);i.LeiGreeting=t.LeiGreeting;i.IsLeigreetingsPurchaseError=t.IsLeigreetingsPurchaseError;i.PassengerTripSummary=t.ConfirmationItinerary.PassengerTripSummary;i.TotalPrice=t.ConfirmationItinerary.TripSummaryTotal;var r=0;n.forEach(t.ConfirmationItinerary.Travellers,function(n){i.SpeedyEnrollAccountNumber[r]=n.SpeedyEnrollAccountNumber;r++;n.TicketNumberSet!=null?i.confirmedPaxList.push(n.FirstName+" "+n.LastName):i.declinedPaxList.push(n.FirstName+" "+n.LastName)});i.confirmedPaxListTxt=i.getConfirmedPaxList();i.declinedPaxListTxt=i.getDeclinedPaxListTxt();i.reservationCode=i.PNRs[0].PNRID;t.IsMainCabinBasicBooking&&(i.hideChangeSeats=!0);i.IsHoldBooking&&(i.hideChangeSeats=!0,i.hideUpdateTravelerInfo=!0,i.hideViewOrPrintReceipt=!0);t.ConfirmationItinerary!=null&&t.ConfirmationItinerary.TripSummary!=null&&t.ConfirmationItinerary.TripSummary.SelectedHotel!=null&&(i.hotel=t.ConfirmationItinerary.TripSummary.SelectedHotel,i.hotel!=null&&(i.reservationCode=t.ConfirmationItinerary.PNRs[0].OWWConfirmationID,i.hideChangeSeats=!0,i.hideUpdateTravelerInfo=!0,i.hideViewOrPrintReceipt=!0,i.showCallUsToChange=!0));i.confirmedPaxList.length>0&&i.declinedPaxList.length>0&&(i.IsPartialSuccess=!0);i.IsCodeShareOnly=!0;n.forEach(i.PNRs[0].Trips,function(t){n.forEach(t.Legs,function(n){n.ISOverNightStay&&(i.PNRs[0].ISOverNightStay=!0);n.IsCodeShare===!1&&(i.IsCodeShareOnly=!1)})})});i.$emit("$haPurchaseConfirmationReady");setTimeout(function(){i.$emit("resizeFlightHop");l()},20)},r;return i.$inject=["$scope","$rootScope","haModal","haPassengersService","haAncillariesSvc","$timeout","haSitecoreStrings"],r=function(n){n.$watch("TripSummary.SelectedCar",function(t){n.SelectedCar=t})},{restrict:"A",scope:!0,link:r,controller:i}}])}(angular),function(n){"use strict";var t=n.module("haMyDashboardModule",[]);t.directive("haMyDashboard",["haGlobals",function(n){var t=function(t){n("jsonMemberSummaryModel",function(n){t.HMDashBoardViewModel=n;t.HMDashBoardViewModel.HMMembershipType==="Pualani Gold"?t.ImageUrl="card03_bg_flower02a.jpg":t.HMDashBoardViewModel.HMMembershipType==="Platinum"&&(t.ImageUrl="card04_bg_pattern01.jpg")});t.$emit("$haMyDashboardReady")},i;return t.$inject=["$scope"],i=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:i,controller:t}}])}(angular),function(n){"use strict";var t=n.module("haCustomDirectivesModule",["haUserProfileAPI"]);t.directive("numberOnly",function(){return{require:"ngModel",link:function(n,t,i,r){r.$parsers.push(function(n){var i;if(n==null)return"";if(i=n.replace(/[^0-9]/g,""),i!==n){var u=t[0],f=0,e=0,o=!1;try{f=u.selectionStart;e=u.selectionEnd+i.length-n.length}catch(s){o=!0}if(r.$setViewValue(i),r.$render(),!o)try{u.setSelectionRange(f,e)}catch(s){}}return i})}}});t.directive("minLength",function(){return{require:"ngModel",link:function(n,t,i,r){var u=parseInt(i.minLength);n.minLengthValidator=function(n){var t=r.$isEmpty(n)||n.length>=u;return r.$setValidity("minlength",t),t?n:undefined};i.$observe("minLength",function(t){u=parseInt(t);n.minLengthValidator(r.$viewValue)});n.$watch(i.ngModel,function(t){u=parseInt(i.minLength);n.minLengthValidator(t)})}}});t.directive("maxLength",function(){return{require:"ngModel",link:function(n,t,i,r){var u=parseInt(i.maxLength);n.maxLengthValidator=function(n){var t=r.$isEmpty(n)||n.length<=u;return r.$setValidity("maxlength",t),t?n:undefined};i.$observe("maxLength",function(i){u=parseInt(i);t.attr("maxlength",u);n.maxLengthValidator(r.$viewValue)});n.$watch(i.ngModel,function(t){u=parseInt(i.maxLength);n.maxLengthValidator(t)})}}});t.directive("regexPattern",function(){return{require:"ngModel",link:function(n,t,i,r){var u=new RegExp(i.regexPattern);r.$parsers.push(function(n){var i;if(n==null)return"";if(i=n.replace(u,""),i!==n){var f=t[0],e=0,o=0,s=!1;try{e=f.selectionStart;o=f.selectionEnd+i.length-n.length}catch(h){s=!0}if(r.$setViewValue(i),r.$render(),!s)try{f.setSelectionRange(e,o)}catch(h){}}return i})}}});t.directive("userNameUnique",["$q","haUserProfileAPI",function(n,t){return{require:"ngModel",link:function(i,r,u,f){var e;i.safeApply=function(n){var t=this.$root.$$phase;t==="$apply"||t==="$digest"?n&&typeof n=="function"&&n():this.$apply(n)};i.$watch(u.ngModel,function(){i.safeApply(function(){f.$setValidity("userNameNotUnique",!0)})});r.on("blur",function(){i.isValid()||i.$apply(function(){f.$setValidity("userNameAjax",!1);var i={username:r.val()};e&&e.resolve();e=n.defer();t.checkUsernameAvailability(i,e).success(function(n){f.$setValidity("userNameNotUnique",n.IsSuccess);f.$setValidity("userNameAjax",!0)})})});i.isValid=function(){var i,t,n;if(r.controller("ngModel").$error){i=!1;t=r.controller("ngModel").$error;for(n in t)if(t.hasOwnProperty(n)&&n!=="userNameAjax"&&n!=="userNameNotUnique"&&t[n]===!0){i=!0;break}return i}return!1}}}}])}(angular),function(n){"use strict";var t=n.module("haMyTripsModule",["haGeoDataModule"]);t.directive("haMyTrips",["haGlobals","haModal","haHttpService","$filter","haSitecoreStrings","$log","$timeout","$window",function(t,i,r,u,f,e,o,s){var c=function(t,h){function c(n,t){if(n){var i=0;return n.replace(/(\[[a-zA-Z0-9_\- ]+\])/g,function(n){if(n){var r=t[i];return i++,r}})}}var a='<a href="/contact-us">'+f("UPCOMING_TRIPS.reservationsdepartmentlinktext")+"<\/a>",l;t.reservationsWithLinkText=c(f("UPCOMING_TRIPS.reservationsinformationtext"),[a]);t.currentTab="all";t.model={sortUpcomingByOptions:[f("UPCOMING_TRIPS.alldatestext")],sortUpcomingByIndex:0};t.modelLoading=!0;l="/MyAccount/MyTrips/GetAllTrips"+(/Windows /i.test(window.navigator.userAgent)?"?"+Math.floor(Math.random()*9999)+1:"");t.tripLookup={confirmationCode:"",lastName:""};t.RedirectURL="";t.cancelCurrencyMatch=!0;t.purchaseCurrencyMatch=!0;t.cancelClicked=[];t.purchaseClicked=[];t.VM={};r.GET(l).success(function(n){var r,w,i,e;if(t.modelLoading=!1,t.VM=n,t.VM.UpcomingTripsCount=0,t.VM.SavedAndHeldTripsCount=0,t.VM.IsHeldRetrieval&&(t.currentTab="savedHeld"),t.VM.UpComingTripsList.length>0){t.VM.UpcomingTripsCount=t.VM.UpComingTripsList.length;var l=null,a=null,v=0,o=[0],s=0;for(i=0;i<t.VM.UpComingTripsList.length;i++){var h=new Date(t.VM.UpComingTripsList[i].DepartureDate),y=h.getMonth(),p=h.getFullYear();l!==y||a!==p?(r=u("date")(h,"MMMM yyyy"),t.model.sortUpcomingByOptions.push(r),v++,i>0&&o.push(s),s=1,l=y,a=p):s++;t.VM.UpComingTripsList[i].sortByIndex=v}for(o.push(s),i=0;i<o.length;i++)i>0&&(r=t.model.sortUpcomingByOptions[i],r+=" ("+o[i]+")",t.model.sortUpcomingByOptions[i]=r);for(t.VM.TripsDDVisibility={showAddToCalendarOption:!1,showPrintOption:!1,showShareItineraryOption:!1,showViewReceiptsOption:!1},i=0;i<t.VM.UpcomingTripOptionsDropDown.length;i++)switch(t.VM.UpcomingTripOptionsDropDown[i].Value){case"VR":t.VM.TripsDDVisibility.showViewReceiptsOption=!0;break;case"AC":t.VM.TripsDDVisibility.showAddToCalendarOption=!0;break;case"PR":t.VM.TripsDDVisibility.showPrintOption=!0;break;case"SR":t.VM.TripsDDVisibility.showShareItineraryOption=!0}}for(t.VM.HoldTripList==null&&(t.VM.HoldTripList=[]),i=0;i<t.VM.HoldTripList.length;i++)t.VM.HoldTripList[i].tripType="held",w=[t.VM.HoldTripList[i].PNRHoldEndDate,"11:59 PM"],t.VM.HoldTripList[i].mustPurchaseByText=c(f("UPCOMING_TRIPS.mustpurchasedatetime"),w),t.VM.HoldTripList[i].Removed=!1,t.purchaseClicked[i]=!1,t.cancelClicked[i]=!1;for(t.VM.SavedTripList==null&&(t.VM.SavedTripList=[]),i=0;i<t.VM.SavedTripList.length;i++)t.VM.SavedTripList[i].tripType="saved";e=[];e=e.concat(t.VM.SavedTripList,t.VM.HoldTripList);t.VM.SavedAndHeldTrips=e;t.VM.SavedAndHeldTripsCount=e.length;t.upcomingTripsLimit=t.VM.UpComingTripsMaxRecordsPerPage||5;t.savedHeldTripsLimit=t.VM.UpComingTripsMaxRecordsPerPage||5}).error(function(n,i){e.debug("get all trips error: "+i);t.modelLoading=!1;t.Error=i});t.selectTab=function(n){t.model.sortUpcomingByIndex=0;t.currentTab=n;t.dismissDropdown();o(function(){$("#sortUpcomingByOptions").width($("#sortUpcomingByOptions").width())})};t.chooseDateFilter=function(n){t.model.sortUpcomingByIndex=n;t.$broadcast("$closeCustomDropdown")};t.upcomingTripsByDate=function(n){return t.model.sortUpcomingByIndex===0?!0:n.sortByIndex===t.model.sortUpcomingByIndex?!0:!1};t.dismissDropdown=function(){t.$broadcast("$closeCustomDropdown")};t.timeElapsed=function(n){var i=new Date(n),s=i.getTime(i)/1e3,h=i.getTimezoneOffset()*60,r=(new Date).getTime()/1e3;r=r+h;var o=r-s,f=Math.round(o/60),e=Math.round(f/60),c=Math.round(e/24);return c>=1?"on "+u("localShortDate")(i,t.$language):e>=1?e+" hours ago":f>1?f+" minutes ago":o<=60?"just now":n};t.loadMoreTrips=function(){t.currentTab==="upcoming"?t.upcomingTripsLimit+=t.VM.UpComingTripsMaxRecordsPerPage:t.savedHeldTripsLimit+=t.VM.UpComingTripsMaxRecordsPerPage};t.GotoBook=function(){window.location.href="/Book"};t.confirmRemoveHeldTrip=function(u){var f=h.$new(!0,t);f.RemoveHoldTripIndex=u;t.VM.SavedAndHeldTrips[f.RemoveHoldTripIndex].PNRCurrencyCode!==t.VM.CookiesCurrencyCode?(t.cancelCurrencyMatch=!1,t.cancelClicked[f.RemoveHoldTripIndex]=!0,t.currencyMismatchPNR=t.VM.SavedAndHeldTrips[f.RemoveHoldTripIndex].ReservationCode,t.heldCurrency=t.VM.SavedAndHeldTrips[f.RemoveHoldTripIndex].PNRCurrencyCode,t.siteCurrency=t.VM.CookiesCurrencyCode):(t.cancelCurrencyMatch=!0,f.removeHeldTrip=function(){var n={cancelHoldTripRQ:{RecordLocator:t.VM.SavedAndHeldTrips[f.RemoveHoldTripIndex].ReservationCode,LastName:t.VM.LastName}};f.RequestingRemoval=!0;t.VM.RemoveRequestSent=!1;r.POST("/MyAccount/MyTrips/CancelHoldTrip",n).success(function(n){t.loading=!1;t.VM.RemoveRequestSent=!0;f.RequestingRemoval=!1;t.RemovalSuccess=n.PNRCancelStatus;t.holdremovedorig=t.VM.SavedAndHeldTrips[f.RemoveHoldTripIndex].OriginCityCode;t.holdremoveddest=t.VM.SavedAndHeldTrips[f.RemoveHoldTripIndex].DestinationCityCode;t.VM.SavedAndHeldTrips[f.RemoveHoldTripIndex].Removed=!0;f.$modalCancel()}).error(function(){t.VM.RemoveRequestSent=!0;t.RemovalSuccess=!1;f.RequestingRemoval=!1;f.$modalCancel()})},i("/Areas/MyAccount/Views/Renderings/Shared/_Held_Trips.cshtml",{id:"cancel-held-trip",backdrop:"true",template:n.element(".remove-held-booking"),scope:f}),t.RemovalSuccess=!1)};t.checkCurrency=function(n){t.VM.SavedAndHeldTrips[n].PNRCurrencyCode!==t.VM.CookiesCurrencyCode?(t.purchaseCurrencyMatch=!1,t.purchaseClicked[n]=!0,t.currencyMismatchPNR=t.VM.SavedAndHeldTrips[n].ReservationCode,t.heldCurrency=t.VM.SavedAndHeldTrips[n].PNRCurrencyCode,t.siteCurrency=t.VM.CookiesCurrencyCode):(t.submitting=!0,t.purchaseCurrencyMatch=!0,s.location.href="/Book/Itinerary/HeldItinerary?enc=1&pnr="+t.VM.SavedAndHeldTrips[n].EncryptedReservationCode+"&lastName="+t.VM.SavedAndHeldTrips[n].EncryptedLastName)};t.submitTripLookupForm=function(n){n.$valid&&(t.searchingTrip=!0,TripLookupForm.submit())}},h;return c.$inject=["$scope","$rootScope"],h=function(n){n.exampleMethod=function(){return n}},h.$inject=["$scope"],{restrict:"A",scope:!0,link:h,controller:c}}]);t.directive("haMyTripsPayment",function(){var t=function(t,i,r,u,f,e){t.AgentCode="";t.PurchaseMilesPayment={EmailAddress:""};t.submitting=!1;t.giftCardState={};t.giftCards=[];u(["purchaseMilesPaymentJson","totalCost"],function(n,i){n&&(t.PurchaseMilesPayment.EmailAddress=n.EmailAddress);i&&(t.giftCardState.balance=i)});t.hasGiftCardAndBalance=function(){return t.giftCardState.balance>0&&t.giftCards.length};t.showPrivacyPolicy=function(){r("",{id:"privacy-policy",backdrop:"true",template:n.element(".showPrivacyPolicy")})};t.showTerms=function(){r("",{id:"terms-and-conditions",backdrop:"true",template:n.element(".showTerms")})};t.getHelpContent=function(){r("",{id:"purchase-miles-help",backdrop:"true",template:n.element(".getHelpContent")})};t.onSubmitForm=function(){return userdata.load_data("user_data"),t.submitting=!0,!0};t.cancelPayment=function(){window.location=itinDetailsPath};t.haPaymentTypes={paymentMethod:"creditDebit"};t.CDESubmit=function(){i.$broadcast("CDESubmit")};t.$on("CDEPaymentSubmitted",function(){t.submitting=!0});t.$on("CDEPaymentSubmitError",function(){t.submitting=!1;f(function(){$("html, body").animate({scrollTop:$("#formIFrame").offset().top-50},"fast")},100)});t.countries=e.setCountryData(countryData);t.countryPhoneDropdown=e.getPhoneCountryCodes();t.phoneCount=1;t.PhoneDetails=[];t.phoneTypes=[{name:"",value:1},{name:"",value:2},{name:"",value:3}];$scs.get("PassengerInfo").then(function(n){t.phoneTypes[0].name=n.hometext;t.phoneTypes[1].name=n.worktext;t.phoneTypes[2].name=n.mobiletext});t.PhoneDetails[0]={CountryCode:window.defaultPhoneCountryCode,Number:"",Type:1};t.PhoneDetails[1]={CountryCode:window.defaultPhoneCountryCode,Number:"",Type:1};t.PhoneDetails[2]={CountryCode:window.defaultPhoneCountryCode,Number:"",Type:1};t.travelCoordinator=!1;t.TravelCoordinatorInfo={TravelCoordinatorPhoneDetails:{CountryCode:window.defaultPhoneCountryCode,Number:""}};t.phoneRegexByCC=function(n){var t=e.lookupCountryByCode(n);return t!=null?e.getPhoneNumberRegex(t.Key):/.*/};t.addPhone=function(){t.phoneCount++;f(function(){$('select[name="PhoneType'+(t.phoneCount-1)+'"]').focus()})};t.deletePhone=function(){t.phoneCount--;f(function(){$('select[name="PhoneType'+(t.phoneCount-1)+'"]').focus()})};t.$watch("PhoneDetails[0].CountryCode",function(n,i){t.PhoneDetails[0].Number=!i||n===i?t.PhoneDetails[0].Number:""});t.$watch("PhoneDetails[1].CountryCode",function(n,i){t.PhoneDetails[1].Number=!i||n===i?t.PhoneDetails[1].Number:""});t.$watch("PhoneDetails[2].CountryCode",function(n,i){t.PhoneDetails[2].Number=!i||n===i?t.PhoneDetails[2].Number:""});t.$watch("TravelCoordinatorInfo.TravelCoordinatorPhoneDetails.CountryCode",function(n,i){t.TravelCoordinatorInfo.TravelCoordinatorPhoneDetails.Number=!i||n===i?t.TravelCoordinatorInfo.TravelCoordinatorPhoneDetails.Number:""});t.$watch("phoneCount",function(n){t.PhoneDetails.forEach(function(t,i,r){r[i]=n<i+1?{CountryCode:window.defaultPhoneCountryCode,Number:"",Type:1}:r[i]})})};return t.$inject=["$scope","$rootScope","haModal","haGlobals","$timeout","haGeoDataSvc"],{restrict:"A",scope:!0,controller:t}})}(angular),function(n){"use strict";var t=n.module("haManageTravelersModule",["haTravelersAPI"]);t.directive("haManageTravelers",["$timeout","haGlobals","haConfig","$log",function(t,i,r){var u=function(u,f,e){u.TravelerLists=[];u.FilteredTravelersList=[];u.VM={MaxTravelersCount:20,InitialTravelerDisplayCount:5};u.maxTravelersReachedMsg=n.element("#maxTravelersReachedMsg").text();i("jsonTravelerListsModel",function(n){var r,t,f,i;if(u.VM=n,e.ShowProfileImageDropdown=n.ShowProfileImageDropdown,n.TravelersList.length>0){for(n.TravelersList.sort(function(n,t){var i=n.LastName.toLowerCase()+" "+n.FirstName.toLowerCase(),r=t.LastName.toLowerCase()+" "+t.FirstName.toLowerCase();return i<r?-1:i>r?1:0}),u.TravelerLists=n.TravelersList,u.VM.ProfileImagesList.unshift({}),u.VM.ProfileImagesList.sort(function(n,t){return Number(n.ID)-Number(t.ID)}),r=0;r<u.TravelerLists.length;r++){if(t=u.TravelerLists[r],!t.AvatarURL)for(t.AvatarID.length===0&&(t.AvatarID="1"),f=Number(t.AvatarID),i=0;i<u.VM.ProfileImagesList.length;i++)f===Number(u.VM.ProfileImagesList[i].ID)&&(t.AvatarURL=u.VM.ProfileImagesList[i].Src);t.DateOfBirth&&t.FirstName&&t.LastName&&t.Gender||(t.IsIncomplete=!0)}u.FilteredTravelersList=u.TravelerLists.splice(0,u.VM.InitialTravelerDisplayCount)}});u.DisplayLoadMore=function(){return u.TravelerLists.length>0};u.ShowAdditionalPax=function(){var t=u.TravelerLists.splice(0,u.VM.InitialTravelerDisplayCount);u.FilteredTravelersList.push.apply(u.FilteredTravelersList,t);n.element("#showAdditionalPax").blur()};u.showTerms=function(){f(r.getTemplateUrl("ha-account-registration/ha-terms-conditions-modal.html"),{id:"registration-privacy",backdrop:"true"})};u.addEditPax=function(t){var r=t&&t.HMAccountNo?"Yes":"No",i="";if(t=$.extend({},t,{HasHMNumber:r}),Object.keys(t).length===1){if(u.FilteredTravelersList.length+u.TravelerLists.length>=u.VM.MaxTravelersCount){u.travelerlisterrortype="info";u.travelerlisterrordescription=u.maxTravelersReachedMsg.trim();u.ShowTravelersAlert=!0;u.$broadcast("$showAlert");return}}else i=t.AvatarID;e.UpdateTraveler=n.copy(t);f("/MyAccount/TravelersList/TravelerAddEdit?AvatarID="+i,{id:"add-edit-traveler",backdrop:!1,extendScope:{isBooking:!!e.isBooking}})};u.ShowMessage=function(n){var r,i=n.Message,t="",f=i.indexOf("|");f>0?(r=i.substring(0,f),u.ShowSpeedyEnrollAlert=!0,t=i.substring(f+1),t.indexOf("ERROR")<0?(u.messageSpeedyEnroll=t,u.speedyMessageType="success"):(u.speedyMessageType="error",u.messageSpeedyEnroll=t.substring(5,t.length))):r=i;u.travelerlisterrortype="success";u.travelerlisterrordescription=r;u.ShowTravelersAlert=!0;u.$broadcast("$showAlert")};u.RedirectToLoginPage=function(n){window.location.href=n!=null&&n.data!=null&&n.data.RedirectURL!=null?n.data.RedirectURL:window.location.href};u.stringToDate=function(n){return new Date(n)};u.$on("TravelerDeleted",function(n,t){var r=t.travelerID,f=t.response,i;u.ShowMessage(f);i=$(u.FilteredTravelersList).filter(function(){return this.TravelerID===r}).get(0);i&&u.FilteredTravelersList.splice(u.FilteredTravelersList.indexOf(i),1)});u.$on("TravelerAdded",function(n,i){t(function(){var n=i.response;u.ShowMessage(n);u.FilteredTravelersList.splice(0,0,n.Data)},0)});u.$on("TravelerModified",function(n,i){t(function(){var n=i.response,t;u.ShowSpeedyEnrollAlert=!1;u.ShowMessage(n);t=$(u.FilteredTravelersList).filter(function(){return this.TravelerID===n.Data.TravelerID}).get(0);t&&u.FilteredTravelersList.splice(u.FilteredTravelersList.indexOf(t),1,n.Data)},0)});u.$on("SessionError",function(){window.location.href=window.location.href});u.$on("responseError:UNAUTHORIZED",function(n,t){u.RedirectToLoginPage(t)});u.$on("responseError:FORBIDDEN",function(n,t){u.RedirectToLoginPage(t)})};return u.$inject=["$scope","haModal","$rootScope"],{restrict:"A",scope:!0,controller:u}}]);t.directive("haManageTravelersAddEdit",["haGlobals","haTravelersAPI","$log","haUtils","$interval","haSitecoreStrings",function(t,i,r,u,f,e){var o=function(r,o,s){var h,c;r.EmailEnrollError=!1;r.isEdit=!1;r.errorMessage="";r.TravelerInfo={};r.dobDayDataSource=[];r.dayDataSource=[];r.dobMonthDataSource=[];r.monthDataSource=[];r.birthDay="";r.monthPlaceHolder=null;r.ShowProfileImageDropdown=s.ShowProfileImageDropdown;r.DOBMonth="";r.DOBDay="";r.DOBYear="";t(["jsonManageTravelerAddEditModel","hideSeatUpgrade"],function(t,i){r.ManageTravelerAddEditModel=s.UpdateTraveler&&Object.keys(s.UpdateTraveler).length>1?s.UpdateTraveler:$.extend(t,s.UpdateTraveler);n.forEach(t.DOBDayDropDown,function(n){r.dayDataSource.push({name:n.Name,value:n.Value});r.dobDayDataSource.push({name:n.Name,value:n.Value})});r.monthDataSource=t.DOBMonthDropDown.map(function(n){return{name:n.Name,value:n.Value}});r.monthDataSource.shift();r.dobMonthDataSource=t.DOBMonthDropDown.map(function(n){return{name:n.Name,value:n.Value}});r.dobMonthDataSource.shift();r.hideSeatUpgrade=i});r.seatPreferences=[];e.get("SEATPREFERENCE_DROPDOWN").then(function(n){r.seatPreferences=n});r.ManageTravelerAddEditModel&&r.ManageTravelerAddEditModel.DateOfBirth&&(h=r.ManageTravelerAddEditModel.DateOfBirth.split("/"),h.length===3&&(r.DOBMonth=h[0],r.DOBDay=h[1],r.DOBYear=h[2]));s.UpdateTraveler&&Object.keys(s.UpdateTraveler).length>1?(r.TravelerInfo=s.UpdateTraveler,r.TravelerInfo.HMAccountNo&&typeof r.TravelerInfo.HMAccountNo!="string"&&(r.TravelerInfo.HMAccountNo=r.TravelerInfo.HMAccountNo.toString()),r.isEdit=r.TravelerInfo.TravelerID>0||r.TravelerInfo.TravelerId>0||r.isBooking&&!s.UpdateTraveler.SaveForFutureBooking,s.UpdateTraveler.DateOfBirth&&s.UpdateTraveler.DateOfBirth!=null&&s.UpdateTraveler.DateOfBirth!==""&&(h=s.UpdateTraveler.DateOfBirth.split("/"),h&&h.length===3&&(r.DOBMonth=h[0],r.DOBDay=h[1],r.DOBYear=h[2])),s.UpdateTraveler=null,r.TravelerInfo.IsIncomplete&&(c=f(function(){$("[name=ManageTravelerForm]").length&&($("[name=ManageTravelerForm]").addClass("submitted"),f.cancel(c))},100))):t("jsonManageTravelerAddEditModel",function(n){var i,t,e;r.TravelerInfo=n;i=r.isBooking||s.individualAccTypes.indexOf(s.user.accountType)>-1;r.isBooking&&s.corpAccTypes.indexOf(s.user.accountType)>-1&&(t=u.readCookie("PermanentSaveCookie"),t!==undefined&&(t=decodeURIComponent(t),i=JSON.parse(t)));r.TravelerInfo.SaveForFutureBooking=i;r.TravelerInfo.SeatPreferences===undefined&&(r.TravelerInfo.SeatPreference="1");r.TravelerInfo.IsIncomplete&&(e=f(function(){$("[name=ManageTravelerForm]").length&&($("[name=ManageTravelerForm]").addClass("submitted"),f.cancel(e))},100))});r.trim=function(n){n.target.value=n.target.value.replace(/\s/g,"")};r.getDOB=function(n){return n=n||r,[n.DOBMonth,n.DOBDay,n.DOBYear].join("/")};r.birthDay=r.getDOB();r.doneAddEditTraveler=function(n){var t,u;n&&(s.corpAccTypes=["C","R","W","A"],r.$root.isLoggedIn&&r.$root.corpAccTypes.indexOf(r.$root.user.accountType)>-1&&!r.isBooking&&$("#SaveForFutureBooking").prop("checked",!0),r.DOBYear?h=r.getDOB():r.ManageTravelerAddEditModel&&(h=r.getDOB({DOBMonth:r.ManageTravelerAddEditModel.DOBMonth,DOBDay:r.ManageTravelerAddEditModel.DOBDay,DOBYear:r.ManageTravelerAddEditModel.DOBYear})),t=r.ManageTravelerAddEditModel.TravelerID||r.ManageTravelerAddEditModel.TravelerId,$('input[name="DateOfBirth"]').val(h),$('input[name="TravelerID"]').val(t),n!=="ManageTravelerForm"||r.processing||(r.processing=!0,r.errorMessage="",u=$("#"+n),i.TravelerAddEdit(u.serialize()).success(function(n){var i,t,u;if(n.IsSuccess){if(r.ManageTravelerAddEditModel.HMNumber&&r.ManageTravelerAddEditModel.TravelerID===0&&!n.Data.IsValidHMNumber){r.errorMessage=HA.SCStrings.passengerinfo.hawaiianmilesnotexistmessage;r.$broadcast("$showAlert");$("#add-edit-traveler").animate({scrollTop:0},"slow");return}i=!!(r.TravelerInfo.TravelerID||r.TravelerInfo.TravelerId);s.$broadcast(i?"TravelerModified":"TravelerAdded",{response:n});r.$emit("closeModal");i||(t=new Date,t.setTime(t.getTime()+31536e6),u="expires="+t.toUTCString(),document.cookie=HA.CookiesRequireSsl?["PermanentSaveCookie","=",r.TravelerInfo.SaveForFutureBooking,"; secure; ",u,"; path=/"].join(""):["PermanentSaveCookie","=",r.TravelerInfo.SaveForFutureBooking,"; ",u,"; path=/"].join(""))}else r.errorMessage=n.Message,r.$broadcast("$showAlert"),$("#add-edit-traveler").animate({scrollTop:0},"slow")}).error(function(n,t){(t===403||t===401)&&s.$broadcast("SessionError")})["finally"](function(){r.processing=!1})))};r.DeleteTraveler=function(n){i.TravelerDelete(n).success(function(t){t.IsSuccess?(r.$emit("closeModal"),s.$broadcast("TravelerDeleted",{response:t,travelerID:n})):r.errorMessage=t.Message}).error(function(n,t){t===403&&s.$broadcast("SessionError")})}};return o.$inject=["$scope","haModal","$rootScope","$attrs"],{restrict:"A",scope:!0,controller:o}}])}(angular),function(n){"use strict";var t=n.module("haCheckoutModule",["haInterstitialAPI","haPaymentAPI"]);t.directive("haCheckout",["haGlobals","haPaymentAPI","$window",function(t,i,r){var u=["$scope","haInterstitialAPI","haModal","haPassengersService","$rootScope","haAncillariesSvc","$timeout","haHttpService","haConfig","haPaymentTypesService","$log","$filter",function(u,f,e,o,s,h,c,l,a,v,y,p){function rt(){return u.TripSummary.TripInsurance&&(u.TripSummary.TripInsurance.IsTripInsuranceSelected||u.TripSummary.IsTripInsuranceConfirmed)&&!u.IsTripInsurancePurchaseError}function ut(){return u.TripSummary.SelectedLeiGreeting&&u.TripSummary.SelectedLeiGreeting.isEligible&&!u.IsLeigreetingsPurchaseError}function ft(){return u.TripSummary.IsAirportShuttleSelected&&u.TripSummary.SelectedShuttleDetails!=null&&u.TripSummary.SelectedShuttleDetails.isEligible&&!u.IsAirportShuttlePurchaseError}var k,tt,it;u.$emit("$haCheckoutReady");t("paymentVm",function(n,t){$.extend(u,n);u.currency=u.TripSummary.currency;u.PricingType=u.TripSummary.PricingType;u.SelectedHotel=u.TripSummary.SelectedHotel;u.enableTCR=t});u.seatSelection=u.TripSummary.SelectedSeatInfo;u.$pax=o;u.$pax.passengers=[];u.selectedSegments=[];u.SelectedFlightInfo=[];u.IsPNRError=!1;u.AddPassengerList=function(n,t){for(var i=0;i<n;i++)u.$pax.add({type:t,isUser:!0})};u.taxDetails=!1;u.IsPNRCreated=!1;u.IsServiceErrors=!1;u.ServiceErrorMessage="";u.IsContinuePayment=!1;u.form=[];u.flag=!1;u.errorType=null;u.Token="";u.secondPhoneMandatory=!1;u.thirdPhoneMandatory=!1;u.firstPhoneMandatory=!0;u.tripSummaryWhiteBG=!0;u.secondCountryMandatory=!1;u.thirdCountryMandatory=!1;u.firstCountryMandatory=!1;u.noExistingPhoneNumbers=!1;u.holdReservationRemoved=!1;u.paymentForm={};k=4;u.giftCardResponse={};u.giftCardResponse.GiftCards=[];u.paymentForm.giftCardForm={};u.giftCardFormData={};u.paymentForm.isBarclayReturned=!1;u.paymentForm.isAlipayPaymentSuccess=!1;var w=10,d=[],b=0,g=[],nt="not-set";t(["paymentVm","defaultPhoneCountryCode"],function(t,i){var r,f;u.UpdatePhoneDetailsValidation=t.ContactInfo;u.showphone2=!1;u.showphone3=!1;u.PhoneDetails=u.UpdatePhoneDetailsValidation.PhoneDetailsVM.PhoneDetails;nt=u.UpdatePhoneDetailsValidation.PhoneDetailsVM.CountryCodeDropDown;d.length=0;n.forEach(u.UpdatePhoneDetailsValidation.PhoneDetailsVM.CountryCodeDropDown,function(n){d.push(n.MaxPhoneLength)});t.ContactInfo.TravelCoordinatorInfo!=null&&(t.ContactInfo.TravelCoordinatorInfo.TravelCoordinatorPhoneDetails==null?t.ContactInfo.TravelCoordinatorInfo.TravelCoordinatorPhoneDetails={CountryCode:i,Number:"",Type:""}:$.isNumeric(t.ContactInfo.TravelCoordinatorInfo.TravelCoordinatorPhoneDetails.CountryCode)?(r=$(u.UpdatePhoneDetailsValidation.PhoneDetailsVM.CountryCodeDropDown).filter(function(){return typeof this!="undefined"&&this.Name==="+"+t.ContactInfo.TravelCoordinatorInfo.TravelCoordinatorPhoneDetails.CountryCode}),t.ContactInfo.TravelCoordinatorInfo.TravelCoordinatorPhoneDetails.CountryCode=r.length>0?r[0].Value:i):t.ContactInfo.TravelCoordinatorInfo.TravelCoordinatorPhoneDetails.CountryCode=i);w=Math.max.apply(this,d);f=$.makeArray($(u.UpdatePhoneDetailsValidation.PhoneDetailsVM.CountryCodeDropDown).filter(function(){return typeof this!="undefined"&&this.Value!==""}));g.length=0;n.forEach(f,function(n){g.push(n.MinPhoneLength)});u.PhoneDetails.length===0?(u.PhoneDetails.push({CountryCode:i,Number:"",Type:""}),u.PhoneDetails.push({CountryCode:i,Number:"",Type:""}),u.PhoneDetails.push({CountryCode:i,Number:"",Type:""}),u.noExistingPhoneNumbers=!0):u.PhoneDetails.length===1?(u.PhoneDetails.push({CountryCode:i,Number:"",Type:""}),u.PhoneDetails.push({CountryCode:i,Number:"",Type:""})):u.PhoneDetails.length===2?(u.PhoneDetails.push({CountryCode:i,Number:"",Type:""}),u.showphone2=!0):u.PhoneDetails.length===3&&(u.showphone2=!0,u.showphone3=!0);u.haPaymentTypes=v;u.haPaymentTypes.updatePaymentTypes();u.haPaymentTypes.paymentMethod="creditDebit";t.MaxGiftCardAllowed&&(k=t.MaxGiftCardAllowed);t.IsBarclayReturn&&(u.paymentForm.isBarclayReturned=!0);t.IsBarclayReturn&&(u.paymentForm.isBarclayReturned=!0);isAlipayPaymentSuccess&&(u.paymentForm.isAlipayPaymentSuccess=!0,u.haPaymentTypes.paymentMethod="alipay",u.paymentMethod="alipay")});b=Math.min.apply(this,g);u.phoneOneMinLength=b;u.phoneOneMaxLength=w;u.phoneSecondMinLength=b;u.phoneSecondMaxLength=w;u.phoneThirdMinLength=b;u.phoneThirdMaxLength=w;u.tcPhoneMinLength=b;u.tcPhoneMaxLength=w;window.sessionStorage.getItem("showCDESubmitFailError")&&(window.sessionStorage.removeItem("showCDESubmitFailError"),u.ShowCDEFormSubmitFailError=!0);u.showSeatMap=function(){e(a.getTemplateUrl("VerticalSeatmap/ha-vertical-seatmap-preview.html"),{backdrop:"true",id:"ha-vertical-seatmap-preview-modal",extendScope:{previewSegments:u.PassengerTripSummary.allSegments,SignifiedMarket:u.SignificantMarket,enableTCR:u.enableTCR,disableSeatUpgrades:!1}})};u.upgradeToMainCabin=function(){i.upgradeToMainCabin().then(function(){document.body.dispatchEvent(new CustomEvent("UpgradeToMainCabin",{detail:{pageName:window.digitalData.page.pageInfo.name}}));r.location.href="/Book/InflightOptions?#upgraded"})};u.getValueOfCountryCode=function(n){if(n){var t=$(nt).filter(function(){return typeof this!="undefined"&&this.Name===n});return t.length?t[0].Value:""}return""};u.getMaxAndMinPhoneLength=function(n){if(n&&n!==""){var t=$(nt).filter(function(){return typeof this!="undefined"&&this.Value===n});return t.length?{minLength:t[0].MinPhoneLength,maxLength:t[0].MaxPhoneLength}:{minLength:b,maxLength:w}}return{minLength:b,maxLength:w}};u.$watch("PhoneDetails[0].CountryCode",function(n){var t=u.getMaxAndMinPhoneLength(n);u.phoneOneMaxLength=t.maxLength;u.phoneOneMinLength=t.minLength;u.setFirstPhonemandatory()});u.setFirstPhonemandatory=function(){u.PhoneDetails[0].CountryCode!=null&&u.PhoneDetails[0].Number!=null&&u.PhoneDetails[0].Number!==""?u.secondPhoneMandatory&&u.thirdPhoneMandatory||(u.firstPhoneMandatory=!0):u.firstPhoneMandatory=u.noExistingPhoneNumbers?!0:!1};u.$watch("PhoneDetails[0].Number",function(){u.setFirstPhonemandatory()});u.$watch("PhoneDetails[1].CountryCode",function(n){var t=u.getMaxAndMinPhoneLength(n);u.phoneSecondMaxLength=t.maxLength;u.phoneSecondMinLength=t.minLength;u.setSecondPhonemandatory()});u.$watch("PhoneDetails[1].Number",function(){u.setSecondPhonemandatory()});u.$watch("ContactInfo.TravelCoordinatorInfo.TravelCoordinatorPhoneDetails.CountryCode",function(n){var t=u.getMaxAndMinPhoneLength(n);u.tcPhoneMaxLength=t.maxLength;u.tcPhoneMinLength=t.minLength});u.giftCardFormData.cards=[{Number:"",Pin:"",Action:0}];u.setPaymentMethod=function(n){u.paymentMethod=n};u.$on("ancelaryStateChange",function(){if(u.PassengerTripSummary){var n=u.PassengerTripSummary.grandTotal,t=u.giftCardResponse.GiftCards.reduce(function(n,t){return n+t.AmountApplied},0);u.giftCardResponse.BookingBalance=n-t;u.giftCardResponse.ShowCreditCardBalance=u.giftCardResponse.BookingBalance}});u.addCard=function(){u.giftCardFormData.cards.length+u.giftCardResponse.GiftCards.length<k&&(u.giftCardFormData.cards.push({Number:"",Pin:"",Action:0}),u.giftCardFormData.cards.length+u.giftCardResponse.GiftCards.length===k&&(u.maxCardsReached=tt()),c(function(){$('input[name="number'+(u.giftCardFormData.cards.length-1)+'"]').first().focus()},0))};u.hasGiftCardAndBalance=function(){return u.giftCardResponse.GiftCards.length&&u.giftCardResponse.BookingBalance>0};tt=function(){return u.giftCardFormData.cards.length+u.giftCardResponse.GiftCards.length===k?!0:!1};it=function(t){u.checkingCards=!0;t.GiftCards.length>1&&n.forEach(t.GiftCards,function(n,i){n.Number||t.GiftCards.splice(i,1)});l.POST("/myaccount/giftcard/ProcessGiftCard",t).success(function(n){u.checkingCards=!1;n.GiftCards?(y.debug(n),u.giftCardResponse=n,u.giftCardFormData.cards=[],u.maxCardsReached=tt(),u.hasAppliedGiftCard=!0,u.giftCardResponse.GiftCards.length===0&&(u.hasAppliedGiftCard=!1,u.giftCardFormData.cards=[{Number:"",Pin:"",Action:0}])):y.warn("error submitting gift cards")}).error(function(n,t){u.checkingCards=!1;y.error("error saving travel goal: "+t)})};u.applyGiftCards=function(n){if(n.preventDefault(),u.paymentForm.giftCardForm.$validate(u.paymentform),u.paymentForm.giftCardForm.$valid){var t={GiftCards:u.giftCardFormData.cards};t.GiftCards.length>0&&it(t)}else $(".ng-invalid:not(form):not(div):first").focus().select()};u.removeGiftCard=function(n){n.Action=1;var t={GiftCards:[n]};it(t)};u.showGiftCardModal=function(n){u.giftCardModalType=n;e(a.getTemplateUrl("ha-checkout-giftcard-modals.html"),{id:"giftcard-modal",backdrop:"true",scope:u})};u.hasInelegibleGiftCardItems=function(){return rt()||ut()||ft()};u.getGiftCardAncillaryMessage=function(){function n(n,i){i=p("localCurrency")(i,u.currency);t.push($scs("GiftCard.ancillarylistformat",[$scs(n),i]))}var t=[];return rt()&&n("passengertripsummary.tripinsurancetext",u.TripSummary.TripInsurance.InsuranceCost),ut()&&n("leigreetingancillary.leigreetinglabel",u.TripSummary.SelectedLeiGreeting.totalCost),ft()&&n("airportshuttleancillary.shuttlelabel",u.TripSummary.SelectedShuttleDetails.totalPrice),$scs("GiftCard.ancillarymessage",[t.join(", ")])};u.setSecondPhonemandatory=function(){u.PhoneDetails[1].CountryCode!=null&&u.PhoneDetails[1].Number!=null&&u.PhoneDetails[1].Number!==""?(u.secondPhoneMandatory=!0,u.firstPhoneMandatory=!1,u.thirdPhoneMandatory=!1):u.secondPhoneMandatory=!1};u.setThirdPhonemandatory=function(){u.PhoneDetails[2].CountryCode!=null&&u.PhoneDetails[2].Number!=null&&u.PhoneDetails[2].Number!==""?(u.thirdPhoneMandatory=!0,u.secondPhoneMandatory=!1,u.firstPhoneMandatory=!1):u.thirdPhoneMandatory=!1};u.$watch("PhoneDetails[2].CountryCode",function(n){var t=u.getMaxAndMinPhoneLength(n);u.phoneThirdMaxLength=t.maxLength;u.phoneThirdMinLength=t.minLength;u.setThirdPhonemandatory()});u.$watch("PhoneDetails[2].Number",function(){u.setThirdPhonemandatory()});u.$watch("PassengerTripSummary.grandTotal",function(){u.IsChangeFlightBooking||u.IsHoldBooking||(u.totalZero=u.PassengerTripSummary.grandTotal<=0);u.IsChangeFlightBooking||!u.IsHoldBooking||u.HidePayment||u.SelectedHoldFare.HoldFee!=0||(u.totalZero=!0)});u.$watch("haPaymentTypes.paymentMethod",function(n){n&&u.paymentform.$setPristine()});u.contactInfoSubmit=function(){u.checkPaymentForm=!0;u.PhoneRequired=u.PhoneDetails[0].CountryCode!==""&&u.PhoneDetails[0].Number!=null&&u.PhoneDetails[0].Number.length>0||u.PhoneDetails[1].CountryCode!==""&&u.PhoneDetails[1].Number!=null&&u.PhoneDetails[1].Number.length>0||u.PhoneDetails[2].CountryCode!==""&&u.PhoneDetails[2].Number!=null&&u.PhoneDetails[2].Number.length>0?!1:!0};u.UpdatePassengerList=function(){u.TripSummary.AdultCount>0&&u.AddPassengerList(u.TripSummary.AdultCount,"Adult");u.TripSummary.ChildCount>0&&u.AddPassengerList(u.TripSummary.ChildCount,"Child");u.TripSummary.InfantCount>0&&u.AddPassengerList(u.TripSummary.InfantCount,"Infant")};u.UpdatePassengerList();u.ToggleTaxDetails=function(){u.taxDetails=!u.taxDetails};u.showTermsAndConditionsModal=function(n){i.fetchModalContent(n).success(function(n){var t=n;e({id:"results-help",backdrop:"true",template:t})})};u.showHoldTermsAndConditionsModal=function(){e({id:"hold-reservation-terms",modalClass:"ha-content-modal",backdrop:"true",template:n.element(".terms-modal-content")})};u.scrollToInsuranceOffer=function(n){n.preventDefault();$("html, body").animate({scrollTop:$("[ha-ancillaries-trip-insurance]").offset().top},1e3)};u.UpdateErrors=function(t){t.GiftCardStatus&&t.GiftCardStatus.length>0?(u.IsGiftCardFailed=t.IsPaymentAuthorized,u.GiftCardHeaderErrorMessage=t.GiftCardHeaderErrorMessage,u.ErrorType="INVALID_GIFTCARD",n.forEach(u.giftCardResponse.GiftCards,function(n){for(var i=0;i<t.GiftCardStatus.length;i++)n.UniqueGiftCardId===t.GiftCardStatus[i].GiftCardID&&(n.ErrorMessage=t.GiftCardStatus[i].GiftCardErrorMessage)})):t.IsServiceError?(u.IsServiceErrors=!0,u.ServiceErrorMessage=t.ErrorMessage):(u.IsPaymentProcessing=!1,u.ErrorType="INVALID_CREDITCARD");$("#termscheckbox").scope().Checkout.acceptTerms=!1;u.$broadcast("ClearCCInfo");$("#formIFrame").attr("src",function(n,t){return t});u.$emit("closeModal");$("body, html").animate({scrollTop:150},"slow")};u.displayInterstitialPayment=function(){$("#InterstitialPayment-modal").length===0&&(e(a.getTemplateUrl("ha-payment-interstitial-template.html"),{id:"InterstitialPayment-modal",backdrop:"true",modalLock:!0}),u.interstitialDynamicResize())};u.$on("CDEPaymentSubmitted",function(){u.displayInterstitialPayment()});u.closeInterstitialPayment=function(){$("#InterstitialPayment-modal").scope().$modalCancel();c(function(){$("html, body").animate({scrollTop:$("#formIFrame").offset().top-50},"fast")},100)};u.$on("CDEPaymentSubmitError",function(){u.closeInterstitialPayment()});u.CDESubmit=function(){var n="paymentform";if(u.haPaymentTypes.paymentMethod==="creditDebit"||u.haPaymentTypes.paymentMethod==="giftCard"&&u.giftCardResponse.GiftCards.length>0&&u.giftCardResponse.BookingBalance>0)s.$broadcast("CDESubmit");else if(u.haPaymentTypes.paymentMethod==="alipay")if($("#termscheckbox").scope().Checkout.acceptTerms)i.getAliPaySignedUrl().success(function(n){n.IsSuccess?window.location=n.Data:(n.ErrorMessage=n.Message,u.handleExceptions(n,"haPaymentAPI-getAliPaySignedUrl"),u.ServiceErrorMessage=n.Message)});else return c(function(){u.$eval(n+".$validate()")},0),!1;else c(function(){$("#"+n).submit()},0)};u.formSubmit=function(n){if(u.IsPaymentProcessing)return!1;u.IsPaymentProcessing=!0;n.preventDefault();u.form=$("#paymentform");u.displayInterstitialPayment();c(function(){var n=$(u.form).serialize();u.handlePayment(n)},0)};window.onresize=function(){u.interstitialDynamicResize()};u.handlePayment=function(n){u.ValidateCreditCardCheck=!0;(u.IsChangeFlightBooking||u.IsHoldBooking||u.HidePayment||u.totalZero)&&(u.ValidateCreditCardCheck=!1);u.ValidateCreditCardCheck?i.ValidatePaymentAuthorization(n).success(function(t){u.IsPaymentProcessing=!1;t.IsPaymentAuthorized||t.PaymentTokenValidator!=="PNRFailed"?t.IsPaymentAuthorized||t.PaymentTokenValidator!=="PaymentValidationFailed"?t.PaymentTokenValidator==="PNRCreatedInSameSession"?window.location.href="/book/error?ErrorType=PNRCreatedInSameSession":t.PaymentTokenValidator==="NonHKStatusFound"?window.location.href="/book/error?ErrorType=NonHKStatusFound":t.PaymentTokenValidator==="ECERTERROR"?window.location.href="/book/error?ErrorType=ECERTERROR&ErrorCode="+t.ErrorMessage:t.PaymentTokenValidator==="RedeemAwardAndPnrStatusError"?window.location.href="/book/error?ErrorType=RedeemAwardAndPnrStatusError&ErrorCode="+t.ErrorMessage:t.PaymentTokenValidator==="InvalidETCO"?window.location.href="/book/error?ErrorType=InvalidETCO&PathType=Book&ErrorCode="+t.ErrorMessage:t.PaymentTokenValidator==="InvalidGAFETCO"?window.location.href="/book/error?ErrorType=InvalidGAFETCO&PathType=Book&ErrorCode="+t.ErrorMessage:t.IsPaymentAuthorized?t.IsPaymentAuthorized?(u.Token=t.PaymentTokenValidator,u.IsChangeFlightBooking||u.IsPackageBooking||u.IsHoldBooking?u.IsHoldBooking?(u.ProcessPaymentForHoldPNR(n),u.IsProcessPayment=!0):i.FlightAvailability(n).success(function(n){u.handleExceptions(n,"haPaymentAPI-checkFlightAvailability")||(n.status===1?u.showFightsNoSeatsAvailableModal():n.status===2?u.showFightsScheduleMismatchModal():n.status===0&&(u.processPayment(),u.IsProcessPayment=!0))}).error(function(n){u.handleExceptions(data,"haPaymentAPI-checkFlightAvailability");u.IsProcessPayment=!1;u.ServiceErrorMessage=n}):(u.ProcessPaymentForAsyncPNR(n),u.IsProcessPayment=!0)):(u.IsPaymentProcessing=!1,u.ErrorType="INVALID_CREDITCARD",u.$emit("closeModal"),$("body, html").animate({scrollTop:150},"slow")):t.PaymentTokenValidator!=="TokenEmpty"&&u.UpdateErrors(t):u.UpdateErrors(t):window.location.href="/book/error?ErrorType=PNRError"}).error(function(n){u.IsPaymentProcessing=!1;u.IsProcessPayment=!1;u.ServiceErrorMessage=n.ErrorMessage}):(u.IsPaymentProcessing=!1,(u.IsChangeFlightBooking||u.IsPackageBooking||u.IsHoldBooking||!u.IsHoldRepurchase||u.HasNIPass)&&(!(u.HidePayment||u.totalZero)||u.HasNIPass||u.IsChangeFlightBooking||u.IsHoldBooking)?u.IsHoldBooking&&!u.HasNIPass?u.ProcessPaymentForHoldPNR(n).success(function(){u.IsProcessPayment=!0}).error(function(n){u.IsPaymentProcessing=!1;u.IsProcessPayment=!1;u.ServiceErrorMessage=n.ErrorMessage}):u.HasNIPass?(u.ProcessNITPRedemption(),u.IsProcessPayment=!0):i.FlightAvailability(n).success(function(n){u.handleExceptions(n,"haPaymentAPI-checkFlightAvailability")||(n.status===1?u.showFightsNoSeatsAvailableModal():n.status===2?u.showFightsScheduleMismatchModal():n.status===0&&(u.processPayment(),u.IsProcessPayment=!0))}).error(function(n){u.handleExceptions(data,"haPaymentAPI-checkFlightAvailability");u.IsProcessPayment=!1;u.ServiceErrorMessage=n}):(u.ProcessPaymentForAsyncPNR(n),u.IsProcessPayment=!0))};u.interstitialDynamicResize=function(){s.isMobile||$(".ha-modal#InterstitialPayment-modal .modalContainer").css({width:$(window).width(),height:$(window).height(),"padding-top":$(window).height()*.2})};u.UpdateFlightSchedule=!1;s.updateFlightSchedule=function(){$("#flightScheduleMismatch").hide();u.UpdateFlightSchedule=!0;u.processPayment()};u.processPayment=function(){userdata.load_data("user_data");i.postPaymentProcess($(u.form).serialize(),u.UpdateFlightSchedule,u.Token).success(function(n){u.handleExceptions(n,"haPaymentAPI-postPaymentProcess")||(n!=="InvalidToken"?n.IsPNRCreated?window.location.href="/book/Confirmation":u.closeInterstitialPayment():u.closeInterstitialPayment())}).error(function(){u.IsServiceErrors=!0;u.handleExceptions("haPaymentAPI-postPaymentProcess")})};u.ProcessPaymentForAsyncPNR=function(n){userdata.load_data("user_data");var t=n||$(u.form).serialize();i.postProcessPaymentForAsyncPNR(t,u.UpdateFlightSchedule,u.Token).success(function(n){if(u.TripSummary.TripInsurance.IsTripInsuranceSelected&&window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("Alnz_Purchs_Rq",1),(typeof n=="string"||n instanceof String)&&(n=n.replace(/"/g,"")),n.ErrorType==="PaymentProcessError"){window.location.href="/book/error?ErrorType=Technical&ErrorCode="+n.ErrorMessage;return}if(n.ErrorType==="ECERTERROR"){window.location.href="/book/error?ErrorType=ECERTERROR&ErrorCode="+n.ErrorMessage;return}u.handleExceptions(n,"haPaymentAPI-ProcessPaymentForAsyncPNR")||(n==="InvalidETCO"?window.location.href="/book/error?ErrorType=InvalidETCO&PathType=Book&ErrorCode="+n.ErrorMessage:n==="InvalidGAFETCO"?window.location.href="/book/error?ErrorType=InvalidGAFETCO&PathType=Book&ErrorCode="+n.ErrorMessage:n!=="InvalidToken"?n.IsPNRCreated?window.location.href="/book/Confirmation":u.closeInterstitialPayment():u.closeInterstitialPayment())}).error(function(){u.IsServiceErrors=!0;u.handleExceptions("haPaymentAPI-ProcessPaymentForAsyncPNR")})};u.ProcessPaymentForHoldPNR=function(n){userdata.load_data("user_data");var t=n||$(u.form).serialize();i.postProcessPaymentForHoldPNR(t,u.UpdateFlightSchedule,u.Token).success(function(n){u.handleExceptions(n,"haPaymentAPI-ProcessPaymentForHoldPNR")||(n!=="InvalidToken"&&n.IsPNRCreated?window.location.href="/book/Confirmation":u.closeInterstitialPayment())}).error(function(){u.IsServiceErrors=!0;u.handleExceptions("haPaymentAPI-ProcessPaymentForHoldPNR")})};u.ProcessNITPRedemption=function(){userdata.load_data("user_data");i.postProcessNITPRedemption().success(function(n){u.handleExceptions(n,"haPaymentAPI-ProcessNITPRedemption")||(n!=="InValidNITPRedemption"?n.IsPNRCreated?window.location.href="/book/Confirmation":u.closeInterstitialPayment():u.closeInterstitialPayment())}).error(function(){u.IsServiceErrors=!0;u.handleExceptions("haPaymentAPI-ProcessNITPRedemption")})};u.showFightsScheduleMismatchModal=function(){i.fetchScheduleMismatchPopup().success(function(n){e({id:"flightScheduleMismatch",backdrop:"true",template:n,modalLock:!0,cancel:{label:"Close",fn:function(){window.location.href="/book/FlightResults"}}})})};u.showFightsNoSeatsAvailableModal=function(){window.location.href="/book/Error?ErrorType=SeatNotAvailable"};u.handleExceptions=function(n){if(n!=="jsError")if(n.ErrorCodeHandle===undefined&&n.ErrorMessage!=null&&n.ErrorMessage!==""){if(n.ErrorType==="ECERTERROR")return window.location.href="/book/error?ErrorType=ECERTERROR&ErrorCode="+n.ErrorMessage,!0;u.showErrorMessage=!0;u.ErrorMessage=n.ErrorMessage;u.closeInterstitialPayment()}else switch(n.ErrorCodeHandle){case"SessionTimeOut":window.location.href="/book/error?ErrorType=SessionTimeOut";break;default:if(n.ErrorCodeHandle!==undefined)window.location.href=n.RedirectURL;else return!1}else window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"};u.removePriceLock=function(){u.IsHoldBooking=!1;u.holdReservationRemoved=!0;i.removePriceLockSession().success(function(n){y.debug(n);v.updatePaymentTypes()}).error(function(){y.debug("Error in removing price lock session")});$("body, html").animate({scrollTop:135},"slow")};u.addDays=function(n,t){return n.replace("[days]",t)};u.validNavigation=!1;window.onbeforeunload=function(){u.validNavigation||$.ajax({type:"GET",url:"/Book/Payment/CancelTrip",async:!1,cache:!1})};$(document).bind("keypress",function(n){n.keyCode===116&&(u.validNavigation=!0)});$("form").bind("submit",function(){u.validNavigation=!0});$("input[type=submit]").bind("click",function(){u.validNavigation=!0});$(document).ready(function(){if(u.paymentForm.isAlipayPaymentSuccess){u.displayInterstitialPayment();var n={};n.PaymentInfo=Object.assign({},u.PaymentInfo);n.paymentMethod=u.paymentMethod;c(function(){u.handlePayment($.param(n))},0)}})}],f=function(t){t.$watch("TripSummary.SelectedCar",function(n){t.SelectedCar=n});t.$watch("TripSummary.SelectedShuttleDetails",function(n){t.SelectedShuttleDetails=n});n.forEach(t.TripSummary.Trips,function(n){var i=n.Flights[0],r;for(i.IsMileagePricing=n.IsMileagePricing,r=0;r<i.AvailBookingFares.length;r++)i.selectedSeatClass=i.AvailBookingFares[r].Name,i[i.selectedSeatClass]=i.AvailBookingFares[r];t.selectedSegments.push(i)})};return{restrict:"A",scope:!0,link:f,controller:u}}])}(angular),function(n){"use strict";var t=n.module("haTermsConditionsModule",["haPaymentAPI"]);t.directive("haTermsConditions",["haPaymentAPI",function(n){var t=["$scope","haModal",function(t,i){t.showTermsAndConditionsModal=function(r){n.fetchModalContent(r).success(function(n){var r=n,u=(window.location.href.indexOf("inflightoptions")>-1)?"":t;i({id:"terms-conditions",backdrop:"true",template:r,scope:u})})}}];return{restrict:"A",scope:!0,controller:t}}])}(angular),function(n){"use strict";var t=n.module("haPurchaseMilesModule",["haPurchaseMilesAPI","haHttpService"]);t.directive("haPurchaseMilesSelect",["haGlobals","haPurchaseMilesAPI","haHttpService",function(t,i,r){var u=function(u,f){u.SelectMiles={MilesSelected:null,RecipientEmail:"",LastName:"",AccountNumber:"",HasSharedTravelers:!0};u.Error="";u.Validated=!1;u.formClicked=!1;t("jsonPurchaseMilesSelectModel",function(n){n.MilesSelected>0&&(u.SelectMiles.MilesSelected=n.MilesSelected+"");u.SelectMiles.RecipientEmail=n.RecipientEmail});t("errorMessage",function(n){n!==""&&(u.Error=n)});u.formdata={};u.formdata.sourceClient="self";u.getHelpContent=function(){f("",{id:"purchase-miles-help",backdrop:"true",template:n.element(".getHelpContent")})};u.safeApply=function(n){var t=this.$root.$$phase;t==="$apply"||t==="$digest"?n&&typeof n=="function"&&n():this.$apply(n)};u.checkPurchaseMilesEligibility=function(n){n.preventDefault();u.Error="";u.busy=!0;var t=!1;u.formdata.sourceClient==="member"&&(t=!0);i.checkEligibility(u.SelectMiles.MilesSelected,t,u.SelectMiles.AccountNumber,u.SelectMiles.LastName,u.SelectMiles.RecipientEmail).success(function(n){u.formClicked=!1;n.IsSuccess?(u.Validated=!0,$("#purchaseMilesSubmit").prop("disabled",!1),$("form[name=purchaseMilesAmount]")[0].submit.click(),$("#purchaseMilesSubmit").prop("disabled",!0)):(u.Error=n.Message,u.busy=!1,$("body, html").animate({scrollTop:0},"fast"))})};u.SelectMiles.HasSharedTravelers&&r.GET("/myaccount/travelerslist/gettravelerlist").then(function(n){n.data.TravelersList&&(u.FilteredTravelersList=n.data.TravelersList)},function(n){console.log(n);u.SelectMiles.HasSharedTravelers=!1});u.travelerChosen=function(n){u.$modalCancel();u.SelectMiles.LastName=n.LastName;u.SelectMiles.AccountNumber=n.HMAccountNo||""};u.openSharedTravelers=function(){f({id:"sharedTravelersModal",backdrop:"true",scope:u,template:n.element("#sharedTravelers")})}};return u.$inject=["$scope","haModal"],{restrict:"A",scope:!0,controller:u}}]);t.directive("haPurchaseMilesPayment",function(){var t=function(t,i,r,u,f){t.AgentCode="";t.PurchaseMilesPayment={EmailAddress:""};t.submitting=!1;u("purchaseMilesPaymentJson",function(n){t.PurchaseMilesPayment.EmailAddress=n.EmailAddress});t.showPrivacyPolicy=function(){r("",{id:"privacy-policy",backdrop:"true",template:n.element(".showPrivacyPolicy")})};t.showTerms=function(){r("",{id:"terms-and-conditions",backdrop:"true",template:n.element(".showTerms")})};t.getHelpContent=function(){r("",{id:"purchase-miles-help",backdrop:"true",template:n.element(".getHelpContent")})};t.onSubmitForm=function(){return userdata.load_data("user_data"),t.submitting=!0,!0};t.cancelPayment=function(){window.location=itinDetailsPath};t.haPaymentTypes={paymentMethod:"creditDebit"};t.CDESubmit=function(){i.$broadcast("CDESubmit")};t.$on("CDEPaymentSubmitted",function(){t.submitting=!0});t.$on("CDEPaymentSubmitError",function(){t.submitting=!1;f(function(){$("html, body").animate({scrollTop:$("#formIFrame").offset().top-50},"fast")},100)})};return t.$inject=["$scope","$rootScope","haModal","haGlobals","$timeout"],{restrict:"A",scope:!0,controller:t}});t.directive("creditCardType",function(){return{require:"ngModel",link:function(n,t,i,r){r.$parsers.unshift(function(t){return n.ccinfo.type=/^5[1-5]|^2(?:2(?:2[1-9]|[3-9]\d)|[3-6]\d\d|7(?:[01]\d|20))/.test(t)?"mastercard":/^4/.test(t)?"visa":/^3[47]/.test(t)?"amex":/^6011|65|64[4-9]|622(1(2[6-9]|[3-9]\d)|[2-8]\d{2}|9([01]\d|2[0-5]))/.test(t)?"discover":undefined,r.$setValidity("invalid",!!n.ccinfo.type),t})}}});t.directive("cardExpiration",function(){return{require:"ngModel",link:function(n,t,i,r){n.$watch("[ccinfo.month,ccinfo.year]",function(t){return r.$setValidity("invalid",!0),+n.ccinfo.year==+n.currentYear&&n.ccinfo.month<=n.currentMonth&&r.$setValidity("invalid",!1),t},!0)}}});t.directive("haPurchaseMilesConfirmation",function(){var t=function(t,i,r){t.CurrentMilesBalance=confirmationVM.CurrentMilesBalance;var u="Balance: "+r("number")(t.CurrentMilesBalance);n.element("#account-nav-list li:first-child").find("span.popover-link-secondary").text(u);t.showFAQ=function(){i("",{id:"purchase-miles-faq",backdrop:"true",template:n.element(".showFAQ")})};t.showTerms=function(){i("",{id:"terms-and-conditions",backdrop:"true",template:n.element(".showTerms")})};t.getHelpContent=function(){i("",{id:"purchase-miles-help",backdrop:"true",template:n.element(".getHelpContent")})};t.$on("haFormValidationSuccess",function(){return!1})};return t.$inject=["$scope","haModal","$filter"],{restrict:"A",scope:!0,controller:t}});t.filter("localPurchaseMilesCurrency",["$compile",function(){var t={USD:'<span class="currency-symbol">$<\/span>{{ amount }}',AUD:'<span class="currency-symbol">$<\/span>{{ amount }} <span class="currency-type">AUD<\/span>',NZD:'<span class="currency-symbol">$<\/span>{{ amount }} <span class="currency-type">NZD<\/span>',CNY:'<span class="currency-symbol">¥<\/span>{{ amount }}',KRW:'<span class="currency-symbol">₩<\/span>{{ amount}}',JPY:'<span class="currency-symbol">¥<\/span>{{ amount }}',TWD:'<span class="currency-type">NT<\/span><span class="currency-symbol">$<\/span>{{ amount }}',MILES:'{{ amount }} <span class="currency-type">mi<\/span>'},i=function(n){var t=n.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")},r=function(t,i){return t>-1?i+" "+n.element("#MoreText").val():i.replace(/-([1-9]+)/g,function(n,t){return t})+" "+n.element("#LessText").val()};return function(n,u,f,e,o){var h,s,c;return(u==="CNY"||u==="KRW"||u==="JPY"||u==="TWD")&&(o=!1,f=!0),h=o?n:f?Math.round(n):(Math.round(n*100)/100).toFixed(2),h&&(s=i(h)),u==="MILES"&&(s=s.split(".")[0]),t[u]?(c=t[u].replace(/\{\{.*\}\}/,s),e?r(n,c):c):void 0}}])}(angular),function(n){"use strict";var t=n.module("haProfileSettingsModule",["haProfileSettingsAPI"]);t.directive("haProfileSettings",["$timeout","haGlobals","haProfileSettingsAPI","haModal","haSitecoreStrings","haReAuthService",function(t,i,r,u,f,e){var o=function(t,f){function o(n,t){var i=parseInt(n.SortOrder),r=parseInt(t.SortOrder);return i<r?-1:i>r?1:0}function s(n,t){var i=$("#"+n);!t||i.append('<input name="AccountDetail.Password" type="hidden" ng-model="AccountDetail.Password" value="'+t+'"/>');i[0].submit()}t.isProfileSettings=!0;t.regform={};i("ContactInfoJson",function(n){t.AccountDetail=n;i("ContactInfoMsg",function(n){n!==""&&(n===!0?(t.ShowProfileSettingsAlert=!0,t.ProfileSettingsMessageType="success",i("successMsg",function(n){t.ProfileSettingsHeaderMessage=n})):(t.ShowProfileSettingsAlert=!0,t.ProfileSettingsMessageType="error",t.ProfileSettingsHeaderMessage=n))});t.passportForm=!1;i("jsonPassportDetails",function(n){var i,r;t.PassportDetails=n;n.PassportNumber&&n.PassportNumber!==undefined?(t.passportForm=!0,t.PassportNumber=n.PassportNumber):(t.passportForm=!1,t.PassportNumber=null);t.Country=n.Country&&n.Country!==undefined?n.Country:null;n.IssueDat&&n.IssueDate!==undefined?(i=n.IssueDate.split("/"),i.length>0&&(t.IssueMon=i[0],t.IssueDay=i[1],t.IssueYear=i[2])):(t.IssueMon=null,t.IssueDay=null,t.IssueYear=null);n.ExpiryDate&&n.ExpiryDate!==undefined?(r=n.ExpiryDate.split("/"),r.length>0&&(t.ExpMon=r[0],t.ExpDay=r[1],t.ExpYear=r[2])):(t.ExpMon=null,t.ExpDay=null,t.ExpYear=null)})});t.showPassportForm=function(){t.passportForm||(t.passportForm=!0)};i("jsonTravelPreferencesModel",function(n){t.Interests=[];t.FavoriteDestinations=[];t.TravelPreferencesViewModel=n;t.RedressNumber=n.RedressNumber;t.KnownTravelerNumber=n.KnownTravelerNumber;t.SeatPreference=n.SeatPreference||"1";t.BookAvailablePremiumSeat=n.BookAvailablePremiumSeat;t.HomeAirport=n.HomeAirport;t.TravelPreferencesViewModel.InterestLists.sort(o);for(var i=0;i<t.TravelPreferencesViewModel.InterestLists.length;i++)t.TravelPreferencesViewModel.InterestLists[i].IsChecked?t.Interests.push(t.TravelPreferencesViewModel.InterestLists[i].Value):t.Interests.push(!1);for(t.TravelPreferencesViewModel.FavoriteDestinationLists.sort(o),i=0;i<t.TravelPreferencesViewModel.FavoriteDestinationLists.length;i++)t.TravelPreferencesViewModel.FavoriteDestinationLists[i].IsChecked?t.FavoriteDestinations.push(t.TravelPreferencesViewModel.FavoriteDestinationLists[i].Value):t.FavoriteDestinations.push(!1)});i("accountSettingsModel",function(n){t.AccountSettings=n;t.AccountSettings.ConfirmNewPassword="";i("ProfileSettingsMessage",function(r){r!==""&&(r===!0?(t.ShowProfileSettingsAlert=!0,t.ProfileSettingsMessageType="success",i("successMsg",function(n){t.ProfileSettingsHeaderMessage=n}),setTimeout(function(){$(".account-pic").attr("src",n.AvatarUrl)})):(t.ShowProfileSettingsAlert=!0,t.ProfileSettingsMessageType="error",t.ProfileSettingsHeaderMessage=r))})});i("EmailSubscriptionJson",function(n){t.EmailSubscriptions=n;i("ProfileSettingsMessage",function(n){n!==null&&n!==""&&(n===!0?(t.ShowProfileSettingsAlert=!0,t.ProfileSettingsMessageType="success",i("successMsg",function(n){t.ProfileSettingsHeaderMessage=n})):(t.ShowProfileSettingsAlert=!0,t.ProfileSettingsMessageType="error",t.ProfileSettingsHeaderMessage=n))});t.getUrlVars=function(){for(var t=[],n,r=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),i=0;i<r.length;i++)n=r[i].split("="),t.push(n[0]),t[n[0]]=n[1];return t};var r=t.getUrlVars();typeof r.EmailAddress!="undefined"&&(t.EmailSubscriptions.EmailAddress=r.EmailAddress,t.EmailSubscriptions.ZipCode=r.ZipCode,t.ShowProfileSettingsAlert=!0,t.ProfileSettingsMessageType="success",i("SubscribtionSuccessMessage",function(n){t.ProfileSettingsHeaderMessage=n}))});t.isSelected=!0;t.IsReadOnly=!0;t.$emit("$haProfileSettingsReady");t.$on("$haDataLoaded",function(){t.genderDropDownSource=[];t.Gender="";n.forEach(t.GenderLists,function(n){t.genderDropDownSource.push({name:n.Gender.Value,value:n.Gender.ID});n.Gender.Selected&&(t.Gender=n.Gender.ID)})});t.UpdateTravelPreferenceSuccess=!1;t.UpdateTravelPreferenceErrorMessage="";t.disableUpdateTravelPreferenceSubmit=!1;t.submitTravelPreferences=function(n){n.preventDefault();t.UpdateTravelPreferenceSuccess=!1;t.UpdateTravelPreferenceErrorMessage="";t.disableUpdateTravelPreferenceSubmit=!0;t.working=!0;var i=$("#TravelPreferencesForm");r.updateTravelPreferences($(i).serialize()).success(function(n){t.working=!1;n.IsSuccess?(t.ProfileSettingsHeaderMessage=successMsg,t.ProfileSettingsMessageType="success",t.ShowProfileSettingsAlert=!0,t.$$childHead.theForm.$dirty=!1):(t.ProfileSettingsHeaderMessage=n.Message,t.ProfileSettingsMessageType="error",t.ShowProfileSettingsAlert=!0);t.disableUpdateTravelPreferenceSubmit=!1;$("body, html").animate({scrollTop:$(i).offset().top},"slow")}).error(function(n,i){t.working=!1;(i===403||i===401)&&f.$broadcast("SessionError");t.disableUpdateTravelPreferenceSubmit=!1})};t.RedirectToLoginPage=function(n){window.location.href=n!=null&&n.data!=null&&n.data.RedirectURL!=null?n.data.RedirectURL:window.location.href};t.$on("responseError:UNAUTHORIZED",function(n,i){t.RedirectToLoginPage(i)});t.$on("responseError:FORBIDDEN",function(n,i){t.RedirectToLoginPage(i)});t.showUpgradeTipModal=function(){u("",{id:"seat-upgrade-tip-modal",backdrop:"true",template:n.element("#upgradeTipContent")})};t.updateProfile=function(i,r){i.preventDefault();var f=$("#"+r).scope();f.submitForm();f[r].$valid&&(t.parentFormName=r,t.reAuthFields&&e.formRequiresReAuth(t.reAuthFields)?u("",{id:"re-authentication-modal",backdrop:"true",template:n.element("#reAuthModal"),scope:t}):s(r))};t.reAuthAndUpdateProfile=function(n,t){s(n,t)};t.$on("$destroy",e.cleanUp())},s;return o.$inject=["$scope"],s=function(n,i,r){function u(){n.reAuthFields&&n.reAuthFields.forEach(function(n){e.registerField(n)})}n.exampleMethod=function(){return n};n.getIssueDate=function(){return n.IssueMon+"/"+n.IssueDay+"/"+n.IssueYear};n.getExpDate=function(){return n.ExpMon+"/"+n.ExpDay+"/"+n.ExpYear};r&&r.reAuthFields&&(n.reAuthFields=r.reAuthFields.split(","));t(u,0)},{restrict:"A",scope:!0,link:s,controller:o}}]);t.directive("countryRegexPattern",function(){return{require:"ngModel",link:function(n,t,i,r){var u=new RegExp(i.countryRegexPattern);t.on("blur",function(){n.ValidateZipCode()});n.$watch(i.ngModel,function(){n.ValidateZipCode()});n.ValidateZipCode=function(){n.safeApply(function(){t.val()&&t.val()!==""?u.test(t.val())?r.$setValidity("CountryRegexPattern",!0):r.$setValidity("CountryRegexPattern",!1):r.$setValidity("CountryRegexPattern",!0)})};n.safeApply=function(n){var t=this.$root.$$phase;t==="$apply"||t==="$digest"?n&&typeof n=="function"&&n():this.$apply(n)}}}})}(angular),function(n){"use strict";var t=n.module("haPaymentMethodsModule",["haPaymentMethodsAPI"]);t.directive("haPaymentMethods",["haGlobals","$window","haPaymentMethodsAPI","haConfig","haSitecoreStrings",function(t,i,r,u,f){var e=function(u,e,o,s){u.PaymentMethods=[];u.MaxPaymentMethods=6;u.maxCardsReachedMsg=n.element("#maxCardsReachedMsg").text();u.CCTypes=[];t("jsonPaymentMethodsModel",function(t){n.forEach(t.PaymentInfos,function(n){n.CCInfo.UpdatedDate=new Date(parseInt(n.CCInfo.UpdatedDate.substr(6)))});u.PaymentMethods=t.PaymentInfos;u.MaxPaymentMethods=t.MaxPaymentMethods;u.CCTypes=t.CCTypesDropDown});t("errorMessage",function(n){n!==""&&(u.PaymentMethodsErrorType="error",u.PaymentMethodsHeaderMessage=n,u.ShowPaymentMethodsAlert=!0)});f.get("PaymentMethods").then(function(n){u.strings=n});u.visitApplyLink=function(){i.location="~/"};u.GetCardName=function(n){if(u.CCTypes.length>0){var t=$(u.CCTypes).filter(function(){return this.Value===n}).get(0);return t?t.Name:n}return n};u.truncateCC=function(n){return n.substr(n.length-4)};u.termsStart=function(){o.$broadcast("termsModalStart");var n="termsAndConditions";e(s.getTemplateUrl("ha-kisa-terms-modal.html"),{id:"kisaTermsModal",backdrop:!0,modalLock:!0,scope:u,extendScope:{scContent:i[n],termsName:n}})};o.$on("termsModalSuccess",function(){u.addPaymentMethod()});u.addPaymentMethod=function(){if(u.PaymentMethods.length>=u.MaxPaymentMethods){u.PaymentMethodsErrorType="info";u.PaymentMethodsHeaderMessage=u.maxCardsReachedMsg.trim();u.ShowPaymentMethodsAlert=!0;return}o.BillingAddress=u.PaymentMethods.length>0?u.PaymentMethods[0].BillingAddress:{};r.PaymentMethodsAddInitialize().success(function(n){n.IsSuccess&&(u.CDEIFrameSrc="/PaymentAuthorization",(u.$switch("Global:EnableVIC")||u.$root.vicilicious)&&(u.CDEIFrameSrc+="?vicilicious=true"),e(s.getTemplateUrl("ha-payment-method-add-modal.html"),{id:"add-Payment",backdrop:"false",scope:u}))}).error(function(n,t){t===403&&o.$broadcast("SessionError")})};u.addEditPaymentMethod=function(n){if(typeof n=="undefined"){if(u.PaymentMethods.length>=u.MaxPaymentMethods){u.PaymentMethodsErrorType="info";u.PaymentMethodsHeaderMessage=u.maxCardsReachedMsg.trim();u.ShowPaymentMethodsAlert=!0;return}o.BillingAddress=u.PaymentMethods.length>0?u.PaymentMethods[0].BillingAddress:{};e("/MyAccount/PaymentMethods/PaymentMethodAddEdit",{id:"add-edit-Payment",backdrop:"false"})}else e("/MyAccount/PaymentMethods/PaymentMethodAddEdit?ccID="+n.CCInfo.CCId+"&rand="+(Math.floor(Math.random()*9999)+1),{id:"add-edit-Payment",backdrop:"false"})};u.RedirectToLoginPage=function(n){window.location.href=n!=null&&n.data!=null&&n.data.RedirectURL!=null?n.data.RedirectURL:window.location.href};u.$on("responseError:UNAUTHORIZED",function(n,t){u.RedirectToLoginPage(t)});u.$on("responseError:FORBIDDEN",function(n,t){u.RedirectToLoginPage(t)});u.$on("PaymentMethodDeleted",function(n,t){var f=t.ccID,e=t.response,i,r;u.ShowMessage(e);i=$(u.PaymentMethods).filter(function(){return this.CCInfo.CCId===f}).get(0);i&&(r=u.PaymentMethods.indexOf(i),u.PaymentMethods.splice(r,1))});u.$on("PaymentMethodAdded",function(t,i){var r=i.response;u.ShowMessage(r);r.Data.CCInfo.IsDefaultCard&&n.forEach(u.PaymentMethods,function(n){n.CCInfo.IsDefaultCard=!1});r.Data.CCInfo.UpdatedDate=new Date(parseInt(r.Data.CCInfo.UpdatedDate.substr(6),10));u.PaymentMethods.push(r.Data)});u.$on("PaymentMethodModified",function(t,i){var r=i.response,f,e;u.ShowMessage(r);f=$(u.PaymentMethods).filter(function(){return this.CCInfo.CCId===r.Data.CCInfo.CCId}).get(0);f&&(e=u.PaymentMethods.indexOf(f),u.PaymentMethods.splice(e,1),r.Data.CCInfo.IsDefaultCard&&n.forEach(u.PaymentMethods,function(n){n.CCInfo.IsDefaultCard=!1}),r.Data.CCInfo.UpdatedDate=new Date(parseInt(r.Data.CCInfo.UpdatedDate.substr(6),10)),u.PaymentMethods.push(r.Data))});u.$on("SessionError",function(){window.location.href=window.location.href});u.ShowMessage=function(n){u.PaymentMethodsErrorType="success";u.PaymentMethodsHeaderMessage=n.Message;u.ShowPaymentMethodsAlert=!0;u.$broadcast("$showAlert")};u.checkCardExpiration=function(n,t){var r=new Date,i=new Date;return i.setFullYear(t,n,1),i<r?!0:!1};i.addEventListener("message",function(t){var i,e,s;t.origin===iframeOrigin&&(t.data==="cancel"?o.$broadcast("$modalCancel"):t.data==="submitFail"?f.get("ReviewAndPay.cdeformsubmitfailerror").then(function(n){o.$broadcast("$modalCancel");u.PaymentMethodsErrorType="error";u.PaymentMethodsHeaderMessage=n;u.ShowPaymentMethodsAlert=!0}):t.data.substring(0,7)==="resize:"?(i=t.data.split(":"),i.length===2&&n.element("#formIFrame").height(i[1])):t.data.substring(0,9)==="complete:"&&(e=t.data.substring(9,t.data.length),s=JSON.parse(e),r.PaymentMethodsAdd(s).success(function(n){n.IsSuccess?(o.$broadcast("$modalCancel"),o.$broadcast("PaymentMethodAdded",{response:n})):(o.$broadcast("$modalCancel"),u.PaymentMethodsErrorType="error",u.PaymentMethodsHeaderMessage=n.Message,u.ShowPaymentMethodsAlert=!0)}).error(function(n,t){(t===403||t===401)&&o.$broadcast("SessionError")})))})};return e.$inject=["$scope","haModal","$rootScope","haConfig"],{restrict:"A",scope:!0,controller:e}}]);t.directive("haPaymentMethodsAddEdit",["haGlobals","haPaymentMethodsAPI","$timeout",function(t,i,r){var f=$("<div/>").html("&bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; &bull;&bull;&bull;&bull; ").text(),u=function(u,e,o){u.truncateCC=function(n){return n.substr(n.length-4)};u.isEdit=!1;u.errorMessage="";u.CCInfo={};u.BillingAddress={};u.ExpirationMonthsDatasource=[];t("jsonPaymentMethodsCCInfoModel",function(n){u.CCInfo=n.CCInfo;u.BillingAddress=n.BillingAddress;u.BillingAddress&&u.BillingAddress.Country&&r(function(){u.$broadcast("AddressInfoDetails",{AddressInfo:u.BillingAddress})});u.CCInfo.CCId>0&&(u.isEdit=!0,u.CCInfo.MaskedCardNumber=f+u.truncateCC(u.CCInfo.CardNumber))});u.CCTypes=[];t("ccTypes",function(n){u.CCTypes=n});u.ExpirationMonths=[];t("ccExpirationMonths",function(t){n.forEach(t,function(n){n.Value!==""&&(u.ExpirationMonths.push({name:n.Name,value:n.Value}),u.ExpirationMonthsDatasource.push({name:n.Name,value:n.Value}))})});u.$watch("CCInfo.ExpirationYear",function(t){var r=parseInt(t,10),f=(new Date).getFullYear(),i;r===f?(i=(new Date).getMonth()+1,u.ExpirationMonths=[],n.forEach(u.ExpirationMonthsDatasource,function(n){parseInt(n.value,10)>=i&&(u.ExpirationMonths.push(n),parseInt(u.CCInfo.ExpirationMonth)<i&&(u.CCInfo.ExpirationMonth=""))})):u.ExpirationMonths=u.ExpirationMonthsDatasource});u.DeleteCreditCard=function(n){var t=$("#PaymentDeleteConfirmation").text();confirm(t)&&i.PaymentMethodsDelete(n).success(function(t){t.IsSuccess?(u.$emit("closeModal"),o.$broadcast("PaymentMethodDeleted",{response:t,ccID:n})):u.errorMessage=t.Message}).error(function(n,t){t===403&&o.$broadcast("SessionError")})};u.GetCardName=function(n){if(u.CCTypes.length>0){var t=$(u.CCTypes).filter(function(){return this.Value===n}).get(0);return t?t.Name:n}return n};u.submit=function(n){n.preventDefault();var t=$("#ManagePaymentForm");i.PaymentMethodsAddEdit($(t).serialize()).success(function(n){if(n.IsSuccess){u.$emit("closeModal");var t="";t=u.CCInfo.CCId===0?"PaymentMethodAdded":"PaymentMethodModified";o.$broadcast(t,{response:n})}else u.errorMessage=n.Message,u.$broadcast("$showAlert"),$("#add-edit-Payment").animate({scrollTop:0},"slow")}).error(function(n,t){(t===403||t===401)&&o.$broadcast("SessionError")})}};return u.$inject=["$scope","haModal","$rootScope"],{restrict:"A",scope:!0,controller:u}}])}(angular),function(n){"use strict";var t=n.module("haReceiptModule",[]);t.directive("haReceipt",["$http",function(t){var i=function(i,r,u){r.$emit("grandRoundTripTotalPrice");r.$pax=u;r.IsTripInsuranceSelected=!1;r.currency=i.$currency;r.AddPassengers=function(t){var i=[];n.forEach(t,function(n){n.Name!=="Empty"&&n.Name!==""&&i.push({type:n.Name,isUser:!0})});r.$pax.add(i)};r.$on("calcTaxes",function(){r.calcTaxes()});r.addTax=function(t){var u=function(t){var i;return n.forEach(r.taxes,function(n){n.description===t&&(i=n)}),i},i=u(t.Description);i?i.amount=Number(i.amount)+Number(t.Amount):r.taxes.push({DisplayDescription:t.DisplayDescription,description:t.Description,amount:t.Amount})};r.getFarePerTraveller=function(t,i,u){var e,f=0,o;return n.forEach(t,function(t){if(o=r.getFareClass(t),r.PricingType==="SegmentFare")n.forEach(t.AvailBookingFares,function(n){if(n.Name.toLowerCase()===o.toLowerCase()){var t;t=i.toLowerCase()==="adult"?n.FareTypes[0]:i.toLowerCase()==="child"?n.FareTypes[1]:i.toLowerCase()==="infant"?n.FareTypes[2]:n.FareTypes[0];e=u?t:t?t:n.FareTypes[0];f=parseFloat(e.TotalBaseFare)+parseFloat(f)}});else if(t.IsRoundTripFare===!0&&t.RoundTripFare.BookingClassFare!=null&&n.forEach(t.RoundTripFare.BookingClassFare.FareTypes,function(n){i!=null&&n.Name.toLowerCase()===i.toLowerCase()&&(f=parseFloat(n.TotalBaseFare)+parseFloat(f))}),t.isMulticityFare){var s=0,h={};h=t.selectedSeatClass.toLowerCase()==="coach"?t.MulticityStepThroughFares.CoachCellFlightDetails:t.selectedSeatClass.toLowerCase()==="first"?t.MulticityStepThroughFares.FirstCellFlightDetails:t.selectedSeatClass.toLowerCase()==="business"?t.MulticityStepThroughFares.FirstCellFlightDetails:t.MulticityStepThroughFares.CoachCellFlightDetails;n.forEach(h,function(t){var u=!0;n.forEach(t.AvailBookingFares,function(t){if(r.selectedSegments[s].selectedSeatClass.toLowerCase()===t.Name.toLowerCase()&&u){var e=t.FareTypes.length>0&&t.FareTypes!==undefined?t.FareTypes:"";e!==""&&n.forEach(e,function(n){i.toLowerCase()===n.Name.toLowerCase()&&(f=parseFloat(n.TotalBaseFare)+parseFloat(f))});u=!1}});s++})}}),f};r.getChangeFlightBaseFareDiff=function(t,i,u,f){var o,e=0,h,s;return t&&t.length>0&&(s=t[t.length-1],h=r.getFareClass(s),n.forEach(s.AvailBookingFares,function(n){n.Name.toLowerCase()===h.toLowerCase()&&(i.toLowerCase()==="adult"?o=n.FareTypes[0]:i.toLowerCase()==="child"&&(o=n.FareTypes[1]),e=parseFloat(o.ExchangeInfo.BaseFareDifference)+parseFloat(e),f==="KRW"&&(i.toLowerCase()==="adult"?e=parseFloat(e)-parseFloat(o.ExchangeInfo.FuelSurchargeDifference):i.toLowerCase()==="child"&&(e=parseFloat(e)-parseFloat(o.ExchangeInfo.FuelSurchargeDifference))))})),e*u};r.getSelectedFareType=function(t){var u,f,i;return t&&t.length>0&&(i=t[t.length-1],u=r.getFareClass(i),n.forEach(i.AvailBookingFares,function(n){n.Name.toLowerCase()===u.toLowerCase()&&(f=n)})),f};r.$watch("selectedSegments",function(){r.selectedFareType=r.getSelectedFareType(r.selectedSegments)});r.getChangeFlightTaxDiff=function(t,i,u){var f,e=0,s,o;return t&&t.length>0&&(o=t[t.length-1],s=r.getFareClass(o),n.forEach(o.AvailBookingFares,function(n){n.Name.toLowerCase()===s.toLowerCase()&&(i.toLowerCase()==="adult"?f=n.FareTypes[0]:i.toLowerCase()==="child"&&(f=n.FareTypes[1]),e=parseFloat(f.ExchangeInfo.TaxDifference)+parseFloat(e))})),e*u};r.getChangeFlightTotalFareDiff=function(t){var i,f=0,e=0,s,o;return t&&t.length>0&&(o=t[t.length-1],s=r.getFareClass(o),n.forEach(o.AvailBookingFares,function(t){t.Name.toLowerCase()===s.toLowerCase()&&n.forEach(u.passengers,function(n){n.type.toLowerCase()==="adult"?i=t.FareTypes[0]:n.type.toLowerCase()==="child"&&(i=t.FareTypes[1]);e=r.isFlightResult&&typeof r.isFlightResult!="undefined"?i.ExchangeInfo.IsFeewaiverAppliedToItinerary?0:parseFloat(i.ExchangeInfo.PenaltyFee):parseFloat(i.ExchangeInfo.PenaltyFee);f=parseFloat(i.ExchangeInfo.BaseFareDifference)+parseFloat(i.ExchangeInfo.FuelSurchargeDifference)+parseFloat(i.ExchangeInfo.TaxDifference)+e+parseFloat(i.ExchangeInfo.ExternalServiceFee)+parseFloat(f)})})),r.$parent&&r.$parent.TripSummary&&r.$parent.TripSummary.TotalPremiumSeatAmount&&!r.$parent.TripSummary.HasPremiumSeatFareDiff&&(f=parseFloat(r.$parent.TripSummary.TotalPremiumSeatAmount)+parseFloat(f)),r.$parent&&r.$parent.TripSummary&&r.$parent.TripSummary.PremiumSeatFareDiff&&r.$parent.TripSummary.HasPremiumSeatFareDiff&&(f=parseFloat(r.$parent.TripSummary.PremiumSeatFareDiff)+parseFloat(f)),r.$parent&&r.$parent.TripSummary&&r.$parent.TripSummary.changeFeeWaiver&&!r.$parent.TripSummary.changeFeeWaiver.IsSameMemberShipType&&r.$parent.TripSummary.changeFeeWaiver.TotalWaivedFee&&r.$parent.TripSummary.changeFeeWaiver.IsChangeFeeWaived&&(f=parseFloat(f)-parseFloat(r.$parent.TripSummary.changeFeeWaiver.TotalWaivedFee)),f};r.getChangeFee=function(t,i,u){var e,f=0,s,o;return t&&t.length>0&&(o=t[t.length-1],s=r.getFareClass(o),n.forEach(o.AvailBookingFares,function(n){n.Name.toLowerCase()===s.toLowerCase()&&(i.toLowerCase()==="adult"?e=n.FareTypes[0]:i.toLowerCase()==="child"&&(e=n.FareTypes[1]),f=r.isFlightResult&&typeof r.isFlightResult!="undefined"?Number(e.ExchangeInfo.WaivedChangeFee)>-1?parseFloat(e.ExchangeInfo.WaivedChangeFee)+parseFloat(f):parseFloat(e.ExchangeInfo.PenaltyFee)+parseFloat(f):parseFloat(e.ExchangeInfo.PenaltyFee)+parseFloat(f))})),f*u};r.getFuelSurchargeDifference=function(t,i,u,f){var e,o=0,h,s;return t&&t.length>0&&f==="KRW"&&(s=t[t.length-1],h=r.getFareClass(s),n.forEach(s.AvailBookingFares,function(n){n.Name.toLowerCase()===h.toLowerCase()&&(i.toLowerCase()==="adult"?e=n.FareTypes[0]:i.toLowerCase()==="child"&&(e=n.FareTypes[1]),o=parseFloat(e.ExchangeInfo.FuelSurchargeDifference)+parseFloat(o))})),o*u};r.getExternalServiceFee=function(t,i,u){var f,e=0,s,o;return t&&t.length>0&&(o=t[t.length-1],s=r.getFareClass(o),n.forEach(o.AvailBookingFares,function(n){n.Name.toLowerCase()===s.toLowerCase()&&(i.toLowerCase()==="adult"?f=n.FareTypes[0]:i.toLowerCase()==="child"&&(f=n.FareTypes[1]),e=parseFloat(f.ExchangeInfo.ExternalServiceFee)+parseFloat(e))})),e*u};r.getFareClass=function(n){return n.selectedSeatClass||n.AvailBookingFares[0].Name.toLowerCase()};r.getPassengerType=function(n){return n.age>=2&&n.age<=12?"Child":n.age<2?"Infant":"Adult"};r.UpdateClasses=function(){n.forEach(r.selectedSegments,function(t){var i,f,e,r,o,u;i=t.selectedSeatClass;i&&n.forEach(t.AvailBookingFares,function(n){n.Name.toLowerCase()===i.toLowerCase()&&(f=n.DisplayClassName,u=n);n.Name.toLowerCase()==="extracomfort"&&(e=n.DisplayClassName);n.Name.toLowerCase()==="coach"&&(r=n.DisplayClassName);(n.Name.toLowerCase()==="first"||n.Name.toLowerCase()==="business")&&(o=n.DisplayClassName)});n.forEach(t.Legs,function(n){if(i!=null&&i.toLowerCase()==="extracomfort")n.IsExtraComfortAvailable?n.selectedClassForDisplay=e:r&&(n.selectedClassForDisplay=r);else if(u)if(u.IsMixedCabin){if(n.FirstClass){var t=n.FirstClass;n.selectedClassForDisplay=t.toLowerCase()==="coach"?r:o}}else n.selectedClassForDisplay=f})})};r.UpdateClasses();r.calcTaxes=function(){var t=0;r.taxes=[];r.isMileageBooking=!1;r.UpdateClasses();n.forEach(r.selectedSegments,function(i){var o,f,e;r.PricingType==="SegmentFare"?(o=i[i.selectedSeatClass],o&&n.forEach(u.passengers,function(u){var e=u.type,f;e==="Adult"?f=i[i.selectedSeatClass].FareTypes[0]:e==="Child"&&i[i.selectedSeatClass].FareTypes.length>1?f=i[i.selectedSeatClass].FareTypes[1]:e==="Child"&&i[i.selectedSeatClass].FareTypes.length===1?f=i[i.selectedSeatClass].FareTypes[0]:e==="Infant"&&i[i.selectedSeatClass].FareTypes.length>2?f=i[i.selectedSeatClass].FareTypes[2]:e==="Infant"&&i[i.selectedSeatClass].FareTypes.length===2&&(f=i[i.selectedSeatClass].FareTypes[1]);f&&(n.forEach(f.Taxes,function(n){r.addTax(n)}),t+=Number(f.TotalTaxes));i.IsMileagePricing===!0&&(r.isMileageBooking=!0)})):(i.IsRoundTripFare===!0&&i.RoundTripFare.BookingClassFare!=null&&n.forEach(i.RoundTripFare.BookingClassFare.FareTypes,function(i){n.forEach(u.passengers,function(u){u.type.toLowerCase()===i.Name.toLowerCase()&&(n.forEach(i.Taxes,function(n){r.addTax(n)}),t+=Number(i.TotalTaxes))})}),i.isMulticityFare&&(f=0,e={},e=i.selectedSeatClass.toLowerCase()==="coach"?i.MulticityStepThroughFares.CoachCellFlightDetails:i.selectedSeatClass.toLowerCase()==="first"?i.MulticityStepThroughFares.FirstCellFlightDetails:i.selectedSeatClass.toLowerCase()==="business"?i.MulticityStepThroughFares.FirstCellFlightDetails:i.MulticityStepThroughFares.CoachCellFlightDetails,n.forEach(e,function(i){var e=!0;n.forEach(i.AvailBookingFares,function(i){if(r.selectedSegments[f].selectedSeatClass.toLowerCase()===i.Name.toLowerCase()&&e){var o=i.FareTypes.length>0&&i.FareTypes!==undefined?i.FareTypes:"";o!==""&&n.forEach(o,function(i){n.forEach(u.passengers,function(u){u.type.toLowerCase()===i.Name.toLowerCase()&&(n.forEach(i.Taxes,function(n){r.addTax(n)}),t+=Number(i.TotalTaxes))})});e=!1}});f++})))});r.totalTaxes=t.toFixed(2)};r.calcTaxesHeader=function(){var t=0;return(r.isMileageBooking=!1,r.SelectedHotel&&r.SelectedHotel.PackageTaxes)?(t=Number(r.SelectedHotel.PackageTaxes),t.toFixed(2)):(n.forEach(r.selectedSegments,function(i){var o,f,e;r.PricingType==="SegmentFare"?(o=i[i.selectedSeatClass],o&&n.forEach(u.passengers,function(n){var f=n.type,u;f==="Adult"?u=i[i.selectedSeatClass].FareTypes[0]:f==="Child"&&i[i.selectedSeatClass].FareTypes.length>1?u=i[i.selectedSeatClass].FareTypes[1]:f==="Child"&&i[i.selectedSeatClass].FareTypes.length===1?u=i[i.selectedSeatClass].FareTypes[0]:f==="Infant"&&i[i.selectedSeatClass].FareTypes.length>2?u=i[i.selectedSeatClass].FareTypes[2]:f==="Infant"&&i[i.selectedSeatClass].FareTypes.length===2&&(u=i[i.selectedSeatClass].FareTypes[1]);u&&(t+=Number(u.TotalTaxes));i.IsMileagePricing===!0&&(r.isMileageBooking=!0)})):(i.IsRoundTripFare===!0&&i.RoundTripFare.BookingClassFare!=null&&n.forEach(i.RoundTripFare.BookingClassFare.FareTypes,function(i){n.forEach(u.passengers,function(n){n.type.toLowerCase()===i.Name.toLowerCase()&&(t+=Number(i.TotalTaxes))})}),i.isMulticityFare&&(f=0,e={},e=i.selectedSeatClass.toLowerCase()==="coach"?i.MulticityStepThroughFares.CoachCellFlightDetails:i.selectedSeatClass.toLowerCase()==="first"?i.MulticityStepThroughFares.FirstCellFlightDetails:i.selectedSeatClass.toLowerCase()==="business"?i.MulticityStepThroughFares.FirstCellFlightDetails:i.MulticityStepThroughFares.CoachCellFlightDetails,n.forEach(e,function(i){var e=!0;n.forEach(i.AvailBookingFares,function(i){if(r.selectedSegments[f].selectedSeatClass.toLowerCase()===i.Name.toLowerCase()&&e){var o=i.FareTypes.length>0&&i.FareTypes!==undefined?i.FareTypes:"";o!==""&&n.forEach(o,function(i){n.forEach(u.passengers,function(n){n.type.toLowerCase()===i.Name.toLowerCase()&&(t+=Number(i.TotalTaxes))})});e=!1}});f++})))}),t.toFixed(2))};r.calculateTaxes=function(n){return r.calcTaxes(),r.UpdateClasses(),n==="Calculate"&&(r.$parent.CalculateTaxesVar="",r.displayTaxes=r.taxes),r.totalTaxes};r.ToggleTaxDetail=function(){r.taxDetails=r.taxDetails?!1:!0};r.addTripInsuranceToItinerary=function(){r.IsTripInsuranceSelected=!0;r.IsTripInsuranceSelected&&(t.post("/Book/Payment/AddTripInsuranceToItinerary").success(function(n){r.$parent.TripSummary.FinalCost=n.TotalTripCost;r.grandRoundTripTotalPrice()}).error(function(){console.error("Error in updating selected trip insurance")}),$("body, html").animate({scrollTop:135},"slow"))};r.grandTotal=function(){var t=0;return n.forEach(r.selectedSegments,function(i){var r=i[i.selectedSeatClass];r&&n.forEach(u.passengers,function(n){var f=n.type,e=r.FareTypes[0]?f:"Adult",u=i[i.selectedSeatClass].FareTypes[0];f==="Child"&&i[i.selectedSeatClass].FareTypes.length>1?(u=i[i.selectedSeatClass].FareTypes[1],e="Child"):f==="Child"&&i[i.selectedSeatClass].FareTypes.length===1?(u=i[i.selectedSeatClass].FareTypes[0],e="Child"):f==="Infant"&&i[i.selectedSeatClass].FareTypes.length>2?(u=i[i.selectedSeatClass].FareTypes[2],e="Infant"):f==="Infant"&&i[i.selectedSeatClass].FareTypes.length===2&&(u=i[i.selectedSeatClass].FareTypes[1],e="Infant");t+=i.IsMileagePricing===!1?Number(u.TotalDisplayFare)+Number(u.TotalTaxes):Number(u.TotalDisplayFare)})}),t.toFixed(2)};r.grandTotalPrice=function(){var t=0;return n.forEach(r.selectedSegments,function(i){var r=i[i.selectedSeatClass];r&&n.forEach(u.passengers,function(n){var u=n.type,r;u==="Adult"&&(r=i[i.selectedSeatClass].FareTypes[0]);u==="Child"&&i[i.selectedSeatClass].FareTypes.length>1?r=i[i.selectedSeatClass].FareTypes[1]:u==="Child"&&i[i.selectedSeatClass].FareTypes.length===1?r=i[i.selectedSeatClass].FareTypes[0]:u==="Infant"&&i[i.selectedSeatClass].FareTypes.length>2?r=i[i.selectedSeatClass].FareTypes[2]:u==="Infant"&&i[i.selectedSeatClass].FareTypes.length===2&&(r=i[i.selectedSeatClass].FareTypes[1]);r&&(t+=i.IsMileagePricing===!1?Number(r.TotalDisplayFare):Number(r.TotalTaxes))})}),r.$parent&&r.$parent.TripSummary&&r.$parent.TripSummary.TotalCostToPurchaseMiles&&(t+=Number(r.$parent.TripSummary.TotalCostToPurchaseMiles)),r.$parent&&r.$parent.TripSummary&&r.$parent.TripSummary.TotalPremiumSeatAmount&&(t+=Number(r.$parent.TripSummary.TotalPremiumSeatAmount)),r.$parent&&r.$parent.TripSummary&&r.$parent.TripSummary.UnselectedExtraComfortSeatsDowngradeAmount&&(t-=Number(r.$parent.TripSummary.UnselectedExtraComfortSeatsDowngradeAmount)),t.toFixed(2)};r.grandRoundTripTotalPrice=function(){var t=0;return n.forEach(r.selectedSegments,function(i){if(i.IsRoundTripFare===!0)i.RoundTripFare.BookingClassFare!=null&&n.forEach(i.RoundTripFare.BookingClassFare.FareTypes,function(i){n.forEach(u.passengers,function(n){n.type.toLowerCase()===i.Name.toLowerCase()&&(t+=Number(i.TotalDisplayFare))})});else if(i.isMulticityFare){var f=0,e={};e=i.selectedSeatClass.toLowerCase()==="coach"?i.MulticityStepThroughFares.CoachCellFlightDetails:i.selectedSeatClass.toLowerCase()==="first"?i.MulticityStepThroughFares.FirstCellFlightDetails:i.selectedSeatClass.toLowerCase()==="business"?i.MulticityStepThroughFares.FirstCellFlightDetails:i.MulticityStepThroughFares.CoachCellFlightDetails;n.forEach(e,function(i){var e=!0;n.forEach(i.AvailBookingFares,function(i){if(r.selectedSegments[f].selectedSeatClass.toLowerCase()===i.Name.toLowerCase()&&e){var o=i.FareTypes.length>0&&i.FareTypes!==undefined?i.FareTypes:"";o!==""&&n.forEach(o,function(i){n.forEach(u.passengers,function(n){i.Name.toLowerCase()===n.type.toLowerCase()&&(t+=Number(i.TotalDisplayFare))})});e=!1}});f++})}}),r.$parent&&r.$parent.TripSummary&&r.$parent.TripSummary.TotalCostToPurchaseMiles&&(t+=Number(r.$parent.TripSummary.TotalCostToPurchaseMiles)),r.$parent&&r.$parent.TripSummary&&r.$parent.TripSummary.TotalPremiumSeatAmount&&(t+=Number(r.$parent.TripSummary.TotalPremiumSeatAmount)),r.$parent&&r.$parent.TripSummary&&r.$parent.TripSummary.UnselectedExtraComfortSeatsDowngradeAmount&&(t-=Number(r.$parent.TripSummary.UnselectedExtraComfortSeatsDowngradeAmount)),r.SelectedHotel&&r.SelectedHotel.PackageGrandTotal&&(t=Number(r.SelectedHotel.PackageGrandTotal)),r.IsTripInsuranceSelected&&(t=Number(r.$parent.TripSummary.FinalCost)),t.toFixed(2)};r.grandTotalMileage=function(){var t=0;return n.forEach(r.selectedSegments,function(i){var r=i[i.selectedSeatClass];r&&n.forEach(u.passengers,function(n){var u=n.type,r;u==="Adult"&&(r=i[i.selectedSeatClass].FareTypes[0]);u==="Child"&&i[i.selectedSeatClass].FareTypes.length>1?r=i[i.selectedSeatClass].FareTypes[1]:u==="Child"&&i[i.selectedSeatClass].FareTypes.length===1?r=i[i.selectedSeatClass].FareTypes[0]:u==="Infant"&&i[i.selectedSeatClass].FareTypes.length>2?r=i[i.selectedSeatClass].FareTypes[2]:u==="Infant"&&i[i.selectedSeatClass].FareTypes.length===2&&(r=i[i.selectedSeatClass].FareTypes[1]);r&&i.IsMileagePricing===!0&&(t+=Number(r.TotalDisplayFare))})}),r.$parent&&r.$parent.TripSummary&&r.$parent.TripSummary.TotalPremiumSeatAmount&&!r.$parent.TripSummary.IsMileagePricing&&(t+=Number(r.$parent.TripSummary.TotalPremiumSeatAmount)),r.$parent&&r.$parent.TripSummary&&r.$parent.TripSummary.UnselectedExtraComfortSeatsDowngradeAmount&&!r.$parent.TripSummary.IsMileagePricing&&(t-=Number(r.$parent.TripSummary.UnselectedExtraComfortSeatsDowngradeAmount)),t.toFixed(2)};r.inFlightOptions=function(){var t=[];if(r.seatSelection!=null&&r.seatSelection.Legs!=null)return n.forEach(r.seatSelection.Legs,function(i){i.SeatSelections!=null&&i.SeatSelections.InFlightOptions!=null&&i.SeatSelections.InFlightOptions.length>0&&n.forEach(i.SeatSelections.InFlightOptions,function(n){t=t.concat(n)})}),t.length===0&&r.seatSelection.InFlightOptions!=null&&r.seatSelection.InFlightOptions.length>0&&n.forEach(r.seatSelection.InFlightOptions,function(n){t=t.concat(n)}),t}},r;return i.$inject=["$rootScope","$scope","haPassengersService"],r=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:r,controller:i}}])}(angular),function(n){"use strict";var t=n.module("haReceiptEndOnEndModule",[]);t.directive("haReceiptEndOnEnd",function(){var t=function(t,i,r){i.totalTaxes=0;i.taxes=[];i.$pax=r;i.$on("calcTaxes",function(){i.calcTaxes()});i.getFarePerTraveller=function(t,i,r){var u;return r!=null&&r?(n.forEach(t.AvailGridFareTypes,function(n){+n.PaxType==+i&&n.IsCompanion&&(u=n.TotalBaseFare)}),u||n.forEach(t.AvailGridFareTypes,function(n){+n.PaxType==0&&n.IsCompanion&&(u=n.TotalBaseFare)}),u):(n.forEach(t.AvailGridFareTypes,function(n){+n.PaxType!==i||n.IsCompanion||(u=n.TotalBaseFare)}),u||n.forEach(t.AvailGridFareTypes,function(n){+n.PaxType!=0||n.IsCompanion||(u=n.TotalBaseFare)}),u)};i.calcTaxes=function(){var u=0,t,e=!1,f;i.taxes=[];f=i.TripSummary.FareDetails.AvailGridTrips.AvailGridFareDetail;n.forEach(r.passengers,function(r){t=!1;r.type==="Adult"&&e?n.forEach(f.AvailGridFareTypes,function(f){i.getPaxTypeNum(r.type)!==f.PaxType||f.IsCompanion||(n.forEach(f.AvailGridTaxes,function(n){i.addTax(n)}),u+=Number(f.TotalTax),t=!0)}):n.forEach(f.AvailGridFareTypes,function(f){i.getPaxTypeNum(r.type)===f.PaxType&&f.IsCompanion&&(n.forEach(f.AvailGridTaxes,function(n){i.addTax(n)}),u+=Number(f.TotalTax),t=!0,e=!0)});t||n.forEach(f.AvailGridFareTypes,function(r){+r.PaxType==0&&(n.forEach(r.AvailGridTaxes,function(n){i.addTax(n)}),u+=Number(r.TotalTax),t=!0)})});i.totalTaxes=u.toFixed(2)};i.addTax=function(t){var u=function(t){var r;return n.forEach(i.taxes,function(n){n.TaxCode===t&&(r=n)}),r},r=u(t.TaxCode);r?r.TaxAmount=Number(r.TaxAmount)+Number(t.TaxAmount):i.taxes.push({Description:t.Description,TaxAmount:t.TaxAmount,TaxCode:t.TaxCode})};i.ToggleTaxDetail=function(){i.taxDetails=i.taxDetails?!1:!0};i.grandTotalPrice=function(){var t=0,u,e=!1,f=i.TripSummary.FareDetails.AvailGridTrips.AvailGridFareDetail;return n.forEach(r.passengers,function(r){u=!1;r.type==="Adult"&&e?n.forEach(f.AvailGridFareTypes,function(n){+i.getPaxTypeNum(r.type)!=+n.PaxType||n.IsCompanion||(t+=Number(n.TotalAmount),u=!0)}):n.forEach(f.AvailGridFareTypes,function(n){+i.getPaxTypeNum(r.type)==+n.PaxType&&n.IsCompanion&&(t+=Number(n.TotalAmount),u=!0,e=!0)});u||n.forEach(f.AvailGridFareTypes,function(n){+n.PaxType==0&&(t+=Number(n.TotalAmount))})}),t.toFixed(2)};i.getPaxTypeNum=function(n){switch(n){case"Adult":return 0;case"Child":return 1;case"Infant":return 2;default:return!1}}},i;return t.$inject=["$rootScope","$scope","haPassengersService"],i=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:i,controller:t}})}(angular),function(n){"use strict";var t=n.module("haAccountRegistrationModule",["haEmailAPI","haUsernameAPI","haUtilsModule"]);t.directive("haAccountRegistration",["$log","$window","$timeout","haGlobals","haUtils","haHttpService","haGeoDataSvc",function(t,i,r,u,f,e,o){var s=function(s,h){var l,v,c,a;u(["defaultCountry","defaultPhoneCountryCode"],function(n,t){l=n;v=t});f.attachViewModelToScopeAsVM(s,"HMRegistrationViewModel",function(n){n.AccountDetail=n.AccountDetail||{};n.AccountDetail.Country==null&&(n.AccountDetail.Country=l)});s.expand={HM:!1};s.shouldAddHM=function(){(s.VM.MemberSubscriptions.ENewsLetters||s.VM.MemberSubscriptions.HMPartners)&&(s.expand.HM=!0)};s.shouldClearSubs=function(){r(function(){s.expand.HM||s.VM==null||(s.VM.MemberSubscriptions.ENewsLetters=!1,s.VM.MemberSubscriptions.HMPartners=!1)},10)};f.attachViewModelToScopeAsVM(s,"WebOnlyHMRegistrationViewModel",function(n){n.AccountDetail=n.AccountDetail||{};n.AccountDetail.Country==null&&(n.AccountDetail.Country=l);s.IsReadOnly=n.MemberPersonalInfo!=null&&n.MemberPersonalInfo.FirstName!=null&&n.MemberPersonalInfo.LastName!=null;s.namePrefilled=!1;s.VM.MemberPersonalInfo.FirstName!=null&&s.VM.MemberPersonalInfo.FirstName.length>0&&(s.namePrefilled=!0);s.shouldAddHM()});u("countryData",function(n){s.countries=o.setCountryData(n)});s.init=function(){r(function(){s.VM.AccountDetail!=null&&s.VM.AccountDetail.EmailAddress!=null&&n.element('input[name="AccountDetail.EmailAddress"]').blur()},10)};s.emailDupe={allowEmailDupe:!1,display:!1};s.getUrlVars=function(){for(var t=[],n,u=i.location.href.replace("amp;","").slice(i.location.href.indexOf("?")+1).split("&"),r=0;r<u.length;r++)n=u[r].split("="),t.push(n[0]),t[n[0]]=n[1];return t};c=s.getUrlVars();typeof c.EmailAddress!="undefined"&&(typeof s.AccountDetail!="undefined"&&(s.AccountDetail.EmailAddress=c.EmailAddress),s.ShowHMRegistrationAlert=!0,s.HMRegistrationMessageType="success",u("SubscribtionSuccessMessage",function(n){s.HMRegistrationHeaderMessage=n}));typeof c.Token!="undefined"&&(s.IsReadOnly=!0);s.showPrivacyPolicy=function(){h("/Shared/Modal/GetModalContent?fieldName=ViewPrivacyPolicy&itemId=HMRegistration",{id:"registration-privacy",backdrop:"true"})};s.showTerms=function(){h("/Shared/Modal/GetModalContent?fieldName=ViewTermsFullText&itemId=HMRegistration",{id:"registration-privacy",backdrop:"true"})};a=function(n){return delete n.CountryStateDropDown,delete n.SecurityQuestions.SecurityQAPlaceHolder,delete n.SecurityQuestions.SecurityQuestionsDropDown,delete n.PhoneDetailList.CountryCodeDropDown,delete n.PhoneDetailList.PhoneTypeDropDown,delete n.MemberPersonalInfo.GenderDropDown,delete n.MemberPersonalInfo.SuffixDropDown,delete n.MemberPersonalInfo.DOBMonthDropDown,delete n.MemberPersonalInfo.DOBDayDropDown,delete n.MemberPersonalInfo.DOBYearDropDown,n};s.onSubmit=function(n,t){n.preventDefault();s.submitting=!1;t.$valid&&(s.submitting=!0,window[t.$name].submit())};s.getDOB=function(){return s.VM.dobMonth+"/"+s.VM.dobDay+"/"+s.VM.dobYear};s.submitUpgrade=function(f){var o,h;f.$valid&&(o=a(n.copy(s.VM)),o.IsHMChecked=!0,o.MemberPersonalInfo.DateOfBirth=s.getDOB(),s.VM.MemberAddress.City!=null?(o.MemberAddress.CityKey=s.VM.MemberAddress.City.Key,o.MemberAddress.City=s.VM.MemberAddress.City.DisplayName):s.VM.MemberAddress.CityName!=null&&(o.MemberAddress.City=s.VM.MemberAddress.CityName),s.VM.MemberAddress.State!=null&&(o.MemberAddress.StateKey=s.VM.MemberAddress.State.Key,o.MemberAddress.State=s.VM.MemberAddress.State.Name),s.VM.MemberAddress.Country!=null&&(o.MemberAddress.CountryKey=s.VM.MemberAddress.Country.Key,o.MemberAddress.Country=s.VM.MemberAddress.Country.Name),h=function(n){t.debug(n.data);s.ShowHMRegistrationAlert=!0;s.HMRegistrationMessageType="error";u("HMUpgradeErrorMessage",function(n){s.HMUpgradeErrorMessage=n})},e.POST("/MyAccount/WebOnlyOrHMRegistration/HMUpgradeJson",o).then(function(n){t.debug(n.data);n.data.RedirectUrl!=null?(s.ShowHMRegistrationAlert=!0,s.HMRegistrationMessageType="success",u("SubscribtionSuccessMessage",function(n){s.HMRegistrationHeaderMessage=n}),r(function(){i.location=n.data.RedirectUrl},750)):(s.HMUpgradeMessage=n.data.Message,h(n))},h))};s.restrictMinors=!0;s.$watch('registration["MemberPersonalInfo.isMinor"].$modelValue',function(n){!n||s.minorDobSelected||(s.minorDobSelected=n)})};return s.$inject=["$scope","haModal"],{restrict:"A",scope:!0,controller:s}}]);t.directive("emailDupeCheck",["$q","haEmailAPI",function(n,t){return{require:"ngModel",scope:{allowDupeEmail:"=allowEmailDupe",displayDupe:"=displayDupe"},link:function(i,r,u,f){var e;i.previousValue="";i.safeApply=function(n){var t=this.$root.$$phase;t==="$apply"||t==="$digest"?n&&typeof n=="function"&&n():this.$apply(n)};i.$watch(function(){return f.$modelValue},function(){i.safeApply(function(){f.$setValidity("emailUnique",!0);i.displayDupe=!1;i.previousValue="";e&&e.resolve();e=n.defer()})});i.$watch(function(){return i.allowDupeEmail},function(n,t){n!==t&&i.safeApply(function(){n===!0?(i.displayDupe=!0,f.$setValidity("emailUnique",!0)):n===!1&&(i.displayDupe=!0,f.$setValidity("emailUnique",!1))})});r.on("blur",function(){i.isValid()||i.previousValue===r.val()||i.$apply(function(){i.previousValue=r.val();f.$setValidity("emailUniqueAjax",!1);e&&e.resolve();e=n.defer();var u=r.val();t.emailAvailabilityCheck(u,e).then(function(n){i.allowDupeEmail=undefined;f.$setValidity("emailUnique",n);f.$setValidity("emailUniqueAjax",!0);i.$emit("validateForm")})})});i.isValid=function(){var i,t,n;if(r.controller("ngModel").$error){i=!1;t=r.controller("ngModel").$error;for(n in t)if(t.hasOwnProperty(n)&&n!=="emailUniqueAjax"&&n!=="emailUnique"&&t[n]===!0){i=!0;break}return i}return!1}}}}]);t.directive("haDuplicateUsernameCheck",["$q","haUtils","haUsernameAPI",function(n,t,i){return{require:"ngModel",link:function(r,u,f,e){var h=t.debounce(function(n,u){t.safeApply(r,function(){e.$setValidity("duplicateUsernameChecked",!1);i.checkAvailability(n,u).then(function(n){e.$setValidity("duplicateUsername",n);e.$setValidity("duplicateUsernameChecked",!0)})})},150),o,s;r.$watch(function(){return e.$modelValue},function(){s?(o&&o.resolve(),o=n.defer(),e.$setValidity("duplicateUsername",!0),e.$error==null||e.$error.required||e.$error.pattern||h(u.val(),o)):s=!0})}}}])}(angular),function(n){"use strict";var t=n.module("haAccountSignInModule",["haLoginAPI"]);t.directive("haAccountSignIn",["haConfig","haGlobals","haLoginAPI","haSitecoreStrings","$locale","$timeout","$window","$rootScope",function(n,t,i,r,u,f,e,o){var h=e.jsonConfirmIdentityModel,c=location.href,s=function(f,s){f.$locale=u;f.loginModel={UserName:"",Password:"",RememberMe:!1};f.resetpasswordModel={Password:""};f.forgotpasswordModel={usernamehmno:""};f.regform={Password:""};f.isWorking=!1;f.showResetMessage=!1;f.ShowButtonOrSpinnerOrError=!1;f.LoginHeaderMessage="";f.getUrlVars=function(){for(var t=[],n,r=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),i=0;i<r.length;i++)n=r[i].split("="),t.push(n[0]),t[n[0]]=n[1];return t};f.AccountSignInError=function(n,t){f.ShowLoginHeaderAlert=!0;f.LoginErrorType=t;f.LoginHeaderMessage=n};f.getNativeAppBannerStringsForCheckIn=function(){o.isMobile||r.get("CHECK_IN_NATIVE_APP_BANNER").then(function(n){f.nativeAppBannerCookie="checkInOrConfirmationNativeAppBanner";f.nativeAppBannerHeader=n.header;f.nativeAppBannerLinkText=n.linktext;f.nativeAppBannerCookieDays=n.cookiedays;f.checkInNativeAppBannerEnabled=!!n.enable})};var l=f.getUrlVars();typeof l.isRedirect!="undefined"&&(f.ShowLoginHeaderAlert=!0,f.LoginErrorType="success",t("SubscribtionSuccessMessage",function(n){f.LoginHeaderMessage=n}));l.indexOf("MaxPasswordChangeAttemptsExceeded")!==-1&&f.AccountSignInError(e.tooManyPasswordChangeAttemptsMessage,"error");/manage\/check-in/i.test(c)&&f.getNativeAppBannerStringsForCheckIn();t(["IsUpdateEmailPreferences","emailPreferenceLogin","SubscribtionSuccessMessage","loginModel","CM_UserProfileSwitch"],function(n,t,i,r,u){r.UserName!=null&&(f.loginModel.UserName=r.UserName,f.loginModel.RememberMe=!0);n==="True"&&typeof l.isRedirect=="undefined"?f.AccountSignInError(t,"info"):typeof l.isRedirect!="undefined"&&f.AccountSignInError(i,"success");f.CM_UsernameSwitch=u});t("jsonValidateSecurityAnswersModel",function(n){f.AccountNo=n.AccountNo;f.SecurityQuestions=n.SecurityQuestions;f.FirstName=n.FirstName;f.LastName=n.LastName;f.PhoneNumber=n.PhoneNumber;f.ZipCode=n.ZipCode;f.Country=n.Country});t("jsonForgotUsernameHMNumberModel",function(n){f.EmailIdOrHMNumber=n.EmailIdOrHMNumber;f.FirstName=n.FirstName});t("jsonRetriveUsernameHMNumberModel",function(n){f.EmailId=n.EmailId});t("jsonForgotEmailMemberDetailsModel",function(n){f.AccountNo=n.AccountNo;f.FirstName=n.FirstName;f.LastName=n.LastName;f.PhoneNumber=n.PhoneNumber;f.ZipCode=n.ZipCode;n.Country!=null&&(f.Country=n.Country)});t(["isPasswordLinkExpired","passwordExpired"],function(n,t){n==="true"&&(f.ShowForgotPasswordAlert=!0,f.ForgotPasswordErrorType="error",f.ForgotPasswordHeaderMessage=t)});t("subscribedEmailAddress",function(n){f.emailaddress=n});t("EmailOnlyPreferencesJson",function(n){f.VM=n});t("jsonResetEmailAddressModel",function(n){f.EmailAddress=n.EmailAddress;f.ConfirmEmailAddress=n.ConfirmEmailAddress});f.CreateUsername=function(){i.CreateUsername(this.forgot.username.$modelValue).success(function(n){n.ResponseBaseModel.IsSuccess===!0&&n.UserAccountInformationViewModel!==undefined?n.UserAccountInformationViewModel.AccountType===1?ShowModalPopup("WOLogin"):n.UserAccountInformationViewModel.AccountType===2?window.location.href="/":window.alert("Invalid AccountType"):(f.ShowCreateUsernameAlert=!0,f.CreateUsernameErrorType="error",f.CreateUsernameHeaderMessage=usernameExists)},function(n){window.alert(n)})};f.submitLogin=function(){f.ShowButtonOrSpinnerOrError=!0;$("#ErrorMessage").hide();var n=$("#login");i.login($(n).serialize()).success(function(n){if(n=n.loginResponse,n.IsSuccess)t(["IsUpdateEmailPreferences","redirectEmailSubscriptionsPath"],function(n,t){if(n==="True"){window.location.href=t;return}}),window.location.href=n.RedirectURL;else{if(n.RedirectURL){window.location.href=n.RedirectURL;return}f.ShowButtonOrSpinnerOrError=!1;f.AccountSignInError(n.TranslateServiceError,"error");f.loginModel.Password="";$("#password").focus()}}).error(function(n){f.ShowButtonOrSpinnerOrError=!1;f.AccountSignInError(n,"error");f.loginModel.Password=""})};f.submitResetPassword=function(n){n.preventDefault();f.ShowButtonOrSpinnerOrError=!0;i.UpdatePassword($.param(f.regform)).success(function(n){if(f.ShowButtonOrSpinnerOrError=!1,n.IsSuccess===!0){window.location.href=n.RedirectUrl;return}f.ShowResetPasswordAlert=!0;f.ResetPasswordErrorType="error";f.ResetPasswordHeaderMessage=n.TranslateServiceError})};f.submitResetEmailAddress=function(n){n.preventDefault();f.ShowButtonOrSpinnerOrError=!0;var t=$("#resetemailaddress");i.ResetEmailAddress($(t).serialize()).success(function(n){f.ShowButtonOrSpinnerOrError=!1;n&&(window.location.href=n.RedirectUrl);return})};f.SubmitResetEmail=function(){if(this.forgot.$valid){var n=this.forgot.emailtwo.$modelValue;i.ResetEmail(n).success(function(n){n.IsSuccess&&t("redirectLoginPath",function(n){window.location.href=n})})}else this.forgot.email.$error.required?(f.showResetMessage=!0,f.ResetEMailErrorType="error",f.ResetEMailHeaderMessage=EmptyNewEmail):this.forgot.email.$error.email?(f.showResetMessage=!0,f.ResetEMailErrorType="error",f.ResetEMailHeaderMessage=NewEmailAddressValid):this.forgot.emailtwo.$error.required?(f.showResetMessage=!0,f.ResetEMailErrorType="error",f.ResetEMailHeaderMessage=EmptyConfirmEMail):this.forgot.emailtwo.$error.pwmatch&&(f.showResetMessage=!0,f.ResetEMailErrorType="error",f.ResetEMailHeaderMessage=EmailNotMatch)};f.UpdatePassword=function(){i.UpdatePassword(f.forgot.password1.$modelValue).success(function(n){n.IsSuccess===!0?window.location.href="/?login=1":($("#LoginError").html(n.Message),$("#LoginError").show())},function(n){console.log(n);alert(n)})};f.UnsubscribeEmailAddressSubmit=function(n){if(this.emailunsubscribe.EmailAddress.$error.email===!0||this.emailunsubscribe.EmailAddress.$error.required===!0)return!1;f.IsUnsubscribeAll=n==="1"?!1:!0;f.EmailAddress=this.emailunsubscribe.EmailAddress.$viewValue;i.UnsubscribeEmailAddressSubmit(f.EmailAddress,f.UnSubscriptionID,f.IsUnsubscribeAll).success(function(n){n.IsSuccess===!0?(f.EmailUnsubscribePasswordAlert=!0,f.EmailUnsubscribeErrorType="success",t("SuccessHeaderMessage",function(n){f.EmailUnsubscribeHeaderMessage=n})):(f.EmailUnsubscribePasswordAlert=!0,f.EmailUnsubscribeErrorType="error",f.EmailUnsubscribeHeaderMessage=n.Message)},function(n){console.log(n);alert(n)})};f.UpdateEmailPreferences=function(){var n=f.EmailAddress,r=f.UnSubscriptionID,u=f.IsUnsubscribeAll;if(n==null||n===""||n==="undefined")return!1;i.UpdateEmailPreferencesSubmit(n,r,u).success(function(n){n.IsSuccess===!0?(f.EmailUnsubscribePasswordAlert=!0,f.EmailOnlyErrorType="success",t("SuccessHeaderMessage",function(n){f.EmailOnlyHeaderMessage=n})):(f.EmailUnsubscribePasswordAlert=!0,f.EmailOnlyErrorType="error",t("HeaderErrorMessage",function(n){f.EmailOnlyHeaderMessage=n}))},function(n){console.log(n);alert(n)})};f.SaveEmailOnlyPreferences=function(){i.EmailOnlyPreferencesSubmit(f.VM).then(function(n){n.IsSuccess===!0?(f.EmailOnlyPreferences=n.Result.EmailOnlyPreferencesVM,f.formNotValid=!1):($("#errorMessages").html(n.Result.Message).show(),f.formNotValid=!0)},function(n){console.log(n)})};f.IsUserNameAvailable=!1;f.showMemberBenefits=function(){s(n.getTemplateUrl("ha-member-benefits-modal.html"),{id:"member-benefits",backdrop:"true"})};f.$on("haAlertClosed",function(n,t){t==="ForgotPasswordAlert"&&(f.ShowForgotPasswordAlert=!1)});f.ConfirmIdentityEmailOnlySubscription=function(){if(this.forgot.$valid){var n=this.forgot.zipcode.$modelValue,t=h.EmailAddress;i.AuthenticateEmailOnly(t,n).success(function(n){n.IsSuccess?window.location=n.RedirectUrl:f.AccountSignInError(n.TranslateServiceError,"error")})}};f.UnsubscribeEmailAddressLoad=function(){f.UnSubscriptionID=l.type;f.EmailAddress=jsonEmailUnsubscrioptionModel.EmailAddress;t(["EmailSubscription1","EmailSubscription2","EmailSubscription3"],function(n,t,i){l.type==="1"?f.Type=n:l.type==="2"?f.Type=t:l.type==="3"&&(f.Type=i)})};f.getUrlVars=function(){for(var t=[],n,r=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),i=0;i<r.length;i++)n=r[i].split("="),t.push(n[0]),t[n[0]]=n[1];return t};f.Cancel=function(){window.location.href="/"};f.ConfirmIdentityLoad=function(n){window.location.href="/EmailOnly/ConfirmIdentityLoad?accountNoOrEmail="+n};f.submitManageTripForm=function(n){n.$valid&&(f.searchingTrip=!0,$(n).submit())}};return s.$inject=["$scope","haModal"],{restrict:"A",scope:!0,controller:s}}])}(angular),function(n){"use strict";var t=n.module("haBookingHeroModule",[]);t.directive("haBookingHero",function(){var n=function(n){n.$emit("$haBookingHeroReady")},t;return n.$inject=["$scope"],t=function(n){n.exampleMethod=function(){return n}},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t=n.module("haItineraryModule",[]);t.directive("haItinerary",["haGlobals","haConfig","haUtils","haAncillariesAPI",function(t,i){var r=function(n,r,u){n.IsItineraryLoaded=!1;n.UpdatePassengerList=function(){n.TripSummary.AdultCount>0&&n.AddPassengerList(n.TripSummary.AdultCount,"Adult");n.TripSummary.ChildCount>0&&n.AddPassengerList(n.TripSummary.ChildCount,"Child");n.TripSummary.InfantCount>0&&n.AddPassengerList(n.TripSummary.InfantCount,"Infant")};var f=function(t){$.extend(n,t);n.TripSummary.TotalPremiumSeatAmount=0;n.TripSummary.UnselectedExtraComfortSeatsDowngradeAmount=0;n.$emit("$haItineraryReady");n.$pax=u;n.$pax.passengers=[];n.selectedSegments=[];n.currency=n.TripSummary.currency;n.PricingType=n.TripSummary.PricingType;n.AddPassengerList=function(t,i){for(var r=0;r<t;r++)n.$pax.add({type:i,isUser:!0})};n.taxDetails=!1;n.UpdatePassengerList()};t("itineraryDetails",f);n.showItineraryHelp=function(){r(i.getTemplateUrl("ha-help-book-itinerary-modal.html"),{id:"itinerary-help",backdrop:"true"})};n.ToggleTaxDetails=function(){n.taxDetails=!n.taxDetails};n.IsChangeFlightBooking||(n.isMainCabinBasicSelected=n.PassengerTripSummary.AvailGridTrips.filter(function(n){return n.CabinName==="MAINCABINBASIC"}).length>0)},u;return r.$inject=["$scope","haModal","haPassengersService"],u=function(t){t.IsItineraryLoaded=!1;t.TripSummary.SelectedHotel!=null&&typeof t.TripSummary.SelectedHotel.HotelId=="string"&&(t.SelectedHotel=t.TripSummary.SelectedHotel);t.$watch("TripSummary.SelectedCar",function(n){t.SelectedCar=n});n.forEach(t.PNRs,function(n){t.IsOrbitzPkgEligible=n.Ancillaries.IsOrbitzPkgEligible});n.forEach(t.TripSummary.Trips,function(n){var i=n.Flights[0],r;for(i.IsMileagePricing=n.IsMileagePricing,r=0;r<i.AvailBookingFares.length;r++)i.selectedSeatClass=i.AvailBookingFares[r].Name,i[i.selectedSeatClass]=i.AvailBookingFares[r];t.selectedSegments.push(i);t.IsItineraryLoaded=!0})},{restrict:"A",scope:!0,link:u,controller:r}}])}(angular),function(n){"use strict";var t=n.module("haItineraryDetailsPaxInfoModule",["haItineraryAPI"]);t.directive("haItineraryDetailsPaxInfo",["haModal","$log","$window","haUtils","haItineraryAPI",function(t,i,r,u,f){return{restrict:"A",scope:!0,link:function(e){function c(n,t){var i=t.substr(0,3).toUpperCase();return i+(", "+n.substr(0,1).toUpperCase()+".")}function s(n,t){var i=n.trim()+" "+t.trim();return i.toLowerCase()}e.itinVM=e.VM.confItinVM?e.VM.confItinVM:e.VM?e.VM:{};$scs.get("Itinerary_Details_Info.ChangeSeatsErrorMessage").then(function(n){e.changeSeatsErrorMsg=n});e.itinVM.flightAndSeat=[];n.forEach(e.itinVM.Segments,function(t){t.Flights&&t.Flights.length>0?n.forEach(t.Flights,function(t){var i=[];n.forEach(e.itinVM.Seats,function(n){n.ArrivalCityCode===t.ArrivalCityCode&&n.DepartureCityCode===t.DepartureCityCode&&n.SegmentNumber===t.SegmentNumber&&(i[n.TravellerNameNumber]=n)});e.itinVM.flightAndSeat.push({flightInfo:t,seats:i})}):e.itinVM.flightAndSeat.push(null)});var o=7,h="SelectGroupPaxModal";e.selectTravelersForSeating=function(r){e.VM.selectTravelersIntent=r||"view seats";e.VM.numSelectedGroupPax=0;e.VM.groupPaxModifyState=0;e.resetFindTraveler();e.findTravelerExpanded=!1;e.exceededPaxAlert=!1;n.forEach(e.Passengers,function(n){n.hiddenName=c(n.FirstName,n.LastName);n.checked&&e.VM.numSelectedGroupPax++});t({id:h,backdrop:"true",templateUrl:"/selectGroupPaxModal.html",scope:e});i.debug("Passengers",e.Passengers)};e.removePax=function(t){n.forEach(e.Passengers,function(n){n.TravellerNameNumber===t&&(n.checked=!1,e.VM.numSelectedGroupPax--,n.DOBDay_input="",n.DOBMonth_input="")})};e.setForm=function(n){e.dobForm=n};e.resetDOBValidity=function(t){n.forEach(e.Passengers,function(n){n.TravellerNameNumber===t&&(e.dobForm["dob-month-"+t].$setValidity("dob",!0),e.dobForm["dob-day-"+t].$setValidity("dob",!0))});e.validationErrorAlert=!1};e.toggleGroupPax=function(n,t){e.Passengers[n]&&(e.exceededPaxAlert=!1,t.target.checked?e.VM.numSelectedGroupPax<o?e.VM.numSelectedGroupPax++:(e.Passengers[n].checked=!1,e.exceededPaxAlert=!0):(e.Passengers[n].checked=!1,e.VM.numSelectedGroupPax--))};e.selectedPaxPredicate=function(n){return n.checked};e.showTravelersPredicate=function(n){return e.VM.IsGroupPNR?e.VM.showSelectedPax&&n.checked?!0:!1:!0};e.resetGroupPaxSelection=function(){n.forEach(e.Passengers,function(n){n.checked=!1});e.VM.showSelectedPax=!1;e.selectTravelersForSeating()};e.resetFindTraveler=function(){e.findTraveler={firstName:"",lastName:"",state:"find"}};e.groupPaxNext=function(){if(e.VM.groupPaxModifyState<1)e.VM.groupPaxModifyState++,e.resetFindTraveler(),e.findTravelerExpanded=!1,e.exceededPaxAlert=!1;else{var t=!0;n.forEach(e.Passengers,function(n){if(n.checked&&(!n.DOBDay_input||!n.DOBMonth_input||n.DOBDay!==n.DOBDay_input||n.DOBMonth!==n.DOBMonth_input)){var i=n.TravellerNameNumber;e.dobForm["dob-month-"+i].$setDirty();e.dobForm["dob-month-"+i].$setValidity("dob",!1);e.dobForm["dob-day-"+i].$setDirty();e.dobForm["dob-day-"+i].$setValidity("dob",!1);t=!1}});t?(e.VM.showSelectedPax=!0,e.VM.selectTravelersIntent==="view seats"?e.$root.$broadcast("$modalCancel",h):e.changeSeatsForSelectedPax()):e.validationErrorAlert=!0}};e.groupPaxPrevious=function(){e.VM.groupPaxModifyState--};e.daysForMonth=function(n){for(var i=[],r=n||"01",u=moment("2016-"+r,"YYYY-MM").daysInMonth(),t=1;t<=u;t++)t.toString().length===1&&(t="0"+t),i.push(t+"");return i};e.changeSeatsForSelectedPax=function(){if(e.VM.showSelectedPax){var t=[];n.forEach(e.Passengers,function(n){n.checked&&t.push(n.TravellerNameNumber)});f.GroupPNRSelectTravellers(t).success(function(n){n&&n.IsSuccess&&n.RedirectURL?window.location.href=n.RedirectURL:e.VM.groupChangeSeatsError=!0}).error(function(){e.VM.groupChangeSeatsError=!0})}else e.selectTravelersForSeating("change seats")};e.expandFindTraveler=function(){if(!e.findTravelerExpanded){e.VM.numSelectedGroupPax<o?(e.findTravelerExpanded=!0,e.resetFindTraveler()):e.exceededPaxAlert=!0;return}e.findTravelerExpanded=!1};e.searchForTraveler=function(){var r,t,i;e.searchedTraveler=e.findTraveler.firstName.trim()+" "+e.findTraveler.lastName.trim();r=s(e.findTraveler.firstName,e.findTraveler.lastName);e.searchedTravelerHiddenName=c(e.findTraveler.firstName,e.findTraveler.lastName);t=0;n.forEach(e.Passengers,function(n,u){var f=s(n.FirstName,n.LastName);f===r&&(t++,i=u)});t>0?t>1?e.findTraveler.state="multiple":e.VM.numSelectedGroupPax<o&&(e.findTraveler.state="found",e.Passengers[i].checked||(e.Passengers[i].checked=!0,e.VM.numSelectedGroupPax++)):e.findTraveler.state="notFound"};e.selectTravelerWithDOB=function(){e.searchedTraveler=e.findTraveler.firstName.trim()+" "+e.findTraveler.lastName.trim();var t=s(e.findTraveler.firstName,e.findTraveler.lastName);n.forEach(e.Passengers,function(n){var i=s(n.FirstName,n.LastName);i===t&&e.findTraveler.DOBMonth===n.DOBMonth&&e.findTraveler.DOBDay===n.DOBDay&&e.VM.numSelectedGroupPax<o&&(e.findTraveler.state="found",n.checked||(n.checked=!0,e.VM.numSelectedGroupPax++))});e.findTraveler.showNoMatchMessage=!1;e.findTraveler.state!=="found"&&(e.findTraveler.showNoMatchMessage=!0)};e.formatString=function(n,t){return n=n.replace(/&quot;/g,'"'),u.formatDynamicString(n,t)};e.showChangeSeatsPage=function(){u.checkForInfant(e.VM)?u.checkIfTicketedInfant(e.VM)?r.location.href="/my-account/my-trips/select-or-upgrade-seats":e.infantChangeSeatsError=!0:r.location.href="/my-account/my-trips/select-or-upgrade-seats"}}}}])}(angular),function(n){"use strict";var t=n.module("haFlightHopModule",[]);t.directive("haFlightHop",function(){var t="#717072",i=["$scope",function(i){var r=function(n){var t=0;return n.forEach(function(n){var i=/^(\d+h ?)?(\d+m)?$/.exec(n.Duration).slice(1);n.totalMin=parseInt(i[0]||0,10)*60;n.totalMin+=parseInt(i[1]||0,10);t+=n.totalMin}),t};i.flightHop=function(n,u,f){var e=n.getContext("2d");e.clearRect(0,0,n.width,n.height);var s=function(n,i){e.beginPath();e.rect(n-17,i-18,32,30);e.fillStyle=f;e.fill();e.font="18px ha-icon";e.fillStyle=t;e.fillText(String.fromCharCode("0xe61e"),n-10,i+6)},h=function(n,t,i,r){for(var u,e=[],o=1-t*i,f=0;f<n.length;f++)u=n[f],u>t&&(u=u/r*o),e.push(u);return e},c=function(n,t){for(var i,u=.2,r=[],f=0,o=0,e=0;e<n.length;e++)i=n[e].totalMin/t,i<u?(i=u,f++):o+=i,r.push(i);return f&&(r=h(r,u,f,o)),r},l=function(u,f){var d=r(u),s;e.strokeStyle=f;e.fillStyle=t;var l=5,h=l,g=c(u,d);for(s=0;s<u.length;s++){var nt=g[s],p=n.width-l*2,v=p*nt,y=n.height-l,w=h+Math.round(v/2),tt=1+v/p*.8,it=v*tt,b=h+v,k=y;a(w,it,h,y,b,k,f);o(h,y,l,f);i.insertFlightData(w,u[s]);s>0&&s<u.length&&i.insertLayoverData(h,u[s-1],u[s]);h+=Math.round(v);o(b,k,l,f)}},o=function(n,i,r,u){var f=Math.PI*2;e.beginPath();e.arc(n,i,r,0,f,!1);e.fillStyle=t;e.fill();e.lineWidth=3;e.strokeStyle=u;e.stroke();e.closePath()},a=function(n,i,r,u,f,o){var h=r-n,c=u-i,l=Math.sqrt(h*h+c*c),a=Math.atan2(u-i,r-n),v=Math.atan2(o-i,f-n);e.beginPath();e.arc(n,i,l,a,v,!1);e.lineWidth=1.2;e.strokeStyle=t;e.stroke();e.closePath();s(n,i-l)};return l(u,f),i};i.flightHopNoCanvas=function(t,r){var u=n.element(t);u.empty();var f=function(n){u.append('<div class="flight-hop-node" style="left: '+n+'px"><\/div>')},e=function(t,i){var r=new Image;r.src="/Content/assets/modules/ha-flight-hop/images/airplane_small_opaque.png";r.onload=function(){var e=t-r.width/2,f=n.element(r);f.css({position:"absolute",left:e,top:i-7});u.append(f)}},o=function(t,i,r){var f=n.element('<div class="flight-hop-leg"><\/div>'),o=r-t;f.css({position:"absolute",left:t,width:o});u.append(f);e(t+o/2,i)},s=function(n){for(var u=5,e=u,c,l,a,r=0;r<n.length;r++){var v=t.width()-u*2,s=v/n.length,h=t.height()-u;f(e,h,u);c=e+s;l=h;o(e,h,c,l);a=e+u+s/2;i.insertFlightData(a,n[r]);r>0&&r<n.length&&i.insertLayoverData(e+u,n[r-1],n[r]);e+=Math.round(s);r===n.length-1&&f(c,l,u)}};return s(r),i}}],r=function(t,i,r){var u=i.find(".trip-illustration .metadata");t.$watch("$viewContentLoaded",function(){t.resizeCanvas()});t.$on("$haFlightHopReady",function(){t.resizeCanvas()});n.element(window).on("resize",function(){u.empty();t.resizeCanvas()});t.resizeCanvas=function(){var n,u,f;window.Modernizr.canvas?(n=i.find("canvas"),u=n.parent(),n.attr({width:u.width()}),t.flightHop(n[0],t.segment.Hops,r.bgColor||"#717072")):(f=i.find(".no-canvas-fallback"),t.flightHopNoCanvas(f,t.segment.Hops))};t.insertFlightData=function(n,t){var i='<div class="flight-info" style="left: '+n+'px"><div class="flight-number">'+t.Carrier+" "+t.FlightNumber+'<\/div><div class="flight-duration">'+t.Duration+"<\/div><\/div>";u.append(i)};t.insertLayoverData=function(n,t){var i="";i=t.ISOverNightStay?'<div class="layover-info" style="left: '+n+'px"><div class="layover-city-code">'+t.ArrivalCityCode+'<\/div><div class="layover-duration">'+t.StopOverTime+'<\/div><div class="layover-overnight">('+r.overnightText+")<\/div><\/div>":'<div class="layover-info" style="left: '+n+'px"><div class="layover-city-code">'+t.ArrivalCityCode+'<\/div><div class="layover-duration">'+t.StopOverTime+"<\/div><\/div>";u.append(i)}};return{restrict:"A",scope:!0,link:r,controller:i}})}(angular),function(n){"use strict";n.module("haGlobalFooterModule",[]).directive("haGlobalFooter",["$rootScope",function(n){return{restrict:"A",scope:!0,link:function(){$(".back-to-top").click(function(){n.isMobile||$("body").animate({scrollTop:0},"fast",function(){$("#skipToContent").focus()});n.isMobile&&window.scrollTo(0,0)})},controller:["$scope",function(n){function i(){for(var t=[],n,r=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),i=0;i<r.length;i+=1)n=r[i].split("="),t.push(n[0]),t[n[0]]=n[1];return t}var t=i();t.subscriptionflag&&t.subscriptionflag==="1"&&(n.ShowFooterHeaderAlert=!0,n.FooterErrorType="error",n.FooterHeaderMessage="Error Occured");n.Date=new Date}]}}])}(angular),function(n){"use strict";function i(n,t,i,r){var u=this;u.id=n;u.FlightRefKey=t;u.SelectedClass=i;u.IsMileagePricing=r}function r(){var n=this;n.FareDetails=[]}var t=n.module("haBookFlightResultsModule",["haFlightResultsAPI","duScroll","haUtilsModule","haModalService","haGlobalsModule","haFeatureFlagsModule"]);t.filter("signedCurrency",function(){return function(n){var t=Math.round(n*100)/100;return n>-1?"blah$"+t:"-$"+Math.abs(t)}});t.directive("haBookFlightResults",["$document","$timeout","haGlobals","haConfig","haFlightResultsAPI","$rootScope","$window",function(t,u,f,e,o,s,h){var c=h.serverShortDate,l=h.searchRequest,a=["$scope","haInterstitialAPI","haModal","haPassengersService",function(t,u,h,a){var y,p,v;t.selectedSegments=[];t.currentSegmentId=1;t.$emit("$haBookFlightResultsReady");t.isSelected=!1;t.isEditingSelected=!1;t.resultsLoaded=!1;t.seatClass="coach";t.loadingSegment=!1;t.multiCity=!1;t.seatClassTypes=[];t.maxDateAllowed=typeof c!="undefined"?new Date(c):new Date;t.maxDateAllowed.setHours(0,0,0);t.maxDateAllowed.setDate(t.maxDateAllowed.getDate()+330);t.isNextAllowed=!0;t.isPreviousAllowed=!0;t.taxDetails=!1;t.IsServiceErrors=!1;t.ServiceErrorMessage="";t.errordescription="";t.isExtraComfort=!1;t.IsFirstClass=!1;t.IsBusinessClass=!1;t.IsChangeProgress=!1;t.IsNewFlightSelected=[];t.ShowMilesToggle=!1;t.SignifiedMarket=1;t.IsChangeFlightBooking=l.IsChangeFlightBooking;t.isFlightResult=!0;t.showBookingWidget=!1;s.checkHoldBookingEligibility=!1;t.lieFlatAvailable=!1;t.lieFlatBannerVisible=!0;t.closeBanner=function(n){n.stopPropagation();t.lieFlatBannerVisible=!1};t.$watch("currency",function(){});s.selectedHoldFare={};t.$pax=a;a.passengers=[];t.TripSummary=[];t.FilterLegs=function(n){if(n.OperatingCarrier!=="HA"&&n.OperatedBy!=null&&n.OperatedBy!=="")return n};t.AddPassengerList=function(n,i){for(var r=0;r<n;r++)t.$pax.add({type:i,isUser:!0})};t.UpdatePassengerList=function(){f("searchRequest",function(n){n.AdultCount>0&&t.AddPassengerList(n.AdultCount,"Adult");n.ChildCount>0&&t.AddPassengerList(n.ChildCount,"Child");n.InfantCount>0&&t.AddPassengerList(n.InfantCount,"Infant")})};t.IsChangeFlightBooking||t.UpdatePassengerList();t.FormatTrip=function(i){(t.TripType===0||i.IsMileagePricing)&&i.ActiveTab&&i.ActiveTab.Flights&&i.ActiveTab.Flights.length>0&&n.forEach(i.ActiveTab.Flights,function(t){t.AvailBookingFares&&t.AvailBookingFares.length>0&&n.forEach(t.AvailBookingFares,function(n,i){n.Name.toLowerCase()==="extracomfort"&&t.AvailBookingFares.splice(i,1)})})};t.showResultsHelp=function(){o.fetchPopup("GetHelpPopup").success(function(n){t.handleExceptions(n,"haFlightResultsAPI-showResultsHelp")||h({id:"results-help",backdrop:"true",template:n})})};t.FormatResults=function(i){if(i&&i.Trips&&i.Trips.length>0)n.forEach(i.Trips,function(n){t.FormatTrip(n)});else if(i&&i.ActiveTab&&i.ActiveTab.Flights&&i.ActiveTab.Flights.length>0){t.FormatTrip(i);var r=!1;t.ShowMilesToggle=!1;n.forEach(i.ActiveTab.Flights,function(i){r=!1;n.forEach(i.Legs,function(n){n.IsCodeShare&&(r=!0)});r||t.ShowMilesToggle!==!1||(t.ShowMilesToggle=!0)})}n.isDefined(i)&&n.isDefined(i.Trips)&&n.isDefined(i.Trips.ActiveTab)&&n.isDefined(i.Trips.ActiveTab.Flights)&&n.isDefined(i.Trips.ActiveTab.Flights.AvailBookingFares)&&n.forEach(i.Trips[0].ActiveTab.Flights[0].AvailBookingFares,function(n){t.updateClass(n.Name.toLowerCase())})};o.fetch().success(function(i){t.handleExceptions(i,"haFlightResultsAPI-fetch")||(t.resultsLoaded=!0,t.lieFlatAvailable=t.hasLieFlat(i),t.SignifiedMarket=i.MarketID,i.Trips!==undefined&&i.Trips.length>0&&(t.TripType=i.TripType,t.FormatResults(i),$.extend(t,i),typeof t.IsChangeFlightBooking!="undefined"&&t.IsChangeFlightBooking&&(t.Trips.length===1&&+t.Trips[0].TripId==2&&(t.Trips[0].TripId=1),t.Trips[0].AdultCount>0&&t.AddPassengerList(t.Trips[0].AdultCount,"Adult"),t.Trips[0].ChildCount>0&&t.AddPassengerList(t.Trips[0].ChildCount,"Child"),t.Trips[0].InfantCount>0&&t.AddPassengerList(t.Trips[0].InfantCount,"Infant")),t.currency=i.Currency,t.TripSummary.currency=i.Currency,t.taxes=[],i.Trips!=null&&(t.TripCount=i.Trips.length,t.multiCity=t.TripType===0&&t.PricingType==="RoundTripFare"?!0:!1),t.arrowUpdate(),n.forEach(i.Trips,function(i){var r=!1;i.ShowPreSelected=!0;n.forEach(i.ActiveTab.Flights,function(i){r=!1;n.forEach(i.Legs,function(n){n.IsCodeShare&&(r=!0)});r||t.ShowMilesToggle!==!1||(t.ShowMilesToggle=!0)})})))}).error(function(){t.handleExceptions("jsError","haFlightResultsAPI-fetch");t.resultsLoaded=!0});y=function(n){return function(t){var i=0,r=t[n].match(/\d*h/g),u=t[n].match(/\d*m/g);return r&&(i=parseInt(r[0].match(/\d+/))*60),u&&(i+=parseInt(u[0].match(/\d+/))),i}};t.sorting={predicateKey:"default"};p=function(){return function(n){for(var i=0,t=0;t<n.AvailBookingFares.length;t++)if(n.AvailBookingFares[t].FareTypes&&n.AvailBookingFares[t].FareTypes.length>0){i=parseFloat(n.AvailBookingFares[t].FareTypes[0].TotalDisplayFare);break}return i}};v=function(n){return function(t){return new Date(t[n])}};t.predicates={"default":undefined,lowestPrice:p(),earliestDepartureTime:v("OriginDateTime"),earliestArrivalTime:v("DestinationDateTime"),shortestDuration:y("Duration")};t.reverse=!1;t.ToggleTaxDetails=function(){t.taxDetails=!t.taxDetails};t.totalTaxes=function(){var i=0;return n.forEach(t.selectedSegments,function(n){n[n.selectedSeatClass]&&(i+=Number(n[n.selectedSeatClass].TotalTaxes)*t.paxCount)}),i.toFixed(2)};t.onTimePerformanceRecords=new Map;t.setArrivalPercentages=function(n,i){var r,u;i&&(r=[],n.Legs.forEach(function(n){if(n.OnTimeArrival==null&&n.LateArrival==null&&n.Cancelled==null){var i=t.onTimePerformanceRecords.get(n.FlightNumber);i==null?r.push(n.FlightNumber):(n.LateArrival=i.DelayedPercentage,n.OnTimeArrival=i.OnTimePercentage)}}),r.length>=1&&(u=o.fetchOnTimePerformanceDetails(r.join(",")).success(function(i){if(i.ErrorMessage!=null&&i.ErrorMessage.length>1){n.Legs.forEach(function(n){r.indexOf(n.FlightNumber)!=-1&&(n.LateArrival="Error Late ",n.OnTimeArrival="Error On Time ")});return}i.forEach(function(n){(n.OnTimeDetails.DelayedPercentage==null||n.OnTimeDetails.DelayedPercentage=="")&&(n.OnTimeDetails.DelayedPercentage=".");(n.OnTimeDetails.OnTimePercentage==null||n.OnTimeDetails.OnTimePercentage=="")&&(n.OnTimeDetails.OnTimePercentage=".");t.onTimePerformanceRecords.set(n.FlightNumber,n.OnTimeDetails)});n.Legs.forEach(function(n){if(r.indexOf(n.FlightNumber)!=-1){var i=t.onTimePerformanceRecords.get(n.FlightNumber);i!=null?(n.OnTimeArrival=i.OnTimePercentage,n.LateArrival=i.DelayedPercentage):(n.OnTimeArrival=".",n.LateArrival=".")}})}).error(function(){result.Legs.forEach(function(n){r.indexOf(n.FlightNumber)!=-1&&(n.LateArrival="Error Late ",n.OnTimeArrival="Error On Time ")})})))};t.grandTotal=function(){var i=0;return n.forEach(t.selectedSegments,function(n){n[n.selectedSeatClass]&&(i+=(Number(n[n.selectedSeatClass].TotalBaseFare)+Number(n[n.selectedSeatClass].TotalTaxes))*t.paxCount)}),i.toFixed(2)};t.$on("toggleMilesEvent",function(i,r){t.loadingSegment=!0;n.element("#segment-"+r[1]).addClass("loading");var u=r[1]*1-1,f=!1;r[0].value==="MILES"&&(f=!0);o.toggleCurrencyMilesService(u,f).success(function(i){t.handleExceptions(i,"haFlightResultsAPI-toggleCurrencyMilesService")||(t.loadingSegment=!1,t.FormatResults(i),i.IsAllSegmentChange?(t.HideAllSegments(),t.resultsLoaded=!0,$.extend(t,i),t.currency=i.Currency,t.backToFlightResults()):(n.element("#segment-"+r[1]).removeClass("loading"),$("#segment-"+r[1]).addClass("current"),$.extend(t.Trips[u],i.Trips[0]),t.PricingType=i.PricingType))}).error(function(){t.handleExceptions("jsError","haFlightResultsAPI-toggleCurrencyMilesService");t.loadingSegment=!1;n.element("#segment-"+r[1]).removeClass("loading");$("#segment-"+r[1]).addClass("current")})});t.buildSearchQuery=function(){var t=n.element("#bookingWidget").scope();return t.getFlightQueryModel()};t.showDateValidationModal=function(){h(e.getTemplateUrl("book/flightresults/ha-flightresults-date-validation-modal.html"),{backdrop:"true",id:"FutureDateValidationPopupModal",scope:t})};t.show331DaysPopup=function(){h(e.getTemplateUrl("book/flightresults/ha-flightresults-331-days-validation-modal.html"),{backdrop:"true",id:"results-331Days",scope:t})};t.showLessThanCurrentDateModal=function(){h(e.getTemplateUrl("book/flightresults/ha-flightresults-less-than-current-date-modal.html"),{backdrop:"true",id:"results-DateValidationLessDate",scope:t})};t.selectTab=function(i,r){var u;if(i.SeatsAvailable>0){if(new Date(i.TabDate)<t.selectedTripDate[r-1])return t.showDateValidationModal(),!1;if(r!==t.Trips.length&&new Date(i.TabDate)>t.selectedTripDate[r+1])return $("#ScData_PrevDateValidation_scenario").html($(".futureValidation").html()),t.showDateValidationModal(),!1;if(new Date(i.TabDate)>=t.maxDateAllowed){t.show331DaysPopup();return}if(u=r-1,t.Trips[u+1]!=null&&r!==t.Trips.length&&new Date(i.TabDate)>new Date(t.Trips[u+1].DepartDate))return $("#ScData_PrevDateValidation_scenario").html($(".futureValidation").html()),t.showDateValidationModal(),!1;t.loadingSegment=!0;n.element("#segment-"+r).addClass("loading");o.fetchTab(r,i.TabDate).success(function(i){var f,e;t.handleExceptions(i,"haFlightResultsAPI-selectTab")||(t.FormatResults(i),t.lieFlatAvailable=t.hasLieFlat(i),i.IsAllSegmentChange===!0?(t.resultsLoaded=!0,$.extend(t,i),t.currency=i.Currency,t.backToFlightResults()):(n.element("#segment-"+r).removeClass("loading"),n.element("#segment-"+r).addClass("current"),$.extend(t.Trips[u],i)),t.arrowUpdate(),t.IsChangeFlightBooking&&t.Trips.length===1&&+t.Trips[0].TripId==2&&(t.Trips[0].TripId=1),t.IsChangeFlightBooking?(e=n.element("#flightResultsStickProgressBarReshop").scope(),e.UpdateBar(r)):(f=n.element("[booking-widget]").scope(),f!==undefined&&(f.updateLegDates(2),f.Initialize()),e=n.element("#flightResultsStickProgressBar").scope(),e.UpdateBar(r)))}).error(function(){t.handleExceptions("jsError","haFlightResultsAPI-selectTab")})}};t.SearchBySeven=function(i,r,u){var e=i-1,f=new Date(u+"T10:00:00Z"),h=new Date(u+"T10:00:00Z"),s=new Date;if(s.setHours(0,0,0,0),f.setHours(0,0,0,0),h.setHours(0,0,0,0),r===1){if(f.setDate(f.getDate()+7),t.Trips[e+1]&&t.Trips[e+1].DepartDate&&i!==t.Trips.length&&new Date(f)>Date.parse(t.Trips[e+1].DepartDate))return $("#ScData_PrevDateValidation_scenario").html($(".futureValidation").html()),t.showDateValidationModal(),!1;if(f>t.maxDateAllowed){t.show331DaysPopup();return}}else if(r===-1){if(f.setDate(f.getDate()-7),Date.parse(f)<Date.parse(s)){t.showLessThanCurrentDateModal();return}if(t.Trips[e-1]&&t.Trips[e-1].DepartDate&&new Date(f)<Date.parse(t.Trips[e-1].DepartDate))return t.showDateValidationModal(),!1}t.loadingSegment=!0;n.element("#segment-"+i).addClass("loading");o.fetchTab(i,r).success(function(r){var u;t.handleExceptions(r,"haFlightResultsAPI-SearchBySeven")||(t.FormatResults(r),t.loadingSegment=!1,t.lieFlatAvailable=t.hasLieFlat(r),r.IsAllSegmentChange?(t.resultsLoaded=!0,$.extend(t,r),t.currency=r.Currency,t.backToFlightResults()):(n.element("#segment-"+i).removeClass("loading"),$("#segment-"+i).addClass("current"),$.extend(t.Trips[e],r)),t.IsChangeFlightBooking?(u=n.element("#flightResultsStickProgressBarReshop").scope(),u.UpdateBar(i)):(u=n.element("#flightResultsStickProgressBar").scope(),u.UpdateBar(i)))}).error(function(){t.handleExceptions("jsError","haFlightResultsAPI-SearchBySeven");t.loadingSegment=!1;$("#segment-"+i).addClass("current")})};t.arrowUpdate=function(){t.isPreviousAllowed=!0;t.isNextAllowed=!0};t.changeCurrency=function(n,i){var r=i-1;o.fetchCurrency(n).success(function(n){t.handleExceptions(n,"haFlightResultsAPI-changeCurrency")||(t.Trips[r]=n.Trips[r])})};t.hasLieFlat=function(n){var o=!1,u=n.ActiveTab,f,i,e,r;if(!u)if(n.Trips&&n.Trips[0]&&n.Trips[0].ActiveTab)u=n.Trips[0].ActiveTab;else return!1;for(f=u.Flights,t.lieFlatBannerVisible=!0,i=0;i<f.length;i++)for(e=f[i].Legs,r=0;r<e.length;r++)e[r].LieFlatAvailable?o=!0:t.lieFlatBannerVisible=!1;return o};t.segmentHasLieFlat=function(n){return n.Legs.some(function(n){return n.LieFlatAvailable})};t.showSeatMap=function(n){h(e.getTemplateUrl("VerticalSeatmap/ha-vertical-seatmap-preview.html"),{backdrop:"true",id:"ha-vertical-seatmap-preview-modal",extendScope:{previewSegments:n,SignifiedMarket:t.SignifiedMarket,enableTCR:t.enableTCR,disableSeatUpgrades:!!t.Trips[0].IsDisableSeatUpgrade}})};t.showSeatClassModal=function(n,i){return(i=i===undefined?t.currentSegmentId:i,t.seatClassModal={},t.seatClassModal.currentClass=n,t.seatClassModal.Data=t.Trips[i-1].SeatClassModalData,t.seatClassModal.selected=t.seatClassModal.Data.filter(function(t){return t.Type===n})[0],!t.seatClassModal.selected)?!1:(h(e.getTemplateUrl("Book/FlightResults/ha-flightresults-seat-class-modal-template.html"),{id:"results-seat-class",backdrop:"true",scope:t,defaultContent:n}),!0)};t.showSeatClassModalLieFlat=function(){var n=t.showSeatClassModal("business");n||t.showSeatClassModal("first")};t.showBaggageFeesModal=function(n){o.fetchModalContent(n).success(function(n){t.handleExceptions(n,"haFlightResultsAPI-showBaggageFeesModal")||h({id:"results-baggageFee",backdrop:"true",template:n})})};t.showModalPopUp=function(n){o.fetchModalContent(n).success(function(i){t.handleExceptions(i,"haFlightResultsAPI-showModalPopUp")||h({id:"results-"+n,backdrop:"true",template:i})})};t.showFightsNoSeatsAvailableModal=function(){window.location.href="/book/Error?ErrorType=SeatNotAvailable"};t.showFightsScheduleMismatchModal=function(){o.fetchPopup("ScheduleMismatch").success(function(n){t.handleExceptions(n,"haFlightResultsAPI-showFightsScheduleMismatchModal")||h({id:"schedule-missmatch",backdrop:"true",template:n,modalLock:!0,cancel:{label:"Close",fn:function(){window.location.href="/book/FlightResults"}}})})};t.updateClass=function(n){n==="first"?t.isFirstClass=!0:n==="business"?t.isBusinessClass=!0:n==="extracomfort"&&(t.isExtraComfort=!0)};t.updateClassTypes=function(){n.forEach(t.selectedSegments,function(i){n.forEach(i.AvailBookingFares,function(n){var i=n.Name.toLowerCase();t.updateClass(i);t.seatClassTypes.indexOf(i)<0&&t.seatClassTypes.push(i)})});t.seatClassTypes.length===3&&(t.seatClassTypes[2]==="extracomfort"&&t.seatClassTypes[1]==="first"&&(t.seatClassTypes[1]="extracomfort",t.seatClassTypes[2]="first"),t.seatClassTypes[2]==="extracomfort"&&t.seatClassTypes[1]==="business"&&(t.seatClassTypes[1]="extracomfort",t.seatClassTypes[2]="business"))};t.openURL=function(n){var t=window.open(n,"blank");t.focus()};t.updateClassTypesMultiSegment=function(){n.forEach(t.selectedSegments,function(i){n.forEach(i.AvailBookingFares,function(n){var i=n.Name.toLowerCase();t.seatClassTypes.indexOf(i)<0&&t.seatClassTypes.push(i)})});t.seatClassTypes.length===3&&(t.seatClassTypes[2]==="extracomfort"&&t.seatClassTypes[1]==="first"&&(t.seatClassTypes[1]="extracomfort",t.seatClassTypes[2]="first"),t.seatClassTypes[2]==="extracomfort"&&t.seatClassTypes[1]==="business"&&(t.seatClassTypes[1]="extracomfort",t.seatClassTypes[2]="business"))};t.getDeviantLegs=function(t,i){var r=[];return n.forEach(t.Legs,function(u){var f=!1;n.forEach(t.AvailBookingFares,function(n){var t=n.Name.toUpperCase();i=i.toUpperCase();n.IsMixedCabin&&t===i&&(f=!0)});f&&r.push(u)}),r};t.ErrorBackToHome=function(n,i,r,u){if(n==="haFlightResultsAPI-fetch")if(t.IsChangeFlightBooking){var f=/(<([^>]+)>)/ig,e=i+": "+r,o=e.replace(f,"");window.location.href="/book/error?ErrorType=Custom&PathType=ChangeFlight&ErrorCode="+o}else{var f=/(<([^>]+)>)/ig,e=i+": "+r,o=e.replace(f,"");window.location.href="/book/home?FltResNull="+o}else window.location.href=u.RedirectURL};t.handleExceptions=function(n,i){if(n!=="jsError")switch(n.ErrorCodeHandle){case"NOFAREGROUP":t.ErrorBackToHome(i,n.ErrorCodeHandle,n.ErrorMessage,n);break;case"NO_FLIGHTRESULTS_TRIPS":t.ErrorBackToHome(i,n.ErrorCodeHandle,n.ErrorMessage,n);break;case"20027":t.ErrorBackToHome(i,n.ErrorCodeHandle,n.ErrorMessage,n);break;case"20024":var r=n.ErrorCodeHandle+": "+$("#NoFlightResultsErrorMsg").text(),u=r.replace(/(<([^>]+)>)/ig,"");window.location.href="/book/home?FltResNull="+u;break;case"20044":window.location.href="/book/error?ErrorType=Custom&ErrorCode="+n.ErrorCodeHandle;break;case"20045":window.location.href="/book/error?ErrorType=Custom&ErrorCode="+n.ErrorCodeHandle;break;case"SessionTimeOut":window.location.href="/book/error?ErrorType=SessionTimeOut";break;default:if(n.ErrorCodeHandle!==undefined)window.location.href=n.RedirectURL;else return!1}else window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"};t.mcbRestrictionModal=function(){$scs.get("MCBRestrictionModal").then(function(n){t.restrictions=n.restrictions;t.heading=n.heading;t.topcontent=n.topcontent;t.disclaimers=n.disclaimers;t.subheading=n.subheading;h(e.getTemplateUrl("book/flightresults/ha-mcb-restrictions-modal.html"),{id:"mcbRestrictionModal",backdrop:!0,scope:t})})};t.AddFlightsToTrip=function(f,e){var v,l,y,p,c,b,k,d,nt,a,w;for(f.preventDefault(),!n.isUndefined(e)&&e&&(v=s.selectedHoldFare,l={},l.UniquePriceID=v.id,l.TimeLimitDays=v.numberOfDays,l.HoldFee=v.price,l.MSRCode=v.msrCode,o.updateSelectedHoldFare(l).success(function(){}).error(function(){})),y=t.selectedSegments,p="true",c=0;c<y.length-1;c++)if(b=y[c].Legs.length,y[c+1].Legs[0].DepartureDateTime<y[c].Legs[b-1].ArrivalDateTime){k=c+1;d=c+1+1;p="false-"+k+"/"+d;break}if(p.indexOf("false")!==-1){var g=p.split("-"),tt=g[g.length-1].split("/"),it=tt;return t.populatePrevDateValidationPopup(it),nt=$("#PrevDateValReturnToSearchPopup").html(),h({id:"ReturnToFlightSearchPopupModal",backdrop:"true",template:nt}),!1}a=new r;w=0;n.forEach(t.selectedSegments,function(n){a.FareDetails.push(new i(w+1,n.UniquerefKey,n.selectedSeatClass,n.IsMileagePricing));w=w+1});a.PricingType=t.PricingType;a.SelectedFareGrid=t.SelectedFareGrid;a.Passengers=t.pax;t.waitingSegment=!0;u.getAirAvailability().success(function(n){h({id:"InterstitialAirAvailability-modal",backdrop:"true",template:n,modalLock:!0});t.interstitialDynamicResize();o.checkFlightAvailability(a).success(function(n){t.handleExceptions(n,"haFlightResultsAPI-checkFlightAvailability")||(t.waitingSegment=!1,n.status===1?t.showFightsNoSeatsAvailableModal():n.status===2?t.showFightsScheduleMismatchModal():n.status===0&&$("#FlightSearchForm").submit())}).error(function(){t.handleExceptions(n,"haFlightResultsAPI-checkFlightAvailability");t.waitingSegment=!1})})};window.onresize=function(){t.interstitialDynamicResize()};t.interstitialDynamicResize=function(){$(".ha-modal#InterstitialAirAvailability-modal .modalContainer").css({width:$(window).width(),height:$(window).height(),"padding-top":$(window).height()*.2})};t.populatePrevDateValidationPopup=function(n){var t=$("#ScData_PrevDateValidation_Unedited").html().replace("~INVALIDFLIGHT1~",n[0]).replace("~INVALIDFLIGHT2~",n[1]);$("#ScData_PrevDateValidation_DynamicContent").html(t)};t.showSelectAllFlightsPopup=function(){var i=$("#SelectOpenSegmentPopupContentNoEdit").html(),n;return $("#SelectOpenSegmentPopupContent").html(i.replace("~SEGMENT~",t.IsNewFlightSelected.indexOf("false")+1)),n=$("#SelectOpenSegmentValidationPopup").html(),h({id:"SelectAllSegmentsModalPopup",backdrop:"true",template:n}),!1};t.getMaxPrice=function(t){var i=0;return t!==null&&t!==undefined&&(i=parseFloat(t[0].ExchangeInfo.TotalFareDifference),t.length>1&&n.forEach(t,function(n){parseFloat(i)<parseFloat(n.ExchangeInfo.TotalFareDifference)&&(i=parseFloat(n.ExchangeInfo.TotalFareDifference))})),i}}],v=function(i,r){i.selectedTripDate=[];i.additionalCostArray=[];i.fareGridResults={};i.exampleMethod=function(){return i};setTimeout(function(){i.selectClass=n.element(".select-class-wrapper");i.continueBar=n.element(".continue-bar-wrapper");i.editingSegment=!1;i.openSegments=null},0);i.selectNewDates=function(){i.$modalCancel();i.$broadcast("open-sticky-booking-widget")};i.getJourneyData=function(t,r,u){var e={},o,f;return e.JDDataList=[],o=1,n.forEach(i.selectedSegments,function(n){var t={};t.S=n.UniquerefKey;t.C=r!=="-1"?n.selectedSeatClass===undefined?n.selectedSeatClass.substring(0,1).toUpperCase():n.selectedSeatClass.substring(0,1):r;t.TId=o++;t.JDInd=!0;e.JDDataList.push(t)}),t!=null&&(f={},f.S=t.UniquerefKey,f.C=r,f.TId=u,f.JDInd=!0,e.JDDataList[u-1]!==undefined?e.JDDataList[u-1]=f:e.JDDataList.push(f)),e};i.checkMCB=function(n,t,r,u,f){if(!u||u.AvailableSeats===0)return!1;if(u.Name.toLowerCase()!=="maincabinbasic"&&t.TripId==1||(u.Name.toLowerCase()=="coach"||u.Name.toLowerCase()=="first")&&t.TripId>1&&i.selectedSegments[0].selectedSeatClass!=="Maincabinbasic"||u.Name.toLowerCase()=="maincabinbasic"&&t.TripId>1&&i.selectedSegments[0].selectedSeatClass=="Maincabinbasic")return!0;if(u.Name.toLowerCase()!=="maincabinbasic"&&t.TripId>1&&i.selectedSegments[0].selectedSeatClass==="Maincabinbasic"){var s=i.selectedSegments[i.TripCount-2].AvailBookingFares.filter(function(n){return n.Name==="Maincabinbasic"})[0].FareTypes[0].TotalDisplayFare,h=n.AvailBookingFares.filter(function(n){return n.Name==="Coach"})[0].FareTypes[0].TotalDisplayFare,o=Math.ceil(h-s);return i.upgradeAmount=o===0||o===-0?"0":o,haModal(e.getTemplateUrl("book/flightresults/ha-upgrade-warning-modal.html"),{id:"mcbUpgradeWarning",backdrop:!0,scope:i,size:"modal-md"}),i.upgradeToMainCabin=function(e,o){i.selectFlight(n,t,r,u,f);i.selectedSegments=e;i.selectedSegments.forEach(function(n){n.selectedSeatClass==="Maincabinbasic"&&(n.selectedSeatClass="Coach",n.Legs[0].selectedClassForDisplay="Main Cabin",n.AvailBookingFares[0].Name==="Maincabinbasic"&&n.AvailBookingFares[0].isSelected&&(n.AvailBookingFares[0].isSelected=!1,n.AvailBookingFares[1].isSelected=!0))});o()},!1}i.acceptRestrictionsCallback=function(){i.selectFlight(n,t,r,u,f)};i.rejectRestrictionsCallback=function(){for(var f,e=!1,u=0;u<n.AvailBookingFares.length;u++)if(f=n.AvailBookingFares[u],f.Name&&f.Name.toLowerCase()==="coach"){e=!0;break}e&&i.selectFlight(n,t,r,f,u)};try{i.MCBAmount=i.getMaxPrice(n.AvailBookingFares.filter(function(n){return n.Name.toLowerCase()==="maincabinbasic"})[0].FareTypes);i.MCAmount=i.getMaxPrice(n.AvailBookingFares.filter(function(n){return n.Name.toLowerCase()==="coach"})[0].FareTypes)}catch(c){console.warn("Error getting amounts for modal.",c)}haModal(e.getTemplateUrl("book/flightresults/ha-mcb-accept-restrictions-modal.html"),{id:"mcbFlightResultsModal",backdrop:!0,scope:i,size:"custom-modal-width"})};i.selectFlight=function(t,r,u,f,e){var s,c,h;if(i.isReshopPath=!0,(!f||f.AvailableSeats===0||t.isSelectedFlight)&&f)r.hasSelectedFlight||(i.IsNewFlightSelected[r.TripId-1]="false");else{if(i.IsChangeFlightBooking&&f.FareTypes[0].SolutionType==="N")return!1;i.Trips[r.TripId-1].AddToSelectedFlightCounter=!0;s="-1";f&&e!=null?(n.forEach(r.ActiveTab.Flights,function(t){n.forEach(t.AvailBookingFares,function(n){n.isSelected=!1})}),t.AvailBookingFares[e].isSelected=!0,i.IsNewFlightSelected[r.TripId-1]="true",f.IsMixedCabin&&(t.hasMixedClass=!0),t.selectedSeatClass=f.Name,s=f.Name.toLowerCase()==="coach"?"C":f.Name.toLowerCase()==="extracomfort"?"E":f.Name.toLowerCase()==="first"?"F":f.Name.toLowerCase()==="business"?"B":f.Name.toLowerCase()==="maincabinbasic"?"M":"-1"):s="-1";t.isSelected=!0;t.IsRoundTripFare=!1;r.hasSelectedFlight=!0;i.selectedTripDate[r.TripId]=new Date(t.Legs[t.Legs.length-1].ArrivalDate);i.Trips[r.TripId-1].ShowPreSelected===!0&&(i.Trips[r.TripId-1].ShowPreSelected=!1,n.forEach(i.Trips[r.TripId-1].ActiveTab.Flights,function(n){n.isSelectedFlight=!1}));i.flightSelectedEvent=!0;i.LastStepThruQueryID=r.TripId;c=i.currentSegmentId>1&&t.selectedSeatClass!=="Maincabinbasic";i.PricingType==="RoundTripFare"&&(i.Trips.length!==i.selectedFlightCounter()||i.TripType===2)?(i.loadingSegment=!0,$("#segment-"+r.TripId).addClass("current"),n.element("#segment-"+r.TripId).addClass("loading"),i.TripType===2&&(s="-1"),h=i.getJourneyData(t,s,r.TripId),o.SearchFlightsStepThrough(h,r.TripId,!1).success(function(f){i.handleExceptions(f,"haFlightResultsAPI-SearchFlightsStepThrough")||(i.lieFlatAvailable=i.hasLieFlat(f),n.element("#segment-"+r.TripId).removeClass("loading"),i.selectFlightStyleChanges(t,r.TripId,u),i.FormatResults(f),f.FareGrid&&f.FareGrid.FareGridCellList&&f.FareGrid.FareGridCellList.length===0?(f.Trips[0].TripId=r.TripId+1,i.Trips[r.TripId]=f.Trips[0],i.loadingSegment=!1):(i.FareGrid={},i.fareGridResults={},n.forEach(f.FareGrid.FareGridCellList,function(n){i.fareGridResults[n.Key]=n.TotalFare;i.FareGrid[n.Key]=n;n.TotalFare!=null&&t.RoundTripFare===undefined&&(t.RoundTripFare=n,t.IsRoundTripFare=!0)}),i.UnavailableClasses=f.FareGrid.UnAvailableClasses,i.selectFlightStyleChanges(t,r.TripId,u)))}).error(function(n){i.handleExceptions(n,"haFlightResultsAPI-SearchFlightsStepThrough");i.loadingSegment=!1;$("#segment-"+r.TripId).addClass("current")})):(i.selectFlightStyleChanges(t,r.TripId,u),n.forEach(i.selectedSegments,function(n){n.isMulticityFare=!1}),i.CalculateTaxesVar="Calculate",i.selectedSegments[r.TripId-1].isMulticityFare=!0,i.calculatePerPersonPriceMulticity(i.selectedSegments[r.TripId-1]),i.IsChangeFlightBooking&&i.calculatePerPersonPriceChangeFlight(i.selectedSegments[r.TripId-1]))}};i.calculatePerPersonPriceMulticity=function(t){n.forEach(t.AvailBookingFares,function(n){t.selectedSeatClass===n.Name&&(i.totalPricePerPaxDisplayMulticity=n.FareTypes.length>1?n.FareTypes[0].TotalMultiCityPerPersonFare:n.FareTypes[0].TotalMultiCityPerPersonFare)})};i.calculatePerPersonPriceChangeFlight=function(t){n.forEach(t.AvailBookingFares,function(n){t.selectedSeatClass===n.Name&&n.FareTypes.length>0&&(i.totalPricePerPaxDisplayChangeFlight=i.getMaxPrice(n.FareTypes))})};i.selectedFlightCounter=function(){var t=0;return n.forEach(i.Trips,function(n){n.AddToSelectedFlightCounter&&(t=t+1)}),t};i.getSegmentBookingType=function(n){return i.Trips[n-1].IsMileagePricing===!0?"MILES":i.currency};i.selectFlightStyleChanges=function(u,f,e){i.editingSegment=!1;i.openSegments=null;i.selectedSegments[f-1]=u;i.selectedSegments[f-1].IsMileagePricing=i.Trips[f-1].IsMileagePricing;i.updateClassTypes();i.currentSegment=n.element("#segment-"+f);i.$broadcast("calcTaxes");i.currentSegment.addClass("hasSelectedFlight");i.selectedFlight=r.find("#leg-"+f+"-result-"+e);i.currentSegment.find(".result").removeClass("selected");i.currentSegment.find(".select").removeClass("hidden");i.selectedFlight.find(".select").addClass("hidden");i.selectedFlight.find(".defaultSelections").addClass("hidden");i.selectedFlight.find(".change").removeClass("hidden");i.currentSegment.find("section.result .keep").addClass("hidden");i.selectedFlight.scope().detailsVisible=!1;t.scrollToElement(n.element("#select-flight-anchor"),0,650);i.switchSegment();setTimeout(function(){i.loadingSegment=!1;i.selectedFlight.addClass("selected");$(".hairlineGrid a.selected").get(0)&&$(".hairlineGrid a.selected").get(0).click();i.selectedFlight.find(".defaultSelections").addClass("hidden");i.$broadcast("calcTaxes")},100)};i.RecalculateTaxes=function(){i.$broadcast("calcTaxes")};i.switchSegment=function(){i.currentSegmentId+=1;i.showReceipt=!1;r.find(".hasSelectedFlight").length===i.TripCount?(i.selectClass.addClass("active"),setTimeout(function(){$(".row.class-selection").each(function(){var n=$(this).find(".col-segment").height();$(this).find("a.col-selection").height(n+"px")})},10),i.continueBar.addClass("active"),i.showReceipt=!0):i.arrowUpdate()};i.HideAllSegments=function(){$(".segment").addClass("hidden");i.showReceipt=!1};i.backToFlightResultsPage=function(){window.location.reload()};i.backToFlightResults=function(){var r=null,u;i.TripType===0&&i.LastStepThruQueryID!==1&&(n.forEach(i.Trips,function(t){n.forEach(t.ActiveTab.Flights,function(n){n.isSelected=!1});t.AddToSelectedFlightCounter=!1}),r=i.Trips[0],i.selectedSegments=[]);r!=null&&i.PricingType==="RoundTripFare"&&i.TripType===0&&r.TripId!==i.LastStepThruQueryID&&(i.loadingSegment=!0,n.element("#segment-"+r.TripId).addClass("loading"),u=i.getJourneyData(),i.LastStepThruQueryID=r.TripId,o.SearchFlightsStepThrough(u,r.TripId,!0).success(function(t){i.handleExceptions(t,"haFlightResultsAPI-SearchFlightsStepThrough")||(i.loadingSegment=!1,i.lieFlatAvailable=i.hasLieFlat(t),n.element("#segment-"+r.TripId).removeClass("loading"),i.FormatResults(t),t.FareGrid&&t.FareGrid.FareGridCellList&&t.FareGrid.FareGridCellList.length===0&&$.extend(i.Trips[r.TripId-1],t.Trips[0]))}).error(function(t){i.handleExceptions(t,"haFlightResultsAPI-SearchFlightsStepThrough");n.element("#segment-"+r.TripId).removeClass("loading")}));$(".segment").removeClass("current hasSelectedFlight");i.currentSegmentId=1;i.continueBar.removeClass("active");i.selectClass.removeClass("active");$(".segment:first").addClass("current");$(".result.selected .change").addClass("hidden");$(".result.selected .keep").removeClass("hidden");t.scrollToElement(n.element("#select-flight-anchor"),0,650)};i.editSegment=function(r,u){var e,h,f;s.checkHoldBookingEligibility=!1;e=i.IsAllFlightsSelected();i.IsChangeProgress!==!0&&e?(i.Trips[r.TripId-1].AddToSelectedFlightCounter=!1,u&&(u.isSelected=!1),i.PricingType==="RoundTripFare"&&i.TripType===0&&r.TripId!==i.LastStepThruQueryID&&(i.IsChangeProgress=!0,i.loadingSegment=!0,n.element("#segment-"+r.TripId).addClass("loading"),h=i.getJourneyData(),i.LastStepThruQueryID=r.TripId,o.SearchFlightsStepThrough(h,r.TripId,!0).success(function(t){i.handleExceptions(t,"haFlightResultsAPI-SearchFlightsStepThrough")||(i.loadingSegment=!1,i.lieFlatAvailable=i.hasLieFlat(t),n.element("#segment-"+r.TripId).removeClass("loading"),i.FormatResults(t),t.FareGrid&&t.FareGrid.FareGridCellList&&t.FareGrid.FareGridCellList.length===0&&$.extend(i.Trips[r.TripId-1],t.Trips[0]),i.IsChangeProgress=!1,i.IsNewFlightSelected[r.TripId-1]="false")}).error(function(){n.element("#segment-"+r.TripId).removeClass("loading");i.IsChangeProgress=!1;i.IsNewFlightSelected[r.TripId-1]="false"})),i.IsChangeFlightBooking&&+r.TripId==1&&i.Trips.length>1&&(i.loadingSegment=!0,n.element("#segment-"+r.TripId).addClass("loading"),o.fetch().success(function(t){i.handleExceptions(t,"haFlightResultsAPI-fetch")||(i.lieFlatAvailable=i.hasLieFlat(t),i.resultsLoaded=!0,i.SignifiedMarket=t.MarketID,t.Trips!==undefined&&t.Trips.length>0&&(i.TripType=t.TripType,i.FormatResults(t),$.extend(i,t),typeof i.IsChangeFlightBooking!="undefined"&&i.IsChangeFlightBooking&&i.Trips.length===1&&+i.Trips[0].TripId==2&&(i.Trips[0].TripId=1),i.currency=t.Currency,i.TripSummary.currency=t.Currency,i.taxes=[],t.Trips!=null&&(i.TripCount=t.Trips.length,i.multiCity=i.TripType===0&&i.PricingType==="RoundTripFare"?!0:!1),i.arrowUpdate(),n.forEach(t.Trips,function(t){var r=!1;t.ShowPreSelected=!0;n.forEach(t.ActiveTab.Flights,function(t){r=!1;n.forEach(t.Legs,function(n){n.IsCodeShare&&(r=!0)});r||i.ShowMilesToggle!==!1||(i.ShowMilesToggle=!0)})})))}).error(function(){i.handleExceptions("jsError","haFlightResultsAPI-fetch");i.resultsLoaded=!0})),i.currentSegment=n.element("#segment-"+r.TripId),i.currentSegmentId=r.TripId,i.selectedFlight=i.currentSegment.find(".result.selected"),$(".segment").removeClass("current"),i.currentSegment.removeClass("hasSelectedFlight"),i.currentSegment.addClass("current"),$(".segment.current .result.selected .change").addClass("hidden"),$(".segment.current .result.selected .keep").removeClass("hidden"),t.scrollToElement(n.element("#select-flight-anchor"),0,650),i.selectClass.removeClass("active"),i.continueBar.removeClass("active"),r.hasSelectedFlight=!1,i.editingSegment?i.openSegments!=null&&(f=n.element("#segment-"+i.openSegments.TripId),f.addClass("hasSelectedFlight"),f.find(".result.selected .keep").addClass("hidden"),f.find(".result.selected .change").removeClass("hidden"),i.openSegments=r):(i.editingSegment=!0,i.openSegments=r)):e||i.showSelectAllFlightsPopup()};i.IsAllFlightsSelected=function(){return i.IsNewFlightSelected.indexOf("false")!==-1?!1:!0};i.openSearchModal=function(n){i.CurrentFlightScope=i.CurrentFlightScope&&i.CurrentFlightScope!=="OFF"?"OFF":"ON";i.$seatViewModal.toggleClass("is-open");i.$seatViewModal.css({"margin-top":function(){return window.pageYOffset-$(this).height()/2}});i.CurrentFlightScope==="ON"&&i.$broadcast("$UpdateSegments",n)};i.CalculateTaxesVar="";i.$on("fareGridtotalPriceReady",function(n,t){var r=0;(i.FareGrid[t]!==undefined||t==="SegFareSkipCheck")&&(r=i.fareGridResults[t]+parseFloat(r),i.totalPricePerPaxDisplay=i.fareGridResults[t],i.selectedSegments[i.selectedSegments.length-1].RoundTripFare=i.FareGrid[t],i.selectedSegments[i.selectedSegments.length-1].IsRoundTripFare=!0,i.SelectedFareGrid=t,i.CalculateTaxesVar="Calculate")});i.seatClassCtrl=function(t){t.selectSeatClass=function(i,r,u){var f,h;if(!$("#"+r+u).hasClass("tempDisabled")&&!$("#"+r+u).hasClass("disabled"))if(i==="SegmentFare")t.segment.selectedSeatClass=r,t.$emit("fareGridtotalPriceReady","SegFareSkipCheck"),t.RecalculateTaxes(),s.checkHoldBookingEligibility=!0;else if(i==="RoundTripFare"){if(f=[],!t.disabled){h=t.segment.selectedSeatClass+u;t.segment.selectedSeatClass=r;t.RecalculateTaxes();var e="",c=0,o=[];$(".hairlineGrid a.selected").each(function(){o[c]=$(this).attr("id");e=e+$(this).attr("id");c++});e=e.replace(h,r+u);o[o.indexOf(h)]=r+u;f=o;n.isUndefined(f)||f.length!==2||(s.checkHoldBookingEligibility=!0);t.$emit("fareGridtotalPriceReady",e)}t.CalculateAdditionalCost(f,r,u);t.RecalculateTaxes()}else return};t.CalculateAdditionalCost=function(i){$(".hairlineGrid div.class-selection a").each(function(){var r,u,o,e,f,s,h;if($(this).hasClass("disabled")||i.indexOf($(this).attr("id"))!==-1)$(this).hasClass("disabled")&&($(this).find("span.TempNotAvailable").hide(),$(this).find("span.adcostDisplay").hide(),$("#"+r).find("span.mixedCabinRT").show());else{for(u=[],n.forEach(i,function(n){u.push(n)}),r=$(this).get(0).id,o=r.slice(-1),e=0;e<u.length;e++)if(u[e].indexOf(o)!==-1){u[e]=r;break}f=u.join();f=f.replace(/,/g,"");s=t.fareGridResults[i.join().replace(/,/g,"")];t.fareGridResults[f]!=null?(h=(parseFloat(t.fareGridResults[f])-parseFloat(s)).toFixed(2),t.additionalCostArray[r]=h,$("#"+r).removeClass("tempDisabled"),$("#"+r).find("span.adcostDisplay").show(),$("#"+r).find("span.TempNotAvailable").hide(),$("#"+r).find("span.mixedCabinRT").show()):t.fareGridResults[f]==null&&i.length!==1&&($("#"+r).addClass("tempDisabled"),$("#"+r).find("span.adcostDisplay").hide(),$("#"+r).find("span.TempNotAvailable").show(),$("#"+r).find("span.mixedCabinRT").hide())}})};t.stateClass=function(i){if(t.InitStateGrid(),t.disabled=!1,t.segment.selectedSeatClass===t.classType)return t.selected=!0,"selected";t.selected=!1;var r=!1;if(t.PricingType==="SegmentFare"){if(!t.segment[t.classType]||t.segment[t.classType].AvailableSeats===0)return t.disabled=!0,"disabled"}else if(t.PricingType==="RoundTripFare"&&(n.forEach(t.UnavailableClasses,function(n){n===i&&(r=!0)}),r))return t.disabled=!0,"disabled";return undefined};t.InitStateGrid=function(){for(var n=0;n<t.segment.AvailBookingFares.length;n++)t.segment.AvailBookingFares[n].Name.toLowerCase()===t.classType&&(t.PricingType==="RoundTripFare"&&t.UnavailableClasses&&t.UnavailableClasses.indexOf(t.segment.selectedSeatClass+t.segmentIdx)!==-1&&(t.segment.selectedSeatClass=undefined),!t.segment.selectedSeatClass&&t.segment.AvailBookingFares[n].AvailableSeats&&(t.segment.selectedSeatClass=t.classType),t.segment[t.classType]=t.segment.AvailBookingFares[n])};t.InitStateGrid()};i.seatClassCtrl.$inject=["$scope"]};return{restrict:"A",scope:!0,link:v,controller:a}}])}(angular),function(n){"use strict";var t=n.module("haBookFlightResultsEndOnEndModule",["ui.router","haFlightResultsEndOnEndAPI","duScroll","haUtilsModule","haModalService","haGlobalsModule","haFeatureFlagsModule","ngAnimate"]);location.pathname.toLowerCase().indexOf("/book/flightresults")>-1&&t.config(["$stateProvider","$urlRouterProvider",function(n,t){var r={selectedResult:["$stateParams",function(n){return n.selectedResult}],selectedClass:["$stateParams",function(n){return n.selectedClass}]},i={segmentschosen:{templateProvider:["haConfig",function(n){return n.getTemplateUrlWithInclude("Book/FlightResults/ha-flightresults-selectedsegments.html")}]},flightchoices:{templateProvider:["haConfig",function(n){return n.getTemplateUrlWithInclude("Book/FlightResults/ha-flightresults-currentsegment.html")}],resolve:r}},u=["$scope","$rootScope","$state","$window",function(n,t,i,r){n.$on("$stateChangeStart",function(t,i,r,u,f){var o=parseInt(f.id,10),s=parseInt(r.id,10),e=r.selectedClass,h=f.selectedClass,c=n.resultItem[1].FareDetails.filter(function(n){return n.CabinType==="MAINCABINBASIC"}).length>0,l=n.currentSegmentId>1?n.resultItem.filter(function(n){return n.selectedSeatClass==="MAINCABINBASIC"}):!1,a=n.currentSegmentId>1?n.TripSummary.Trips.filter(function(n){return n.selectedSeatClass==="MAINCABINBASIC"}):!1,v=h===0&&s!==1||h===""&&s!==1;l.length>0&&n.resultItem[n.currentSegmentId].FareDetails[e].CabinType==="COACH"&&a.length>0&&v&&(t.preventDefault(),n.showUpgradeWarningModal(n,o,e));e===0&&o===1&&!n.$parent.acceptRestrictions&&c&&(t.preventDefault(),n.showRestrictionsModal(n))});n.$on("$stateChangeSuccess",function(r,u,f,e,o){var a=parseInt(o.id,10),s=parseInt(f.id,10),h,c,l,v=!0;if((isNaN(s)&&u.name!=="segment.complete"||s>n.TripCount||s<1)&&(location.href=location.pathname),!e.name&&(s>1||!f.id)){i.transitionTo("segment.x",{id:1},{notify:!1,location:"replace"});t.dtmVals={pageName:window.digitalData.page.pageInfo.name+":segment:1",pageURL:[location.origin,location.pathname,location.search,"#/segment/1"].join("")};return}if(t.dtmVals={pageName:window.digitalData&&window.digitalData.page?window.digitalData.page.pageInfo.name+(!s?":complete":":segment:"+s):"Error: window.digitalData.page is undefined for search: "+location.search,pageURL:[location.origin,location.pathname,location.search,!s?"#/complete":"#/segment/"+s].join("")},!isNaN(a)&&!isNaN(s)&&a>s||e.name==="segment.complete")n.hasLieFlat(n.searchResults[s-1]),n.hasECPreferred(n.searchResults[s-1]),n.hasMCBOferred(n.searchResults[s-1]),h=n.TripSummary.Trips[s-1],h&&(n.$emit("flightChanged",h),h.isDiscountNotApplied?n.removePromo(s===1):(n.editSegment(h,n.isClassModified()),n.detailsVisible=!1));else{if((u.name==="segment.complete"||e.name==="segment.complete")&&(s=n.TripCount+1),e.name==="segment.complete")f.selectedResult=o.selectedResult,f.selectedClass=o.selectedClass;else if(isNaN(parseInt(f.selectedResult,10))||isNaN(parseInt(f.selectedClass,10))){if(h=n.searchResults[n.searchResults.map(function(n){return n.TripId}).indexOf(s-1)],f.selectedResult=h?h.ActiveTab.TripAndFareDetails.map(function(n){return n.isSelectedFlight}).indexOf(!0):undefined,v=!1,u.name!=="segment.complete"&&(n.hasLieFlat(n.searchResults[s-1]),n.hasECPreferred(n.searchResults[s-1]),n.hasMCBOferred(n.searchResults[s-1])),typeof f.selectedResult!="undefined"&&f.selectedResult<0&&u.name==="segment.x"){i.transitionTo("segment.x",{id:1},{location:"replace",notify:!1});return}if(typeof f.selectedResult!="undefined"&&f.selectedResult<0||u.name==="segment.complete"&&n.searchResults.length<n.TripCount){location.replace(document.referrer);return}f.selectedClass=typeof f.selectedResult!="undefined"?h.ActiveTab.TripAndFareDetails[f.selectedResult].FareDetails.map(function(n){return n.isSelected}).indexOf(!0):undefined}h=n.searchResults.filter(function(n){return n.TripId===s-1})[0];c=h&&n.resultItem[s-1]?h.ActiveTab.TripAndFareDetails.filter(function(t){return t.UniqueReferenceKey===n.resultItem[s-1].UniqueReferenceKey})[0]:undefined;l=c?c.FareDetails[f.selectedClass]:undefined;h&&c&&l&&(h.hasSelectedFlight=!1,n.selectFlightWithPrice(c,h,l,v),n.detailsVisible=!1)}});n.changeClicked=function(t,i){t=parseInt(t,10);var u=isNaN(t)?n.TripCount-i+1:t-i;r.history.go(-1*u);n.hasLieFlat(n.searchResults[i-1]);n.hasECPreferred(n.searchResults[i-1]);n.hasMCBOferred(n.searchResults[i-1])};n.resultItem=[];n.setResultItem=function(i,r,u){if(n.resultItem[r]=i,u){var f=u.toLowerCase();(t.isMobile||f!=="extracomfort")&&f!=="preferred"||document.body.dispatchEvent(new CustomEvent("UpgradeSeatSelected",{detail:{seatType:f,pageName:t.dtmVals.pageName,pageURL:t.dtmVals.pageURL}}));f==="maincabinbasic"&&document.body.dispatchEvent(new CustomEvent("MainCabinBasicSelected",{detail:{pageName:t.dtmVals.pageName,pageURL:t.dtmVals.pageURL}}));r===1&&document.body.dispatchEvent(new CustomEvent("UpgradeToMainCabin",{detail:{pageName:t.dtmVals.pageName,seatType:f}}))}}}];n.state("segment",{abstract:!0,url:"/segment",controller:u}).state("segment.x",{url:"/:id",params:{selectedResult:"",selectedClass:""},views:i}).state("segment.complete",{url:"^/complete",params:{selectedResult:"",selectedClass:""},views:i});t.otherwise("/segment/1")}]).run(["$rootScope","$state","$stateParams",function(n,t,i){n.$state=t;n.$stateParams=i}]);t.directive("haBookFlightResultsEndOnEnd",["$window","$document","$timeout","haGlobals","haConfig","haFlightResultsEndOnEndAPI","$rootScope","$filter","haHttpService","$state","haSitecoreStrings","$log","haUtils","haDateUtils","haLaunchDarklyAPI",function(t,i,r,u,f,e,o,s,h,c,l,a,v,y,p){window.onpageshow=function(n){n.persisted&&window.location.reload()};var k=t.serverShortDate,w=t.enablePassengerTripSummary,b=t.isHoldEligible,d=["$scope","haInterstitialAPI","haModal","haPassengersService",function(t,i,s,h){function ut(){if(t.TripType===2&&t.searchRequest.FlightSearchSegmentList[0].DepartureDate&&t.searchRequest.FlightSearchSegmentList[1].DepartureDate){var n=t.searchRequest.FlightSearchSegmentList[0].DepartureDate,i=new Date(parseInt(n.match(/\d+/)[0],10)),r=t.searchRequest.FlightSearchSegmentList[1].DepartureDate,u=new Date(parseInt(r.match(/\d+/)[0],10));t.isValidLowFareDuration=y.numDaysDifference(i,u)<=60}else t.isValidLowFareDuration=!0}function b(n,i){var r={code:t.searchResults[0].OriginCityCode,display:t.searchResults[0].OriginCityName},u={code:t.searchResults[0].DestinationCityCode,display:t.searchResults[0].DestinationCityName};return{origin:n===0&&r||u,destination:n===0&&u||r,departDate:i}}function ft(){var f=t.searchRequest.FlightSearchSegmentList[0].DepartureDate,i=parseInt(f.match(/\d+/)[0],10),r,u,n;return i=new Date(moment(i).utc().format("MM/DD/YYYY")),r=[b(0,i)],t.TripType===2&&(u=t.searchRequest.FlightSearchSegmentList[1].DepartureDate,n=parseInt(u.match(/\d+/)[0],10),n=new Date(moment(n).utc().format("MM/DD/YYYY")),r.push(b(1,n))),r}var a,g,nt,tt;t.switchRtTooltips=t.$switch("BookingWidget:EnableRtTooltips");t.showFareTooltip=v.localStorageGet("hideFareTooltip")!=="true";t.lieFlatAvailable=!1;var it=10,w=10,rt=2e3;t.resetPage=function(){t.currentSegmentId=0;t.searchResults=[];t.editingSegment=!1;t.resultsLoaded=!1;t.showReceipt=!1;t.selectedChildFare="";t.childFarePriceText="";t.isNextAllowed=!0;t.isPreviousAllowed=!0;t.taxDetails=!1;t.flightSearchEditOpen=!1;t.priceTypeInfo={};t.sortDropdown=[];t.waitingForHeldReservation=!1;t.listDetailsOpen=[];t.TripSummary={};t.TripSummary.Trips=[];t.PassengerTripSummary={};t.UpsellGrid={};t.IsError=!1;t.ErrorMessage="";t.IsServiceErrors=!1;t.ServiceErrorMessage="";t.errordescription="";t.selectedPromo=null;t.hasChildPax=!1;o.isEligible=!1;o.selectedHoldFare={};t.model={loadingSegment:!0,flightResultsLimit:w}};t.resetPage();t.$emit("$haBookFlightResultsReady");t.$pax=h;h.passengers=[];t.searchRequest={};u(["searchRequest","showMilitaryTime","enableTCR","defaultDestinationImage","wholesaleDisableDollarMile"],function(n,i,r,u,f){t.searchRequest=n;t.TripType=n.FlightQueryTypeId;t.TripCount=n.FlightSearchSegmentList.length;t.showMilitaryTime=i!=="0";t.enableTCR=r;t.multiCity=!r;t.defaultDestinationImage=u;t.wholesaleDisableDollarMile=f});t.$on("elementScrolledIntoView",function(n,i){i==="lastFlightResult"&&r(function(){t.model.flightResultsLimit+=it})});t.$on("dtmPage",function(n,t){window.digitalDataLoaded.then(function(){setTimeout(function(){document.body.dispatchEvent(new CustomEvent("FlightResults",{detail:t}))})})});t.resetFlightResultsLimit=function(){t.model.flightResultsLimit=w};t.hasLieFlat=function(n){var i=!1,f,r,e,u;if(typeof n!="undefined"&&(!n.ActiveTab||!t.hasFirstOrBusiness(n)))return t.lieFlatBannerVisible=!1,i;for(t.lieFlatBannerVisible=!1,f=typeof n!="undefined"?n.ActiveTab.TripAndFareDetails:[],r=0;r<f.length;r++)for(e=f[r].TripSlice.Segments,u=0;u<e.length;u++)if(e[u].LieFlatAvailable)return i=!0,t.lieFlatBannerVisible=!0,i;return i};t.hasLieFlatFareGrid=function(n){var u=!1,f,i,e,r;for(t.lieFlatBannerVisible=!1,f=n,i=0;i<f.length;i++)for(e=f[i].TripSlice.Segments,r=0;r<e.length;r++)if(e[r].LieFlatAvailable)return u=!0,t.lieFlatBannerVisible=!0,u;return u};t.hasLieFlatFromTripSlice=function(n){for(var u=n.TripSlice.Segments,i=!1,r=0;r<u.length;r++)if(u[r].LieFlatAvailable)return i=!0,t.lieFlatBannerVisible=!0,i;return i};t.$on("flightChanged",function(n,i){t.lieFlatAvailable=t.hasLieFlatFromTripSlice(i);t.UpsellGrid={};t.UpsellGrid.showUpsellGrid=!1});t.segmentHasLieFlat=function(n){return n.TripSlice.Segments.every(function(n){return n.LieFlatAvailable})};t.tripSeatType=function(n,t){return n.TripSlice.Segments.every(function(n){if(n.OperatingAirline!="HA")return!1;var i=a(n.EquipmentType);return i?i.FCSeatType==t:!1})};a=function(n){for(var r,i=0,u=t.planesConfiguration.length;i<u;i++)if(r=t.planesConfiguration[i],$.inArray(n,r.codes)>-1)return r;return!1};t.getAircraftMarketingInfo=function(n){for(var r,i=0,u=t.PlanesMarketingData.length;i<u;i++)if(r=t.PlanesMarketingData[i],$.inArray(n,r.EquipmentCodes)>-1)return r;return!1};t.getAirplaneName=function(n){var t=a(n);return t.name?t.name:""};t.hasFirstOrBusiness=function(n){var u,i,r,t;if(!n.ActiveTab)return!1;for(u=n.ActiveTab.TripAndFareDetails,i=0;i<u.length;i++)for(r=u[i].FareDetails,t=0;t<r.length;t++)if(r[t].CabinType==="FIRST"||r[t].CabinType==="BUSINESS")return!0;return!1};t.hasECPreferred=function(n){var t=!1,f,i,e,r,u;if(typeof n!="undefined"&&!n.ActiveTab)return t;for(f=typeof n!="undefined"?n.ActiveTab.TripAndFareDetails:[],i=0;i<f.length;i++)for(e=f[i].FareDetails,r=0;r<e.length;r++)if(u=e[r].CabinType.toLowerCase(),u==="extracomfort"||u==="preferred")return t=!0,document.body.dispatchEvent(new CustomEvent("UpgradeSeatOffered",{detail:{seatType:u,pageName:o.dtmVals.pageName,pageURL:o.dtmVals.pageURL}})),t;return t};t.hasMCBOferred=function(n){var r=!1,u,t,f,i,e;if(typeof n!="undefined"&&!n.ActiveTab)return r;for(u=typeof n!="undefined"?n.ActiveTab.TripAndFareDetails:[],t=0;t<u.length;t++)for(f=u[t].FareDetails,i=0;i<f.length;i++)if(e=f[i].CabinType.toLowerCase(),e==="maincabinbasic")return document.body.dispatchEvent(new CustomEvent("MainCabinBasicOffered",{detail:{pageName:o.dtmVals.pageName,pageURL:o.dtmVals.pageURL}})),r;return r};t.enablepricechart=t.$switch("LowFare:enablepricechart");t.enablepricecalendar=t.$switch("LowFare:enablepricecalendar");ut();t.openPriceChart=function(n){n=n||"calendar";s(f.getTemplateUrl("/Book/FlightSearch/ha-flexible-price-modal.html"),{id:"FlexiblePriceView",backdrop:"true",extendScope:{legs:ft(),adults:t.searchRequest.AdultCount,children:t.searchRequest.ChildCount,display:n}})};t.openMobileMixedCabin=function(n){s(f.getTemplateUrl("Book/FlightResults/ha-mixed-cabin-modal.html"),{backdrop:"true",id:"MixedCabinModal",extendScope:{legsWithCabinDetails:n,getCabinDisplayName:t.getCabinDisplayName}})};t.crossCheckSearch=function(n,i){var r=!0,u;if(t.searchRequest.FlightSearchSegmentList.length>=n.TripId?(u=t.searchRequest.FlightSearchSegmentList[n.TripId-1],(u.OriginCityCode!==n.OriginCityCode||u.DestinationCityCode!==n.DestinationCityCode)&&(r=!1)):r=!1,r&&i)switch(n.BookingType){case 0:t.searchRequest.FlightSearchSegmentList.filter(function(n){return n.IsMiles}).length>0&&(r=!1);break;case 1:(t.searchRequest.FlightQueryTypeId===0||t.searchRequest.FlightSearchSegmentList.filter(function(n){return!n.IsMiles}).length>0)&&(r=!1);break;case 2:(t.searchRequest.FlightQueryTypeId!==2||t.searchRequest.FlightSearchSegmentList.length!==2||t.searchRequest.FlightSearchSegmentList[0].IsMiles||!t.searchRequest.FlightSearchSegmentList[1].IsMiles)&&(r=!1);break;case 3:(t.searchRequest.FlightQueryTypeId!==2||t.searchRequest.FlightSearchSegmentList.length!==2||!t.searchRequest.FlightSearchSegmentList[0].IsMiles||t.searchRequest.FlightSearchSegmentList[1].IsMiles)&&(r=!1);break;default:r=!1}return r||(window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"),r};t.hideFareTooltip=function(){t.showFareTooltip=!1;v.localStorageSet("hideFareTooltip",!0)};t.showFareModal=function(){s(f.getTemplateUrl("fare-help-modal.html"),{id:"fare-help-modal",backdrop:"true",scope:t})};t.closeBanner=function(n){n.stopPropagation();t.lieFlatBannerVisible=!1};t.socialProofDisplay=function(i,u,f){var i=moment(i).utc().format("LL"),h=function(){n.element("#social-proof-container").css("left","0px")},s=function(){n.element("#social-proof-container").css("left","-1000px")};t.closeSp=function(){s()};e.getSocialProofData(u,f,i).success(function(n){n.ErrorMessage!=null&&n.ErrorMessage.length>1?t.spData={visitorNo:0,displayEligible:!1}:(t.spData={visitorNo:n.FlightSearchCount,displayEligible:n.DisplaySocialProofSlider},l.get("FareSearch").then(function(n){t.spData.displayText=n.socialprooftext.replace("{Number value}",t.spData.visitorNo).replace("{Destination}",t.searchResults[t.currentSegmentId-1].DestinationCityName.split(",")[0])}),r(h,3e3),o.isMobile?r(s,7e3):r(s,13e3))})};t.initialSearch=function(i){var u=$("#FlightResultsInterstitial"),f=function(){n.element("body").removeAttr("style");u.addClass("ng-hide")};u.addClass("done");window.scrollTo(0,0);t.socialProofDisplay(i.DepartureDate,i.OriginCityCode,i.DestinationCityCode);r(function(){u.one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",f).addClass("animated").addClass("bounceOutUp");$(document.documentElement).hasClass("no-csstransforms3d")&&f();t.model.loadingSegment=!1;r(function(){n.element("#segment-1").removeClass("loading")},0)},rt);t.resultsLoaded=!0;document.body.dispatchEvent(new CustomEvent("UpgradeToMainCabin",{detail:{pageName:o.dtmVals.pageName,clearData:"true"}}));t.lieFlatAvailable=t.hasLieFlat(i);t.hasECPreferred(i);t.hasMCBOferred(i);t.enableChildFare=t.$switch("FlightResult:enablechildfarelabels");n.forEach(t.$pax.passengers,function(n){n.type=="Child"&&(t.hasChildPax=!0)});i.ActiveTab!==undefined&&i.AlternateTabs!==undefined&&i.TripId!==undefined&&(t.currentSegmentId=i.TripId,t.currency=i.CurrencyCode,t.searchResults[i.TripId-1]=i,t.resetFlightResultsLimit(),t.searchRequest.IsRefundable=i.IsRefundableFare,t.Message=i.Message,t.SignifiedMarket=i.MarketID,t.priceTypeInfo.priceType=i.BookingType!==undefined&&i.BookingType<=3?i.BookingType:0,t.priceTypeInfo.priceTypeSelection=t.priceTypeInfo.priceType===3?2:t.priceTypeInfo.priceType,t.priceTypeInfo.priceTypeMilesDollarsSelection="",t.priceTypeInfo.priceType>1&&(t.priceTypeInfo.priceTypeMilesDollarsSelection=t.priceTypeInfo.priceType),t.arrowUpdate(),t.updatePromo(i.Discounts),t.updateSortDropdown());o.isMobile&&t.getLowestFares(i)};t.planesConfiguration=[];e.fetchPlaneConfiguration().success(function(n){t.planesConfiguration=n}).error(function(){t.handleExceptions("jsError","haFlightResultsEndOnEndAPI-planeConfiguration")});t.PlanesMarketingData=[];e.fetch().success(function(n){t.handleExceptions(n,"haFlightResultsEndOnEndAPI-fetch")||(t.initialSearch(n),t.$emit("dtmPage",{pageName:o.dtmVals.pageName,pageURL:o.dtmVals.pageURL,lowestFare:t.searchResults[0].AlternateTabs[3].DisplayAmount||"0"}))}).error(function(){t.handleExceptions("jsError","haFlightResultsEndOnEndAPI-fetch");t.resultsLoaded=!0});t.$watch("priceTypeInfo.priceTypeSelection",function(n,i){(n=parseInt(n),isNaN(n)||n===parseInt(i))||n<=2&&(t.priceTypeInfo.priceType=n)});t.$watch("priceTypeInfo.priceTypeMilesDollarsSelection",function(n,i){(n=parseInt(n),isNaN(n)||n===parseInt(i))||(t.priceTypeInfo.priceType=n)});t.$watch("priceTypeInfo.priceType",function(i,u){if(u!==undefined&&u!==i&&i!==undefined){t.selectClass.removeClass("active");t.continueBarActive=!1;t.resetPage();r(function(){n.element(".ha-loading-spinner").focus()},0);switch(i){case 0:n.forEach(t.searchRequest.FlightSearchSegmentList,function(n){n.IsMiles=!1});break;case 1:n.forEach(t.searchRequest.FlightSearchSegmentList,function(n){n.IsMiles=!0});break;case 2:t.searchRequest.FlightSearchSegmentList.length===2&&(t.searchRequest.FlightSearchSegmentList[0].IsMiles=!1,t.searchRequest.FlightSearchSegmentList[1].IsMiles=!0);break;case 3:t.searchRequest.FlightSearchSegmentList.length===2&&(t.searchRequest.FlightSearchSegmentList[0].IsMiles=!0,t.searchRequest.FlightSearchSegmentList[1].IsMiles=!1)}c.go("segment.x",{id:1},{notify:!1});e.changeMilesOption(i).success(function(n){t.handleExceptions(n,"haFlightResultsEndOnEndAPI-changeMilesOption")||t.crossCheckSearch(n,!1)&&t.initialSearch(n)}).error(function(){t.handleExceptions("jsError","haFlightResultsEndOnEndAPI-changeMilesOption")})}});t.$watch("model.loadingSegment",function(i){!i&&t.currentSegmentId<=t.TripCount&&r(function(){$(".discount-applied").bind("mouseover",function(t){$(t.target).children("#discountTooltip").length===0&&$(t.target).parent().append(n.element("#discountTooltip"));n.element("#discountTooltip").removeClass("ng-hide");$(t.target).mouseleave(function(){$("#discountTooltip").addClass("ng-hide");$("body").append(n.element("#discountTooltip"))})})},10)});t.AddPassengerList=function(n,i){for(var r=0;r<n;r++)t.$pax.add({type:i,isUser:!0})};t.UpdatePassengerList=function(){t.searchRequest.AdultCount>0&&t.AddPassengerList(t.searchRequest.AdultCount,"Adult");t.searchRequest.ChildCount>0&&t.AddPassengerList(t.searchRequest.ChildCount,"Child");t.searchRequest.InfantCount>0&&t.AddPassengerList(t.searchRequest.InfantCount,"Infant")};t.UpdatePassengerList();t.$on("applyPromo",function(n,i){t.selectPromo(i)});t.$on("removePromo",function(){t.removePromo()});t.selectPromo=function(n){t.selectClass.removeClass("active");t.continueBarActive=!1;t.resetPage();c.go("segment.x",{id:1},{notify:!1});e.selectPromo(n).success(function(n){t.handleExceptions(n,"haFlightResultsEndOnEndAPI-selectPromo")||t.initialSearch(n)}).error(function(){t.handleExceptions("jsError","haFlightResultsEndOnEndAPI-selectPromo")})};t.updatePromo=function(i){t.$broadcast("updatePromoList",i);n.forEach(i,function(n){t.selectedPromoTitle=undefined;n.Active&&(t.selectedPromo=n)})};t.removePromo=function(n){t.selectClass.removeClass("active");t.continueBarActive=!1;t.resetPage();n||c.go("segment.x",{id:1},{notify:!1});e.removePromo().success(function(n){t.handleExceptions(n,"haFlightResultsEndOnEndAPI-removePromo")||t.initialSearch(n)}).error(function(){t.handleExceptions("jsError","haFlightResultsEndOnEndAPI-removePromo")})};t.selectTab=function(i,u){var f=i.TabDate.split(/[^0-9]/),s=new Date(f[0],f[1]-1,f[2],f[3],f[4],f[5]);if(!i.IsSoldOut&&!i.IsNoFlights){if(!t.handleDateCheckAndError(s,u))return!1;t.model.loadingSegment=!0;n.element("#segment-"+u).addClass("loading");r(function(){n.element(".ha-loading-spinner").focus()},0);e.fetchTab(t.getJourneyData(),u,i.TabDate).success(function(i){var f,e,s;(t.model.loadingSegment=!1,t.handleExceptions(i,"haFlightResultsEndOnEndAPI-selectTab"))||(t.lieFlatAvailable=t.hasLieFlat(i),t.hasECPreferred(i),t.hasMCBOferred(i),t.crossCheckSearch(i,!0)&&(t.searchResults=t.searchResults.slice(0,i.TripId),t.resetFlightResultsLimit(),n.element("#segment-"+u).removeClass("loading"),n.element("#segment-"+u).addClass("current"),$.extend(t.searchResults[u-1],i),t.Message=i.Message,t.updatePromo(i.Discounts),t.socialProofDisplay(i.DepartureDate,i.OriginCityCode,i.DestinationCityCode),t.arrowUpdate(),f=n.element("[booking-widget]").scope(),f!==undefined&&(f.updateLegDates(2),f.Initialize()),t.IsChangeFlightBooking?(s=n.element("#flightResultsStickProgressBarReshop").scope(),s.UpdateBar(u)):(e=n.element("#flightResultsStickProgressBar").scope(),e.UpdateBar(u)),r(function(){$("#leg-"+u+"-tab-3").focus()},0),t.$emit("dtmPage",{pageName:o.dtmVals.pageName,pageURL:o.dtmVals.pageURL,lowestFare:t.searchResults[0].AlternateTabs[3].DisplayAmount||"0"})),o.isMobile&&t.getLowestFares(i))}).error(function(){t.handleExceptions("jsError","haFlightResultsEndOnEndAPI-selectTab")})}};document.referrer.indexOf("deals-and-offers")!=-1&&(t.TripType=2);t.openFlightSearchEdit=function(){t.isFlightSearchEditModal=!0;s(f.getTemplateUrl("ha-book-flight-search-edit-modal.html"),{id:"fare-help-modal",backdrop:"false",scope:t,modalLock:!0})};t.SearchBySeven=function(i,u,f){var s=f.split(/[^0-9]/),h=new Date(s[0],s[1]-1,s[2],s[3],s[4],s[5]);if(u===1?h.setDate(h.getDate()+7):u===-1&&h.setDate(h.getDate()-7),!t.handleDateCheckAndError(h,i))return!1;t.model.loadingSegment=!0;n.element("#segment-"+i).addClass("loading");r(function(){n.element(".ha-loading-spinner").focus()},0);e.fetchTab(t.getJourneyData(),i,u).success(function(u){var f,e;t.handleExceptions(u,"haFlightResultsEndOnEndAPI-SearchBySeven")||t.crossCheckSearch(u,!0)&&(t.model.loadingSegment=!1,t.searchResults=t.searchResults.slice(0,u.TripId),t.resetFlightResultsLimit(),n.element("#segment-"+i).removeClass("loading"),$("#segment-"+i).addClass("current"),$.extend(t.searchResults[i-1],u),t.Message=u.Message,t.updatePromo(u.Discounts),t.IsChangeFlightBooking?(e=n.element("#flightResultsStickProgressBarReshop").scope(),e.UpdateBar(i)):(f=n.element("#flightResultsStickProgressBar").scope(),f.UpdateBar(i)),r(function(){$("#leg-"+i+"-tab-3").focus()},0),t.$emit("dtmPage",{pageName:o.dtmVals.pageName,pageURL:o.dtmVals.pageURL,lowestFare:t.searchResults[0].AlternateTabs[3].DisplayAmount||"0"}))}).error(function(){t.handleExceptions("jsError","haFlightResultsEndOnEndAPI-SearchBySeven");t.model.loadingSegment=!1;$("#segment-"+i).addClass("current")})};t.AddFlightsToTrip=function(r,u){var l,c,f,y,h,p,w,b,d,a,v;for(r!==undefined&&r.preventDefault(),!n.isUndefined(u)&&u&&(l=o.selectedHoldFare,c={},c.UniquePriceID=l.id,c.TimeLimitDays=l.numberOfDays,c.HoldFee=l.price,c.MSRCode=l.msrCode,e.updateSelectedHoldFare(c).success(function(){}).error(function(){console.error("Error in holding price")})),f=t.TripSummary.Trips,f.length>0&&f[0].selectedSeatClassInitial==="MAINCABINBASIC"&&(f[0].selectedSeatClass==="COACH"||f[0].selectedSeatClass==="EXTRACOMFORT"||f[0].selectedSeatClass==="PREFERRED")&&document.body.dispatchEvent(new CustomEvent("UpgradeToMainCabin",{detail:{pageName:o.dtmVals.pageName,pageURL:o.dtmVals.pageURL}})),y="true",h=0;h<f.length-1;h++)if(p=f[h].TripSlice.Segments.length,f[h+1].TripSlice.Segments[0].DepartureDateTime<f[h].TripSlice.Segments[p-1].ArrivalDateTime){w=h+1;b=h+1+1;y="false-"+w+"/"+b;break}if(y.indexOf("false")!==-1){var k=y.split("-"),g=k[k.length-1].split("/"),nt=g;return t.populatePrevDateValidationPopup(nt),d=$("#PrevDateValReturnToSearchPopup").html(),s({id:"ReturnToFlightSearchPopupModal",backdrop:"true",template:d}),!1}a={};v="";a.FareDetails=[];n.forEach(t.TripSummary.Trips,function(n){var t={};t.id=n.TripId;t.FlightRefKey=n.UniqueReferenceKey;t.IsMileagePricing=!1;t.SelectedClass=n.selectedSeatClass;a.FareDetails.push(t);v!==""&&(v+="+");v+=n.selectedSeatClass.toUpperCase()});a.SelectedFareGrid=v;t.waitingSegment=!0;i.getAirAvailability().success(function(n){s({id:"InterstitialAirAvailability-modal",backdrop:"true",template:n,modalLock:!0});t.interstitialDynamicResize();e.checkFlightAvailability(a).success(function(n){t.handleExceptions(n,"haFlightResultsEndOnEndAPI-checkFlightAvailability")||(t.waitingSegment=!1,n.status===1?t.showFightsNoSeatsAvailableModal():n.status===2?t.showFightsScheduleMismatchModal():n.status===4?t.showFightsDataAccessDownModal():n.status===0&&$("#FlightSearchForm").submit())}).error(function(){t.handleExceptions(n,"haFlightResultsEndOnEndAPI-checkFlightAvailability");t.waitingSegment=!1})})};t.showDateValidationModal=function(){s(f.getTemplateUrl("book/flightresults/ha-flightresults-date-validation-modal.html"),{backdrop:"true",id:"FutureDateValidationPopupModal",scope:t})};t.show331DaysValidationModal=function(){s(f.getTemplateUrl("book/flightresults/ha-flightresults-331-days-validation-modal.html"),{backdrop:"true",id:"results-331Days",scope:t})};t.showLessThanCurrentDateModal=function(){s(f.getTemplateUrl("book/flightresults/ha-flightresults-less-than-current-date-modal.html"),{backdrop:"true",id:"results-DateValidationLessDate",scope:t})};t.handleDateCheckAndError=function(n,i){var u,r;return(t.today===undefined&&(typeof k!="undefined"?(u=k.split(/[^0-9]/),t.today=new Date(u[2],u[0]-1,u[1],0,0,0)):(t.today=new Date,t.today.setHours(0,0,0,0))),t.maxDateAllowed===undefined&&(t.maxDateAllowed=new Date(t.today.getTime()),t.maxDateAllowed.setDate(t.maxDateAllowed.getDate()+330)),Date.parse(n)<Date.parse(t.today))?(t.showLessThanCurrentDateModal(),!1):(r=t.searchResults[i-2]?new Date(t.searchResults[i-2].DepartureDate):t.searchRequest.FlightSearchSegmentList[i-2]?new Date(Number(t.searchRequest.FlightSearchSegmentList[i-2].DepartureDate.replace(/[^0-9]/g,""))):!1,r&&Date.parse(n)<r)?(t.showDateValidationModal(),!1):(r=t.searchResults[i]?new Date(t.searchResults[i].DepartureDate):t.searchRequest.FlightSearchSegmentList[i]?new Date(Number(t.searchRequest.FlightSearchSegmentList[i].DepartureDate.replace(/[^0-9]/g,""))):!1,r&&Date.parse(n)>r)?($("#ScData_PrevDateValidation_scenario").html($(".futureValidation").html()),t.showDateValidationModal(),!1):Date.parse(n)>Date.parse(t.maxDateAllowed)?(t.show331DaysValidationModal(),!1):!0};t.arrowUpdate=function(){t.isPreviousAllowed=!0;t.isNextAllowed=!0};t.changeCurrency=function(n,i){var r=i-1;e.fetchCurrency(n).success(function(n){t.handleExceptions(n,"haFlightResultsEndOnEndAPI-changeCurrency")||(t.Trips[r]=n.Trips[r])})};var et=function(){return function(n){for(var i=0,t=0;t<n.FareDetails.length;t++)if(n.FareDetails[t].DisplayAmount){i=parseFloat(n.FareDetails[t].DisplayAmount);break}return i}},ot=function(){return function(n){for(var i=0,t=0;t<n.FareDetails.length;t++)if(n.FareDetails[t].DisplayMiles){i=parseFloat(n.FareDetails[t].DisplayMiles);break}return i}},st=function(){return function(n){return new Date(n.TripSlice.Segments[0].DepartureDateTime)}},ht=function(){return function(n){return new Date(n.TripSlice.Segments[n.TripSlice.Segments.length-1].ArrivalDateTime)}},ct=function(n){return function(t){var i=0,r=t.TripSlice[n].match(/\d*d/g),u=t.TripSlice[n].match(/\d*h/g),f=t.TripSlice[n].match(/\d*m/g);return r&&(i+=parseInt(r[0].match(/\d+/))*1440),u&&(i+=parseInt(u[0].match(/\d+/))*60),f&&(i+=parseInt(f[0].match(/\d+/))),i}},d=[];t.getLowestFares=function(i){i.ActiveTab!=null&&n.forEach(i.ActiveTab.TripAndFareDetails,function(r,u){var f=[],e=[],o=!1;n.forEach(r.FareDetails,function(n){n.IsAvailable==!0&&(f.push(n.DisplayAmount),e.push(n.DisplayMiles));n.IsDiscount==!0&&(o=!0)});f.sort(function(n,t){return n-t});e.sort(function(n,t){return n-t});t.searchResults[i.TripId-1].ActiveTab.TripAndFareDetails[u].lowestDollars=f[0];t.searchResults[i.TripId-1].ActiveTab.TripAndFareDetails[u].lowestMiles=e[0];t.searchResults[i.TripId-1].ActiveTab.TripAndFareDetails[u].hasDiscount=o})};g=function(n,t){return function(i){var r=i.TripSlice[n]*1e4,u=i.TripSlice[t].match(/\d*d/g),f=i.TripSlice[t].match(/\d*h/g),e=i.TripSlice[t].match(/\d*m/g);return i.TripSlice.IsCodeShare&&(r+=200),u&&i.TripSlice[n]>0&&(r+=parseInt(u[0].match(/\d+/))*1440),f&&i.TripSlice[n]>0&&(r+=parseInt(f[0].match(/\d+/))*60),e&&i.TripSlice[n]>0&&(r+=parseInt(e[0].match(/\d+/))),i.TripSlice[n]===0&&(r=moment.duration(moment(new Date(i.TripSlice.Segments[i.TripSlice.Segments.length-1].ArrivalDateTime)).diff(moment())).seconds()),r}};nt=function(){p.getFeatureFlag(HA.FLAGS.MetalNeutralShoppingFeatureKey,"boolean",!0,!1).then(function(n){return n.data==="ENABLED"?null:g("StopsCount","Duration")})};t.updateSortDropdown=function(){var n=t.priceTypeInfo.priceType;t.sortOptions=d.filter(function(t,i){return i===1?n!==1:i===2?n!==0:!0});t.sorting={predicateKey:"default"}};l.get("FareSearch").then(function(){d=[{key:l("FareSearch.defulttext"),val:"default"},{key:l("FareSearch.lowestpricetext"),val:"lowestPrice"},{key:l("FareSearch.lowestmilestext"),val:"lowestMiles"},{key:l("FareSearch.earliestdeparturetimetext"),val:"earliestDepartureTime"},{key:l("FareSearch.earliestarrivaltimetext"),val:"earliestArrivalTime"},{key:l("FareSearch.shortestdurationtext"),val:"shortestDuration"}];t.updateSortDropdown();t.milesDollarsDropdown=[{key:l("FareSearch.selectonetext"),val:""},{key:l("FareSearch.dollarmilestext"),val:2},{key:l("FareSearch.milesdollartext"),val:3}];t.operatedByText=l("FareSearch.operatedbytext")});t.predicates={"default":nt(),lowestPrice:et(),lowestMiles:ot(),earliestDepartureTime:st(),earliestArrivalTime:ht(),shortestDuration:ct("Duration")};t.reverse=!1;t.ToggleTaxDetails=function(){t.taxDetails=!t.taxDetails};t.showSeatClassModal=function(n,i){return(n.stopPropagation(),i==="maincabinbasic")?t.mcbRestrictionModal():(t.seatClassModal={},t.seatClassModal.currentClass=i,i==="business"|i==="first"&&t.lieFlatBannerVisible&&(i="lieflat"),t.seatClassModal.Data=t.searchResults[t.currentSegmentId-1]?t.searchResults[t.currentSegmentId-1].SeatClassModalData:t.searchResults[0].SeatClassModalData,t.seatClassModal.selected=t.seatClassModal.Data.filter(function(n){return n.Type===i})[0],!t.seatClassModal.selected)?!1:(s(f.getTemplateUrl("Book/FlightResults/ha-flightresults-seat-class-modal-template.html"),{id:"results-seat-class",backdrop:"true",scope:t}),!0)};t.showSeatClassModalLieFlat=function(){var n=t.showSeatClassModal("business");n||t.showSeatClassModal("first")};t.showBaggageFeesModal=function(n){e.fetchModalContent(n).success(function(n){t.handleExceptions(n,"haFlightResultsEndOnEndAPI-showBaggageFeesModal")||s({id:"results-baggageFee",backdrop:"true",template:n})})};t.showModalPopUp=function(n){e.fetchModalContent(n).success(function(i){t.handleExceptions(i,"haFlightResultsEndOnEndAPI-showModalPopUp")||s({id:"results-"+n,backdrop:"true",template:i})})};t.showFightsNoSeatsAvailableModal=function(){window.location.href="/book/Error?ErrorType=SeatNotAvailable"};t.showFightsDataAccessDownModal=function(){window.location.href="/book/Error?ErrorType=DataAccessDown"};t.showFightsScheduleMismatchModal=function(){e.fetchPopup("ScheduleMismatch").success(function(n){t.handleExceptions(n,"haFlightResultsEndOnEndAPI-showFightsScheduleMismatchModal")||s({id:"schedule-missmatch",backdrop:"true",template:n,modalLock:!0,cancel:{label:"Close",fn:function(){window.location.href="/book/FlightResults"}}})})};t.showSeatMap=function(n){s(f.getTemplateUrl("VerticalSeatmap/ha-vertical-seatmap-preview.html"),{backdrop:"true",id:"ha-vertical-seatmap-preview-modal",extendScope:{previewSegments:n,SignifiedMarket:t.SignifiedMarket,enableTCR:t.enableTCR,disableSeatUpgrades:t.searchResults[0].IsDisableSeatUpgrade}})};t.ErrorBackToHome=function(n,i,r){var u,f,e;n==="haFlightResultsEndOnEndAPI-fetch"||n==="haFlightResultsEndOnEndAPI-changeMilesOption"?t.IsChangeFlightBooking?(u=/(<([^>]+)>)/ig,f=i+": "+r,e=f.replace(u,""),window.location.href="/book/error?ErrorType=Custom&PathType=ChangeFlight&ErrorCode="+e):(u=/(<([^>]+)>)/ig,f=i+": "+r,e=f.replace(u,""),window.location.href="/book/home?FltResNull="+e):(u=/(<([^>]+)>)/ig,f=i+": "+r,e=f.replace(u,""),window.location.href="/book/home?FltResNull="+e)};t.handleExceptions=function(n,i){if(n!=="jsError")switch(n.ErrorCodeHandle){case"BFS0":t.ErrorBackToHome(i,n.ErrorCodeHandle,n.ErrorMessage,n.RedirectURL);break;case"BFRT0":t.ErrorBackToHome(i,n.ErrorCodeHandle,n.ErrorMessage,n.RedirectURL);break;case"20027":t.ErrorBackToHome(i,n.ErrorCodeHandle,n.ErrorMessage,n.RedirectURL);break;case"20055":l.get("FareSearch").then(function(){t.ErrorBackToHome(i,"20055",l("FareSearch.dollarsnoavailability"))});break;case"20066":l.get("FareSearch").then(function(){t.ErrorBackToHome(i,"20066",l("FareSearch.dollarsmilesnoavailability"))});break;case"20024":var r=/(<([^>]+)>)/ig;l.get("FareSearch").then(function(){var t=n.ErrorCodeHandle+": "+l("FareSearch.noflightresultserrormsg"),i=t.replace(r,"");window.location.href="/book/home?FltResNull="+i});break;case"20044":window.location.href="/book/error?ErrorType=Custom&ErrorCode="+n.ErrorCodeHandle;break;case"20045":window.location.href="/book/error?ErrorType=Custom&ErrorCode="+n.ErrorCodeHandle;break;case"SessionTimeOut":window.location.href="/book/error?ErrorType=SessionTimeOut";break;default:if(n.ErrorCodeHandle!==undefined)window.location.href=n.RedirectURL;else if(n.ErrorMessage)window.location.href="/book/error?ErrorType=Custom&ErrorCode="+n.ErrorMessage;else return!1}else window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"};tt=v.debounce(function(){t.interstitialDynamicResize()},100,!1);window.onresize=function(){tt()};t.interstitialDynamicResize=function(){o.isMobile||$(".ha-modal#InterstitialAirAvailability-modal .modalContainer").css({width:$(window).width(),height:$(window).height(),"padding-top":$(window).height()*.2})};t.populatePrevDateValidationPopup=function(n){var t=$("#ScData_PrevDateValidation_Unedited").html().replace("~INVALIDFLIGHT1~",n[0]).replace("~INVALIDFLIGHT2~",n[1]);$("#ScData_PrevDateValidation_DynamicContent").html(t)};t.showSelectAllFlightsPopup=function(){var i=$("#SelectOpenSegmentPopupContentNoEdit").html(),n;return $("#SelectOpenSegmentPopupContent").html(i.replace("~SEGMENT~",t.openSegments.TripId)),n=$("#SelectOpenSegmentValidationPopup").html(),s({id:"SelectAllSegmentsModalPopup",backdrop:"true",template:n}),!1};t.containsMixedClass=function(t,i){var r=!1;return n.forEach(t,function(t){t.CabinType.toLowerCase()===i.toLowerCase()&&n.forEach(t.BookingClassDetails,function(n){n.IsMixedCabin&&(r=!0)})}),r};t.legsWithCabinDetails=function(t,i,r){var u=[];return n.forEach(t,function(n){u.push(n)}),n.forEach(i,function(t){t.CabinType.toLowerCase()===r.toLowerCase()&&n.forEach(t.BookingClassDetails,function(t){n.forEach(t.ClassOfServices,function(n,t){u[t].PricedClass=n.PricedClass})})}),u};t.getFlightList=function(i){if(i.flightList===undefined){var u=[],e=!1,r="",f="";n.forEach(i.Segments,function(n){n.OperatingAirline!=null&&n.OperatingAirline!==""&&u.indexOf(n.OperatingAirline)===-1&&(n.OperatingAirline==="HA"?e=!0:u.push(n.OperatingAirline))});r+='<span class="flightnos">';n.forEach(i.Segments,function(n,f){r+='<span class="flightno">'+n.MarketingAirline+" "+n.FlightNumber;n.OperatingAirline!=null&&n.OperatingAirline!==""&&u.indexOf(n.OperatingAirline)>-1&&(r+='<sup aria-hidden="true">'+(u.indexOf(n.OperatingAirline)+1)+"<\/sup>",r+='<span class="sr-only">'+t.operatedByText+" "+t.getCodeShareAirlineName(n.OperatingAirline)+"<\/span>");f<i.Segments.length-1&&(r+=",&nbsp;");r+="<\/span>"});r+="<\/span>";u.length>0&&(r+='<\/br><span aria-hidden="true" class="operatedby">'+t.operatedByText,n.forEach(u,function(n,u){e&&u===0&&(f+=t.getCodeShareAirlineName("HA")+", ",r+=" "+t.getCodeShareAirlineName("HA")+",",i.showHA=!0);u>0&&(f+=", ",r+=",");f+=t.getCodeShareAirlineName(n);r+=" <sup>"+(u+1)+"<\/sup>"+t.getCodeShareAirlineName(n)}),r+="<\/span>");i.operatedByList=f;i.flightList=r}return i.flightList};t.hasLowestPrice=function(n){if(n&&n.FareDetails){for(var t=0;t<n.FareDetails.length;t++)if(n.FareDetails[t].IsLowestFare)return!0;return!1}};t.upgradeToMainCabin=function(n,i){t.mcbToMain=!0;var r=window.digitalData.page.pageInfo.name+":mcbUpgradeWarning";t.resultItem=n;t.resultItem.forEach(function(n){n.selectedSeatClass==="MAINCABINBASIC"&&(n.selectedSeatClass="COACH")});n.forEach(function(n,i){var r=t.searchResults[i-1],u;r.ActiveTab.TripAndFareDetails.filter(function(n){return n.isSelectedFlight&&n.selectedSeatClassInitial==="MAINCABINBASIC"}).length&&(u=n.FareDetails.filter(function(n){return n.CabinType==="COACH"})[0],t.searchResults[i-1].hasSelectedFlight!==undefined&&t.searchResults[i-1].hasSelectedFlight&&delete t.searchResults[i-1].hasSelectedFlight,t.selectFlightWithPrice(n,r,u,!1))});document.body.dispatchEvent(new CustomEvent("UpgradeToMainCabin",{detail:{pageName:r,pageURL:o.dtmVals.pageURL}}));i()};t.acceptRestrictions=!1}],g=function(t){r(function(){t.selectClass=n.element(".select-class-wrapper");t.continueBarActive=!1;t.editingSegment=!1;t.openSegments=null},0);r(function(){t.contentScrollTop=n.element(".main-content").offset().top},1e3);t.selectNewDates=function(){t.$modalCancel();t.openFlightSearchEdit()};t.getJourneyData=function(){var i=[];return t.TripSummary&&t.TripSummary.JDDataList&&n.forEach(t.TripSummary.JDDataList,function(n){n&&i.push(n)}),i};t.updateJourneyData=function(i){var u,r;t.TripSummary.JDDataList===undefined&&(t.TripSummary.JDDataList=[]);u=t.TripSummary.Trips[i-1];u&&(r={},r.JDInd=!0,r.TId=u.TripSlice.TripID,r.S=u.UniqueReferenceKey,n.forEach(u.FareDetails,function(n){n.CabinType.toLowerCase()===u.selectedSeatClass.toLowerCase()&&(r.C=n.BookingClassDetails[0],r.Source=u.selectedSeatClass,r.HasUpgrade=u.hasUpgrade,r.isEC=u.selectedSeatClass.toLowerCase()==="extracomfort"?!0:!1,r.isPS=u.selectedSeatClass.toLowerCase()==="preferred"?!0:!1)}),t.TripSummary.JDDataList[i-1]=r)};t.resetJourneyData=function(n){t.TripSummary&&t.TripSummary.JDDataList&&t.TripSummary.JDDataList[n-1]&&(t.TripSummary.JDDataList[n-1]=null)};t.checkHasUpgrade=function(n,t){for(var i=0;i<n.FareDetails.length;i++)if(t.toLowerCase()===n.FareDetails[i].CabinType.toLowerCase()&&(n.FareDetails[i+1]&&n.FareDetails[i+1].BookingCount>0||n.FareDetails[i+2]&&n.FareDetails[i+2].BookingCount>0))return!0;return!1};t.isAnyUpgrade=function(){var i=!1;return n.forEach(t.TripSummary.Trips,function(n){n.hasUpgrade&&(i=!0)}),i};t.updateIsDiscountNotApplied=function(){if(t.selectedPromo){var i=!1;n.forEach(t.TripSummary.Trips,function(n){var t=n.FareDetails.filter(function(t){return t.CabinType.toLowerCase()===n.selectedSeatClass.toLowerCase()})[0];t&&!t.IsDiscount&&(i=!0)});n.forEach(t.TripSummary.Trips,function(n){n.isDiscountNotApplied=i})}};t.selectFlightWithPrice=function(i,u,f,s){var h,l;if(!u.hasSelectedFlight){if(u.hasSelectedFlight=!0,t.editingSegment=!1,n.forEach(t.searchResults[u.TripId-1].ActiveTab.TripAndFareDetails,function(t){t.isSelectedFlight=!1;n.forEach(t.FareDetails,function(n){n.isSelected=!1})}),i.isSelectedFlight=!0,f.isSelected=!0,t.mcbToMain&&i.TripSlice.TripID!==1&&i.needsUpdate!==!1&&(i.needsUpdate=i.FareDetails.filter(function(n){return n.CabinType==="MAINCABINBASIC"}).length>0),t.lastStepThruQueryID=u.TripId,window.scrollTo(0,0),t.TripSummary.Trips[u.TripId-1]={},i.selectedSeatClass=f.CabinType,i.selectedSeatClassInitial=f.CabinType,i.hasUpgrade=t.checkHasUpgrade(i,f.CabinType),$.extend(!0,t.TripSummary.Trips[u.TripId-1],i),t.updateJourneyData(u.TripId),t.selectedPromo&&!f.IsDiscount&&n.forEach(t.TripSummary.Trips,function(n){n.isDiscountNotApplied=!0}),typeof s!="undefined"&&!s&&t.searchResults[u.TripId]){t.currentSegmentId=u.TripId+1;return}t.model.loadingSegment=!0;r(function(){n.element(".ha-loading-spinner").focus()},0);h=t.getJourneyData();t.TripType===1&&t.isAnyUpgrade()&&t.priceTypeInfo.priceType===0&&!t.searchRequest.IsRefundable||t.TripType===2&&t.getJourneyData().length===1||t.TripType===2&&t.getJourneyData().length===2&&t.isAnyUpgrade()&&t.priceTypeInfo.priceType===0&&!t.searchRequest.IsRefundable||t.TripType===0&&t.getJourneyData().length<t.TripCount?e.SearchFlightsStepThrough(t.getJourneyData(),u.TripId,!1).success(function(n){var i;if(!t.handleExceptions(n,"haFlightResultsEndOnEndAPI-SearchFlightsStepThrough")){if(t.model.loadingSegment=!1,t.$state.current.name!=="segment.complete"&&t.socialProofDisplay(n.DepartureDate,n.OriginCityCode,n.DestinationCityCode),t.lieFlatAvailable=t.hasLieFlat(n),t.hasECPreferred(n),t.hasMCBOferred(n),t.updateFareDetails=!1,t.$emit("dtmPage",{pageName:o.dtmVals.pageName,pageURL:o.dtmVals.pageURL,lowestFare:n.AlternateTabs?n.AlternateTabs[3].DisplayAmount||"0":"0"}),n.IsSuccess&&n.TripId&&n.ActiveTab&&n.ActiveTab.TripAndFareDetails)t.crossCheckSearch(n,!0)&&(t.searchResults[n.TripId-1]=n,t.resetFlightResultsLimit(),t.Message=n.Message,t.currentSegmentId=n.TripId,t.updatePromo(n.Discounts),t.arrowUpdate(),c.go("segment.x",{id:h.length+1}));else if(n.IsSuccess&&n.AvailFareGridResponseList)t.UpsellGrid={},t.currentSegmentId=t.TripCount+1,c.go("segment.complete"),n.AvailFareGridResponseList.length>0&&n.UpSellGridDetails&&n.UpSellGridDetails.AvailableCabins.length>0?(t.lieFlatAvailable=t.hasLieFlatFareGrid(t.TripSummary.Trips),t.UpsellGrid.UpSellGridDetails=n.UpSellGridDetails,t.UpsellGrid.AvailFareGridResponseList=n.AvailFareGridResponseList,t.updateTripSummaryFareDetail(),i="",$.inArray("EXTRACOMFORT",n.UpSellGridDetails.AvailableCabins)>-1&&(i="EXTRACOMFORT"),$.inArray("PREFERRED",n.UpSellGridDetails.AvailableCabins)>-1&&(i="PREFERREDSEAT"),i&&document.body.dispatchEvent(new CustomEvent("UpgradeSeatOffered",{detail:{seatType:i,pageName:o.dtmVals.pageName,pageURL:o.dtmVals.pageURL}}))):t.generateTripSummaryFareDetail(f),w&&n.PassengerTripSummary&&(t.PassengerTripSummary=n.PassengerTripSummary),r(function(){!t.UpsellGrid.showUpsellGrid&&t.UpsellGrid.UpSellGridDetails&&t.UpsellGrid.UpSellGridDetails.UpSellGridTrips&&t.UpsellGrid.UpSellGridDetails.UpSellGridTrips.length>0&&(t.UpsellGrid.showUpsellGrid=!0);t.continueBarActive=!0;t.showReceipt=!0;t.isMainCabinBasicSelected=t.TripSummary.Trips.filter(function(n){return n.selectedSeatClass==="MAINCABINBASIC"}).length>0;t.TripSummary.FareDetails&&(!t.selectedPromo||b)&&(o.checkHoldBookingEligibility=!0)},0);else if(n.ErrorCodeHandle==="20027"){var u=n.ErrorCodeHandle+": "+n.ErrorMessage,e=u.replace(/(<([^>]+)>)/ig,"");window.location.href="/book/home?FltResNull="+e}else t.handleExceptions("jsError","haFlightResultsEndOnEndAPI-SearchFlightsStepThrough");o.isMobile&&t.getLowestFares(n)}}).error(function(n){t.handleExceptions(n,"haFlightResultsEndOnEndAPI-SearchFlightsStepThrough");t.model.loadingSegment=!1}):(t.currentSegmentId=t.TripCount+1,t.priceTypeInfo.priceType>0||t.selectedPromo&&t.selectedPromo.Type!==2&&!b||t.enableTCR||t.searchRequest.IsRefundable?r(function(){t.model.loadingSegment=!1;t.AddFlightsToTrip()},700):(l=n.element("#holdReservation").scope(),l.checkEligibility(!0,function(n){n?w?e.GetTripSummary(t.getJourneyData()).success(function(n){(t.model.loadingSegment=!1,t.handleExceptions(n,"haFlightResultsEndOnEndAPI-GetTripSummary"))||(n.AvailGridTrips?t.PassengerTripSummary=n:t.handleExceptions("jsError","haFlightResultsEndOnEndAPI-GetTripSummary"),t.continueBarActive=!0,t.showReceipt=!0)}).error(function(n){t.handleExceptions(n,"haFlightResultsEndOnEndAPI-GetTripSummary")}):(t.model.loadingSegment=!1,t.generateTripSummaryFareDetail(f),t.continueBarActive=!0,t.showReceipt=!0):r(function(){t.model.loadingSegment=!1;t.AddFlightsToTrip()},700)})))}};t.generateTripSummaryFareDetail=function(i){t.TripSummary.FareDetails={};t.TripSummary.FareDetails.Source="";t.TripSummary.FareDetails.AvailGridTrips={};t.TripSummary.FareDetails.AvailGridTrips.AvailGridTripList=[];n.forEach(t.TripSummary.Trips,function(i,r){r>0&&(t.TripSummary.FareDetails.Source+="+");t.TripSummary.FareDetails.Source+=i.selectedSeatClass.toUpperCase();t.TripSummary.FareDetails.AvailGridTrips.AvailGridTripList.push({Segments:[]});n.forEach(i.TripSlice.Segments,function(u,f){t.TripSummary.FareDetails.AvailGridTrips.AvailGridTripList[r].Segments.push({FlightNumber:u.FlightNumber,DepartureDateTime:u.DepartureDateTime,ArrivalDateTime:u.ArrivalDateTime,Duration:u.Duration,DayDifference:u.DayDifference,OriginCityName:u.OriginCityName,DestinationCityName:u.DestinationCityName,MarketingAirline:u.MarketingAirline,OperatingAirline:u.OperatingAirline,ISOverNightStayRequired:u.IsOverNightStay,LayOverTime:u.LayOverTime,ExtraComfortFee:u.ExtraComfortFee,StopInformation:u.StopInformation,AvailGridClassOfService:{}});n.forEach(i.FareDetails,function(n){i.selectedSeatClass.toLowerCase()===n.CabinType.toLowerCase()&&(t.TripSummary.FareDetails.AvailGridTrips.AvailGridTripList[r].Segments[f].AvailGridClassOfService.PricedCabin=n.BookingClassDetails[0].ClassOfServices[f].PricedClass,t.TripSummary.FareDetails.AvailGridTrips.AvailGridTripList[r].Segments[f].AvailGridClassOfService.BookingClass=n.BookingClassDetails[0].ClassOfServices[f].BookingClass)})})});t.TripSummary.FareDetails.AvailGridTrips.AvailGridFareDetail={};t.TripSummary.FareDetails.AvailGridTrips.AvailGridFareDetail.DisplayAmount=i.DisplayAmount;t.TripSummary.FareDetails.AvailGridTrips.AvailGridFareDetail.AvailGridFareTypes=[];n.forEach(i.FareTypes,function(n){t.TripSummary.FareDetails.AvailGridTrips.AvailGridFareDetail.AvailGridFareTypes.push({Type:n.Type,TotalAmount:n.TotalAmount,TotalBaseFare:n.TotalBaseFare,BaseFareAmountWithOutDiscount:n.BaseFareWithOutDiscount,FuelSurcharge:n.FuelSurcharge,TotalTax:n.TotalTax,PaxType:n.PaxType,AvailGridTaxes:n.Taxes,IsCompanion:n.IsCompanion})});t.$broadcast("calcTaxes")};t.updateTripSummaryFareDetail=function(){var i="";n.forEach(t.TripSummary.Trips,function(n,t){t>0&&(i+="+");i+=n.selectedSeatClass.toUpperCase()});n.forEach(t.UpsellGrid.AvailFareGridResponseList,function(n){n.Source===i&&(t.TripSummary.FareDetails=n)});t.$broadcast("calcTaxes")};t.updatePassengerTripSummaryFareDetail=function(){var u="",r,i;n.forEach(t.TripSummary.Trips,function(n,t){t>0&&(u+="+");u+=n.selectedSeatClass.toUpperCase()});n.forEach(t.UpsellGrid.AvailFareGridResponseList,function(n){n.Source===u&&(r=n)});r&&(i=n.copy(t.PassengerTripSummary),i.AvailGridTrips=r.AvailGridTrips.AvailGridTripList,i.FareDetails=[],n.forEach(r.AvailGridTrips.AvailGridFareDetail.AvailGridFareTypes,function(t){var u=0,e,f;switch(t.Type){case"WEB":u=0;break;case"WBC":u=1;break;case"INF":u=2}e=r.AvailGridTrips.AvailGridFareDetail.IsDiscount;f={FareType:u,IsCompanion:t.IsCompanion,HasDiscount:e,DiscountedAmount:t.DiscountAmount,TotalAmount:t.TotalAmount,BaseFareAmount:t.TotalBaseFare,BaseFareAmountWithOutDiscount:t.BaseFareWithOutDiscount,FuelSurcharge:t.FuelSurcharge,BaseFareMiles:0,TaxAmount:t.TotalTax,Taxes:[]};n.forEach(t.AvailGridTaxes,function(t){var i=!1;n.forEach(f.Taxes,function(n){n.Code===t.TaxCode&&(i=!0,n.Amount+=t.TaxAmount)});i||f.Taxes.push({Code:t.TaxCode,Description:t.Description,Amount:t.TaxAmount})});i.FareDetails.push(f)}),n.forEach(i.Passengers,function(t){t.Seats=[];n.forEach(i.AvailGridTrips,function(i){n.forEach(i.Segments,function(n){var r=0,u=0;n.AvailGridClassOfService.PricedCabin.toUpperCase()==="EXTRACOMFORT"&&(r=1,u=n.ExtraComfortFee);n.AvailGridClassOfService.PricedCabin.toUpperCase()==="PREFERRED"&&(r=2,u=n.PreferredSeatFee);t.Seats.push({Type:r,SeatLocation:null,SegmentID:n.SegmentID,SeatAmount:u,TripID:i.TripID})})})}),t.PassengerTripSummary=i)};t.totalPricePerPaxDisplay=function(){return w?parseFloat(t.PassengerTripSummary.FareDetails[0].TotalAmount):parseFloat(t.TripSummary.FareDetails.AvailGridTrips.AvailGridFareDetail.DisplayAmount)};t.totalPricePerAdultDisplay=function(){var i=0;return n.forEach(t.PassengerTripSummary.Passengers,function(n){n.PaxType==0&&n.TotalAmount>0&&n.fare&&(i=n.fare.TotalAmount)}),parseFloat(i)};t.totalPricePerChildDisplay=function(){var i=0;return n.forEach(t.PassengerTripSummary.Passengers,function(n){n.PaxType==1&&n.fare&&(i=n.fare.TotalAmount)}),parseFloat(i)};t.backToFlightResultsPage=function(){window.location.reload()};t.editSegment=function(i,u){if(t.model.loadingSegment)return!1;t.model.loadingSegment=!0;o.checkHoldBookingEligibility=!1;t.showReceipt=!1;t.selectClass.removeClass("active");t.continueBarActive=!1;t.currentSegmentId=i.TripSlice.TripID;n.forEach(t.searchResults,function(n){n.TripId>=i.TripSlice.TripID&&(n.hasSelectedFlight=!1,t.resetJourneyData(n.TripId))});t.mcbToMain&&(i.needsUpdate===undefined||i.needsUpdate)&&i.TripSlice.TripID>1&&(r(function(){n.element(".ha-loading-spinner").focus()},0),t.lastStepThruQueryID=i.TripSlice.TripID,e.SearchFlightsStepThrough(t.getJourneyData(),i.TripSlice.TripID,!0).success(function(n){if(!t.handleExceptions(n,"haFlightResultsEndOnEndAPI-SearchFlightsStepThrough")){t.model.loadingSegment=!1;$.extend(t.searchResults[n.TripId-1],n);var r=t.searchResults[n.TripId-1].ActiveTab.TripAndFareDetails.filter(function(n){return n.UniqueReferenceKey===i.UniqueReferenceKey})[0];r.isSelectedFlight=!0;r.needsUpdate=!1;r.mcbToMain=!0;r.FareDetails.filter(function(n){return n.CabinType==="COACH"})[0].isSelected=!0;r.selectedSeatClass=r.FareDetails.filter(function(n){return n.CabinType==="COACH"})[0].CabinType;t.Message=n.Message;o.isMobile&&t.getLowestFares(t.searchResults[n.TripId-1])}}).error(function(){t.model.loadingSegment=!1}));u?(t.model.loadingSegment=!0,t.lastStepThruQueryID=i.TripSlice.TripID,e.SearchFlightsStepThrough(t.getJourneyData(),i.TripSlice.TripID,!0).success(function(n){if(!t.handleExceptions(n,"haFlightResultsEndOnEndAPI-SearchFlightsStepThrough")){t.model.loadingSegment=!1;t.searchResults=t.searchResults.slice(0,n.TripId);$.extend(t.searchResults[n.TripId-1],n);t.openSegments=t.searchResults[i.TripSlice.TripID-1];t.Message=n.Message;for(var r=0;r<n.TripId;r++)t.TripSummary.Trips[r].selectedSeatClassInitial=t.TripSummary.Trips[r].selectedSeatClass}}).error(function(){t.model.loadingSegment=!1})):(t.openSegments=t.searchResults[i.TripSlice.TripID-1],window.scrollTo(0,0),(t.mcbToMain===undefined||t.mcbToMain&&i.needsUpdate===!1||t.mcbToMain&&i.needsUpdate===undefined&&i.TripSlice.TripID===1)&&r(function(){t.model.loadingSegment=!1},0))};t.openSearchModal=function(n){t.CurrentFlightScope=t.CurrentFlightScope&&t.CurrentFlightScope!=="OFF"?"OFF":"ON";t.$seatViewModal.toggleClass("is-open");t.$seatViewModal.css({"margin-top":function(){return window.pageYOffset-$(this).height()/2}});t.CurrentFlightScope==="ON"&&t.$broadcast("$UpdateSegments",n)};u("cabinDict",function(i){t.cabinDict=[];n.forEach(i,function(n){n.Key!==undefined&&n.Value!==undefined&&(t.cabinDict[n.Key.toUpperCase()]=n.Value)})});t.getCabinDisplayName=function(n){return n=n.toUpperCase(),t.searchRequest.IsRefundable&&(n="REFUNDABLE"+n),n in t.cabinDict?t.cabinDict[n]:n};t.getFormattedDayDifference=function(i){t.dateDifferenceDict===undefined&&u("dateDifferenceDict",function(i){t.dateDifferenceDict=[];n.forEach(i,function(n,i){t.dateDifferenceDict[i]=n})});var r="",f="";if(f=i,i<0){if(f!==""&&f in t.dateDifferenceDict)return r=i,t.dateDifferenceDict[r];r="-"+i}else if(i>0){if(f!==""&&f in t.dateDifferenceDict)return r=i,t.dateDifferenceDict[r];r="+"+i}return r!==""&&r in t.dateDifferenceDict?t.dateDifferenceDict[r]:i};t.getCodeShareAirlineName=function(i){return(t.codeShareAirlineDict===undefined&&u("codeShareAirlineDict",function(i){t.codeShareAirlineDict=[];n.forEach(i,function(n,i){t.codeShareAirlineDict[i]=n})}),i in t.codeShareAirlineDict)?t.codeShareAirlineDict[i]:i};t.getFormattedFullDate=function(n,t){var i=n.split(/[^0-9]/),r=new Date(i[0],i[1]-1,i[2],i[3],i[4],i[5]);return t==="en"?s("date")(r,"fullDate"):s("date")(r,"longDate")+" "+s("date")(r,"EEEE")};t.getFormattedTime=function(n,t){var i=n.split(/[^0-9]/),r=new Date(i[0],i[1]-1,i[2],i[3],i[4],i[5]),u;return t?s("date")(r,"HH:mm"):(u="",u=s("date")(r,"H")<12?"am":"pm",s("date")(r,"h:mm")+u)};t.onTimePerformanceRecords=new Map;t.clickDetails=function(n){var i,r;t.PlanesMarketingData.length==0?e.fetchPlaneMarketingData().success(function(i){t.PlanesMarketingData=i;n.TripSlice.Segments.forEach(function(n){var i=t.getAircraftMarketingInfo(n.EquipmentType);n.MarketingInfo=i?{Icon:i.Icon,Message:i.Message}:{Icon:"",Message:""}})}).error(function(){t.handleExceptions("jsError","haFlightResultsEndOnEndAPI-PlaneMarketingData")}):n.TripSlice.Segments.forEach(function(n){if(n.MarketingInfo==null){var i=t.getAircraftMarketingInfo(n.EquipmentType);n.MarketingInfo=i?{Icon:i.Icon,Message:i.Message}:{Icon:"",Message:""}}});o.isMobile?haModal(f.getTemplateUrl("book/flightresults/ha-flightresults-flightdetails-modal.html"),{id:"flightDetailsModal",backdrop:!0,scope:t,extendScope:{result:n}}):n.detailsVisible&&(i=[],n.TripSlice.Segments.forEach(function(n){if(n.OnTimeDetail==null){var r=t.onTimePerformanceRecords.get(n.FlightNumber);r==null?i.push(n.FlightNumber):n.OnTimeDetail=r}}),i.length>=1&&(r=e.fetchOnTimePerformanceDetails(i.join(",")).success(function(r){if(r.ErrorMessage!=null&&r.ErrorMessage.length>1){n.TripSlice.Segments.forEach(function(n){i.indexOf(n.FlightNumber)!=-1&&(n.OnTimeDetail={DelayedPercentage:"Error Delayed ",OnTimePercentage:"Error On Time "})});return}r.forEach(function(n){(n.OnTimeDetails.DelayedPercentage==null||n.OnTimeDetails.DelayedPercentage=="")&&(n.OnTimeDetails.DelayedPercentage=".");(n.OnTimeDetails.OnTimePercentage==null||n.OnTimeDetails.OnTimePercentage=="")&&(n.OnTimeDetails.OnTimePercentage=".");t.onTimePerformanceRecords.set(n.FlightNumber,n.OnTimeDetails)});n.TripSlice.Segments.forEach(function(n){if(i.indexOf(n.FlightNumber)!=-1){var r=t.onTimePerformanceRecords.get(n.FlightNumber);n.OnTimeDetail=r!=null?r:{DelayedPercentage:".",OnTimePercentage:"."}}})}).error(function(){n.TripSlice.Segments.forEach(function(n){i.indexOf(n.FlightNumber)!=-1&&(n.OnTimeDetail={DelayedPercentage:"Error Delayed ",OnTimePercentage:"Error On Time "})})})))};t.togglePrices=function(n){n.pricesVisible=!n.pricesVisible};t.compareExperiencesModal=function(){l.get("compareexperience").then(function(n){t.serviceTypeByBrand=n.servicestype[0].subservicetype[0].servicetypebybrand.map(function(n){return{brandType:n.brandtype[0]}});t.servicesType=n.servicestype;haModal(f.getTemplateUrl("book/flightresults/ha-compare-experience-modal.html"),{id:"compareExperienceModal",backdrop:!0,scope:t})})};t.showUpgradeWarningModal=function(n,i,r){var u=n.resultItem[t.currentSegmentId],e=n.resultItem[t.currentSegmentId-1];n.upgradeAmount=u.FareDetails.filter(function(n){return n.CabinType==="COACH"})[0].DisplayAmount-e.FareDetails.filter(function(n){return n.CabinType==="MAINCABINBASIC"})[0].DisplayAmount;n.upgradeAmount=Math.ceil(n.upgradeAmount);n.upgradeAmount=n.upgradeAmount===0||n.upgradeAmount===-0?"0":n.upgradeAmount;haModal(f.getTemplateUrl("book/flightresults/ha-upgrade-warning-modal.html"),{id:"mcbUpgradeWarning",backdrop:!0,scope:n,extendScope:{selectedResult:i,selectedClass:r},size:"modal-md"})};t.showRestrictionsModal=function(n){var i=n.resultItem[t.currentSegmentId],r="mcbFlightResultsModal",u=window.digitalData.page.pageInfo.name+":"+r;n.amount=i.FareDetails.filter(function(n){return n.CabinType==="COACH"})[0].DisplayAmount-i.FareDetails.filter(function(n){return n.CabinType==="MAINCABINBASIC"})[0].DisplayAmount;n.amount=Math.ceil(n.amount);n.MCAmount=i.FareDetails.filter(function(n){return n.CabinType==="COACH"})[0].DisplayAmount;n.MCBAmount=i.FareDetails.filter(function(n){return n.CabinType==="MAINCABINBASIC"})[0].DisplayAmount;n.currentSegmentItem=i;n.acceptRestrictionsCallback=function(){n.setAcceptRestrictions(!0);n.setResultItem(n.currentSegmentItem,n.currentSegmentId);c.go(n.currentSegmentId<n.TripCount?"segment.x":"segment.complete",{id:n.currentSegmentId+1,selectedResult:0,selectedClass:0})};n.rejectRestrictionsCallback=function(){n.setResultItem(n.currentSegmentItem,n.currentSegmentId);document.body.dispatchEvent(new CustomEvent("UpgradeToMainCabin",{detail:{pageName:u,pageURL:o.dtmVals.pageURL}}));c.go(n.currentSegmentId<n.TripCount?"segment.x":"segment.complete",{id:n.currentSegmentId+1,selectedResult:1,selectedClass:1})};haModal(f.getTemplateUrl("book/flightresults/ha-mcb-accept-restrictions-modal.html"),{id:r,backdrop:!0,scope:n,size:"custom-modal-width"})};t.setAcceptRestrictions=function(n){t.acceptRestrictions=n};t.mcbRestrictionModal=function(){l.get("MCBRestrictionModal").then(function(n){t.restrictions=n.restrictions;t.heading=n.heading;t.topcontent=n.topcontent;t.disclaimers=n.disclaimers;t.subheading=n.subheading;haModal(f.getTemplateUrl("book/flightresults/ha-mcb-restrictions-modal.html"),{id:"mcbRestrictionModal",backdrop:!0,scope:t})})};t.toggleChildFareTooltip=function(i){t.selectedChildFare==""||t.selectedChildFare!=i.$$hashKey?(t.selectedChildFare=i.$$hashKey,n.forEach(i.FareTypes,function(n){var i,r;n.Type=="WBC"&&(i="",t.TripType==1?i=l("FareSearch.onewaytext"):t.TripType==2&&(i=l("FareSearch.roundtriptext")),r=s("localCurrency")(n.TotalAmount,t.currency),t.childFarePriceText=l("FareSearch.childfarepopuptext",[r,i]))})):t.selectedChildFare=""};t.closeChildFareOverlay=function(){t.selectedChildFare=""};t.isClassModified=function(){for(var n=0;n<t.TripSummary.Trips.length;n++)if(t.TripSummary.Trips[n].selectedSeatClass!==t.TripSummary.Trips[n].selectedSeatClassInitial)return!0};t.selectSeatClass=function(n,i){t.TripSummary.Trips[i].selectedSeatClass=t.TripSummary.Trips[i].selectedSeatClass.toLowerCase()===n.toLowerCase()?t.TripSummary.Trips[i].selectedSeatClassInitial:n;w?t.updatePassengerTripSummaryFareDetail():t.updateTripSummaryFareDetail();t.updateIsDiscountNotApplied();t.updateJourneyData(i+1);t.TripSummary.FareDetails&&(!t.selectedPromo||b)&&(o.checkHoldBookingEligibility=!0)}};return{restrict:"A",scope:!0,link:g,controller:d}}])}(angular),function(n){"use strict";var t=n.module("exploreMapModule",[]);t.directive("exploreMap",["haConfig",function(n){var i=function(){},t;return i.$inject=["$scope"],t=function(n){n.$emit("$exploreMapReady")},t.$inject=["$scope"],{restrict:"A",templateUrl:n.getTemplateUrl("explore-map-base-template"),scope:!0,link:t,controller:i}}])}(angular),function(n){"use strict";var t=n.module("exploreHeroModule",[]);t.directive("exploreHero",["haConfig",function(n){var t=function(n){n.$emit("$methodsBound")},i;return t.$inject=["$scope"],i=function(n,t,i){n.PhotoGallery=[];n.widgetTitle=i.widgettitle;n.widgetDescription=i.widgetdescription;n.widgetLinkLabel=i.widgetlinklabel},{restrict:"A",scope:!0,link:i,templateUrl:n.getTemplateUrl("explore-hero-base-template.html"),controller:t}}])}(angular),function(n){"use strict";n.module("haGlobalHeaderModule",["haGlobalHeaderAPI"]).directive("haGlobalHeader",["$timeout","haModal","$http","$rootScope",function(t,i,r,u){return{restrict:"A",scope:!0,link:function(f,e){function o(n){f.accountMenuIsOpen=n}function s(n){f.myTripsMenuIsOpen=n}function h(n,i){if(n){l.css({bottom:0,visibility:"visible"});$(".navtray-content-inner.active").removeClass("active");var r=$(".navtray-content-inner--"+i);$(".nav-overflow").css("max-height",v);f.primaryNavtrayIsOpen=!0;f.currentSection=i;t(function(){r.addClass("active");$(".nav-pane").css("opacity","1")},120)}else l.css({bottom:0,transition:"bottom .2s ease-in"}),f.primaryNavtrayIsOpen=!1,f.currentSection=null,$(".nav-overflow").css("max-height","0"),$(".nav-pane").css("opacity","0"),t(function(){l.css({visibility:"hidden"})},200)}function c(n){f.regionSelectMenuIsOpen=n;n||$(".region.link").focus()}function a(n){n?($("#searchModalTemplate .search-textarea").removeAttr("id"),i({id:"SearchModel",backdrop:!1,scope:f,size:"modal-size",template:$("#searchModalTemplate"),cancel:{fn:function(){f.searchModalIsOpen=!1}}}),$("#searchModalTemplate .search-textarea").attr("id","help-search"),$("#searchModalTemplate").attr("role","dialog")):(f.$modalCancel(),$(".nav-utility-li--search > a").focus());f.searchModalIsOpen=n}function y(n){var i=$(".nav-pane."+f.currentSection),r=$(".nav-pane."+n);i.css("opacity","1");f.currentSection=n;t(function(){r.css("opacity","1")},90)}var l=e.find("[ha-primary-nav-tray]"),v="185px";if(f.search=function(){f.searchText?($(".search-submit-btn").removeClass("disabled"),$(".search-submit-btn > .sr-only").css("display","none")):($(".search-submit-btn").addClass("disabled"),$(".search-submit-btn > .sr-only").css("display","block"))},f.skipToContent=function(){$('[role="main"] :tabbable:first').focus()},f.submitSearch=function(){if(!f.searchText)return!1;r({url:"/search-results",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:$.param({searchText:f.searchText})}).then(function(){window.location.href="/search-results"})},f.toggleAccountMenu=function(){f.accountMenuIsOpen?o(!1):o(!0)},f.toggleMyTripsMenu=function(){f.myTripsMenuIsOpen?s(!1):s(!0)},f.toggleNavigation=function(i){f.primaryNavtrayIsOpen?f.currentSection===i?h(!1):y(i):h(!0,i);i==="book"&&(u.user.isExpertBookingOptIn||t(function(){n.element("[ha-global-header]").find('a[href^="/Book/ExpertBooking"]').addClass("ng-hide")},0))},f.toggleRegion=function(){f.regionSelectMenuIsOpen?c(!1):c(!0)},f.toggleSearch=function(){f.searchModalIsOpen?a(!1):a(!0)},f.$root.isMobile)f.$watch("mobileMenus",function(n){n.menuOpen||n.myAcctOpen?$('.ha-global-footer, section[role="main"]').hide():$('.ha-global-footer, section[role="main"]').show()},!0);else{$("html").on("click",function(n){var i=$.grep($(n.target).parents(),function(n){return $(n).hasClass("nav-overflow")}).length>0;!f.primaryNavtrayIsOpen||i||$(n.target).hasClass("ha-nav")||t(function(){h(!1)});f.regionSelectMenuIsOpen&&!$(n.target).closest(".parent").hasClass("region")&&t(function(){c(!1)});f.myTripsMenuIsOpen&&!$(n.target).closest(".parent").hasClass("my-trips")&&t(function(){s(!1)});f.accountMenuIsOpen&&!$(n.target).closest(".parent").hasClass("my-account")&&t(function(){o(!1)})});$("body").delegate("a:not(.my-account)","focus",function(){f.accountMenuIsOpen&&t(function(){o(!1)})}).delegate("a:not(.ha-nav.nav-li-inner, .nav-pane a)","focus",function(){f.primaryNavtrayIsOpen&&t(function(){h(!1)})}).delegate("a:not(.my-trips)","focus",function(){f.myTripsMenuIsOpen&&t(function(){s(!1)})}).delegate("a:not(.region)","focus",function(){f.regionSelectMenuIsOpen&&t(function(){c(!1)})});$("body").on("keyup",function(n){if(n.keyCode===27&&(n.preventDefault(),f.regionSelectMenuIsOpen&&t(function(){c(!1)}),f.myTripsMenuIsOpen&&t(function(){$("a.my-trips").first().focus();s(!1)}),f.accountMenuIsOpen&&t(function(){$("a.my-account").first().focus();o(!1)}),f.primaryNavtrayIsOpen)){var i=$(document.activeElement).parent().attr("class").split(" ")[1];["book","manage","airline","island"].indexOf(i)>-1&&$(".ha-nav."+i).focus();t(function(){h(!1)})}});$("#skipToContent").focus(function(){$(this).removeClass("sr-only")}).blur(function(){$(this).addClass("sr-only")});$(".nav-pane").removeClass("init")}},controller:["$scope","$rootScope","haUser","haFavorites","haGlobals","haGlobalHeaderAPI",function(n,t,i,r,u,f){t.user&&$.extend(t.user,{accountType:sessionStorage.getItem("accType"),haMiles:sessionStorage.getItem("haMiles")});n.mobileMenus={myAcctOpen:!1,menuOpen:!1};t.corpAccTypes=["C","R","W","A"];t.individualAccTypes=["B","D","E","H","I","O","P","S","T","V","Z"];n.logout=function(){i.logout();sessionStorage.clear()};var o,s,h,e;i.updateUser();r.updateFavorites();u("enableUSSite",function(n){o=n==="True"});u("enableAUSite",function(n){s=n==="True"});u("enableNZSite",function(n){h=n==="True"});u("sitecoreContextId",function(n){e=n});u(["isLoggedIn","acctType","acctNo","isExpertBookingOptIn","haMilesEliteStatus"],function(n,i,r,u,f){t.isLoggedIn=n;t.user&&$.extend(t.user,{accountType:i,haMiles:r,isExpertBookingOptIn:u,haMilesEliteStatus:f})});n.navSelectCountry=function(n){f.selectCountry(n,e).success(function(n){n!==null&&n!==""&&(window.location.href=n.RedirectUrl)},function(n){window.alert(n)})}}]}}])}(angular),function(n){"use strict";var t=n.module("haShareMilesModule",["haHttpService"]);t.directive("haShareMiles",["haGlobals","haHttpService",function(t,i){return{restrict:"A",scope:!0,controller:["$scope","haModal",function(r,u){r.ShareMiles={AccountNumber:"",LastName:"",MilesToShare:"",CurrentMilesBalance:0,HasSharedTravelers:!0};r.Error="";r.FilteredTravelersList=[];t("shareMilesReceipientJson",function(n){r.ShareMiles.AccountNumber=n.AccountNumber;r.ShareMiles.LastName=n.LastName;r.ShareMiles.CurrentMilesBalance=n.CurrentMilesBalance;n.MilesToShare>0&&(r.ShareMiles.MilesToShare=n.MilesToShare);r.ShareMiles.HasSharedTravelers=n.HasSharedTravelers});r.getHelpContent=function(){u("",{id:"share-miles-help",backdrop:"true",template:n.element(".getHelpContent")})};t("errorMessage",function(n){n!==""&&(r.Error=n)});r.ShareMiles.HasSharedTravelers&&i.GET("/myaccount/travelerslist/gettravelerlist").then(function(n){n.data.TravelersList&&(r.FilteredTravelersList=n.data.TravelersList)},function(n){console.log(n);r.ShareMiles.HasSharedTravelers=!1});r.travelerChosen=function(n){r.$modalCancel();r.ShareMiles.LastName=n.LastName;r.ShareMiles.AccountNumber=n.HMAccountNo||""};r.openSharedTravelers=function(){u({id:"sharedTravelersModal",backdrop:"true",scope:r,template:n.element("#sharedTravelers")})}}]}}]);t.directive("milesLimit",["haGlobals",function(n){return{require:"ngModel",link:function(t,i,r,u){var f=null;n("shareMilesReceipientJson",function(n){f=parseInt(n.CurrentMilesBalance)});u.$parsers.push(function(n){try{if(n==null)return"";var t=parseInt(n);t===0?u.$setValidity("InvalidMiles",!1):(t>f?u.$setValidity("MilesExceeded",!1):u.$setValidity("MilesExceeded",!0),u.$setValidity("InvalidMiles",!0))}catch(i){u.$setValidity("InvalidMiles",!0);u.$setValidity("MilesExceeded",!0)}return n})}}}]);t.directive("haShareMilesPayment",["haGlobals",function(t){var i=function(i,r,u,f){i.submitting=!1;t("transferMilesRecipientJson",function(n){n!=null&&(i.IsHACardHolder=n)});i.getHelpContent=function(){u("",{id:"share-miles-help",backdrop:"true",template:n.element(".getHelpContent")})};i.showPrivacyPolicy=function(){u("",{id:"privacy-policy",backdrop:"true",template:n.element(".showPrivacyPolicy")})};i.showTerms=function(){u("",{id:"terms-and-conditions",backdrop:"true",template:n.element(".showTerms")})};i.onSubmitForm=function(){return userdata.load_data("user_data"),i.submitting=!0,!0};i.haPaymentTypes={paymentMethod:"creditDebit"};i.CDESubmit=function(){r.$broadcast("CDESubmit")};i.$on("CDEPaymentSubmitted",function(){i.submitting=!0});i.$on("CDEPaymentSubmitError",function(){i.submitting=!1;f(function(){$("html, body").animate({scrollTop:$("#formIFrame").offset().top-50},"fast")},100)})},r;return i.$inject=["$scope","$rootScope","haModal","$timeout"],r=function(){},{restrict:"A",scope:!0,link:r,controller:i}}]);t.directive("haShareMilesConfirmation",function(){var t=function(t,i,r){t.CurrentMilesBalance=confirmationVM.CurrentMilesBalance;var u="Balance: "+r("number")(t.CurrentMilesBalance);n.element("#account-nav-list li:first-child").find("span.popover-link-secondary").text(u);t.showFAQ=function(){i("",{id:"share-miles-faq",backdrop:"true",template:n.element(".showFAQ")})};t.getHelpContent=function(){i("",{id:"share-miles-help",backdrop:"true",template:n.element(".getHelpContent")})};t.showTerms=function(){i("",{id:"terms-and-conditions",backdrop:"true",template:n.element(".showTerms")})};t.$on("haFormValidationSuccess",function(){return!1})};return t.$inject=["$scope","haModal","$filter"],{restrict:"A",scope:!0,controller:t}});t.filter("localPurchaseMilesCurrency",["$compile",function(){var t={USD:'<span class="currency-symbol">$<\/span>{{ amount }}',AUD:'<span class="currency-symbol">$<\/span>{{ amount }} <span class="currency-type">AUD<\/span>',NZD:'<span class="currency-symbol">$<\/span>{{ amount }} <span class="currency-type">NZD<\/span>',CNY:'<span class="currency-symbol">¥<\/span>{{ amount }}',KRW:'<span class="currency-symbol">₩<\/span>{{ amount }}',JPY:'<span class="currency-symbol">¥<\/span>{{ amount }}',TWD:'<span class="currency-type">NT<\/span><span class="currency-symbol">$<\/span>{{ amount }}',MILES:'{{ amount }} <span class="currency-type">mi<\/span>'},i=function(n){var t=n.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")},r=function(t,i){return t>-1?i+" "+n.element("#MoreText").val():i.replace(/-([1-9]+)/g,function(n,t){return t})+" "+n.element("#LessText").val()};return function(n,u,f,e,o){var h,s=0,c;return(u==="CNY"||u==="KRW"||u==="JPY"||u==="TWD")&&(o=!1,f=!0),h=o?n:f?Math.round(n):(Math.round(n*100)/100).toFixed(2),h&&(s=i(h)),u==="MILES"&&(s=s.split(".")[0]),t[u]?(c=t[u].replace(/\{\{.*\}\}/,s),e?r(n,c):c):void 0}}])}(angular),function(n){"use strict";var t=n.module("haCmsBodyCopyWithSidebarModule",[]);t.directive("haCmsBodyCopyWithSidebar",function(){var n=function(n){n.$emit("$haCmsBodyCopyWithSidebarReady")},t;return n.$inject=["$scope"],t=function(n,t){$("html").hasClass("lte-ie8")&&t.find(":last-child").addClass("last-child")},{restrict:"A",scope:!0,link:t,controller:n}})}(angular),function(n){"use strict";var t;try{t=n.module("haHotelPackagesModule")}catch(i){t=n.module("haHotelPackagesModule",["haUtilsModule","haGlobalsModule","haFeatureFlagsModule","haCurrencyModule","haAncillariesModule","haModalService","haEqualHeightModule","haPassengersService","haRoundingFiltersModule","haSitecoreModule"])}t.directive("haHotelAddOn",["haConfig",function(n){return{restrict:"A",scope:!0,transclude:!0,templateUrl:n.getTemplateUrl("ha-hotels-add-on-template.html"),controller:"haHotelAddOnCtrl as ctrl"}}]);t.controller("haHotelAddOnCtrl",["$log","$scope","$rootScope","$location","$window","haUtils","haGlobals","haFeatureFlags","haHotelCommonService",function(n,t,i,r,u,f,e,o,s){e("HA",function(n){angular.extend(t,n.messages);t.morePerNightTxt=t.morePerNightTxt||"morePerNightTxt"});var h={isEligible:!1,hasPackages:!1,airportCode:"",hotels:[],packages:[],nights:null,limitedAvailabilityLevel:o.get("HotelLimitedAvailabilityLevel",10),savingsThreshold:o.get("HotelShowSavingsThreshold",20),hotelId:function(){return r.search().hotelId},showDetail:function(n){u.location.href=this.detailUrl(n)},detailUrl:function(n){return h.listUrl()+"#?hotelId="+n.id},listUrl:function(){return"/Book/Itinerary/GetVacationPackageList"},promoHasTerms:function(n){return n.promoCode==="VA"&&(n.customerFulfillmentRequirement||n.termsAndConditions)},UpdateHotelMark:function(){if(window.performance.clearMarks("mark_end_Hotel"),window.performance.mark("mark_end_Hotel"),window.performance.getEntriesByName("mark_end_Hotel")&&window.performance.getEntriesByName("mark_end_Hotel")[0]){var n=window.performance.getEntriesByName("mark_end_Hotel")[0].startTime;window.BOOMR&&BOOMR.version&&(window.BOOMR.sendTimer("Hotel_Itin_Time",n),window.BOOMR.sendMetric("UI_Search_Load",1))}}},c=function(n){n!=null&&(h.isEligible=n.IsOrbitzPkgEligible,n.OrbitzPackage!=null&&(h.hasPackages=n.OrbitzPackage.HasRetrievedOrbitzPackage,h.airportCode=n.OrbitzPackage.DestinationAirport,h.hotels=s.mapOrbitzPackages(n.OrbitzPackage)),h.loading=!1)};return t.$watch("ancillariesData",c),t._init=c,h}])}(angular),function(n){"use strict";function t(n,t){i[n]&&(i[n].textContent=t)}var i,r=n.module("haPerformanceStatsModule",[]);r.directive("haPerformanceStats",["$log","$window","$document","$rootScope","haConfig",function(n,r,u,f,e){var s=r.performance,c=s!=null?s.now():0,o=r.perfStats,h;return o.timeToAngular=c-o.headStart,h=function(){var t,n,i=f,r=0,u=0;n=i;do if(r+=1,n.$$watchers&&(u+=n.$$watchers.length),!(t=n.$$childHead||n!==i&&n.$$nextSibling))while(n!==i&&!(t=n.$$nextSibling))n=n.$parent;while(n=t);return[r,u]},{restrict:"A",replace:!0,templateUrl:e.getTemplateUrl("ha-performance-stats.html"),link:function(){if(i={"#scopes":u[0].querySelector("#scopes"),"#watchers":u[0].querySelector("#watchers"),"#dirty-checks":u[0].querySelector("#dirty-checks"),"#digest-cycles":u[0].querySelector("#digest-cycles"),"#digest-ms":u[0].querySelector("#digest-ms"),"#digest-fps":u[0].querySelector("#digest-fps"),"#avg-digest-ms":u[0].querySelector("#avg-digest-ms"),"#avg-digest-fps":u[0].querySelector("#avg-digest-fps"),"#max-digest-ms":u[0].querySelector("#max-digest-ms"),"#max-digest-fps":u[0].querySelector("#max-digest-fps"),"#head-load":u[0].querySelector("#head-load"),"#body-load":u[0].querySelector("#body-load"),"#footer-load":u[0].querySelector("#footer-load"),"#vendor-load":u[0].querySelector("#vendor-load"),"#app-load":u[0].querySelector("#app-load"),"#metrics-load":u[0].querySelector("#metrics-load"),"#time-to-eop":u[0].querySelector("#time-to-eop"),"#time-to-ng":u[0].querySelector("#time-to-ng")},t("#head-load",o.headLoad.toFixed(1)),t("#body-load",o.bodyLoad.toFixed(1)),t("#footer-load",o.footerLoad.toFixed(1)),t("#vendor-load",o.vendorScriptLoad.toFixed(1)),t("#app-load",o.appLoad.toFixed(1)),t("#metrics-load",o.metricsLoad.toFixed(1)),t("#time-to-eop",o.TTLB.toFixed(1)),t("#time-to-ng",o.timeToAngular.toFixed(1)),s!=null){var e=0,c=0,a=0,l=0,v=0;f.$$watchers.push({eq:!1,last:null,fn:function(){},exp:function(){},get:function(){return v++,c===0&&(c=s.now(),e++),f.$$postDigest(function(){var u,i,f,o;if(c!==0){u=s.now();i=u-c;t("#digest-ms",i.toFixed(1));t("#digest-fps",(1e3/i).toFixed(0));l=Math.max(i,l);t("#max-digest-ms",l.toFixed(1));t("#max-digest-fps",(1e3/l).toFixed(0));a+=i;e>0&&(f=a/e,t("#avg-digest-ms",f.toFixed(1)),t("#avg-digest-fps",(1e3/f).toFixed(0)));t("#dirty-checks",v);t("#digest-cycles",e);var y=h(),p=y[0],w=y[1];t("#scopes",p);t("#watchers",w);o="NG-PERF: Digest Cycle #"+e+": "+i.toFixed(1)+" ms, Scopes: "+p+", Watchers: "+w+" [Overhead: "+(s.now()-u).toPrecision(3)+" ms]";n.debug(o);r.console.timeStamp&&r.console.timeStamp(o);c=0}}),null}})}}}}])}(angular),function(n){"use strict";function i(n,t){if(n&&n.origin&&n.origin.Code&&n.destination&&n.destination.Code)return t?n.destination.Code+"-"+n.origin.Code:n.origin.Code+"-"+n.destination.Code}var t=n.module("haBookingFormModule",["haFeatureFlagsModule","duScroll"]);t.directive("haBookingForm",["$document","haHttpService","haConfig","haGlobals","haFeatureFlags","$window","haUtils","haCitiesSvc","haDateUtils","haUnavailableDays","$timeout","haModal","haEcertAPI","$filter","$q","$compile","$log","haSitecoreStrings",function(t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k){return{restrict:"A",link:function(i,f,p){function d(n){var t=i.departDate[n];return t&&moment(t).startOf("day")}function et(){i.multicity_datepicker_configs.forEach(function(n,t){var r=function(){for(var n=t;n;)if(i.departDate[--n])return moment(i.departDate[n])}();!d(t)&&r&&ot(n.viewing,r);ot(n.range_start,d(t-1)||r||moment());ot(n.range_end,d(t+1)||moment().add(331,"days"))})}function ot(n,t){n.year(t.year()).month(t.month()).date(t.date())}function ri(){t.off("click.closeCalendar");t.on("click.closeCalendar",function(r){var u=$(r.target);u.closest(".originDestinationWrap"+i.idx).length||(t.off("click.closeCalendar"),i.currentDateChoice="",n.forEach(i.calendarOpen,function(n,t){rt(t)}),i.$digest())})}function rt(n){l(function(){i.calendarOpen[n]=!1},500)}function g(){i.isChildCountInvalid=parseInt(i.pax.adultCount,10)===0&&parseInt(i.pax.childCount,10)>0;i.isSearchDisabled=i.pax.adultCount<1&&i.pax.childCount<1;var n=parseInt(i.pax.adultCount,10)+parseInt(i.pax.childCount,10);i.isCountValid=n>0&&n<8;i.flightSearch&&i.flightSearch.$setValidity("haPassengerCount",i.isCountValid)}function st(){i.$root.selectedPromoId&&i.tripType>0&&(i.paymentType.type="0",n.forEach(i.legs,function(n){n.isMiles=!1}));switch(i.tripType){case 0:i.paymentType.type="0";break;case 1:i.paymentType.type=i.legs.length===1&&i.legs[0].isMiles?"1":"0";break;case 2:i.paymentType.type=i.legs.length===2&&i.legs[0].isMiles&&i.legs[1].isMiles?"1":i.legs.length===2&&!i.legs[0].isMiles&&i.legs[1].isMiles?"2":i.legs.length===2&&i.legs[0].isMiles&&!i.legs[1].isMiles?"3":"0"}i.milesRadioOverride!==""&&(i.paymentType.type=i.milesRadioOverride)}function pt(){var n=!1,t=!1;return i.legs[0]&&i.legs[0].origin&&i.legs[0].origin.IsCodeShare&&i.legs[0].origin.Code!=="MKK"&&i.legs[0].origin.Code!=="JHM"&&i.legs[0].origin.Code!=="LNY"&&(n=!0),i.legs[0]&&i.legs[0].destination&&i.legs[0].destination.IsCodeShare&&i.legs[0].destination.Code!=="MKK"&&i.legs[0].destination.Code!=="JHM"&&i.legs[0].destination.Code!=="LNY"&&(t=!0),!n&&!t}function ht(){if(i.$switch("BookingWidget:enablerefundablefares")&&i.refundableFareOption&&!i.enableTCR&&!i.$root.selectedPromoId&&i.tripType!==0&&(i.paymentType.type===undefined||i.paymentType.type==="0")&&pt()){i.showRefundableFare=!0;return}i.showRefundableFare=!1}function ct(){i.disableMilesOption=!!i.$root.selectedPromoId||!pt()||i.tripType===0;(i.disableMilesOption||i.tripType===1&&parseInt(i.paymentType.type,10)>1)&&(i.paymentType.type="0")}function wt(){i.promoCodeOptionEnabled=i.promoCodeOption&&!i.$root.selectedPromoId&&!i.enableTCR}function ut(){i.flexiblePriceViewLink&&(i.isValidLowFareDuration=i.departDate[0]&&i.returnDate[0]&&i.tripType===2?h.numDaysDifference(i.departDate[0],i.returnDate[0])<=60:!0)}function lt(){var n=!0;i.flightSearch.$setValidity("haDuplicateLegs",n);l(function(){var u,f,t,r;if(i.tripType===0&&!(i.legs.length<2)&&i.flightSearch.$valid)for(t=0;t<i.legs.length;t++)for(u=i.legs[t].origin.Code,f=i.legs[t].destination.Code,r=0;r<i.legs.length;r++)if(t!==r&&(n=i.tripType!==0||u!==i.legs[r].origin.Code||f!==i.legs[r].destination.Code,i.flightSearch.$setValidity("haDuplicateLegs",n),!n))return})}function at(n){typeof n!="undefined"&&(i.messages[n]=[bt(n,"origin"),bt(n,"destination")].filter(function(n){return!!n}).join("<br>"))}function bt(n,t){return(t=i.legs[n][t])&&t.ShowCalendarMessage?t.CalendarMessage:""}function kt(t,r){t=t||{};var u=t.legs&&(r||t.legs[0].departDate>=nt)&&!(t.tripType===0&&i.multiCity===!1);u&&(i.legs=[],i.departDate=[],i.returnDate=[],i.unavailableDays=[],i.messages=[],t.legs.forEach(function(r,u){s.getCityMap().then(function(t){var f=i.legs[u]={origin:t[r.origin.code],destination:t[r.destination.code],isMiles:!!r.miles};i.intl=f.origin.Market===3||f.destination.Market===3;c.getUnavailableDays(f,i).then(function(t){i.unavailableDays[u]=n.isArray(t)?t:[];g();at(u)})});i.departDate[u]=r.departDate;var f=t.legs[u+1];f&&(i.returnDate[u]=f.departDate)}));i.pax.adultCount=i.enableTCR||i.disableAdultFieldForNITP?1:tt(t.adults,1);i.pax.childCount=i.enableTCR||i.disableAdultFieldForNITP||i.isCorporate?0:tt(t.children,0);i.tripType=tt(t.tripType,2);i.flightSearch&&(i.flightSearch.IsRefundableCheck=!!t.refundable);g();st()}function ui(t){t=t||{};i.legs=[];i.departDate=[];i.returnDate=[];i.unavailableDays=[];i.messages=[];t.legs.forEach(function(r,u){s.getCityMap().then(function(t){var f=i.legs[u]={origin:t[r.origin.code],destination:t[r.destination.code],isMiles:!!r.miles};i.intl=f.origin&&f.origin.Market&&f.destination&&f.destination.Market?f.origin.Market===3||f.destination.Market===3:f.origin&&!f.destination?f.origin.Market===3:f.destination?f.destination.Market===3:"";f.origin&&f.destination&&c.getUnavailableDays(f,i).then(function(t){i.unavailableDays[u]=n.isArray(t)?t:[];g();at(u)})});i.departDate[u]=r.departDate;var f=t.legs[u+1];f&&(i.returnDate[u]=f.departDate)});i.pax.adultCount=i.enableTCR||i.disableAdultFieldForNITP?1:tt(t.adults,1);i.pax.childCount=i.enableTCR||i.disableAdultFieldForNITP||i.isCorporate?0:tt(t.children,0);i.tripType=tt(t.tripType,2);i.flightSearch&&(i.flightSearch.IsRefundableCheck=!!t.refundable);g();st()}function tt(n,t){return n=Number(n),isNaN(n)?t:n}function fi(){var n=o.getFlightQueryModelRecentCookie();i.flightQueryCookieArr=n&&n.filter(function(n){var t=n.FlightSearchSegmentList[0].DepartureDate.substr(0,10);return t=moment(t,"YYYY-MM-DD").toDate(),t>=nt})}function ei(){l(function(){"promos,travelCredit,btnSearchFlights,btnSearchFlightsPlusHotels,recentSearchesSwitch,advancedSearchLink,flexiblePriceViewLink,flightScheduleLink,oneWay,roundTrip,multiCity,adults,children,expanded,childCountWarning,refundableFareOption".split(",").forEach(function(n){i[n]=!(p[n]&&p[n]==="false")});["milesRadioButton","promoCodeOption"].forEach(function(n){i[n]=!!(p[n]&&p[n]==="true")});(i.isAffiliate||i.isCorporate)&&(i.btnSearchFlightsPlusHotels=!1);i.theme=p.theme||"a";i.milesRadioOverride=p.milesRadioOverride||"";i.searchPosition=p.searchPosition||"right";i.defaultDestinationImage=p.defaultDestinationImage||"";ut();wt()})}function dt(n,t){var r=i.legs[n]&&i.legs[n].origin||i.legs[0].destination,u=i.legs[n]&&i.legs[n].destination||i.legs[0].origin;return{origin:{code:r.Code,display:r.DisplayName},destination:{code:u.Code,display:u.DisplayName},departDate:t}}function oi(){var n=[dt(0,i.departDate[0])];return i.tripType===2&&n.push(dt(1,i.returnDate[0])),n}function si(){var t="",n="";v.HandleAffiliates(i.promoCode.Code).then(function(r){r.data.IsSuccess&&r.data.RedirectURL!=null?(r.data.RedirectURL=r.data.RedirectURL,e.location=r.data.RedirectURL):(r.data.ServiceErrors!=null?(i.promoCodeNotFound=!0,i.flightSearch.PromoCode.$setValidity("promoCodeNotFound",!1)):t="Error While Processing Request",n(r))},n)}function hi(n){var t="/Ecertificate?ecertId="+n;t!=null?e.location=t:(i.promoCodeNotFound=!0,i.flightSearch.PromoCode.$setValidity("promoCodeNotFound",!1))}function ci(){return["departureDate","arrivalDate","departureLocation","arrivalLocation"].forEach(function(n){i[n]=p[n]||""}),i.childrenCount=p.childrenCount||0,i.adultsCount=p.adultsCount||1,i.roundTripFlight=p.roundTripFlight!=null&&p.roundTripFlight==="1",p.promoCodeValue&&(i.promoCode={},i.promoCode.Code=p.promoCodeValue),i.departureDate||i.arrivalDate||i.departureLocation||i.arrivalLocation||p.promoCodeValue?(i.searchAttributesSet=!0,!0):(i.searchAttributesSet=!1,!1)}function gt(){var n=[],r={origin:{code:i.departureLocation.toUpperCase()},destination:{code:i.arrivalLocation.toUpperCase()},departDate:i.departureDate?moment(i.departureDate.substr(0,10),"YYYY-MM-DD").toDate():undefined},t;return n.push(r),i.roundTripFlight===!0&&(t={origin:{code:i.arrivalLocation.toUpperCase()},destination:{code:i.departureLocation.toUpperCase()},departDate:i.arrivalDate?moment(i.arrivalDate.substr(0,10),"YYYY-MM-DD").toDate():undefined},n.push(t)),vt(n,i.adultsCount,i.childrenCount)}function ni(){var n=o.parseLegs(o.querystring("l"));return n&&vt(n,o.querystring("a"),o.querystring("c"))}function ti(n){if(n){var i=n.FlightSearchSegmentList.map(function(n){return{origin:{code:n.OriginCityCode.toUpperCase()},destination:{code:n.DestinationCityCode.toUpperCase()},departDate:moment(n.DepartureDate.substr(0,10),"YYYY-MM-DD").toDate(),miles:n.IsMiles}}),t=vt(i,n.AdultCount,n.ChildCount);return t.refundable=n.IsRefundable,t}}function vt(n,t,i){var r=n.length===2&&n[0].origin.code===n[1].destination.code,u=!parseInt(t,10)&&!parseInt(i,10);return{legs:li(n),adults:u?1:parseInt(t,10)||0,children:parseInt(i,10)||0,tripType:r?2:n.length===1?1:0}}function li(n){return n.map(function(n){var t=moment(n.departDate);return t.diff(moment().startOf("day"))<0&&(n.departDate=null),n})}function ai(){n.element('a[href^="/book/flights"]').parent().addClass("ng-hide");n.element('a[href^="/book/hotels"]').parent().addClass("ng-hide");n.element('a[href^="/book/car-rentals"]').parent().addClass("ng-hide");n.element('a[href^="/book/vacation-packages"]').parent().addClass("ng-hide");n.element('a[href^="/book/activities-and-cruises"]').parent().addClass("ng-hide")}function vi(){n.element('a[href^="/book/flights"]').parent().removeClass("ng-hide");n.element('a[href^="/book/hotels"]').parent().removeClass("ng-hide");n.element('a[href^="/book/car-rentals"]').parent().removeClass("ng-hide");n.element('a[href^="/book/vacation-packages"]').parent().removeClass("ng-hide");n.element('a[href^="/book/activities-and-cruises"]').parent().removeClass("ng-hide")}function ii(t){i.promoCode.isValidPromoCode=!0;i.promoCode.hasApplied=!0;i.promoCode.PromoCodePromotion=t;i.PromoModel.Promo=t;ai();k.get("Header.promoappliedmessage").then(function(t){var r='<div ha-global-message header="'+t+'" type="success" message-close-time="4700"><\/div>';n.element("[ha-global-header]").append(w(r)(i))});i.promoCodeNotFound=!1;i.$root.discountRemoved=!1;i.$root.discountPermanentlyRemoved=!1;i.$root.selectedPromoId=i.PromoModel.Promo.OfferId}function yi(){i.promoCode.isValidPromoCode=!1;i.promoCode.Code=null;vi();i.$root.discountRemoved=!0;i.$root.discountPermanentlyRemoved=!0;i.$root.selectedPromoId=null;v.removePromoCodeFromSession()}function yt(){i.promoCode.Code=null;i.promoCodeNotFound=!1;i.flightSearch.PromoCode!==null&&i.flightSearch.PromoCode!==undefined&&(i.flightSearch.PromoCode.$setValidity("promoCodeNotFound",!0),i.flightSearch.PromoCode.$validate())}function pi(){var r,n,t;if(u("promoJson",function(n){i.PromoModel=n||undefined;i.promoCode={};i.promoCodeNotFound=!1;i.promoCode.PromoCodePromotion=i.PromoModel.Promo;i.PromoModel!==null&&i.PromoModel.Promo!==null&&(i.$root.selectedPromoId=i.PromoModel.Promo.OfferId,i.PromoModel.Promo.OfferType===10&&ii(i.PromoModel.Promo))}),u("enableTCR",function(n){i.enableTCR=n}),u("wholesaleDisableDollarMile",function(n){i.wholesaleDisableDollarMile=n}),u("ETCOResponseModel",function(n){i.ETCOResponseModel=n}),u("flightSearchModel",function(n){i.disableAdultFieldForNITP=n.DisableAdultField}),i.ActivateValidationSpinner=!1,i.formSubmitted=!1,ei(),i.intl=!1,i.isEN=o.isEN(),i.legs=[],r={},i.legs.push(r),i.departDate=[],i.returnDate=[],i.currentDateChoice="",i.calendarOpen=[],i.messages=[],i.unavailableDays=[],i.pax={},i.passengerCount=[0,1,2,3,4,5,6,7],i.childrenOnly=!1,i.isAffiliate=!1,i.$root.user.accountType=="A"&&(i.isAffiliate=!0),i.isCorporate=i.$root.isLoggedIn&&i.$root.corpAccTypes.indexOf(i.$root.user.accountType)>-1,i.paymentType={},i.enablepricechart=i.$switch("LowFare:enablepricechart"),i.enablepricecalendar=i.$switch("LowFare:enablepricecalendar"),i.ETCOResponseModel&&k.get("ReservationsTravelCreditRedemption.offallroutesfootertext").then(function(n){var t=y("localCurrency")(i.ETCOResponseModel.Amount,i.$currency);i.offAllRoutesFooterText=n.replace("{{ETCO.Dollar.Discounts}}",t)}),n=window.location.href.toLowerCase().indexOf("flexibleautoopen")!==-1,t=n?gt()||ni():ci()?gt():ni()||ti(o.getFlightQueryModelCookie()),l(function(){i.searchAttributesSet?ui(t):kt(t,!0);fi();i.$broadcast("trip type changed",i.tripType)},0),n&&(i.autoOpened=!1,i.$on("citiesavailable",function(){i.autoOpened||(i.autoOpened=!0,l(function(){i.openPriceChart()}))})),i.ready=!0,HA.cdnDynamic)$(window).on("load",function(){["BookingWidget","StickProgressBar","LowFare","InflightOptions","InFlightOptionsInfo","PassengerTripSummary","FareSearch","PROMO_DISCOUNTS","ETCO_CHECK"].map(k.request)})}var ft=$('form[name="flightSearch"]'),it,nt;for(s.preloadCities(),i.range_datepicker_config={start:"[name='_FlightSearchSegmentList[0].DepartureDate']",end:"[name='_FlightSearchSegmentList[1].DepartureDate']"},i.multicity_datepicker_configs=[],i.multicity_datepicker_config=function(n){if(i.multicity_datepicker_configs[n])return i.multicity_datepicker_configs[n];var t=i.multicity_datepicker_configs[n]={viewing:d(n-1)||moment().startOf("day"),range_start:d(n-1)||moment().startOf("day"),range_end:d(n+1)||moment().add(331,"days").startOf("day"),idx:n};return et(),t},it=0;it<6;it++)i.$watch("departDate["+it+"]",function(){et()});i.$on("dateInputFocused",function(t,r,u){i.currentDateChoice=r;i.idx=u;n.forEach(i.calendarOpen,function(n,t){i.calendarOpen[t]=!1});i.calendarOpen[u]=!0;ri()});i.$on("setDate",function(n,t){if(i[i.currentDateChoice]){if(i[i.currentDateChoice][i.idx]=t||"",i.currentDateChoice==="departDate"&&i.returnDate[i.idx]&&t>i.returnDate[i.idx]?i.returnDate[i.idx]=undefined:i.currentDateChoice==="returnDate"&&i.departDate[i.idx]&&t<i.departDate[i.idx]&&(i.departDate[i.idx]=undefined),i.tripType===0){for(var r=i.idx;r>0;r--)i.departDate[r-1]&&t<i.departDate[r-1]&&(i.departDate[r-1]=t);for(r=i.idx;r<i.legs.length-1;r++)i.departDate[r+1]&&t>i.departDate[r+1]&&(i.departDate[r+1]=t)}i.$digest()}});i.$on("airportInputFocused",function(n,t){var r=t.closest("li"),u=r.index();i.idx=u;i.expanded||i.setExpanded()});i.$on("haWhereWeFlyPinClicked",function(){i.expanded||l(function(){i.setExpanded()},500)});i.$on("airportChanged",function(){var r,f,t,u,e;n.forEach(i.legs,function(n){n.invalidPair=!1});r=i.legs;f=i.tripType===2;r[0]&&f&&(r.length<2&&(r[1]={}),r[1].origin=r[0].destination,r[1].destination=r[0].origin);t=r&&r[i.idx];t&&t.origin&&t.origin.Code&&t.destination&&t.destination.Code&&(c.getUnavailableDays(t,i).then(function(r){i.departDate[i.idx]&&r[0].CalendarYears.contains(i.departDate[i.idx])&&delete i.departDate[i.idx];i.returnDate[i.idx]&&r[1].CalendarYears.contains(i.returnDate[i.idx])&&delete i.returnDate[i.idx];i.unavailableDays[i.idx]=n.isArray(r)?r:[];i.intl=t.origin&&t.origin.Market===3||t.destination&&t.destination.Market===3?!0:!1;g()}),at(i.idx),lt(),i.idx===0&&i.defaultDestinationImage!==""&&(u=t.destination.ImageURL,u===""&&(u=i.defaultDestinationImage),e=new Image,e.src=u));ht();ct();i.$broadcast("airport changed")});i.$on("recallSearch",function(n,t){i.recallSearch(t)});i.$watchCollection("[pax.adultCount, pax.childCount]",function(){g()});i.$watchCollection("departDate",function(){i.departDate[i.idx]&&!i.returnDate[i.idx]&&i.tripType===2?i.currentDateChoice="returnDate":i.departDate[i.idx]&&i.returnDate[i.idx]?rt(i.idx):i.tripType!==2&&rt(i.idx);ut()});i.$watchCollection("returnDate",function(){i.returnDate[i.idx]&&!i.departDate[i.idx]?i.currentDateChoice="departDate":i.returnDate[i.idx]&&i.departDate[i.idx]&&rt(i.idx);ut()});i.$watchCollection("legs",function(){i.milesRadioButton&&st();ut()});i.recentSearches={open:!1};i.$watch("recentSearches.open",function(n){typeof n!="undefined"&&(n?l(function(){$("body").on("click.recent",function(){i.$apply(function(){i.recentSearches.open=!1})})},10):$("body").off("click.recent"))});i.$watch("paymentType.type",function(){ht()});i.$root.$watch("selectedPromoId",function(){ht();ct();wt()});i.$watch("promoCode.Code",function(){i.flightSearch&&i.flightSearch.PromoCode&&i.flightSearch.PromoCode.$setValidity("promoCodeNotFound",!0)});nt=new Date((new Date).setHours(0,0,0,0));i.setTripType=function(n){i.flightSearch.$submitted=!1;ft.removeClass("submitted");i.tripType!=0&&n===0&&i.deleteLeg(1);i.tripType=n;n===1&&(i.legs=i.legs.slice(0,1));i.showChartError=!1;i.$root.selectedPromoId&&i.tripType===0?(i.$root.discountRemoved=!0,i.$root.selectedPromoId=null):i.PromoModel&&i.PromoModel.Promo&&i.tripType!==0&&!i.$root.discountPermanentlyRemoved&&(i.$root.selectedPromoId=i.PromoModel.Promo.OfferId,i.$root.discountRemoved=!1);ct();i.$broadcast("trip type changed",n)};i.focusTripTypeSelection=function(){i.expanded=!0};i.focusBackOnTripType=function(){i.recentSearches.open=!1};i.$on("airportInputFocused",function(){i.recentSearches.open=!1});i.$on("haAlertClosed",function(n,t){t==="promoCodeError"&&(i.promoCodeNotFound=!1)});i.openPriceChart=function(n){n=n||"calendar";i.flightSearch.$valid?a(r.getTemplateUrl("/Book/FlightSearch/ha-flexible-price-modal.html"),{id:"FlexiblePriceView",backdrop:"true",extendScope:{legs:oi(),adults:i.pax.adultCount,children:i.pax.childCount,display:n}}):i.showChartError=!0};i.addLeg=function(n){ft.removeClass("submitted");i.flightSearch.$submitted=!1;for(var t=0;t<n;t++)i.leg={},i.legs.push(i.leg)};i.deleteLeg=function(n){i.legs.splice(n,1);i.departDate.splice(n,1);i.unavailableDays.splice(n,1);i.messages.splice(n,1);i.multicity_datepicker_configs.splice(n,1);et();lt()};i.getCalendarHeading=function(n){return n!=="returnDate"?k("BookingWidget.departdate"):k("BookingWidget.returndate")};i.scrollForm=function(r){var u=n.element(".homepage-widget");u.length>0?t.scrollToElement(u,20,450,function(n){return n<.5?8*n*n*n*n:1-8*--n*n*n*n}).then(function(){i.expanded=r}):i.expanded=r};i.scrollTo=function(i){l(function(){var r=n.element("#"+i);r.length>0&&t.scrollToElement(r,20,450,function(n){return n<.5?8*n*n*n*n:1-8*--n*n*n*n})},0)};i.getIsUnavailable=function(n){if(h.isBefore(n,nt)&&!h.isSameDay(n,nt)||h.isAfter331(n,nt))return!0;var t=i.currentDateChoice,f=c.isUnavailable(n,i.unavailableDays[i.idx],t),r=i.departDate[i.idx],u=i.returnDate[i.idx];return r&&u&&i.tripType>0?f:f||i.tripType===2&&(t==="returnDate"&&r&&h.isBefore(n,r)||t==="departDate"&&u&&h.isAfter(n,u))};i.infantInfoModal=function(){(!i.isCorporate||i.isAffiliate)&&a(r.getTemplateUrl("ha-child-infant-info-modal.html"),{id:"infantModal",backdrop:"true"});console.log(i.isAffiliate)};i.infantInfoContentCheck=function(){return k("BookingWidget.childinformationmodal")==null||k("BookingWidget.childinformationmodal")===""||k("BookingWidget.childinformationmodal")==="[BookingWidget.childinformationmodal]"?!0:!1};i.searchFlightsPlusHotels=function(n){var r,h,u,l,a,f,v;for(n.preventDefault(),r=0,h=i.legs.length;r<h;r++)if(i.legs[r].invalidPair=s.pairIsInvalid(i.legs[r].origin.Code,i.legs[r].destination.Code),i.legs[r].invalidPair)return;if(i.flightSearch.PromoCode===undefined||i.flightSearch.PromoCode.$valid||yt(),i.flightSearch.$valid||_.size(i.flightSearch.$error)===1&&i.flightSearch.$error.haPassengerCount){var c=1,t={},p=i.departDate[0].YYYY_MM_DD(),w=i.returnDate[0].YYYY_MM_DD(),d=i.legs[0].origin.Code,g=i.legs[0].destination.Code,nt=i.pax.adultCount,e=i.pax.childCount;for(t.FromAirport=d,t.Destination=g,t.ToTime=362,t.FromTime=362,t.NumRoom=c,t.cabinClass="e",u=0;u<c;u++)if(l="NumAdult-Room"+(u+1),a="NumChild-room"+(u+1),t[l]=nt,e>0)for(t[a]=e,f=0;f<e;f++)v="Room"+(u+1)+"-Child"+(f+1)+"Age",t[v]=6;t.mdpcid=o.webtrends.tokenV2("FLTWIDGET.PACKAGE");var tt=o.createQueryString(t),it=k("BookingWidget.searchpackagesurl"),y=it+"FlightHotel/"+p+"/"+w+tt;b.debug(y);location.href=y}else{i.flightSearch.$submitted=!0;ft.addClass("submitted");i.$broadcast("validateForm");return}};i.applyPromoCodeOnEnter=function(n){n.which===13&&(n.preventDefault(),i.applyPromoCode())};i.applyPromoCode=function(){v.validateRedeemPromoCode(i.promoCode.Code).success(function(n){n&&n.IsSuccess&&n.PromoCodePromotion?(n&&n.IsSuccess&&n.PromoCodePromotion.OfferType===10?ii(n.PromoCodePromotion):n&&n.IsSuccess&&n.PromoCodePromotion.OfferType===3&&hi(i.promoCode.Code),i.flightSearch.PromoCode.$setValidity("promoCodeNotFound",!0)):n.PromoCodePromotion==null?(si(i.promoCode.Code),i.flightSearch.PromoCode.$setValidity("promoCodeNotFound",!0)):(b.error("applyPromoCode failed"),i.promoCodeNotFound=!0,i.flightSearch.PromoCode.$setValidity("promoCodeNotFound",!1))}).error(function(n){b.error("Validate Promo Code encountered error: "+n);i.promoCodeNotFound=!0;i.flightSearch.PromoCode.$setValidity("promoCodeNotFound",!1)})};i.removePromoCode=function(){i.promoCode.hasApplied=!1;yi()};i.submit=function(t){var f,u,e;if(t.preventDefault(),i.formSubmitted=!0,i.flightSearch.PromoCode===undefined||i.flightSearch.PromoCode.$valid||yt(),!i.flightSearch.$valid){i.$broadcast("validateForm");return}for(f=[],i.legs&&n.forEach(i.legs,function(n){f.push(n.origin.Code);f.push(n.destination.Code)}),u=0,e=i.legs.length;u<e;u++)if(i.legs[u].invalidPair=s.pairIsInvalid(i.legs[u].origin.Code,i.legs[u].destination.Code),i.legs[u].invalidPair)return;if(i.tripType===0&&(i.legs.length===1?document.flightSearch.FlightQueryTypeId.value=1:i.legs.length===2&&(document.flightSearch.FlightQueryTypeId.value=i.legs[0].origin.Code===i.legs[1].destination.Code&&i.legs[0].destination.Code===i.legs[1].origin.Code?2:i.tripType),lt()),i.milesRadioButton&&i.paymentType&&i.paymentType.type!==undefined)switch(i.paymentType.type){case"1":i.legs[0].isMiles=!0;i.tripType===2&&(i.legs[1]===undefined&&(i.legs[1]={origin:i.legs[0].destination,destination:i.legs[0].origin}),i.legs[1].isMiles=!0);break;case"2":i.legs[0].isMiles=!1;i.legs[1]===undefined&&(i.legs[1]={origin:i.legs[0].destination,destination:i.legs[0].origin});i.legs[1].isMiles=!0;break;case"3":i.legs[0].isMiles=!0;i.legs[1]===undefined&&(i.legs[1]={origin:i.legs[0].destination,destination:i.legs[0].origin});i.legs[1].isMiles=!1;break;default:i.legs[0].isMiles=!1;i.tripType===2&&(i.legs[1]===undefined&&(i.legs[1]={origin:i.legs[0].destination,destination:i.legs[0].origin}),i.legs[1].isMiles=!1)}l(function(){var t,u;if(!i.flightSearch.$valid){i.$broadcast("validateForm");return}if(i.enableTCR&&(t=new Date,t.setHours(0,0,0,0),i.ETCOResponseModel.Errors=[],(i.legs[0].origin.IsCodeShare&&i.legs[0].origin.Code!=="MKK"&&i.legs[0].origin.Code!=="JHM"&&i.legs[0].origin.Code!=="LNY"||i.legs[0].destination.IsCodeShare&&i.legs[0].destination.Code!=="MKK"&&i.legs[0].destination.Code!=="JHM"&&i.legs[0].destination.Code!=="LNY")&&i.ETCOResponseModel.Errors.push("ETCOErrorCodeShare"),(h.isBefore(t,new Date(i.ETCOResponseModel.BookBetweenFrom))||h.isAfter(t,new Date(i.ETCOResponseModel.BookBetweenTo)))&&i.ETCOResponseModel.Errors.push("ETCOErrorNoLongerValid"),(h.isBefore(i.departDate[0],new Date(i.ETCOResponseModel.TravelPeriodFrom))||i.tripType===1&&h.isAfter(i.departDate[0],new Date(i.ETCOResponseModel.TravelPeriodTo))||i.tripType===2&&h.isAfter(i.returnDate[0],new Date(i.ETCOResponseModel.TravelPeriodTo)))&&i.ETCOResponseModel.Errors.push("ETCOErrorDateRange"),i.ETCOResponseModel.Errors.length>0)){k.get("ReservationsTravelCreditRedemption").then(function(t){n.forEach(i.ETCOResponseModel.Errors,function(n,r){t.hasOwnProperty(n.toLowerCase())&&(i.ETCOResponseModel.Errors[r]=t[n.toLowerCase()])});a(r.getTemplateUrl("ha-booking-etco-modal.html"),{id:"promoValidationModal",backdrop:"true",scope:i})});return}i.tripType!==0&&i.PromoModel&&i.PromoModel.Promo&&!i.$root.discountRemoved?(u={PromoCode:i.PromoModel.Promo.OfferId,Origin:i.legs[0].origin.Code,Destination:i.legs[0].destination.Code,DepartureDate:y("date")(i.departDate[0],"yyyy-MM-dd"),ReturnDate:i.returnDate[0]?y("date")(i.returnDate[0],"yyyy-MM-dd"):null,TripType:i.tripType,AdultCount:!!i.flightSearch.AdultCount&&!!i.flightSearch.AdultCount.$modelValue?i.flightSearch.AdultCount.$modelValue:0,ChildCount:!!i.flightSearch.ChildCount&&!!i.flightSearch.ChildCount.$modelValue?i.flightSearch.ChildCount.$modelValue:0,InfantCount:!!i.flightSearch.InfantCount&&!!i.flightSearch.InfantCount.$modelValue?i.flightSearch.InfantCount.$modelValue:0},i.ActivateValidationSpinner=!0,i.PromoModel.Errors=null,v.isValidPromo(u).success(function(n){!n||n.IsSuccess!==!1?(i.ActivateValidationSpinner=!1,l(function(){document.flightSearch.submit()})):(i.ActivateValidationSpinner=!1,i.PromoModel.Errors=n.Errors,a(r.getTemplateUrl("ha-booking-promo-modal.html"),{id:"promoValidationModal",backdrop:"true",scope:i}))}).error(function(n){i.ActivateValidationSpinner=!1;n&&n.RedirectURL&&(window.location.href=n.RedirectURL);return})):i.promoCode==undefined||i.promoCode.Code==undefined||i.promoCode.Code==""||i.promoCode.hasApplied?(i.$root.discountRemoved=!0,i.$root.selectedPromoId=null,l(function(){document.flightSearch.submit()})):l(function(){a(r.getTemplateUrl("ha-booking-promo-modal.html"),{id:"promoValidationModal",backdrop:"true",scope:i})})})};i.submitWithoutDiscount=function(){i.$root.discountRemoved=!0;i.$root.selectedPromoId=null;yt();i.$modalCancel();l(function(){document.flightSearch.submit()})};i.submitWithoutETCO=function(){i.etcoRemoved=!0;i.$modalCancel();l(function(){document.flightSearch.submit()})};i.recallSearch=function(n){var t=i.flightQueryCookieArr[n];kt(ti(t));i.recent=!1};i.setExpanded=function(){i.expanded=!0;$(".booking-widget.row").addClass("open")};i.setClosed=function(){i.setTripType(2);i.expanded=!1;$(".booking-widget.row").removeClass("open")};i.mobileSelect=function(n){i.tab=i.tab===n?"":n};i.openMobileRecentSearches=function(){a(r.getTemplateUrl("/Book/FlightSearch/ha-recent-searches-modal.html"),{id:"RecentSearchesModal",backdrop:"true",extendScope:{flightQueryCookieArr:i.flightQueryCookieArr,recallSearch:i.recallSearch}})};pi()}}}]);t.directive("haBookingDateFormatter",["$filter","$locale",function(n,t){return{require:"ngModel",link:function(i,r,u,f){f.$formatters.push(function(i){return!i||!(i instanceof Date)?"":n("date")(i,"EEEE, ")+n("date")(i,t.DATETIME_FORMATS.shortDate)})}}}]);t.directive("haDatesAvailable",["haUnavailableDays",function(n){return{restrict:"A",require:"ngModel",link:function(t,i,r,u){var f=function(i,r){var f=!0;return!r||!r.length?(u.$setValidity("haDates",f),f):(u.$modelValue&&(f=t.tripType!==1?!n.isUnavailable(u.$modelValue,r,"departDate")||!n.isUnavailable(u.$modelValue,r,"returnDate"):!n.isUnavailable(u.$modelValue,r,"departDate")),u.$setValidity("haDates",f),i)};u.$formatters.push(f);t.$on("unavailableDaysChanged",function(n,t){return f(u.$viewValue,t)})}}}]);t.factory("haUnavailableDays",["haHttpService","$q",function(n,t){function u(n){var t=this;return(t=t&&t[n.getFullYear()])&&(t=t[n.getMonth()+1])&&t[n.getDate()]}function f(t,i){return t=t.split("-"),n.GET("/book/flightschedule/UnAvailableDaysOfOperation",{method:"get",params:{origin:t[0],destination:t[1],triptype:i||1},config:{cache:!0}})}var r={};return{get:function(n){var t=r[n];return t?t:r[n]=f(n).then(function(t){var i=t.data[n]||{CalendarYears:{}};return i.CalendarYears.pair=n,i.CalendarYears.contains=u,i.CalendarYears}).catch(function(n){return console.log(n),Promise.reject(n)})},getUnavailableDays:function(n,r){return t.all([this.get(i(n),!0),this.get(i(n,!0),!0)]).then(function(n){return n=n.map(function(n){return{CalendarYears:n}}),r.$broadcast("unavailableDaysChanged",n),n})},isUnavailable:function(n,t,i){if(t&&t.length){var r=i==="departDate"?t[0]:t[1];return r.CalendarYears.contains(n)}}}}]);t.directive("haDelegateClick",function(){return function(t,i,r){var u=r.haDelegateClick;i.on("click",r.haDelegateSelector,function(i){var r=$(i.target),f=r.data("ng-json")?r:r.closest("[data-ng-json]"),e=n.fromJson(f.data("ngJson")||undefined);typeof t[u]=="function"&&t[u](i,e)})}})}(angular),function(n){"use strict";var t=n.module("haEcertEtcoModule",["haBookNonMemberEcertAPI"]);t.directive("haEcertEtco",["haGlobals","$timeout","haBookNonMemberEcertAPI",function(t,i,r){var u=function(u,f,e){function s(n){n.IsOfferValid&&n.MemberPromotion?n.MemberPromotion.OfferType===3?(u.ecertValid=!0,i(function(){window.location.href="/Book/home?ecertId="+u.Ecert.EcertNumber},200)):n.IsOfferValid&&n.MemberPromotion&&n.MemberPromotion.OfferType===8?(u.ecertValid=!0,i(function(){window.location.href="/Book/home?ecertId="+u.Ecert.EcertNumber},200)):n.MemberPromotion.OfferType===9?(u.ecertValid=!0,u.showMilesLogin=!0,u.Ecert.Description=n.MemberPromotion.OfferDescription,u.Ecert.SecondaryDescription=n.MemberPromotion.OfferSecondaryDescription,u.Ecert.PartnerCode=n.MemberPromotion.HMAwardCode,u.Ecert.AwardMiles=n.MemberPromotion.AwardMiles,u.ECertForm.$submitted=!1,$('form[name="ECertForm"]').removeClass("submitted")):h():h()}function h(){u.IsEcertError=!0;n.element("html,body").animate({scrollTop:u.contentScrollTop+"px"},"fast")}function c(){u.IsEcertError=!1;u.ecertChecking=!0;r.validatePromo(u.Ecert).success(function(n){u.handleExceptions(n,"haBookNonMemberEcertAPI-validatePromo")||(typeof u.$modalCancel=="function"&&u.$modalCancel(),u.ecertChecking=!1,s(n))}).error(function(){u.handleExceptions("jsError","haBookNonMemberEcertAPI-validatePromo")})}u.step=0;u.IsEcertError=!1;u.IsAccountError=!1;u.IsDepositError=!1;u.showMilesLogin=!1;u.ecertChecking=!1;u.accountChecking=!1;u.Ecert={};var o=[],l=e.absUrl().slice(e.absUrl().indexOf("?")+1).split("&");n.forEach(l,function(n){var t=n.split("=");t[0]&&t[1]&&(o[t[0]]=t[1])});u.Ecert.EcertNumber=o.ecertId||"";u.Ecert.RedemptionCode=o.redemptionCode||"";u.setForm=function(n){u.ECertForm=n};u.submit=function(){u.step===0?u.showMilesLogin?u.validateAccount():u.validateEcert():u.step===1&&u.depositMiles()};u.validateEcert=function(){if(u.$broadcast("validateForm"),!u.ECertForm.$valid)return!1;r.isGAFETCO(u.Ecert).success(function(n){u.handleExceptions(n,"haBookNonMemberEcertAPI-isGAFETCO")||(u.Ecert.IsGAFTravelCredit=n&&n.IsGAFETCO,u.Ecert.IsGAFTravelCredit?haModal("modalContent",{backdrop:"true",modalClass:"ha-content-modal",id:"etco-terms-modal",scope:u}):c())})};u.validateAccount=function(){if(u.$broadcast("validateForm"),!u.ECertForm.$valid)return!1;u.IsAccountError=!1;u.accountChecking=!0;r.validateAccount(u.Ecert).success(function(t){u.handleExceptions(t,"haBookNonMemberEcertAPI-validateAccount")||(u.accountChecking=!1,t.IsHMNumberValid?(u.Ecert.FirstName=t.FirstName,u.Ecert.LastName=t.LastName,u.Ecert.CostMiles=t.CostPerMile,u.Currency=t.CurrencyCode||"USD",u.step=1,u.ECertForm.$submitted=!1,$('form[name="ECertForm"]').removeClass("submitted"),n.element("html,body").animate({scrollTop:u.contentScrollTop+"px"},"fast")):(u.IsAccountError=!0,n.element("html,body").animate({scrollTop:u.contentScrollTop+"px"},"fast")))}).error(function(){u.handleExceptions("jsError","haBookNonMemberEcertAPI-validateAccount")})};u.changeRecipient=function(){u.IsDepositError=!1;u.step=0};u.depositMiles=function(){if(u.$broadcast("validateForm"),!u.ECertForm.$valid)return!1;u.IsDepositError=!1;r.depositMiles(u.Ecert).success(function(t){u.handleExceptions(t,"haBookNonMemberEcertAPI-depositMiles")||(t.IsMilesDeposited?(u.step=2,n.element("html,body").animate({scrollTop:u.contentScrollTop+"px"},"fast")):u.IsDepositError=!0)}).error(function(){u.handleExceptions("jsError","haBookNonMemberEcertAPI-depositMiles")})};u.acceptTerms=function(){c()};u.cancelTerms=function(){u.$modalCancel()};u.handleExceptions=function(n){if(n!=="jsError")if(n.ErrorCodeHandle!==undefined)window.location.href=n.RedirectURL+"?ErrorCode="+n.ErrorCodeHandle;else return!1;else window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"};t(["redemptionInformationLinks","memberPromotionResponse"],function(n,t){u.redemptionLinks=n;t&&s(t)})},f;return u.$inject=["$scope","$attrs","$location"],f=function(t){i(function(){t.contentScrollTop=n.element(".main-content").offset().top},1e3)},{restrict:"A",scope:!0,link:f,controller:u}}])}(angular),function(n){"use strict";var t=n.module("haBookInsufficientMilesModule",[]);t.directive("haBookInsufficientMiles",["haGlobals",function(n){var t=function(t){n("MilesBookingSummaryVM",function(n){$.extend(t,n)});t.$emit("$haBookInsufficientMilesReady")},i;return t.$inject=["$scope"],i=function(){setTimeout(function(){$(".list").each(function(){var n=$(this).find(".value").height();$(this).find(".label").height(n+"px")})},10)},{restrict:"A",scope:!0,link:i,controller:t}}])}(angular),function(n){"use strict";var r=n.module("haFlexiblePriceViewModule",["haPriceApiModule","ngAnimate","haFeatureFlagsModule"]),i=!1,e=.33,u=331,t=25,o=1e3,f,s=["januarytext","februarytext","marchtext","apriltext","maytext","junetext","julytext","augusttext","septembertext","octobertext","novembertext","decembertext"];r.directive("haFlexiblePriceView",["haFeatureFlags","haSitecoreStrings","haHttpService","haPriceApiService","haConfig","haDateUtils","$filter","$animate","haUtils","$timeout","$rootScope",function(r,h,c,l,a,v,y,p,w,b,k){return{templateUrl:a.getTemplateUrl("/Book/FlightSearch/ha-flexible-price-view.html"),restrict:"A",link:function(r,c){function rt(){function t(t,i){return{OriginCityCode:n[t].origin.code,DestinationCityCode:n[t].destination.code,DepartureDate:moment(i).format("YYYY-MM-DD"),SegmentID:t+1}}var n=r.legs,u=new Date(n[0].departDate),f=new Date(n[0].departDate).dateAdd("day",r.model.tripLength),i={searchRequest:{FlightQueryTypeId:r.legs.length,AdultCount:r.adults,ChildCount:r.children,FlightSearchSegmentList:[t(0,u)]},isCalendar:r.display==="calendar"};return r.legs.length===2&&i.searchRequest.FlightSearchSegmentList.push(t(1,f)),i}function ut(){r.selectedPrice={date:new Date(r.legs[0].departDate),price:0};k.isMobile&&(r.initialPrice={date:new Date(r.legs[0].departDate),price:0});r.display==="chart"?(r.currentDate=new Date(r.selectedPrice.date),r.currentDate.setDate(r.currentDate.getDate()-parseInt(t/2))):r.currentDate=new Date(r.legs[0].departDate.getFullYear(),r.legs[0].departDate.getMonth(),1)}function y(n){var e,s,f,t,o,u,i;if(k.isMobile&&n.length>90){for(e=[],t=0,o=n.length;t<o;t++)f=n[t].DepartDate,s=moment(f).month(),moment(f).date()>=20&&e.indexOf(s)<0&&e.push(s);for(t=0;t<n.length;t++)f=n[t].DepartDate,e.indexOf(moment(f).month())<0&&(n.splice(t,1),t--)}for(r.firstBufferDate=r.firstBufferDate?r.firstBufferDate:new Date("1/1/2100"),r.lastBufferDate=r.lastBufferDate?r.lastBufferDate:new Date("1/1/1900"),t=0,o=n.length;t<o;t++)u=n[t],i=u.DepartDate,i===r.selectedPrice.date.YYYY_MM_DD()&&(r.selectedPrice.price=u.Price),k.isMobile&&i===r.initialPrice.date.YYYY_MM_DD()&&(r.initialPrice.price=u.Price),r.buffer[i]={price:u.Price,departDate:i,returnDate:u.ReturnDate},i=moment(u.DepartDate).toDate(),r.lastBufferDate=v.isAfter(i,r.lastBufferDate)?i:r.lastBufferDate,r.firstBufferDate=v.isBefore(i,r.firstBufferDate)?i:r.firstBufferDate}function a(){var n,u,s,i,f,o,h;for(r.chartData=[],r.calendarData={},r.minPrice=Number.POSITIVE_INFINITY,r.maxPrice=Number.NEGATIVE_INFINITY,k.isMobile?f=v.numDaysDifference(new Date(r.firstBufferDate),new Date(r.lastBufferDate)):(f=v.numDaysDifference(r.currentDate,new Date(r.lastBufferDate)),f=f>t?f:t),o=0;o<f+1;o++)h=k.isMobile?r.firstBufferDate:r.currentDate,n=new Date(h),n.setDate(h.getDate()+o),s=new Date(n),s.setDate(n.getDate()+parseInt(r.model.tripLength)),u=n,i=undefined,u.YYYY_MM_DD()===r.selectedPrice.date.YYYY_MM_DD()&&(r.buffer[n.YYYY_MM_DD()]&&r.buffer[n.YYYY_MM_DD()].price?r.selectedPrice.price=r.buffer[n.YYYY_MM_DD()].price:r.selectionError=!0),r.buffer[u.YYYY_MM_DD()]&&(i=r.buffer[u.YYYY_MM_DD()].price,i&&((o<=t||k.isMobile)&&(r.minPrice=Math.min(r.minPrice,i),r.maxPrice=Math.max(r.maxPrice,i)),r.minCalendarPrice=Math.min(r.minCalendarPrice,i))),r.calendarData[u.YYYY_MM_DD()]={departDate:u,returnDate:s,price:i},(o<=t||k.isMobile)&&r.chartData.push({departDate:u,returnDate:s,price:i});k.isMobile?(r.minPrice=Math.min(r.minPrice,r.initialPrice.price),r.maxPrice=Math.max(r.maxPrice,r.initialPrice.price)):(r.minPrice=Math.min(r.minPrice,r.selectedPrice.price),r.maxPrice=Math.max(r.maxPrice,r.selectedPrice.price));r.maxPrice+=Math.round(r.maxPrice*e);ft();window.setTimeout(function(){p.enabled(!0)},0)}function ft(){for(var n=0;n<r.chartData.length;n++)r.chartData[n].price&&(r.chartData[n].ratio=r.chartData[n].price===r.minPrice&&r.chartData[n].price===r.maxPrice?1:r.chartData[n].price/r.maxPrice);r.selectedPrice.ratio=Math.min(r.selectedPrice.price/r.maxPrice,1);k.isMobile&&(r.initialPrice.ratio=Math.min(r.initialPrice.price/r.maxPrice,1))}function et(n){var u,i,f,e;if(n>0){if(u=new Date(r.lastBufferDate),i=new Date(r.currentDate),i.dateAdd("day",t-1),v.isAfter(i,u))return!0}else if(f=new Date(r.firstBufferDate),e=new Date(r.currentDate),v.isBefore(e,f))return!0;return!1}function d(n){if(r.error){r.model.loading=!1;return}var i,u,t=!0;n>0?(i=new Date(r.lastBufferDate),r.currentDate=new Date(r.currentDate.getFullYear(),r.currentDate.getMonth()+1,1),u=new Date(r.currentDate.getFullYear(),r.currentDate.getMonth()+2,1),t=v.isAfter(u,r.lastBufferDate)?!0:!1,t=r.maxForward&&r.maxForward.date?!1:t):(i=new Date(r.firstBufferDate.getTime()),r.currentDate=new Date(r.currentDate.getFullYear(),r.currentDate.getMonth()-1,1),t=v.isBefore(r.currentDate,r.firstBufferDate)&&!moment(new Date).isSame(i,"day"));r.maxForward&&r.maxForward.date&&(r.maxForward.disableForward=v.isAfter(u,r.lastBufferDate)?!0:!1);t?(r.model.loading=!0,l.fetchPrices(moment(i).add(n,"day").format("YYYY-MM-DD"),n,{cache:!0}).success(function(n){n.IsSuccess&&(y(n.LowFareTripResponseList),n.isMaxDateReached&&(r.maxForward={date:r.results[r.results.length-1].DepartDate,disableForward:!0}),a());r.model.loading=!1})):(a(),r.model.loading=!1)}function ot(n){var i=et(n),t;r.moving=!1;r.model.loading=!0;i?(t=n>0?new Date(r.lastBufferDate):new Date(r.firstBufferDate),l.fetchPrices(moment(t).format("YYYY-MM-DD"),n,{cache:!0}).success(function(n){n.IsSuccess&&(y(n.LowFareTripResponseList),a());r.model.loading=!1})):(a(),r.model.loading=!1);r.$apply()}function g(){var f;r.preventLeft=!1;r.preventRight=!1;r.endOfMonthIndex=null;var e=[],n=r.chartData[0].departDate,i={month:n.getMonth(),year:n.getFullYear(),days:1};for(f=1;f<t;f++)n=r.chartData[f].departDate,n.getMonth()!==i.month?(e.push(i),r.endOfMonthIndex=f-1,i={month:n.getMonth(),year:n.getFullYear(),days:1}):i.days++,n<=Date.now()&&(r.preventLeft=!0),v.numDaysDifference(new Date,n)>=u&&(r.preventRight=!0);e.push(i);r.visibleMonths=e}function st(){var n=c.closest(".ha-modal")[0];return n.scrollHeight-n.scrollTop}function nt(){v.numDaysDifference(new Date(r.firstBufferDate),new Date(moment(Date.now()).utc().format("MM/DD/YYYY")))<=1&&(r.preventLeft=!0);v.numDaysDifference(new Date,new Date(r.lastBufferDate))>=u&&(r.preventRight=!0)}function it(){typeof r.legs=="string"&&(r.legs=w.parseLegs(r.legs),r.legs[0].origin.display=r.legs[0].origin.code,r.legs[0].destination.display=r.legs[0].destination.code);r.minPrice=Number.POSITIVE_INFINITY;r.maxPrice=Number.NEGATIVE_INFINITY;r.buffer={};r.visibleMonths=[];r.display=r.display||"calendar";r.maxForward={};r.chartData=[];r.calendarData={};r.currentDate=undefined;r.firstBufferDate=undefined;r.lastBufferDate=undefined;r.visibleMonths=[];r.model={tripLength:r.legs.length===2?moment(r.legs[1].departDate).diff(r.legs[0].departDate,"days"):0,loading:!1};r.tripType=r.legs.length;h.fetch("LowFare.nighttext,LowFare.nightstext").then(function(t){r.nightValues=n.copy(Array(61)).map(function(n,i){return i+" "+t[1]});r.nightValues[0]="0 "+t[0];r.nightValues[1]="1 "+t[0];r.$apply()});ut();r.updatePrices()}r.$on("calendarForward",function(){r.model.loading=!0;d(1)});r.$on("calendarBackward",function(){r.model.loading=!0;d(-1)});r.$watch("model.tripLength",function(n,t){n!==t&&(r.legs[1].departDate=moment(r.legs[0].departDate).add(n,"days").toDate(),r.maxForward={},r.updatePrices())});r.initialLoad=!0;r.$watch("results",function(n){n&&n.length&&(r.initialLoad=!1,p.enabled(!1),y(n),a(),g(),k.isMobile&&nt())});r.updatePrices=function(){r.error=!1;r.model.loading=!0;var n=rt();b(function(){l.fetchInitialPrices({data:n,config:{cache:!0}}).then(function(n){n.IsSuccess?(r.results=n.LowFareTripResponseList,n.isMaxDateReached&&(r.maxForward={date:r.results[r.results.length-1].DepartDate,disableForward:!0})):(r.error=!0,r.results=[]);b(function(){r.model.loading=!1})},50)})};r.move=function(n){if(i||r.error){r.model.loading=!1;return}r.moving=!0;i=!0;r.currentDate.setDate(r.currentDate.getDate()+n);var t=n/Math.abs(n);window.clearTimeout(f);f=window.setTimeout(function(){ot(t)},o);a();g()};r.monthFilter=function(n){return h("LowFare."+s[n])};r.getFlightResultsLink=function(n){var t="/Book/FlightResults?l="+r.legs[0].origin.code+"-"+r.legs[0].destination.code+"+"+moment(n).format("YYYY-MM-DD");return r.legs[1]&&(t+=","+r.legs[1].origin.code+"-"+r.legs[1].destination.code+"+"+moment(n).add(r.model.tripLength,"days").format("YYYY-MM-DD")),r.adults&&(t+="&a="+r.adults),r.children&&(t+="&c="+r.children),t};r.getLowLineStyle=function(){return"calc("+((1-r.selectedPrice.ratio)*100).toString()+"% + 45px)"};r.getBarStyle=function(n){return n.price?((1-n.ratio)*100).toString()+"%":r.model.loading||r.moving?"100%":"-23px"};r.getMonthStyle=function(n,t,i){return t==="width"?(n.days*4).toString()+"%":(i?((1-n.days/25)*100).toString():"0")+"%"};r.getTipStyle=function(n){return n.price?Math.min((1-n.ratio)*100,84).toString()+"%":r.model.loading||r.moving?"100%":"-23px"};r.setDisplay=function(n){r.display=n;it()};r.dayPlus=function(t,i){return n.isDate(t)?new Date(+t).dateAdd("day",i):new Date};r.selectDate=function(n,t){k.isMobile&&(t.preventDefault(),r.calendarData[n.YYYY_MM_DD()]&&b(function(){r.legs[0].departDate=n;r.selectedPrice.date=n;r.selectedPrice.price=r.calendarData[n.YYYY_MM_DD()].price}))};r.moveMobile=function(n){if(r.error||!k.isMobile)return!1;r.model.loading=!0;var t=n>0?new Date(r.lastBufferDate):new Date(r.firstBufferDate);l.fetchPrices(moment(t).format("YYYY-MM-DD"),n,{cache:!0}).success(function(t){var i,u;t.IsSuccess&&(n<0&&(i=st(),b(function(){var n=c.closest(".ha-modal")[0];n.scrollTop=n.scrollHeight-i},0)),y(t.LowFareTripResponseList),a(),u=n>0?"calendarGoForward":"calendarGoBackward",r.$broadcast(u,3));t.isMaxDateReached&&(r.preventRight=!0);nt();b(function(){r.model.loading=!1})})};r.setScrollPos=function(){$("#load-previous-row").length&&($("#FlexiblePriceView")[0].scrollTop=82)};var tt=!0;r.setChartPos=function(){tt&&k.isMobile&&(tt=!1,b(function(){var n=c.find(".selected-price");n.length&&c.closest(".ha-modal").scrollTop(n.offset().top-$(window).height()/2)},0))};it()}}}]);r.animation(".month-animation",function(){return{enter:function(n,t){n.css({opacity:0});n.delay(500).animate({opacity:1},{complete:t})}}});r.animation(".price-item-animation",function(){return{enter:function(n,t){if(n.hasClass("first-item")){var r=n.css("margin-left");return n.css({"margin-left":0}),n.animate({"margin-left":r},{easing:"linear",duration:500,complete:t}),function(){n.css({"margin-left":""});i=!1}}n.animate({"background-color":"transparent"},{duration:500,complete:t})},leave:function(n,t){if(n.animate({"margin-left":0},{easing:"linear",duration:500,complete:t}),n.hasClass("first-item")){var r=n.nextAll(":not(.ng-leave-prepare)").first();return r.css({"margin-left":0}),function(){r.css({"margin-left":""});i=!1}}}}})}(angular),function(n){"use strict";var t=n.module("haVerticalSeatmapModule",[]);t.directive("haVerticalSeatmap",["haVerticalSeatmapService","haConfig","$filter","$timeout","$log","$rootScope","$window",function(n,t,i,r,u,f,e){return{restrict:"A",scope:{},templateUrl:t.getTemplateUrl("VerticalSeatmap/ha-vertical-seatmap.html"),link:function(t){function l(n){var f,i;if(n.type!=="keyup"||n.keyCode===13){var e=$(this),r=e.attr("id"),u=r.split("-");if(r&&u.length){if(f=u[2],i=t.svc.legs[t.svc.activeLegIndex].seatModel.seats[f],i.isUnavailable)return;t.seat=i;t.$emit("seatWasSelectedOrDeselected",i)}}}function a(){var i=$(this),r=i.attr("id"),u=r.split("-"),f=u[2],n=t.svc.legs[t.svc.activeLegIndex].seatModel.seats[f],e=n.isSelected?"#seatPopoverSelected":"#seatPopover";if(n.isFiltered=y(n),t.seat=n,t.isTouchDevice&&n.isSelected){t.$emit("seatWasSelectedOrDeselected",n);return}v(i,e)}function g(){$("#seatPopover").fadeOut("fast");$("#seatPopoverSelected").fadeOut("fast");$("#seatPopoverArrow").fadeOut("fast",function(){if(!t.isTouchDevice||t.seat.isSelected){var n=$("#"+t.svc.activeLegIndex+"-seat-"+t.seat.name),i=t.seat.isSelected?"#seatPopoverSelected":"#seatPopover";v(n,i)}})}function c(){r.cancel(h);$("#seatPopover").hide();$("#seatPopoverSelected").hide();$("#seatPopoverArrow").hide()}function v(n,i){r.cancel(h);h=r(function(){var u=n.find("rect"),f=n.parents(".seatmap"),e=f.width(),o=Number(u.attr("width"))*t.svc.svgScaleFactor,s=$(i).width(),v=$(i).height(),h=e-s,c=Number(u.attr("y"))*t.svc.svgScaleFactor,y=Number(u.attr("x"))*t.svc.svgScaleFactor,p=n.parents("svg").attr("width")*t.svc.svgScaleFactor,w=(e-p)/2,b=f.position().left,l=b+w+y,a=11,r={tooltipTop:c-v-a,tooltipLeft:l+o/2-s/2,arrowTop:c-a,arrowLeft:l+o/2-10};r.tooltipLeft<0&&(r.tooltipLeft=0);r.tooltipLeft>h&&(r.tooltipLeft=h);$(i).show().css({top:r.tooltipTop,left:r.tooltipLeft});$("#seatPopoverArrow").show().css({top:r.arrowTop,left:r.arrowLeft})},250)}function y(n){return n.isStandard&&!t.svc.seatTypeFilters.standard.value||n.isPreferred&&!t.svc.seatTypeFilters.preferred.value||n.isExtraComfort&&!t.svc.seatTypeFilters.extra.value||n.isLieFlat&&!t.svc.seatTypeFilters.flat.value||n.isFirstClass&&!t.svc.seatTypeFilters.first.value||n.isExitRow&&!t.svc.seatTypeFilters.exit.value}function p(n,t,i){var r=$("#"+i+"-seat-"+n),e,s;if(r[0]){var u=r.find("rect"),f=u.attr("orig-fill"),h=y(t);h?(r[0].classList.add("filtered"),r.attr("tabindex")&&(e=r.attr("tabindex"),r.removeAttr("tabindex"),r.attr("restore-tabindex",e))):(r[0].classList.remove("filtered"),r.attr("restore-tabindex")&&(e=r.attr("restore-tabindex"),r.removeAttr("restore-tabindex"),r.attr("tabindex",e)));t.isSelected&&!f&&(r[0].classList.add("hide-text"),t.isLieFlat?(s=r.find("path").attr("fill"),r.find("path").attr("fill",o.darkViolet),r.find("line").attr("stroke","none")):(s=u.attr("fill"),u.attr("fill",o.darkViolet)),u.attr("orig-fill",s),tt(r,n,i));!t.isSelected&&f&&(r.children("[id^=checkmark]").remove(),r[0].classList.remove("hide-text"),t.isLieFlat?(r.find("path").attr("fill",f),r.find("line").attr("stroke",o.stroke)):u.attr("fill",f),u.removeAttr("orig-fill"));t.isSelected&&r[0].classList.remove("filtered")}}function i(n,t){n.attr("name")?n.attr("name",n.attr("name")+","+t):n.attr("name",t)}function nt(n){var v,e,h,y,g,nt,tt,it;if($("#svgSeatmap"+n).find("svg").attr("rendered")){b(n);return}if(v=(new Date).getTime(),$("g[id^=seat]").off(),t.svc.isForSelection)if(f.isMobile)$("g[id^=seat]").on("click",l);else if(t.isTouchDevice)$("g[id^=seat]").on("click keyup",a);else{$("g[id^=seat]").on("click keyup",l);$("g[id^=seat]").hover(a,c)}e=t.svc.legs[n].seatModel;h=0;e.availableFirstClassSeats=0;e.availableExtraComfortSeats=0;e.availablePreferredSeats=0;e.seatsUnavailable?$("#svgSeatmap"+n).find("svg").remove():($("g[id^=seat]").each(function(){var u=$(this),v=u.find("rect"),s=u.attr("id").split("-"),r=s[1],c=parseInt(r,10),f=s[2]?s[2]:"";if(u.attr("id",n+"-seat-"+r),u[0].classList.add("seat"),e.seats[r]||(e.seats[r]={isUnavailable:!0}),t.svc.isForSelection&&!e.seats[r].isUnavailable&&!u.attr("tabindex")){var l=parseInt(r),a=r.match(/[A-Z]/)[0],y=w.indexOf(a),b=100+l*10+y;u.attr({tabindex:b,"aria-label":l+" "+a})}e.seats[r].name=r;e.seats[r].Type=0;f.indexOf("f")>=0&&(i(u,"firstclass"),e.seats[r].isFirstClass=!0);f.indexOf("i")>=0&&(i(u,"lieflat"),e.seats[r].isLieFlat=!0);f.indexOf("x")>=0&&(i(u,"exitrow"),e.seats[r].isExitRow=!0);f.indexOf("a")>=0&&(i(u,"aisle"),e.seats[r].isAisle=!0);f.indexOf("w")>=0&&(i(u,"window"),e.seats[r].isWindow=!0);f.indexOf("e")>=0&&(i(u,"extracomfort"),e.seats[r].isExtraComfort=!0);f.indexOf("p")>=0&&(i(u,"preferred"),e.seats[r].isPreferred=!0);f.indexOf("r")>=0&&(i(u,"rearfacing"),e.seats[r].isRearFacing=!0);f.indexOf("l")>=0&&(i(u,"limitedrecline"),e.seats[r].isLimitedRecline=!0);e.seats[r].isExtraComfort||e.seats[r].isPreferred||e.seats[r].isFirstClass||(i(u,"standard"),e.seats[r].isStandard=!0);e.seats[r].price&&e.seats[r].price>h&&(h=e.seats[r].price);t.svc.legs[n].disableFirstClass&&e.seats[r].isFirstClass&&(e.seats[r].isUnavailable=!0);t.svc.legs[n].disableMainCabin&&!e.seats[r].isFirstClass&&(e.seats[r].isUnavailable=!0);c===4&&t.svc.legs[n].EquipmentName==="Boeing 717"&&t.svc.disableRow4&&(e.seats[r].isUnavailable=!0);c===4&&t.svc.legs[n].EquipmentName==="Boeing 717"&&t.svc.BlockRowFour&&(e.seats[r].isUnavailable=!0);t.svc.disableExitRows&&e.seats[r].isExitRow&&(e.seats[r].isUnavailable=!0);e.disableSeatUpgradeFlx&&(t.svc.disableSeatUpgrades=e.disableSeatUpgradeFlx);t.svc.disableSeatUpgrades&&(e.seats[r].isExtraComfort||e.seats[r].isPreferred)&&(e.seats[r].isUnavailable=!0);e.seats[r].isFirstClass&&(u[0].classList.add("firstClass"),e.hasFirstClass=!0);e.seats[r].isLieFlat&&(u[0].classList.add("lieFlat"),e.hasLieFlats=!0);e.seats[r].isRearFacing&&(e.hasRearFacing=!0);e.seats[r].isExtraComfort&&(u[0].classList.add("extraComfort"),e.hasExtraComfort=!0,e.seats[r].price&&(e.extraComfortPrice=e.seats[r].price));e.seats[r].isPreferred&&(u[0].classList.add("preferred"),e.hasPreferred=!0,e.seats[r].price&&(e.preferredSeatPrice=e.seats[r].price));e.seats[r].isStandard&&u[0].classList.add("standard");e.seats[r].isUnavailable?e.seats[r].isLieFlat?(u.find("line").attr("stroke","none"),u.find("path").attr("fill",o.gray),d(u,7.7)):(v.attr("fill",o.gray),d(u,7)):(u[0].classList.add("available"),e.seats[r].isFirstClass&&e.availableFirstClassSeats++,e.seats[r].isExtraComfort&&(e.availableExtraComfortSeats++,e.seats[r].Type=1),e.seats[r].isPreferred&&(e.availablePreferredSeats++,e.seats[r].Type=2));p(r,e.seats[r],n)}),y=t.svc.legs[n].IsInternational?t.svc.strings.businessclass:t.svc.strings.firstclass,g=$("#heading-firstClass"),k(g,y,s,n),nt=$("#heading-mainCabin"),k(nt,t.svc.strings.maincabin,s,n),tt=(new Date).getTime(),it=tt-v,u.debug("rendered seatmap in "+it+"ms"),$("#svgSeatmap"+n).find("svg").attr({rendered:!0,id:"svg"+n}).removeAttr("data-name").children("title").remove(),f.IsChangeFlightBooking&&t.svc.applyAnyAvailableSeatCredits(n));r(function(){t.$emit("haStickyResize")})}function b(n){var o=(new Date).getTime(),i,r,f,e;for(i in t.svc.legs[n].seatModel.seats)r=t.svc.legs[n].seatModel.seats[i],p(i,r,n);f=(new Date).getTime();e=f-o;u.debug("updated seatmap at index "+n+" in "+e+"ms")}function k(n,t,i,r){var e;if(n[0]){var f=n.find("text"),u=f.attr("transform"),o=u.substr(u.indexOf("(")+1,u.length-u.indexOf("(")-2),s=o.split(" "),h=Number($("#svgSeatmap"+r).find("svg").attr("width")),c=h/2,l=Number(s[1]);f.removeAttr("font-family letter-spacing");f.attr({transform:"translate("+c+" "+l+")","text-anchor":"middle","class":i}).text(t);e=n.attr("id");n.attr("id",r+"-"+e)}}function tt(n,t,i){if(!$("#checkmark"+t)[0]){var r=document.createElementNS("http://www.w3.org/2000/svg","path"),o=Number(n.find("rect").attr("x")),s=Number(n.find("rect").attr("y")),h=Number(n.find("rect").attr("width")),e=(h-34)/2,u=o+29,f=s+10,c="M"+u+","+f,l=u-15.134,a=f+8.498,v="L"+l+","+a,y=u+.459,p=f+.677,w=u+.303,b=f+.305,k="C"+y+","+p+","+w+","+b+","+u+","+f+"z",d=c+"l-2.217-2.217c-0.307-0.306-0.676-0.457-1.111-0.457c-0.438,0-0.801,0.151-1.107,0.457"+v+"l-4.792-4.812c-0.305-0.305-0.674-0.455-1.109-0.455c-0.434,0-0.803,0.15-1.107,0.455l-2.218,2.218c-0.306,0.306-0.457,0.675-0.457,1.109s0.151,0.804,0.457,1.11l8.12,8.118c0.306,0.306,0.675,0.456,1.109,0.456c0.434,0,0.804-0.15,1.108-0.456l14.022-14.021c0.303-0.305,0.459-0.674,0.459-1.109"+k;r.setAttribute("fill","#fff");r.setAttribute("d",d);r.setAttribute("id","checkmark"+i+"-"+t);r.setAttribute("transform","translate("+e+","+e+")");n[0].appendChild(r)}}function d(n,t){var i=document.createElementNS("http://www.w3.org/2000/svg","line"),r=document.createElementNS("http://www.w3.org/2000/svg","line"),u=Number(n.find("rect").attr("x")),f=Number(n.find("rect").attr("y")),s=Number(n.find("rect").attr("width")),e=s-t;i.setAttribute("x1",u+t);i.setAttribute("y1",f+t);i.setAttribute("x2",u+e);i.setAttribute("y2",f+e);r.setAttribute("x1",u+e);r.setAttribute("y1",f+t);r.setAttribute("x2",u+t);r.setAttribute("y2",f+e);i.setAttribute("stroke",o.stroke);r.setAttribute("stroke",o.stroke);i.setAttribute("stroke-linecap","round");r.setAttribute("stroke-linecap","round");n[0].appendChild(i);n[0].appendChild(r)}var o,h,s,w;t.svc=n;t.seat={};t.isTouchDevice=!1;f.isMobile||(t.isTouchDevice=Boolean(navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)));o={gray:"#D0D0D0",darkViolet:"#4D2E91",stroke:"#3C3C34"};s="header-uppercase-7";(f.$switch("Global:EnableVIC")||f.vicilicious)&&(s="medium-titlecase-3");t.$on("renderSeatmapAtIndex",function(n,t){nt(t)});t.$on("updateSeatmapAtIndex",function(n,t){b(t)});t.$on("cancelTooltip",c);t.$on("refreshSeatmapTooltip",g);e.addEventListener("orientationchange",function(){u.debug("orientation change");f.$broadcast("cancelTooltip")});t.calculateSeatDisplayCost=function(n){var i=n.price,r=t.svc.passengers[t.svc.selectedPassengerIndex].Seats[t.svc.activeLegIndex],u=t.svc.legs[t.svc.activeLegIndex].SelectedFareClass;return r.originalSeat&&r.originalSeat.credit>0?i-=r.originalSeat.credit:n.Type>0&&/coach/gi.test(u)||(i-=n.price),n.SeatAmountDisplay=i,i};t.hideTooltip=function(){c()};w=["A","B","C","D","E","F","G","H","J"]}}}])}(angular);"document"in self&&("classList"in document.createElement("_")&&(!document.createElementNS||"classList"in document.createElementNS("http://www.w3.org/2000/svg","g"))?function(){"use strict";var n=document.createElement("_"),t,i;n.classList.add("c1","c2");n.classList.contains("c2")||(t=function(n){var t=DOMTokenList.prototype[n];DOMTokenList.prototype[n]=function(n){for(var r=arguments.length,i=0;i<r;i++)n=arguments[i],t.call(this,n)}},t("add"),t("remove"));n.classList.toggle("c3",!1);n.classList.contains("c3")&&(i=DOMTokenList.prototype.toggle,DOMTokenList.prototype.toggle=function(n,t){return 1 in arguments&&!this.contains(n)==!t?t:i.call(this,n)});n=null}():function(n){"use strict";var f;if("Element"in n){var e="classList",t="prototype",o=n.Element[t],r=Object,l=String[t].trim||function(){return this.replace(/^\s+|\s+$/g,"")},a=Array[t].indexOf||function(n){for(var t=0,i=this.length;t<i;t++)if(t in this&&this[t]===n)return t;return-1},s=function(n,t){this.name=n;this.code=DOMException[n];this.message=t},u=function(n,t){if(t==="")throw new s("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new s("INVALID_CHARACTER_ERR","String contains an invalid character");return a.call(n,t)},h=function(n){for(var i=l.call(n.getAttribute("class")||""),r=i?i.split(/\s+/):[],t=0,u=r.length;t<u;t++)this.push(r[t]);this._updateClassName=function(){n.setAttribute("class",this.toString())}},i=h[t]=[],c=function(){return new h(this)};if(s[t]=Error[t],i.item=function(n){return this[n]||null},i.contains=function(n){return n+="",u(this,n)!==-1},i.add=function(){var t=arguments,i=0,f=t.length,n,r=!1;do n=t[i]+"",u(this,n)===-1&&(this.push(n),r=!0);while(++i<f);r&&this._updateClassName()},i.remove=function(){var i=arguments,r=0,e=i.length,t,f=!1,n;do for(t=i[r]+"",n=u(this,t);n!==-1;)this.splice(n,1),f=!0,n=u(this,t);while(++r<e);f&&this._updateClassName()},i.toggle=function(n,t){n+="";var i=this.contains(n),r=i?t!==!0&&"remove":t!==!1&&"add";return r&&this[r](n),t===!0||t===!1?t:!i},i.toString=function(){return this.join(" ")},r.defineProperty){f={get:c,enumerable:!0,configurable:!0};try{r.defineProperty(o,e,f)}catch(v){v.number===-2146823252&&(f.enumerable=!1,r.defineProperty(o,e,f))}}else r[t].__defineGetter__&&o.__defineGetter__(e,c)}}(self)),function(n){"use strict";var t=n.module("haVerticalSeatSelectionModule",["ui.router","ui.bootstrap","ngSanitize","haSeatMapAPI"]),i=location.hash.toLowerCase().indexOf("upgraded")>-1;(location.pathname.toLowerCase().indexOf("/book/inflightoptions")>-1||location.pathname.toLowerCase().indexOf("/uidocs/demo/verticalseatmap")>-1||location.pathname.toLowerCase().indexOf("/my-account/my-trips/select-or-upgrade-seats")>-1)&&t.config(["$stateProvider","$urlRouterProvider",function(n,t){n.state("index",{url:"/flight/:flightId"});t.otherwise("/flight/1")}]);t.directive("haVerticalSeatSelection",["$rootScope","haGlobals","haVerticalSeatmapService","$timeout","haConfig","$state","$stateParams","haSeatMapAPI","$log","haModal","$window","haSitecoreStrings","$interval","$filter",function(t,r,u,f,e,o,s,h,c,l,a,v,y,p){return{restrict:"A",scope:{},templateUrl:e.getTemplateUrl("VerticalSeatmap/ha-vertical-seat-selection.html"),link:function(e,v,w){function it(){for(var t=[],n,r=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),i=0;i<r.length;i++)n=r[i].split("="),t.push(n[0]),t[n[0]]=n[1];return t}function g(i){if(u.disallowAdvanceSeatSelection(e.svc.legs[i],e.$switch("InFlightOptionsInfo:EnableFAARestriction"),"ppg",e.svc))return u.setFAARestriction(e.svc.legs[e.svc.activeLegIndex],e.svc);e.svc.legs[i].IsCodeShare||(e.svc.legs[i].error=null,e.svc.legs[i].promise||(e.svc.legs[i].promise=e.svc.getAvailableSeatsForLeg(i)),e.svc.legs[i].promise.then(function(){e.svc.loadSvgSeatmapForLeg(i).then(function(){var r,u,f;ht();ft();r=e.svc.legs[i].SelectedFareClass;(r==="first"||r==="business")&&e.svc.legs[i].EquipmentCode!=="AT5"&&(st(),e.IsChangeFlightBooking||(e.svc.legs[i].disableMainCabin=!0));r!=="first"&&r!=="business"&&(e.svc.isChangeSeats?(e.svc.legs[i].disableFirstClass=!0,ut()):t.PassengerTripSummary&&(t.PassengerTripSummary.SelectedPromo!==null||t.PassengerTripSummary.BookingType>0||t.PassengerTripSummary.MilesPurchaseDetails!==null||t.PassengerTripSummary.SelectedHotel!==null)&&(e.svc.legs[i].disableFirstClass=!0,ut()));n.forEach(e.svc.passengers,function(n){n.Seats[i].SeatLocation&&(e.svc.legs[i].seatModel.seats[n.Seats[i].SeatLocation]={price:n.Seats[i].SeatAmount,isSelected:!0,pax:n},n.Seats[i].SeatAmount>0&&(n.Seats[i].SurchargeOk=!0),e.svc.includeSeatNumber=!0)});e.svc.legs[i].resolved||(e.svc.legs[i].resolved=!0,t.$broadcast("legResolvedAtIndex",i));e.$broadcast("renderSeatmapAtIndex",i);nt();e.$emit("haStickyResize");t.isMobile&&(u=$("#svgSeatmap"+i).find("svg"),u.attr("scaled")||(f=y(function(){if($("#svgSeatmap"+i).outerWidth()>100){y.cancel(f);var t=parseFloat(u.attr("width")),r=parseFloat(u.attr("height")),o=$("#svgSeatmap"+i).outerWidth(),n=o/t,s=n*r;c.debug("svg scale factor:",n);e.svc.svgScaleFactor=n;u.attr({height:s,scaled:!0})}},50)))},rt)},rt))}function rt(n){e.svc.legs[e.svc.activeLegIndex].resolved=!0;e.svc.legs[e.svc.activeLegIndex].error=n;c.error(n)}function ft(){e.svc.legs&&e.svc.legs.length&&!e.upgradeSeatAvailable&&e.svc.legs.forEach(function(n){if(typeof n.seatModel!="undefined"&&typeof n.seatModel.seats!="undefined")for(var t in n.seatModel.seats)if(n.seatModel.seats[t].price>0){e.upgradeSeatAvailable=!0;break}})}function et(n){return n.isStandard?"coach":n.isPreferred?"preferred":n.isExtraComfort?"extracomfort":n.isFirstClass?"first":void 0}function nt(){f(function(){e.svc.seatChargeSubtotals[e.svc.activeLegIndex]=0;n.forEach(e.svc.passengers,function(n){var t=n.Seats[e.svc.activeLegIndex],i=t.SeatAmount,r=e.svc.legs[e.svc.activeLegIndex].SelectedFareClass;t.originalSeat&&t.originalSeat.credit>0?i-=t.originalSeat.credit:t.IsUpgrade==null||t.IsUpgrade||(i-=t.SeatAmount);t.SeatAmountDisplay=i;e.svc.seatChargeSubtotals[e.svc.activeLegIndex]+=i})},0)}function ot(){e.svc.selectedPassengerIndex===e.svc.passengers.length-1?e.svc.selectedPassengerIndex=0:e.svc.selectedPassengerIndex++}function ut(){for(var n in e.svc.seatTypeFilters)n==="first"&&(e.svc.seatTypeFilters[n].value=!1)}function st(){for(var n in e.svc.seatTypeFilters)(n==="standard"||n==="extra"||n==="preferred")&&(e.svc.seatTypeFilters[n].value=!1)}function ht(){for(var n in e.svc.seatTypeFilters)e.svc.seatTypeFilters[n].value=!0}var tt,d,b,k;e.upgradedToMainCabin=i&&!t.IsMainCabinUpgradeAvailable;e.standalone=typeof w.standalone=="string";tt=typeof w.disableRouting=="string";d="mcbSeatMapModal";tt&&(e.$on("$stateNotFound",function(n,t){n.preventDefault();o.go(t.to,t.toParams)}),o={go:function(n,t){if(n!=="index"||!t)throw"Invalid call to mock $state.go with disabledRouting set.";s=t;e.$broadcast("$stateChangeSuccess")}},s={flightId:1});e.svc=u;e.entertaimentTooltipVisible=!1;e.inFlightEntertainmentInfo=null;e.inFlightEntertainmentAvailable=null;t.adultPresent={PaxType:0};e.upgradeSeatAvailable=!1;e.MainCabinPriceDifference=t.MainCabinPriceDifference;e.upgradeToMainCabin=function(){e.svc.upgradeToMainCabin().then(function(){document.body.dispatchEvent(new CustomEvent("UpgradeToMainCabin",{detail:{pageName:window.digitalData.page.pageInfo.name+":"+d}}));a.location.href=a.location.pathname+"?#upgraded"})};r("HA",function(n){n&&n.SCStrings&&n.SCStrings.entertainment_data&&(e.inFlightEntertainmentInfo=n.SCStrings.entertainment_data);t.IsMainCabinUpgradeAvailable&&l({id:d,templateUrl:"/Templates/VerticalSeatmap/ha-seatmap-MCB-upgrade.html",backdrop:"true",modalLock:!0,size:"modal-md",scope:e})});it().user&&(e.svc.selectedPassengerIndex=+it().user.replace(/\/#\/flight\/./,""));t.PassengerTripSummary&&(t.adultPresent=p("filter")(t.PassengerTripSummary.Passengers,{PaxType:0})[0]);window.sessionStorage.getItem("haMinor")&&window.sessionStorage.getItem("haMinor")!=="false"&&(t.adultPresent={PaxType:1});e.fareRulesLink=a.fareRulesLink;e.showSeatingFilters=!1;e.svc.getFlightVM();e.checkIFE=function(n){var t,i,r;if(!n)return!1;if(t=!1,e.inFlightEntertainmentInfo!==undefined&&e.inFlightEntertainmentInfo.airplanes.length)for(i=0;i<e.inFlightEntertainmentInfo.airplanes.length;i++)r=e.inFlightEntertainmentInfo.airplanes[i],r["airplane name"].toLowerCase()===n.toLowerCase()&&(t=!0);return t&&(e.inFlightEntertainmentAvailable=t),t};e.$watch("svc.pageLoading",function(){if(e.svc.pageLoading===!1)if(e.svc.activeLegIndex=s.flightId-1,e.svc.legs&&e.svc.legs.length){if(!e.svc.legs[e.svc.activeLegIndex]){o.go("index",{flightId:1});return}e.inFlightEntertainmentInfo===null?e.svc.loadIFE().then(function(n){e.inFlightEntertainmentInfo=n[0];g(e.svc.activeLegIndex)}):g(e.svc.activeLegIndex);e.svc.legs[e.svc.activeLegIndex].IsCodeShare&&e.svc.getNextLeg()}else e.svc.handleError("Missing leg data for flights.")});e.$on("$stateChangeSuccess",function(){!e.svc.pageLoading&&s.flightId-1!==e.svc.activeLegIndex&&e.svc.legs[s.flightId-1]&&(e.$broadcast("cancelTooltip"),e.svc.activeLegIndex=s.flightId-1,t.$broadcast("seatSelectionLegChanged"),g(e.svc.activeLegIndex),document.documentElement.scrollTop=document.body.scrollTop=0)});e.$on("seatWasSelectedOrDeselected",function(n,t){e.selectSeat(t);e.svc.includeSeatNumber=!0});b=!1;e.assignSeat=function(){e.$emit("closeModal");b=!1;var i=e.seat,u=e.svc.passengers[e.svc.selectedPassengerIndex],n=u.Seats[e.svc.activeLegIndex],r=e.svc.legs[e.svc.activeLegIndex].SelectedFareClass;n.SeatLocation&&(e.svc.legs[e.svc.activeLegIndex].seatModel.seats[n.SeatLocation].isSelected=!1);i.isSelected=!0;n.SeatLocation=i.name;n.SeatAmount=i.price;n.Type=i.Type;n.originalSeat&&(n.originalSeat.isChanged=!1);i.pax=u;n.IsUpgrade=i.Type>0&&/coach/gi.test(r);n.isSurcharge=i.Type===1&&r!=="extracomfort"||i.Type===2&&r!=="preferred"?!0:!1;t.$broadcast("ancelaryStateChange");t.$broadcast("refreshSeatmapTooltip");e.$broadcast("updateSeatmapAtIndex",e.svc.activeLegIndex);ot();nt()};e.selectSeat=function(i){var o=e.svc.passengers[e.svc.selectedPassengerIndex],r=o.Seats[e.svc.activeLegIndex],u;if(u=typeof r.SeatLocation=="undefined"||r.SeatLocation===null||r.SeatLocation.length===0?e.svc.legs[e.svc.activeLegIndex].SelectedFareClass:et(e.svc.legs[e.svc.activeLegIndex].seatModel.seats[r.SeatLocation]),i.isSelected)delete i.pax,b=!1,n.forEach(e.svc.passengers,function(n,r){if(n.Seats[e.svc.activeLegIndex].SeatLocation&&n.Seats[e.svc.activeLegIndex].SeatLocation===i.name){i.isSelected=!1;n.Seats[e.svc.activeLegIndex].SeatLocation=null;n.Seats[e.svc.activeLegIndex].SeatAmount=null;n.Seats[e.svc.activeLegIndex].Type=0;e.svc.selectedPassengerIndex=r;t.$broadcast("ancelaryStateChange");t.isMobile?e.$broadcast("cancelTooltip"):t.$broadcast("refreshSeatmapTooltip");e.$broadcast("updateSeatmapAtIndex",e.svc.activeLegIndex);nt();return}});else{if(i.isFirstClass&&u!=="first"&&u!=="business"){f(function(){l({id:"ConfirmUpgradeModal",backdrop:"true",templateUrl:"/upgradeToFirstModal.html",scope:e})});return}if(!r.SurchargeOk&&(!e.svc.isChangeSeats&&i.isExtraComfort&&(u!=="extracomfort"||r.DowngradeOk)||i.isPreferred&&(u!=="preferred"||r.DowngradeOk)||r.originalSeat&&r.originalSeat.price<i.price&&!r.originalSeat.isChanged||e.svc.isChangeSeats&&i.isExtraComfort&&!r.originalSeat)){e.seat=i;f(function(){l({id:"ConfirmUpgradeModal",backdrop:"true",templateUrl:"/upgradeSeatModal.html",scope:e})});return}if(!r.DowngradeOk&&u!=="first"&&(u==="extracomfort"&&e.svc.legs[e.svc.activeLegIndex].seatModel.availableExtraComfortSeats>0&&!i.isExtraComfort||u==="preferred"&&e.svc.legs[e.svc.activeLegIndex].seatModel.availablePreferredSeats>0&&!i.isPreferred||r.originalSeat&&r.originalSeat.price>i.price&&!r.originalSeat.isChanged)){if(e.seat=i,e.originalSeat=r.originalSeat,i.isExtraComfort){if(!r.DifferenceOk){f(function(){l({id:"ConfirmDowngradeModal",backdrop:"true",templateUrl:"/differenceSeatModal.html",scope:e})});return}}else{f(function(){l({id:"ConfirmDowngradeModal",backdrop:"true",templateUrl:"/downgradeSeatModal.html",scope:e})});return}if(!r.DifferenceOk)return}if(i.isExitRow&&!r.ExitOk){e.seat=i;f(function(){l({id:"ConfirmExitRowModal",backdrop:"true",template:n.element(".confirmExitRowModal"),scope:e})});return}t.isMobile?b?e.assignSeat():(i.charge=0,(i.Type===1&&u!=="extracomfort"||i.Type===2&&u!=="preferred")&&(i.charge=i.price),e.seat=i,f(function(){l({id:"ConfirmSelectionMobileModal",backdrop:"true",templateUrl:"/confirmSelectionMobileModal.html",scope:e})})):(e.seat=i,e.assignSeat())}};e.seatsChanged=function(){var t=!1;return n.forEach(e.svc.passengers,function(i,r){n.forEach(i.Seats,function(n,i){n.SeatLocation&&n.SeatLocation!==e.svc.passengersInitial[r].Seats[i].SeatLocation&&(t=!0)})}),t};e.confirmUpgrade=function(){e.$emit("closeModal");e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].DowngradeOk=!1;e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].SurchargeOk=!0;e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].originalSeat&&(e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].originalSeat.isChanged=!0);b=!0;e.selectSeat(e.seat);var n="";e.seat.isExtraComfort?n="extracomfort":e.seat.isPreferred&&(n="preferred");document.body.dispatchEvent(new CustomEvent("UpgradeSeatSelected",{detail:{seatType:n}}))};e.confirmDowngrade=function(){e.$emit("closeModal");e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].DowngradeOk=!0;e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].SurchargeOk=!1;e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].originalSeat&&(e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].originalSeat.isChanged=!0);b=!0;e.selectSeat(e.seat)};e.confirmDifference=function(){t.PassengerTripSummary&&e.seat.Type>0&&e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].DowngradeOk&&(t.PassengerTripSummary.Passengers[e.svc.selectedPassengerIndex].PremiumSeatAmount+=e.seat.price);var n=e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].SeatAmount;t.PassengerTripSummary&&(t.PassengerTripSummary.Passengers[e.svc.selectedPassengerIndex].PremiumSeatAmount-=n);e.$emit("closeModal");e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].SurchargeOk=!0;e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].DifferenceOk=!0;e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].originalSeat&&(e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].originalSeat.isChanged=!0);b=!0;e.selectSeat(e.seat)};e.confirmExitRow=function(){e.$emit("closeModal");e.svc.passengers[e.svc.selectedPassengerIndex].Seats[e.svc.activeLegIndex].ExitOk=!0;e.selectSeat(e.seat)};e.scrollToTop=function(){var n=$("#SeatSelection").length?"#SeatSelection":"body",t=$(n).offset().top;$("body, html").animate({scrollTop:t},"fast")};e.paxHaveSeatsForLegCount=function(){for(var t=0,n=0,i=e.svc.passengers.length;n<i;n++)e.svc.passengers[n].Seats[e.svc.activeLegIndex].SeatLocation&&t++;return t};e.$watch("svc.seatTypeFilters",function(){e.$broadcast("updateSeatmapAtIndex",e.svc.activeLegIndex)},!0);e.$watch("svc.rangeFilter",function(){e.$broadcast("updateSeatmapAtIndex",e.svc.activeLegIndex)},!0);e.submitStandalone=function(){if(!e.seatsChanged()){e.cancelStandalone();return}var i={};n.forEach(e.svc.legs,function(t,r){var u=[];n.forEach(e.svc.passengers,function(n){u.push({id:n.TravelerID||n.ID,seat:n.Seats[r].SeatLocation,amount:n.Seats[r].SeatAmount})});i[t.id]=u});t.$broadcast("$standaloneVerticalSeatmapSubmit",i)};e.cancelStandalone=function(){t.$broadcast("$standaloneVerticalSeatmapCancel")};e.cancelSeatChange=function(){a.location.href="/my-account/my-trips/itinerary-details"};e.submitSeatSelection=function(i){if(e.svc.setIFE(e.inFlightEntertainmentAvailable).then($.noop,$.noop),!i&&e.svc.activeLegIndex!==e.svc.legs.length-1){e.svc.selectedPassengerIndex=0;o.go("index",{flightId:e.svc.activeLegIndex+2});return}if(e.standalone){e.submitStandalone();return}i||(e.submitting=!0);var r=e.svc.createSeatsPostObject();e.svc.setUpgradableSeat(e.upgradeSeatAvailable).finally(function(){e.svc.isChangeSeats?(delete r.InFlightOptions,delete r.TotalPremiumSeatAmount,h.ValidateEditSeatFareDifference(r).success(function(t){c.debug("validate seat fare diff result",t);switch(t){case 1:n.element("#seatMapForm").submit();break;case 2:case 3:h.ConfirmEditSeatsService(r).success(function(t){c.debug("confirm edit seats service response",t);n.element("#seatMapForm").submit()}).error(function(n){e.svc.handleError(n);e.submitting=!1});break;case 4:e.svc.handleError(noSeatChangeErrorText);e.submitting=!1;break;default:e.svc.handleError("Unhandled result for ValidateEditSeatFareDifference request: "+t);e.submitting=!1}}).error(function(n){e.svc.handleError(n);e.submitting=!1})):t.IsChangeFlightBooking?h.UpdateChangeFlightInflightoptions(r,JSON.stringify(r)).success(function(){n.element("#seatMapForm").submit()}).error(function(){n.element("#seatMapForm").submit()}):h.UpdateInflightOptionsService(r,JSON.stringify(r)).success(function(){window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("Alnz_Quote_Rq",1);n.element("#seatMapForm").submit()}).error(function(n){e.svc.handleError(n);e.submitting=!1})})};k=$("body");e.upgradeTracking=function(n,t){var i="";return n!="EXTRACOMFORT"||k.data("UpgradeSeatOffered")&&k.data("UpgradeSeatOffered")===t||(i="extracomfort"),n!="PREFERREDSEAT"||k.data("UpgradeSeatOffered")&&k.data("UpgradeSeatOffered")===t||(i="preferred"),i&&(k.data("UpgradeSeatOffered",t),document.body.dispatchEvent(new CustomEvent("UpgradeSeatOffered",{detail:{seatType:i}}))),!0}}}}]);t.controller("haInFlightOptionsController",["$scope","haGlobals","$rootScope","haPassengersService","$timeout","haVerticalSeatmapService",function(t,i,r,u,f,e){i("InFlightVM",function(n){$.extend(r,n)});i("infantlap",function(n){r.infantLapList=n});i("groupPNRSelectedPax",function(n){r.groupPNRSelectedPax=n});var o=!0;r.TripSummary&&(n.forEach(r.TripSummary.Passengers,function(n){var t="Adult";if(n.ActualPaxTypeSelected?t=n.ActualPaxTypeSelected:n.Type&&(t=n.Type),r.IsChangeFlightBooking)switch(n.PaxFareCode){case"ADT":t="Adult";break;case"CHD":t="Child";break;default:t="Adult"}u.add({type:t,isUser:o,FirstName:n.FirstName,LastName:n.LastName,AvatarUrl:n.AvatarImage,Id:n.TravelerAssociationID});o===!0&&(o=!1)}),t.selectedSegments=[],n.forEach(r.TripSummary.Trips,function(n){var i=n.Flights[0],r;for(i.IsMileagePricing=n.IsMileagePricing,r=0;r<i.AvailBookingFares.length;r++)i.selectedSeatClass=i.AvailBookingFares[r].Name,i[i.selectedSeatClass]=i.AvailBookingFares[r];t.selectedSegments.push(i)}),t.$on("ancelaryStateChange",function(){t.seatSelection=e.createSeatsPostObject();r.TripSummary.TotalPremiumSeatAmount=t.seatSelection.TotalPremiumSeatAmount}))}])}(angular),function(n){"use strict";var t=n.module("haKisaTermsModule",[]);t.directive("haKisaTermsCheckboxLaunch",["$window","$rootScope","haConfig","haModal",function(n,t,i,r){return{restrict:"A",scope:!1,link:function(u,f,e){var o=e.contentVar||"termsAndConditions";e.ngModel&&(t.$on("termsModalFailure",function(n,t){t===o&&u.$eval(e.ngModel+" = false")}),t.$on("termsModalSuccess",function(n,t){t===o&&u.$eval(e.ngModel+" = true")}));n[o]&&n[o].ParentCheckBoxText&&f.after('<label for="'+e.id+'" class="required">'+n[o].ParentCheckBoxText+"<\/label>");u.termsStart=function(){n[o]&&(t.$broadcast("termsModalStart",o),r(i.getTemplateUrl("ha-kisa-terms-modal.html"),{id:"kisaTermsModal",backdrop:!0,modalLock:!0,scope:u,extendScope:{scContent:n[o],termsName:o}}))}}}}]);t.directive("haKisaTermsModal",["$rootScope","haConfig","haModal",function(n){return{restrict:"A",scope:!1,link:function(t){n[t.termsName]=n[t.termsName]||{allAccepted:!1,themes:t.scContent.PrivacyPolicies};t.terms=n[t.termsName];t.termsToggleAll=function(){var n;n=t.terms.allAccepted?!0:!1;t.terms.themes.forEach(function(t){t.accepted=n})};t.termsToggleTheme=function(n){t.terms.themes[n].accepted||(t.terms.allAccepted=!1)};t.cancelTerms=function(){n.$broadcast("termsModalFailure",t.termsName);t.$modalCancel()};t.submitTerms=function(){n.$broadcast("termsModalSuccess",t.termsName);t.$modalSuccess()}}}}])}(angular),function(n){"use strict";var t;try{t=n.module("haFormNativeappLinkSmsModule")}catch(i){t=n.module("haFormNativeappLinkSmsModule",["haHttpService","haGeoDataModule"])}t.directive("haFormNativeappLinkSms",["$q","haGlobals","haHttpService","haGeoDataSvc",function(t,i,r,u){var f=function(t,f,e){t.IsCountryDataReady=!1;u.getCountries().then(function(i){t.countries=i;n.extend(t,{countryCodeData:u.getPhoneCountryCodes()});t.phoneRegexByCC=function(n){var t=u.lookupCountryByCode(n);return t!=null?u.getPhoneNumberRegex(t.Key):/.*/};t.phoneCountryCodeByCC=function(n){var i=t.countries.filter(function(t){if(t.IsoCode===n)return t});return i.length===1?i[0].PhoneCountryCode:""};t.IsCountryDataReady=!0},function(){!t.form||$(t.form).hide()});$(document).ready(function(){t.isModal||(t.form=$("#"+e.formName),t.msgSent=f.find(".msgSent"),t.msgFailed=f.find(".msgFailed"))});t.recipient={};t.recipient.CountryCode="USA";i("defaultCountryCode",function(n){t.recipient.CountryCode=n});t.recipient.Number="";t.formNativeappLinkSmsSubmit=function(){t.isModal&&!t.form&&(t.form=$("#"+e.formName),t.msgSent=f.find(".msgSentModal"),t.msgFailed=f.find(".msgFailedModal"));t.sendSmsRequest().success(function(){$(t.msgSent).fadeIn("slow");setTimeout(function(){$(t.msgSent).fadeOut("slow")},5e3);t.isSubmitted=!1}).error(function(){$(t.msgFailed).fadeIn("slow");setTimeout(function(){$(t.msgFailed).fadeOut("slow")},5e3);t.isSubmitted=!1})};t.isSubmitted=!1;t.sendSmsRequest=function(){t.isSubmitted=!0;var n=t.form[0].elements,i="+"+$(n.PhoneCountryCode).val()+$(n.PhoneNumber).val().replace(/\D/g,""),u=$(n.area).val();return r.POST("/api/v2/shared/TextAppLink",{phone:i,area:u})}};return{restrict:"A",scope:!0,link:f}}])}(angular),function(n){"use strict";var t=n.module("haNativeAppModalModule",[]);t.directive("haNativeAppModal",["$location","$rootScope","haGlobals","haUtils",function(t,i,r,u){var f=function(t){r("daysToHide",function(n){if(!n){t.daysToHide=0;return}if(n<0){t.daysToHide=0;return}t.daysToHide=n});t.createModalHideExpirationCookie=function(n){var i=new Date,r,u;!n||(i=new Date(n));r=new Date;r.setTime(i.getTime()+t.daysToHide.toString()*864e5);u="expires="+r.toUTCString();document.cookie=HA.CookiesRequireSsl?["ModalHideExpirationCookie="+i.toUTCString()+"; ",u,"; secure; ","; path=/"].join(""):["ModalHideExpirationCookie="+i.toUTCString()+"; ",u,"; path=/"].join("")};t.getModalHideExpirationCookie=function(){var n="",t=u.readCookie("ModalHideExpirationCookie");return!t||(n=decodeURIComponent(t)),n};t.removeModalHideExpirationCookie=function(){document.cookie=encodeURIComponent("ModalHideExpirationCookie")+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain=; path="};$(window).load(function(){var i,u,f,e,o;if(r("defaultCountryCode",function(n){n!=="USA"}),i="",i=t.getModalHideExpirationCookie(),i!==""&&i!=="Invalid Date"){if(u=i,f=(new Date).toUTCString(),t.createModalHideExpirationCookie(u),e=moment(u).isValid()?moment(u):moment(),o=moment(f).isValid()?moment(f):moment(),t.daysToHide>o.diff(e,"days"))return;haModal({id:"modal-nativeapp-link-sms",backdrop:"true",template:n.element("#modal-nativeapp-link-sms"),scope:t})}else haModal({id:"modal-nativeapp-link-sms",backdrop:"true",template:n.element("#modal-nativeapp-link-sms"),scope:t,cancel:{label:"Close",fn:t.createModalHideExpirationCookie}})})};return{restrict:"A",scope:!0,link:f}}])}(angular),function(n){"use strict";var r=n.module("haUpsellGridModule",[]),i=["717","321","332"],u={COACH:"UpsellGrid.maincabintext",EXTRACOMFORT:"UpsellGrid.extracomforttext",FIRST:"UpsellGrid.firstclasstext",BUSINESS:"UpsellGrid.businessclasstext",PREFERRED:"UpsellGrid.preferredseatstext"},t={DEPARTING:0,RETURNING:1,BOTH:2};r.directive("haUpsellGrid",["haGlobals","haConfig","haSitecoreStrings",function(n,r,f){var e=["$scope",function(n){var r,e;n.OPTION_TYPE_MAP=t;n.gridDetails=n.UpsellGrid.UpSellGridDetails;n.pst=n.PassengerTripSummary;n.originCode=n.pst.AvailGridTrips[0].Origin;n.destinationCode=n.pst.AvailGridTrips[0].Destination;n.trips=[];n.hideCoach=function(){return n.gridDetails.UpsellStaticRules.InboundSelectedBrand==="MAINCABINBASIC"&&n.trips[2]===!1&&n.trips.indexOf("COACH")!==-1};n.brandAlreadySelected=function(i,r){var f,u;if(r.OptionType==="BOTH"&&(n.trips[2]===i.BrandType||i.ShowDepartingFlight||i.ShowReturningFlight))return!1;for(f=t[r.OptionType],u=0;u<n.trips.length;u++)if(u!==f&&n.trips[u]&&i.BrandType===n.trips[u])return!0;return!1};n.isChecked=function(i,r,u){return n.trips[t[u.OptionType]]===r&&(!n.brandAlreadySelected(i,u)||u.OptionType=="BOTH")};n.brandKeyPress=function(t,i,r,u){u.keyCode===32&&(u.preventDefault(),n.makeSelection(t,i,r))};n.getBrandFromBrandType=function(t){return n.gridDetails.UpsellStaticRules.UpsellOptions.filter(function(n){return n.BrandType===t})[0]};n.makeSelection=function(t,i,r,u){var f,o,s,e,h;r.IsAvailable&&((f=n.isChecked(t,i,r),u&&(o=$(u.target)),f&&o&&!o.is("label"))||(r.OptionType==="DEPARTING"||r.OptionType==="RETURNING"?(s=r.OptionType==="DEPARTING"?0:1,e=r.OptionType==="DEPARTING"?1:0,n.trips[s]=f?!1:i,h=n.trips[2]&&n.getBrandFromBrandType(n.trips[2]).Options.length===1?n.trips[2]:!1,n.selectSeatClass(t.BrandType,s),n.gridDetails.UpsellStaticRules.InboundSelectedBrand==="MAINCABINBASIC"?(n.trips[e]=f?!1:"COACH",n.trips[2]!=="COACH"&&n.selectSeatClass("COACH",e)):h&&n.selectSeatClass(h,e),n.trips[2]=!1):(t.Options&&t.Options.length===1&&t.Options[0].OptionType==="BOTH"?(n.trips[0]=n.trips[1]=!1,n.trips[2]=f?!1:i):n.trips[0]=n.trips[1]=n.trips[2]=f?!1:i,n.selectSeatClass(t.BrandType,0),n.selectSeatClass(t.BrandType,1))))};n.getTrip=function(t){return n.gridDetails.UpSellGridTrips.filter(function(n){return n.TripId===t})[0]};n.getFareDetails=function(t,i){var r=n.getTrip(t);if(r)return r.GridFares.filter(function(n){return n.Cabin===i})[0]};r={};n.getBrandText=function(n){return r[n]?r[n]:f.get(u[n]).then(function(t){r[n]=t})};n.getEquipmentType=function(){if(e)return e;var t=-1,r=function(n){n&&n.TripSlice&&n.TripSlice.Segments.forEach(function(n){t=Math.max(t,i.indexOf(n.EquipmentType))})};return n.gridDetails.UpSellGridTrips[0]&&r(n.gridDetails.UpSellGridTrips[0]),n.gridDetails.UpSellGridTrips[1]&&r(n.gridDetails.UpSellGridTrips[1]),t>=0?e=i[t]:void 0}}];return{restrict:"A",scope:!0,controller:e,templateUrl:r.getTemplateUrl("ha-upsell-grid.html")}}])}(angular),function(n){"use strict";var i=3,t=n.module("haDealTilesModule",[]);t.directive("haDealTiles",[function(){var t=function(t,r,u){var s=n.fromJson(u.dealsData),e,o,f,h;for(t.deals=s.DealTiles,console.log(s),e=[],o=-1,f=0;f<t.deals.length;f++)h=t.deals[f],f%i==0&&(e.push({group:[]}),o++),e[o].group.push(h);t.dealGroups=e};return{restrict:"A",scope:!0,link:t}}]);t.directive("haDealTile",["haConfig","$rootScope",function(n,t){var i=function(n){if(console.log("deal tile 2020 directive link"),console.log(n.model),n.model.LowestFare=Math.min(n.model.MainCabinBasicFare||Number.POSITIVE_INFINITY,n.model.Fare),n.referenceMark=n.referenceMark||"*",t.footnotes&&t.footnotes.numeric&&t.references||(t.footnotes={numeric:[]},t.references={}),t.references[n.model.DisclaimerGuid])n.model.DisclaimerReferenceMark=t.references[n.model.DisclaimerGuid];else if(n.model.Disclaimer&&n.model.TripType!=3){t.references[n.model.DisclaimerGuid]=n.referenceMark+(Object.keys(t.references).length+1);n.model.DisclaimerReferenceMark=t.references[n.model.DisclaimerGuid];var i=n.model.LowestFare&&n.model.LowestFare===n.model.MainCabinBasicFare,r=i?n.model.MainCabinBasicDisclaimer:n.model.Disclaimer;t.footnotes.numeric.push({id:"*"+(t.footnotes.numeric.length+1),text:r})}};return{restrict:"A",scope:{model:"="},link:i,templateUrl:n.getTemplateUrl("ha-deal-tile-base-template.html")}}])}(angular),function(n){"use strict";var t=n.module("haAdvanceToNextInputService",[]);t.service("haAdvanceToNextInput",[function(){return{next:function(n){var t=$("input[ha-advance-to-next-input]"),i=t.index(n.find("input[ha-advance-to-next-input]")),r=t.eq(i+1);r.length>0&&i>=0&&setTimeout(function(){r.focus()},0)}}}]);t.run(["$rootScope","haAdvanceToNextInput",function(n,t){n.$on("haAdvanceToNextInput:next",function(n,i){t.next(i)})}])}(angular),function(n){"use strict";var t=n.module("haCalendarEventsService",[]);t.service("haCalendarEventsService",function(){var n={"123":{promoDays:[{start:{year:2013,month:10,day:20},end:{year:2013,month:11,day:1}},{start:{year:2013,month:11,day:16},end:{year:2013,month:11,day:18}},{start:{year:2013,month:11,day:30},end:{year:2013,month:12,day:1}}]},"456":{unavailableDays:[{start:{year:2013,month:11,day:8},end:{year:2013,month:11,day:10}}]},"789":{unavailableDays:[{start:{year:2013,month:11,day:8},end:{year:2013,month:11,day:10}}],promoDays:[{start:{year:2013,month:10,day:20},end:{year:2013,month:11,day:1}},{start:{year:2013,month:11,day:16},end:{year:2013,month:11,day:18}},{start:{year:2013,month:11,day:30},end:{year:2013,month:12,day:1}}]}};return{getEvents:function(t,i){setTimeout(function(){i(n[t])},1)}}})}(angular),function(n){"use strict";function t(n,i){return typeof i=="undefined"&&(i=3),n().then(undefined,function(r){if(i>0&&[0,408,500,502,503,504].indexOf(r.status)>=0)return t(n,i-1);throw r;})}var i=n.module("haCitiesModule",["haCitiesAPI"]);i.factory("haCitiesSvc",["$q","$log","$filter","haCitiesAPI",function(i,r,u,f){var e={},o=!1,c=function(n,t){var r,i;if(t!=null){if(typeof t=="string"&&(t=u(t)),typeof t!="function")return n;for(r=[],i=0;i<n.length;i++)n[i]!=null&&t(n[i])&&r.push(n[i]);return r}return n},k=function(n){return o=!0,s(n)},s=function(n){var r,u;return o&&!e.CITY_LIST_EXPERT_BOOKING&&(e.CITY_LIST=null),e.CITY_LIST?(r=i.defer(),r.resolve(c(e.CITY_LIST,n)),r.promise):(u=o?f.getCityListExpertBooking:f.getCityList,t(u).then(function(t){return e.CITY_LIST=t,o&&(e.CITY_LIST_EXPERT_BOOKING=t),c(e.CITY_LIST,n)}))},d=function(n,i){var r=function(){return f.getFilteredCityList(n,i)};return t(r).then(function(n){return n})},h=function(){if(e.CITY_MAP!=null){var n=i.defer();return n.resolve(e.CITY_MAP),n.promise}return s().then(function(n){e.CITY_MAP={};for(var t=0;t<n.length;t++)e.CITY_MAP[n[t].Code]=n[t];return e.CITY_MAP})},a=function(){var n,r;return o&&!e.CITY_PAIRS_EXPERT_BOOKING&&(e.CITY_PAIRS=null),e.CITY_PAIRS?(n=i.defer(),n.resolve(e.CITY_PAIRS),n.promise):(r=o?f.getCityPairsExpertBooking:f.getCityPairs,t(r).then(function(n){return e.CITY_PAIRS=n,o&&(e.CITY_PAIRS_EXPERT_BOOKING=n),e.CITY_PAIRS}))},v=function(){if(e.NITP_MAP!=null){var n=i.defer();return n.resolve(e.NITP_MAP),n.promise}return t(f.getNitpMap).then(function(n){return e.NITP_MAP=n,e.NITP_MAP})},g=function(n){return h().then(function(t){return t[n]})},nt=function(n){return e.CITY_MAP[n]},l=function(n,t){var u=[],r,i;if(t=t||1,!e.CITY_PAIRS||!e.CITY_MAP)return[];for(r=e.CITY_PAIRS[n],i=0;i<r.length;i++)u.push(e.CITY_MAP[r[i]]);return u},tt=function(n,t){return t=t||1,i.all([a(),h()]).then(function(){return l(n,t)})},y=function(n,t,i){return n==null?s(i):(t=t||1,tt(n,t).then(function(n){return c(n,i)}))},p=function(n){for(var i=[],t=0;t<n.length-1;t++)i.push(n[t]+" "+n[t+1]),i.push(n[t]+n[t+1]);return n.concat(i)},it=function(t,i){var r=0,u,f,e,o;return i==null?r:(t.DisplayName===i&&(r=100),u=i.split(" ").join(""),t.Code!=null&&t.Code.toUpperCase()===i.toUpperCase()&&(r+=1),t.DisplayName!=null&&(f=p(t.DisplayName.split(" ")),n.forEach(f,function(n){n.toLowerCase().indexOf(i.toLowerCase())===0?r+=.3:n.toLowerCase().indexOf(u.toLowerCase())===0&&(r+=.15)})),t.LinkedAirportCodes!=null&&(e=t.LinkedAirportCodes.split(","),n.forEach(e,function(n){n.toUpperCase()===i.toUpperCase()&&(r+=.2)})),t.SearchTags!=null&&(o=p(t.SearchTags.split(" ")),n.forEach(o,function(n){(n.toLowerCase().indexOf(i.toLowerCase())===0||n.toLowerCase().indexOf(u.toLowerCase())===0)&&(r+=.1)})),r>0&&t.IsHACity&&(r+=.5),t._weight=r,t._weight)},w=function(n,t){for(var i,u=[],r=0;r<n.length;r++)i=n[r],i!=null&&it(i,t)>0&&u.push(i);return u},rt=function(n,t,i){return o=!0,b(n,t,i)},b=function(n,t,i){return y(t,1,i).then(function(t){return u("orderBy")(w(t,n),"-_weight")})},ut=function(n,i,r){var e=function(){return f.getFilteredCityList(i,r)};return t(e).then(function(t){return u("orderBy")(w(t,n),"-_weight")})},ft=function(){return i.all([s(),v()]).then(function(n){for(var i,r=n[0],f=n[1],u=[],t=0;t<r.length;t++)i=r[t],f.hasOwnProperty(i.Code)&&u.push(i);return u})},et=function(n){return i.all([s(),v()]).then(function(t){for(var s,i,u,f=t[0],h=t[1],e=[],o=h[n],r=0;r<o.length;r++)for(s=o[r],i=0;i<f.length;i++)u=f[i],u.Code===s&&e.push(u);return e})};return e.preloadCitiesExpertBooking=function(){o=!0;e.preloadCities()},e.preloadCities=function(){h();a()},e.isInternational=function(n){return n!=null&&n.Market===3},e.pairIsInvalid=function(n,t){var r,u,i,f;if(!n||!t)return!0;for(r=l(n),u=[],i=0,f=r.length;i<f;i++)r[i]&&r[i].Code&&u.push(r[i].Code);return u.indexOf(t)<0?!0:!1},e.getAllCities=s,e.getAllCitiesExpertBooking=k,e.getFilteredCities=d,e.getReachableCities=y,e.getCityByCode=g,e.getCityByCodeSync=nt,e.getMatchingCities=b,e.getNitpOrigins=ft,e.getNitpDestinations=et,e.getMatchingFilteredCities=ut,e.getCityMap=h,e.getValidPairs=l,e.getMatchingCitiesExpertBooking=rt,e.getHotelCities=f.getExpediaCityList,e.searchCarLocations=f.searchCarLocations,e.getAllCarLocations=f.getAllCarLocations,e.getCarLocationById=f.getCarLocationById,e}])}(angular),function(n){"use strict";var t=n.module("haCustomerSelectionsService",[]);t.service("haCustomerSelections",["$rootScope","haUtils",function(t,i){var r;return $.extend(t,{selections:{tripName:"Default Trip Name",legs:[],passengers:[]}}),t.$watch("selections",function(){r.updateTotal()},!0),r={clearLegs:function(){t.selections.legs=[]},createLegs:function(n,i){for(var r=0;r<n;r++)!i&&(i||t.selections.legs[r])||t.selections.legs[r]===undefined&&(t.selections.legs[r]={})},getLeg:function(n){return!i.isNumber(n)||!t.selections.legs[n]?!1:t.selections.legs[n]},setLegDate:function(i,u){var f=null,e=u?new Date(u.year,u.month-1,u.day):new Date(new Date*1+6048e5*i),h=new Date,o=new Date(h.getFullYear(),h.getMonth(),h.getDate()),s;u===undefined?(i>0&&(f=t.selections.legs[i-1].date),f===undefined&&(f={year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()})):(f=u,s=0,n.forEach(t.selections.legs,function(n){if(n.date!=null){var t=new Date(n.date.year,n.date.month-1,n.date.day);s<i?t>e&&(n.date=f):s>i&&t<e&&(n.date=f)}s++}));t.selections.legs[i].date=f;e<o&&setTimeout(function(){r.setLegDate(i,{year:o.getFullYear(),month:o.getMonth()+1,day:o.getDate()})},0)},updateTotal:function(){t.selections.currentTotal=1234.56},updateLegDates:function(){var u,r,n,i,f,e;if(t.selections.legs&&t.selections.legs.length>1)for(u=t.selections.legs.length,r=0;r<=u-2;r++)n=t.selections.legs[r],i=t.selections.legs[r+1],n.date!=null&&i.date!=null&&(f=new Date(n.date.year,n.date.month-1,n.date.day),e=new Date(i.date.year,i.date.month-1,i.date.day),e<f&&(i.date=n.date))}}}])}(angular),function(n){"use strict";n.module("haDataCacheService",["haHttpService"]).service("haDataCacheService",["haHttpService","$cacheFactory",function(n,t){var i=t.get("haDataCache");return{get:function(t){return n.GET(t,{cache:i})}}}])}(angular),function(n){"use strict";var t=n.module("haFavoritesService",[]);t.service("haFavorites",["$rootScope",function(n){var i=[{title:"Waimoku Falls Trail",photo:"/Content/assets/common/images/demo-nav-wishlist1.jpg",location:"Haleakala National Park"}],t={updateFavorites:function(){return n.favorites=i,t}};return t}])}(angular),function(n){"use strict";var t=n.module("haGlobalsModule",[]);t.factory("haGlobals",["$window",function(t){return function(i,r,u){if(i=[].concat(i),u=!!u,i.length!==0&&r!=null){var o=[],f=!1,e=!0;n.forEach(i,function(n){var i=typeof t[n]!="undefined"&&t[n]!==null;f=f||i;e=e&&i;o.push(t[n])});(u&&e||!u&&f)&&r.apply(null,o)}}}])}(angular),function(n){"use strict";var t=n.module("haHelpAndTipsService",[]);t.service("haHelpAndTips",function(){var n={cityName:"Kahului, Maui",months:[{sunnyPct:"80",tempLow:"70F",tempHigh:"84F"},{sunnyPct:"90",tempLow:"70F",tempHigh:"84F"},{sunnyPct:"90",tempLow:"70F",tempHigh:"84F"},{sunnyPct:"90",tempLow:"70F",tempHigh:"84F"},{sunnyPct:"90",tempLow:"70F",tempHigh:"84F"},{sunnyPct:"90",tempLow:"70F",tempHigh:"84F"},{sunnyPct:"90",tempLow:"70F",tempHigh:"84F"},{sunnyPct:"90",tempLow:"70F",tempHigh:"84F"},{sunnyPct:"90",tempLow:"70F",tempHigh:"84F"},{sunnyPct:"90",tempLow:"70F",tempHigh:"84F"},{sunnyPct:"90",tempLow:"70F",tempHigh:"84F"},{sunnyPct:"90",tempLow:"70F",tempHigh:"84F"}]};return{getData:function(t,i){n.cityName=t==="OGG"?"Kahului, Maui":t==="HNL"?"Honolulu":"Default Data";i(n)}}})}(angular),function(n){"use strict";n.module("haHttpService",[]).factory("requestedWithInterceptor",["$location","$rootScope",function(n,t){return{request:function(n){return/\/\//.test(n.url)||(n.headers["X-Requested-With"]="XMLHttpRequest",n.headers.csrf=t.csrf),n},response:function(n){if(n&&n.data&&n.data.ErrorType){if(n.data.ErrorType==="TabError"){window.location.href="/book/error?ErrorType=TabError";return}if(n.data.ErrorType==="SessionTimeOut"){window.location.href="/book/error?ErrorType=SessionTimeOut";return}}return n}}}]).factory("sessionLostInterceptor",["$q","$rootScope",function(n,t){return{responseError:function(i){return i&&i.status===401&&t.$broadcast("$sessionLostEvent"),n.reject(i)}}}]).config(["$httpProvider",function(n){n.interceptors.push("requestedWithInterceptor");n.interceptors.push("sessionLostInterceptor")}]).factory("haHttpService",["$log","$http","$q",function(t,i,r){return{GET:function(n,r){return r=r||{},typeof t.debug=="function"&&t.debug("GET "+n),i.get(n,r).error(function(i,r){t.warn("["+r+"] GET "+n,i)})},GETPARALLEL:function(t){var u=r.defer(),f=[];return n.forEach(t,function(n){f.push(i.get(n))}),r.all(f).then(function(n){u.resolve(n)},function(){u.reject()}),u.promise},POST:function(n,r,u){return u=u||{},typeof t.debug=="function"&&t.debug("POST "+n),i.post(n,r,u).error(function(i,r){t.warn("["+r+"] POST "+n,i)})},PUT:function(n,r,u){return u=u||{},typeof t.debug=="function"&&t.debug("PUT "+n),i.put(n,r,u).error(function(i,r){t.warn("["+r+"] PUT "+n,i)})},DELETE:function(n,r){return r=r||{},typeof t.debug=="function"&&t.debug("DELETE "+n),i["delete"](n,r).error(function(i,r){t.warn("["+r+"] DELETE "+n)})}}}]).directive("form",["$rootScope",function(n){return{restrict:"E",link:function(t,i){i.length&&n.csrf&&i.append($('<input type="hidden" name="__RequestVerificationToken" value="'+$('body > [name="__RequestVerificationToken"]').val()+'" />'))}}}])}(angular),function(n){"use strict";var t=n.module("haModalService",[]);t.factory("haModal",["$document","$compile","$rootScope","haConfig","$controller","$timeout",function(t,i,r,u,f,e){function s(t,u,s){var d=n.element('<div class="ha-loading-spinner fixed"><div><div><\/div><\/div><\/div>'),w,ft,et,c,ot,st;o.append(d);var y=$(document.activeElement),p=window.pageYOffset,g=!1,nt=!1;n.isObject(t)?(s=u,u=t):u.templateUrl=t;u=n.extend({},h,u);w=u.id?' id="'+u.id+'" ':"";document.body.dispatchEvent(new CustomEvent("ModalOpened",{detail:u.id}));r.$broadcast("cancelTooltip");var tt=function(){return u.template?n.isString(u.template)?u.template:u.template.html():"<div ng-include=\"'"+u.templateUrl+"'\"><\/div>"}(),l="",v="",it=u.modalLock;it?(l=n.element('<div class="ha-modal '+u.modalClass+' fade"'+w+' tabindex="0"><div class="modalContainer modalLock '+u.size+'">'+tt+"<\/div><\/div>"),v=n.element('<div class="modal-backdrop">')):(l=n.element('<div class="ha-modal '+u.modalClass+' fade"'+w+' tabindex="0"><div class="modalContainer '+u.size+'"><a class="close-modal-icon" ng-click="$modalCancel()" href="" role="button"><i class="close ha-icon icon-close"><\/i><span class="sr-only" scs-text="forms.close"><\/span><\/a>'+tt+"<\/div><\/div>"),v=n.element('<div class="modal-backdrop" ng-click="$modalCancel($event)">'));var a,b,ht=function(){a=$(l[0]).find(":focusable");b=$(l[0]).find("input[type=text], input[type=email], textarea, select");b.length>0?$("html").hasClass("lte-ie9")||$(b[0]).focus():r.isMobile||$(a[0]).focus()},ct=function(){var n=c.$watch(function(){return l.find(".modalContainer").height()},function(t){if(t!==0){var i=l.find(".modalContainer"),r=i.outerHeight()/-2;i.css({top:"50%","margin-top":r});n()}})},rt=function(n){if(n.keyCode===9){a=$(l[0]).find(":focusable").get();var t=document.activeElement===a[0],i=document.activeElement===a[a.length-1];n.shiftKey&&t?(n.preventDefault(),a[a.length-1].focus()):!n.shiftKey&&i&&(n.preventDefault(),a[0].focus())}},ut=function(n){n.keyCode!==27||it||($(document.activeElement).blur(),c.$modalCancel(n))},k=function(){nt||(nt=!0,o.unbind("keydown",ut),o.unbind("keydown",rt),v.removeClass("fade in"),l.removeClass("in"),e(function(){if(l.remove(),o.removeClass("modal-active"),r.modalsopen--,r.modalsopen==0&&(r.modalactive=!1),r.isMobile&&!g){var n=parseFloat($("body").css("margin-top"));p=n*-1;$("body").css({"margin-top":0});window.scrollTo(0,p)}u.backdrop&&v.remove()},300))};o.bind("keydown",ut);o.bind("keydown",rt);c=u.scope||r.$new();u.extendScope&&n.extend(c,u.extendScope);r.modalsopen?r.modalsopen++:r.modalsopen=1;r.modalactive=!0;c.$defaultContent=u.defaultContent;c.$title=u.title;c.$modalClose=k;c.$on("$modalCancel",function(n,t){t&&t.length?t===u.id&&c.$modalClose():c.$modalClose()});c.$on("$modalOpened",function(n,t){t&&t.length&&t!==u.id&&(g=!0)});c.$modalCancel=function(n){var t=l.find(".modalContainer"),i;n&&n.type==="click"&&($.contains(t[0],n.target)||t.is(n.target)||!$.contains(document,n.target))||(i=u.cancel.fn||k,c.$modalClose(),e(function(){c.$emit("haModalClosed",u.id);!r.isMobile&&y&&y[0]&&y[0].tagName!=="g"&&y.focus()},300),i.call(this))};c.$modalSuccess=function(){var n=u.success.fn||k;n.call(this);c.$modalClose()};c.$modalSuccessLabel=u.success.label;c.$modalCancelLabel=u.cancel.label;u.controller&&(et=n.extend({$scope:c},s),ft=f(u.controller,et),l.contents().data("$ngControllerController",ft));r.$on("closeModal",function(){c.$modalCancel()});i(l)(c);i(v)(c);o.append(l);o.addClass("modal-active");r.isMobile&&(ot=parseFloat($("body").css("margin-top")),ot>=0&&$("body").css({"margin-top":p*-1}),l.find(".modal-header").length&&(st=l.find(".modal-header").outerHeight(),l.find(".modal-main").css({paddingTop:st})));r.$broadcast("$modalOpened",u.id);u.backdrop&&(o.append(v),e(function(){v.addClass("fade in")},0));$(".ha-modal").on("click",function(n){n.stopPropagation();$(n.target).hasClass("ha-modal")&&!u.modalLock&&c.$modalCancel()});return e(function(){l.addClass("in");d.addClass("ng-hide");ht();u.callback&&u.callback(l);!r.isMobile&&u.verticalCenter&&ct()},100),c}var h={id:null,template:null,templateUrl:null,title:"Default Title",backdrop:!0,success:{label:"OK",fn:null},cancel:{label:"Close",fn:null},controller:null,backdropClass:"modal-backdrop",defaultContent:null,modalClass:"modal",modalLock:!1,size:"",verticalCenter:!1},o=t.find("body");return s.openPriceCalendar=function(n,t,i){var r={id:"FlexiblePriceView",backdrop:"true",extendScope:{legs:n,adults:t||1,children:i||0}};s(u.getTemplateUrl("/Book/FlightSearch/ha-flexible-price-modal.html"),r)},window.haModal=s,s}])}(angular),function(n){"use strict";var t=n.module("haPassengersService",["haPassengersAPI"]);t.service("haPassengersService",["haPassengersAPI",function(t){return{passengers:[],types:["Adult","Child","Infant"],addeditpax:t.addeditpax,editPaxLink:t.editPaxLink,editLoggedInPax:t.editLoggedInPax,addPaxToPNR:t.addPaxToPNR,addExtraLoggedTravellerInfo:t.addExtraLoggedTravellerInfo,associateinfants:t.associateinfants,updatecontactinfo:t.updatecontactinfo,isAdultInFlight:function(n,t){if(n&&n.length>0){var i=$.grep(n,function(n){return moment(t,"MM-DD-YYYY").diff(moment(n.DOBMonth+"/"+n.DOBDay+"/"+n.DOBYear,"MM-DD-YYYY"),"years")>=15}),r=$.grep(n,function(n){var i=moment(t,"MM-DD-YYYY").diff(moment(n.DOBMonth+"/"+n.DOBDay+"/"+n.DOBYear,"MM-DD-YYYY"),"years");return i>=12&&i<15}),u=$.grep(n,function(n){var i=moment(t,"MM-DD-YYYY").diff(moment(n.DOBMonth+"/"+n.DOBDay+"/"+n.DOBYear,"MM-DD-YYYY"),"years");return i>=2&&i<12});return i.length===0&&u.length===0?r.length>0:i.length>0}return!1},num:function(t){if(t){var i=0;return n.forEach(this.passengers,function(n){n.type===t&&i++}),i}return this.passengers.length},add:function(n){return typeof n=="object"&&n.length?(this.passengers=this.passengers.concat(n),this.passengers):this.passengers.push(n)},uniquePaxTypes:function(){var t=[];return n.forEach(this.passengers,function(n){t.push(n.type)}),$.unique(t)},remove:function(t){var i=this;return n.forEach(this.passengers,function(n,r){for(var u in t)t.hasOwnProperty(u)&&n[u]===t[u]&&i.passengers.splice(r,1)}),this.passengers},get:function(t){n.forEach(this.passengers,function(n){for(var i in t)if(t.hasOwnProperty(i)&&n[i]===t[i])return n})}}}])}(angular),function(n){"use strict";var t=n.module("haSearchCacheService",[]);t.service("haSearchCache",["$rootScope",function(n){return $.extend(n,{searchCache:[{tripName:"Trip To Honolulu",legs:[{origin:"SFO",destination:"HNL",date:{year:2013,month:9,day:10},time:{start:900,end:2100}}]},{tripName:"Trip To Honolulu",legs:[{origin:"SFO",destination:"HNL",date:{year:2013,month:9,day:10},time:{start:900,end:2100}},{origin:"HNL",destination:"SFO",date:{year:2013,month:9,day:20},time:{start:900,end:2100}}]},{tripName:"Trip To Hawaii",legs:[{origin:"SFO",destination:"HNL",date:{year:2013,month:9,day:10},time:{start:900,end:2100}},{origin:"HNL",destination:"OGG",date:{year:2013,month:9,day:15},time:{start:900,end:2100}},{origin:"OGG",destination:"SFO",date:{year:2013,month:9,day:20},time:{start:900,end:2100}}]}]}),{cacheCurrentSelections:function(){n.searchCache.unshift(n.selections)},restoreSearch:function(t){n.searchCache[t]&&(n.selections=$.extend(!0,{},n.searchCache[t]))}}}])}(angular),function(n){"use strict";var t=n.module("haSegmentService",[]);t.service("haSegmentService",["haPassengersService","$log",function(t,i){return{selectedSegments:[],legs:[],numFares:function(i,r){var u={Adult:0,Child:0,Infant:0},f=this.getRelevantPaxTypes();return t.passengers!=null&&n.forEach(t.passengers,function(n){n.Type==="Child"&&f.indexOf(n.Type)<0?u.Adult++:u[n.Type]++}),u[r]},getRelevantPaxTypes:function(i){var r=[],u=this,f=i?[i]:this.selectedSegments;return n.forEach(t.getNonInfants(),function(t){n.forEach(f,function(n){u.getFare(n,t.Type,!0)&&r.indexOf(t.Type)===-1&&r.push(t.Type)})}),r},getFare:function(t,r,u){var f,o=this,e;return t!=null?(e=this.getFareClass(t),t.BookingFares!=null&&n.forEach(t.BookingFares,function(n){if(n.Name.toLowerCase()===e){var t=n.FareTypes[r];f=u?t:o.getClosestFare(r,n.FareTypes)}})):i.warn('getFare() called with null "segment"'),f},getClosestFare:function(n,i){for(var u,f=t.types.indexOf(n),r=f;r>=0;r--)if(u=i[t.types[r]],u)return u},getFareClass:function(n){var t;return n!=null?n.BookingFares!=null&&n.BookingFares[0]!=null&&typeof n.BookingFares[0].Name=="string"&&(t=n.BookingFares[0].Name.toLowerCase()):i.warn('getFareClass() called with null "segment"'),n.selectedSeatClass||t},getExtraComfortPrice:function(t){var i=0;return this.Legs!=null&&n.forEach(t.Legs,function(n){i+=this.getLegExtraComfortPrice(n)}),i},getLegExtraComfortPrice:function(t){var i=0;return t.SeatSelections!=null&&n.forEach(t.SeatSelections,function(n){i+=n.price}),i}}}])}(angular),function(n){"use strict";n.module("haTemplateCache",["haHttpService"]).service("haTemplateCache",["haHttpService","$templateCache",function(n,t){return{get:function(i){return n.GET(i,{cache:t})}}}])}(angular),function(n){"use strict";var t=n.module("haUserService",[]);t.service("haUser",["$rootScope",function(n){var i={firstName:"John",lastName:"Doe",photo:"/Content/assets/common/images/demo-nav-account-pic-icon.jpg",haMiles:"14552",upcomingTrips:[{departTime:1386375432426,arriveTime:1386375432426,flights:[123,456,789],onTime:!0},{departTime:1386375432426,arriveTime:1386375432426,flights:[123,456,789],onTime:!0}],savedTrips:[{tripName:"Trip to Maui",tripType:"Package",tripLink:"#",newPrice:!1,savedDate:1386375432426,departDate:1386375432426,returnDate:1386375432426,otherPassengers:["Charlie Becket","Mako Becket","Brad Becket"]},{tripName:"Trip to Honolulu",tripType:"Package",tripLink:"#",newPrice:!0,savedDate:1386375432426,departDate:1386375432426,returnDate:1386375432426,otherPassengers:["Charlie Becket"]},{tripName:"Trip to Big Island",tripType:"Package",tripLink:"#",newPrice:!0,savedDate:1386375432426,departDate:1386375432426,returnDate:1386375432426,otherPassengers:["Charlie Becket","Brad Becket"]}],eCerts:[{title:"30% Off",subtitle:"Mainland to Hawaii Islands",travelStart:1386375432426,travelEnd:1386375432426,bookBy:1386375432426}]},t={updateUser:function(){return n.user=i,t},logout:function(){return delete n.user,t}};return t.updateUser(),t}])}(angular),function(n){"use strict";String.prototype.format||(String.prototype.format=function(){var n=arguments;return this.replace(/{(\d+)}/g,function(t,i){return typeof n[i]!="undefined"?n[i]:t})});var t=n.module("haUtilsModule",["haViewModelModule"]);t.factory("haUtils",["$rootScope","$log","$window","$locale","haViewModelSvc",function(t,i,r,u,f){function c(){var n,t=/([^&=]+)=?([^&]*)/g,i=window.location.search.substring(1);for(o={};n=t.exec(i);)o[s(n[1])]=s(n[2])}function s(n){return decodeURIComponent(n.replace(/\+/g," "))}function h(t){var r=null,i=t.split("|"),u;return i.length===6&&(r={FlightSearchSegmentList:[],FlightQueryTypeId:parseInt(i[1]),AdultCount:parseInt(i[2]),ChildCount:parseInt(i[3]),InfantCount:parseInt(i[4]),IsRefundable:i[5]==="true"?!0:!1},u=i[0].split("+"),n.forEach(u,function(n){var t=n.split("=");t.length===4&&r.FlightSearchSegmentList.push({DepartureDate:t[0],OriginCityCode:t[1],DestinationCityCode:t[2],IsMiles:t[3]==="true"?!0:!1})})),r}var e={debounce:function(n,t,i){var r;return function(){function e(){i||n.apply(u,f);r=null}var u=this,f=arguments;r?clearTimeout(r):i&&n.apply(u,f);r=setTimeout(e,t||100)}},safeApply:function(n,i){if(typeof n.$id!="number"&&typeof i=="function")throw new Error("safeApply expects a scope and a function.");var r=t.$$phase;r==="$apply"||r==="$digest"?i():n.$apply(i)},closestInArray:function(n,t){var r,u=Infinity,i,f;for(i in n)f=Math.abs(n[i]-t),Math.abs(n[i]-t)<u&&(u=f,r=n[i]);return r},getChildrenPositions:function(n,t){var r=n.get(0).getBoundingClientRect().left,i=[];return t.each(function(){i.push(this.getBoundingClientRect().left-r)}),i},indexOf:function(n,t){if(!n||!t)return-1;for(var i=0;i<n.length;i++)if(n[i]===t)return i;return-1},inIframe:function(){try{return r.self!==r.top}catch(n){return!0}},isNumber:function(n){return!isNaN(parseFloat(n))&&isFinite(n)},leftPad:function(n,t){for(var i=n+"";i.length<t;)i="0"+i;return i},objRef:function(n,t){t=t.split(".");for(var i=0;i<t.length;i++){if(!n||n[t[i]]===undefined)return undefined;n=n[t[i]]}return n},objSet:function(n,t,i){for(t=t.split(".");t.length>1;)n=n[t.shift()];return n[t.shift()]=i,i},readCookie:function(n){n+="=";for(var i=document.cookie.split(/;\s*/),t=i.length-1;t>=0;t--)if(!i[t].indexOf(n))return i[t].replace(n,"")},getFlightQueryModelCookie:function(){var n=this.readCookie("FlightQueryModelCookie2"),t;return n!==undefined&&(i.debug("FlightQueryModelCookie2: Found"),n=decodeURIComponent(n),t=h(n),t)?t:(i.debug("FlightQueryModelCookie2: null"),null)},getFlightQueryModelRecentCookie:function(){var t=this.readCookie("FlightQueryModelRecentCookie2"),r,u;return t!==undefined&&(i.debug("getFlightQueryModelCookie2: Found"),t=decodeURIComponent(t),r=[],u=t.split(","),n.forEach(u,function(n){var t=h(n);t&&r.push(t)}),r.length>0)?r:(i.debug("getFlightQueryModelCookie2: null"),null)},getReshopFlightQueryModelCookie:function(){var n=this.readCookie("ReshopFlightQueryModelCookie");return n!==undefined?(n=decodeURIComponent(n),JSON.parse(n)):null},isEN:function(){var t=n.element("body");return t.hasClass("en")||t.hasClass("en-au")||t.hasClass("en-nz")||t.hasClass("en-us")},isJP:function(){return n.element("body").hasClass("ja-jp")},isKR:function(){return n.element("body").hasClass("ko-kr")},isCN:function(){return n.element("body").hasClass("zh-cn")},isTW:function(){return n.element("body").hasClass("zh-tw")},ensureRootScope:function(){return t.HA||(t.HA={})},ensureScope:function(n,t){return t[n]||(t[n]={})},isLocalDev:function(){return r.location.hostname.indexOf("local")===0},attachNgModelAttrToScopeAsVM:function(n,t,i){t.ngModel!=null&&t.$observe("ngModel",function(t){t!=null&&n.$watch(t,function(t){t!=null&&(n.VM=t,i!=null&&i(n.VM))})})},attachViewModelToScopeAsVM:function(n,t,i){return f.get(t).then(function(t){n.VM==null&&(n.VM=t);n.VM!=null&&i!=null&&i(n.VM)})},attachPartialVM:function(n,t,i,r,u){t.ngModel!=null?e.attachNgModelAttrToScopeAsVM(n,t,u):i!=null?e.attachViewModelToScopeAsVM(n,i,u):(n.VM=r||{},u!=null&&u(n.VM))},getImageFromSiteCoreString:function(n){var i=$(n),r=i.attr("mediapath"),t;return r?[HA.cdn,"/~/media",r,".ashx"].join(""):(t=i.attr("src"),t?[HA.cdn,"/",t].join(""):void 0)},getImageObjectFromSiteCoreString:function(n){var t=$(n),i=t.attr("mediapath"),r=t.attr("alt"),u=t.attr("width"),f=t.attr("height");return{src:[HA.cdn,"/~/media",i,".ashx"].join(""),alt:r,width:u,height:f}},webtrends:{token:function(n){var t=r.$pageName.replace(" ",""),i=r.$langCode.substr(-2);return["HAWAIIANAIR",i,n,t].join("_")},tokenV2:function(n){var t=r.$langCode.substr(-2);return["HAWAIIAN-",t,".TPS.BRAND.",n].join("")}},parseLegs:function(n){return n&&n.split(",").map(function(n){var t=/([A-Za-z]{3})-?([A-Za-z]{3})?[ +-]?(\d\d\d\d-\d\d-\d\d)?/.exec(n);if(t)return{origin:{code:t[1].toUpperCase()},destination:{code:t[2].toUpperCase()},departDate:t[3]&&moment(t[3],"YYYY-MM-DD").toDate()}})},splitUrl:function(n){var i={url:n,params:[]},t;return n&&(t=n.split("?"),t.length>1&&(i={url:t[0],params:t[1].split("&")})),i},querystring:function(n){return o||c(),o[n]},createQueryString:function(t,i,r){var u=[],e,f;if(n.forEach(t,function(n,t){u.push(t+"="+encodeURI(n))}),i&&(e=encodeURI(this.createCarRentalQuery(i)),e&&u.push("supplierBenefits="+e)),r)for(f=0;f<r.length;f++)u.push(r[f]);return"?"+u.join("&")},createCarRentalQuery:function(t){var i=[];return n.forEach(t,function(t,r){n.forEach(t,function(n,t){n&&i.push(r+"|"+t+"|"+n)})}),i.join(",")},getLocale:function(n){var t="";switch(n){case"ja-jp":t="jp";break;case"zh-cn":t="zh";break;case"zh-tw":t="zh_hk";break;case"ko-kr":t="ko";break;default:t="en"}return t},localStorageSet:function(n,t){r.localStorage&&r.localStorage.setItem(n,t)},localStorageGet:function(n){var t;return r.localStorage&&(t=r.localStorage[n]),t?t:null},injectScriptDependency:function(t,i){var r=n.element(document.createElement("script"));r.attr("charset","utf-8");r.attr("src",i);t.prepend(r)},formatDynamicString:function(n,t){if(n)return n.replace(/({\d})/g,function(n){if(n)return t[n.replace(/{/,"").replace(/}/,"")]})},checkForInfant:function(n){for(var i=!1,t=0;t<n.Travellers.length;t++)n.Travellers[t].Type=="INF"&&(i=!0);return i},checkIfTicketedInfant:function(n){for(var t,r=!1,i=0;i<n.Travellers.length;i++)for(t=0;t<n.Tickets.length;t++)n.Travellers[i].Type=="INF"&&n.Travellers[i].DisplayName===n.Tickets[t].TravellerName&&n.Tickets[t].ETicket.length>0&&(r=!0);return r},removeDuplicatesFromArray:function(n,t){return n.filter(function(n){return this[n[t]]?!1:this[n[t]]=!0},{})},getStandardLocale:function(){var n=u.id.split("-");return n[1]=!n[1]?"":n[1].toUpperCase(),n.join("_")}},o;return t.constructor.prototype.isEN=e.isEN,t.constructor.prototype.isJP=e.isJP,t.constructor.prototype.isKR=e.isKR,t.constructor.prototype.isCN=e.isCN,t.constructor.prototype.isTW=e.isTW,e}])}(angular),function(n){"use strict";var t=n.module("haConfigModule",[]);t.factory("haConfig",[function(){var r="/templates/",o="/sitecoreresources/",i="en-US",u=[{com:"en"},{"co.jp":"ja-jp"},{"co.kr":"ko-kr"},{"com.cn":"zh-cn"},{"com.tw":"zh-tw"},{"com.au":"en-au"},{"co.nz":"en-nz"}],t=location.host.split("."),f=t.length<4||!isNaN(parseInt(t[0],10))?"com":t[2]+"."+t[3],s=u.map(function(n){return typeof n[f]!="undefined"}).indexOf(!0),n=HA.cdn.html&&HA.cdn.js&&HA.cdn.css&&HA.cdn.img?"?sc_lang="+u[s][f]:"",e=window.ver;return HA.cdn.isOldIE&&(HA.cdn.html=HA.cdnDynamic=""),{getTemplateUrl:function(n){return n?[HA.cdn.html,r,n.replace(/^\/|\/$/g,""),"?ver=",e].join(""):""},getTemplateUrlWithInclude:function(n){return"<div ng-include=\"'"+this.getTemplateUrl(n)+"'\"><\/div>"},getRazorTemplateUrl:function(t){t+=n;var i=(~t.indexOf("?")?"&":"?")+"ver="+e;return t?[HA.cdn.html,r,t.replace(/^\/|\/$/g,""),i].join(""):""},getImgUrl:function(t){if(/^http/i.test(t)||/^\/\//i.test(t))return t;var i=n;return/\?/gi.test(t)&&n&&(i="&"+n.substring(1)),t?[HA.cdn.img,"/",t.replace(/^\/|\/$/g,""),i].join(""):""},getSitecoreResourceUrl:function(t){return t?[HA.cdnDynamic,o,t.replace(/^\/|\/$/g,""),n].join(""):""},getDynamicJsonUrl:function(t){if(/^http/i.test(t)||/^\/\//i.test(t))return t;var i=n;return/\?/gi.test(t)&&n&&(i="&"+n.substring(1)),t?[HA.cdnDynamic,"/",t.replace(/^\/|\/$/g,""),i].join(""):""},setLanguageCode:function(n){i=n;n==="en"&&(i="en-US")},getLanguageCode:function(){return i}}}])}(angular),function(n){"use strict";var r;try{r=n.module("haHotelPackagesModule")}catch(o){r=n.module("haHotelPackagesModule",["haUtilsModule","haGlobalsModule","haFeatureFlagsModule","haCurrencyModule","haAncillariesModule","haModalService","haEqualHeightModule","haPassengersService","haRoundingFiltersModule","haSitecoreModule"])}var u=4,f=3,e=4,t=function(n,t){return n.reduce(function(n,i){return i.Type===t&&n++,n},0)},i=function(n,t){return n.reduce(function(n,i){var r=i[t];return typeof r=="string"&&(i[t]=parseInt(r)),n+i[t]},0)};r.factory("haHotelRoomService",["$log","$rootScope","$templateCache","haModal",function(n,r,o,s){var h={_data:null,_rooms:[],_travellers:[],_numAdults:0,_numChildren:0,init:function(n){h._data=n;h._travelers=n.Travellers;h._numSeniors=t(n.Travellers,"SRC");h._numInfants=t(n.Travellers,"INF");h._numChildren=t(n.Travellers,"WBC")+t(n.Travellers,"CHD")+t(n.Travellers,"INF");h._numAdults=h._travelers.length-h._numChildren;n.UserRoomDistribution&&n.UserRoomDistribution.Rooms&&(h._rooms=n.UserRoomDistribution.Rooms)},count:function(){return h._rooms.length},addRoom:function(n){n=n||h._rooms;n.push({RoomIndex:n.length+1,AdultCount:1,ChildCount:0,SeniorCount:0,InfantCount:0})},canAddRoom:function(n){return n=n||h._rooms,n.length<u&&n.length<h._numAdults},validate:function(n){var r=[],t,u,o,s;for(n.length>h._numAdults&&r.push("Cannot have more rooms than adult guests."),t=0;t<n.length;t++)if(u=parseInt(n[t].AdultCount)+parseInt(n[t].ChildCount),f<parseInt(n[t].AdultCount)){r.push("Too many adults in Room "+(t+1)+".");break}for(t=0;t<n.length;t++)if(u=parseInt(n[t].AdultCount)+parseInt(n[t].ChildCount),e<u){r.push("Too many guests in Room "+(t+1)+".");break}return(o=i(n,"AdultCount"),o!==h._numAdults&&r.push("Must have "+h._numAdults+" adult guest(s)."),s=i(n,"ChildCount"),s!==h._numChildren&&r.push("Must have "+h._numChildren+" child guest(s)."),i(n,"SeniorCount"),i(n,"InfantCount"),r.length>0)?r:null},getMaxAdultsPerRoom:function(){return f},getMaxGuestsPerRoom:function(){return e},getMaxRooms:function(){return u},getNumAdults:function(){return h._numAdults},getNumChildren:function(){return h._numChildren},openChangeRoomsModal:function(){var n=r.$new();n.rooms=h._rooms.map(function(n){return{RoomIndex:n.RoomIndex,AdultCount:n.AdultCount+n.SeniorCount,ChildCount:n.ChildCount+n.InfantCount,SeniorCount:0,InfantCount:0}});n.addRoom=function(){h.addRoom(n.rooms)};n.canAddRoom=function(){return h.canAddRoom(n.rooms)};n.updateRooms=function(){var l=h.validate(n.rooms),i,u,t;if(l==null){for(i=h._numSeniors,u=h._numInfants,angular.copy(n.rooms,h._rooms),t=n.rooms.length-1;t>=0;t--){var c=n.rooms[t],f=0,e=c.AdultCount,o=c.ChildCount,s=0;i>0&&(f=Math.min(e,i),e=e-f,i-=f);u>0&&(s=Math.min(o,u),o=o-s,u-=s);h._rooms[t]={RoomIndex:c.RoomIndex,SeniorCount:f,AdultCount:e,ChildCount:o,InfantCount:s}}n.$modalCancel();r.$broadcast("haHotelRoomService:updateRooms",h._rooms)}else n.errorMessage=l.join("<br>")};s({id:"ChangeRoomsModal",backdrop:"true",scope:n,template:o.get("ChangeRoomsModal.html")})}};return h}])}(angular),function(n){"use strict";var t;try{t=n.module("haHotelPackagesModule")}catch(i){t=n.module("haHotelPackagesModule",["haUtilsModule","haGlobalsModule","haFeatureFlagsModule","haCurrencyModule","haAncillariesModule","haModalService","haEqualHeightModule","haPassengersService","haRoundingFiltersModule","haSitecoreModule"])}t.factory("haHotelCommonService",["$log","$window","haFeatureFlags",function(t,i,r){var e=function(n){return{amount:n.Amount,numNightsFree:n.NumNightsFree,numNightsRequired:n.NumNightsRequired,promoCode:n.PromoCode,text:n.ShortMarketingText,customerFulfillmentRequirements:n.CustomerFulfillmentRequirements,termsAndConditions:n.TermsAndConditions}},f=function(n){return function(t){if(t==null)return null;var i={roomCode:t.RoomCode,rateCode:t.RateCode,rateAccessCode:t.RateAccessCode,promotions:t.Promotion.map(e),stayAvailability:t.StayAvailability,description:t.RoomDescription,basePrice:parseFloat(n.BasePrice.Amount)||n.BasePrice.Amount,nightlyPriceDiff:0,totalPriceDiff:0,totalPrice:0,resortFees:0};return t.HotelFees!=null&&t.HotelFees.SupplierFees!=null&&angular.forEach(t.HotelFees.SupplierFees,function(n){typeof n.total=="number"&&(i.resortFees+=n.total)}),i}},o=function(n,t,i){return function(r){var u=f(n)(r.RoomDetails.HotelRoomInfo);return u=angular.extend({},t,u),u.nightlyPriceDiff=r.PriceDifference.Value/i,u.totalPriceDiff=u.nightlyPriceDiff*i,u}},u={data:null,hotels:[],mapOrbitzRepriceRooms:function(n,t){for(var u,l,e,s,r=[],h=n.PkgHotelSolution&&n.PkgHotelSolution.HotelRoomType||[],a=h.length,c=n.PackageSolution,v=c.HotelServicePrice.NumberOfNights||1,i=0;i<a;i++)if(r[i]=[],u=f(c)(h[i].RoomDetails),u!=null)for(l=h[i].RoomUpSells.map(o(c,u,v)),r[i]=[u].concat(l),e=0;e<r[i].length;e++)s=r[i][e],s.totalPrice=s.basePrice+s.totalPriceDiff+t;return r},mapOrbitzPackages:function(n){if(n==null)return t.debug("orbitzPackage == null"),[];if(n.ErrorMessage!=null)return t.debug("orbitzPackage.ErrorMessage != null"),[];return n.HotelSolutions.map(function(t,i){var e=n.PackageSolutions[i],r={id:t.HotelId,name:t.Name,description:"",hostCode:t.HotelHostCode,imageUrls:u.propertyImageUrls(t),propertyImageUrl:u.pickBestPropertyImage(t),starRating:t.StarRating,userScore:t.UserScoreRating,distanceValue:t.Distance.Value,distanceUnit:t.Distance.DistanceUnitField,coords:{latitude:t.Geocoded.Latitude.Value,longitude:t.Geocoded.Longitude.Value},rooms:t.HotelRoomDetail.map(f(e)),totalCost:e.Total,morePerNight:e.ServicePricePerPerson,nights:e.HotelServicePrice.NumberOfNights,checkIn:e.HotelServicePrice.CheckInDate,checkOut:e.HotelServicePrice.CheckOutDate,savings:e.ServicePriceTotalSavings,streetAddress:t.Address.Street+", "+t.Address.City,address:t.Address,phoneNumber:t.PhoneNumber,isExclusive:t.IsHAExclusiveOffer,isLimited:t.IsLimited,resortFees:null},o,c,s,h;for(angular.forEach(t.Content.Description,function(n){r.description+=n.replace("\r\n","<br>")+"<br>"}),r.fullAddress=t.Address.Street+", "+t.Address.City+", "+t.Address.StateProvince+" "+t.Address.PostalCode,r.savingsPercent=100*(r.savings/(r.savings+r.cost)),r.promotions=[],o=1;o<=r.rooms.length;o++)if(c=r.rooms[o-1],c.promotions!=null&&0<c.promotions.length){if(s=c.promotions,r.rooms.length>1)for(h=0;h<s.length;h++)s[h].text="Room "+o+": "+s[h].text;r.promotions=r.promotions.concat(s)}return r})},mapBestPropertyImage:function(t){n.forEach(t,u.pickBestPropertyImage)},pickBestPropertyImage:function(n){for(var t,i=0;i<n.Content.Visuals.length;i++)if(t=n.Content.Visuals[i].Url,t.indexOf(".jpg")===t.length-4)return n.propertyImageUrl=t,t},propertyImageUrls:function(n,t){t=t||r.get("HotelMaxImages",27);var u=r.get("HotelTrimLastImage",!0)?n.Content.Visuals.length-2:n.Content.Visuals.length-1,i=[];return angular.forEach(n.Content.Visuals,function(n,r){if(!(i.length>=t)&&(!(r>0)||!(r>=u))){var f=n.Url;(f.indexOf(".jpg")===f.length-4||f.indexOf(".png")===f.length-4||f.indexOf(".gif")===f.length-4||f.indexOf(".jpeg")===f.length-5)&&i.push(f)}}),i}};return u}])}(angular),function(n){"use strict";var t=n.module("haFeatureFlagsModule",[]);t.provider("haFeatureFlags",["$windowProvider",function(n){var i=n.$get(),r=i.HA!=null&&i.HA.FLAGS||{},t={},u=this.hasDefault=function(n){return typeof t[n]!="undefined"},f=this.has=function(n){return typeof r[n]!="undefined"},e=this.get=function(n,i){return f(n)?r[n]:typeof i!="undefined"?i:u(n)?t[n]:undefined};this.setDefault=function(n,i){t[n]=i};this.getDefault=function(n){return t[n]};this.$get=function(){return{hasDefault:u,has:f,get:e,setDefault:this.setDefault,getDefault:this.getDefault}}}])}(angular),function(n){"use strict";var t=n.module("haDateUtilsModule",[]);t.factory("haDateUtils",["$locale",function(t){function i(n){return n>9?"-"+n:"-0"+n}return Date.prototype.dateAdd=function(n,t){t=parseInt(t);var i=0;switch(n){case"day":i=t*24;this.dateAdd("hour",i);break;case"hour":i=t*60;this.dateAdd("minute",i);break;case"week":i=t*7;this.dateAdd("day",i);break;case"minute":i=t*60;this.dateAdd("second",i);break;case"second":i=t*1e3;this.dateAdd("millisecond",i);break;case"month":t=t+this.getUTCMonth();t/12>0&&(this.dateAdd("year",t/12),t=t%12);this.setUTCMonth(t);break;case"millisecond":this.setTime(this.getTime()+t);break;case"year":this.setFullYear(this.getUTCFullYear()+t);break;default:throw new Error("Invalid date increment passed");}return this},Date.prototype.YYYY_MM_DD=function(){return this.getFullYear()+i(this.getMonth()+1)+i(this.getDate())},{getVisibleMonths:function(n,i){for(var f=n>0?(new Date).dateAdd("month",n*-1):new Date,r=f.getMonth(),u=f.getFullYear(),e=[],s=t.DATETIME_FORMATS.MONTH,o=0;o<n+i+1;o++)r===12&&(r=0,u++),e.push({weeks:this.getVisibleWeeks(new Date(u,r,1)),name:s[r]+" "+u}),u=r>11?u+1:u,r=r>11?r-12:++r;return e},getVisibleWeeks:function(n){var t,i,r;for(n=new Date(n||new Date),n.setDate(1),n.setHours(0),n.setMinutes(0),n.setSeconds(0),n.setMilliseconds(0),n.getDay()===0&&n.getDate()===1||(n.getDay()===0?n.setDate(-5):n.setDate(n.getDate()-n.getDay()),n.getDate()===1&&n.setDate(-6)),t=[];t.length<6;){for(i=[],r=0;r<7;r++)i.push(new Date(n)),n.setDate(n.getDate()+1);t.push(i)}return t},getDaysOfWeek:function(n){var t,i;for(n=new Date(n||new Date),n=new Date(n.getFullYear(),n.getMonth(),n.getDate()),n.setDate(n.getDate()-n.getDay()),t=[],i=0;i<7;i++)t.push(new Date(n)),n.setDate(n.getDate()+1);return t},isValid:function(n,t,i){var u=parseInt(n,10),f=parseInt(t,10),e=parseInt(i,10),r;return!u||isNaN(f)||!e?!1:(r=new Date(u,f-1,e),r.getFullYear()===u&&r.getMonth()===f-1&&r.getDate()===e)},isBetween:function(n,t,i){return this.isAfter(n,t)&&this.isBefore(n,i)},isAfter:function(t,i){return!n.isDate(t)||!n.isDate(i)?!1:t.getTime()>i.getTime()},isBefore:function(t,i){return!n.isDate(t)||!n.isDate(i)?!1:t.getTime()<i.getTime()},isSameYear:function(t,i){return!n.isDate(t)||!n.isDate(i)?!1:t.getFullYear()===i.getFullYear()},isSameMonth:function(t,i){return!n.isDate(t)||!n.isDate(i)?!1:this.isSameYear(t,i)&&t.getMonth()===i.getMonth()},isSameDay:function(t,i){return!n.isDate(t)||!n.isDate(i)?!1:this.isSameMonth(t,i)&&t.getDate()===i.getDate()},isAfter331:function(t,i){if(!n.isDate(t)||!n.isDate(i))return!1;var r=Math.round(Math.abs((t.getTime()-i.getTime())/864e5));return r>=330},msToDate:function(n){return new Date(n)},isNextDay:function(t,i){return!n.isDate(t)||!n.isDate(i)?!1:t.getTime()<i.getTime()},numDaysDifference:function(t,i){if(!n.isDate(t)||!n.isDate(i))return!1;return Math.round(Math.abs((t.getTime()-i.getTime())/864e5))}}}])}(angular),function(n){"use strict";function o(n){return u.indexOf(n)!==-1?(u.splice(u.indexOf(n),1),!0):!1}function e(n,i,r,u){var f=t(r);/text|html|value/.test(u)?n[u==="value"?"val":u](f):(i[i.$normalize(u)]=f,n.attr(u,f));i.scsHideEmpty!==undefined&&o(r)&&n.addClass("hidden")}function s(n){return n.replace(/[A-Z]/g,function(n,t){return(t?"-":"")+n.toLowerCase()}).replace(/^[^-]+-/,"")}function r(n,t,i){return n=n.replace(/{(\d+)}/g,function(n,i){return t&&t[i]}),i&&(n=n.replace(/{([^}]+)}/g,function(n,t){return i.$eval(t)||n})),n}function h(n){if(!n[0].attributes[0])throw new Error("`scs` element must have a keys attribute");return n[0].attributes[0].name}function f(n){return console.error("SCString not found: ",n),u.push(n),"["+n+"]"}var i=n.module("haSitecoreModule",["haGlobalsModule"]),u=[],t=f;i.factory("haSitecoreStrings",["$parse","haGlobals","$q","haConfig","haHttpService",function(i,u,e,o,s){function a(n){var r=i(n.toLowerCase())(t);return typeof r=="undefined"&&f(n),!!r&&!/0|false/.test(r)&&r}function h(n){return s.GET(l(n)).then(function(i){return i.data?t[n]=i.data:Promise.reject(new Error("Invalid response data"))})}function c(n){var r=/^(\w+)(?:(?:\.|\[['"])([\w ]+))?/.exec(n);if(!r)return Promise.reject(new Error("Invalid ns_key argument: "+n));var i=r[1].toLowerCase(),u=r[2],f=t[i]?Promise.resolve(t[i]):t[i]=h(i);return f.then(function(i){return u?t(n):i})}var l=o.getSitecoreResourceUrl;return t=function(u,e){var o=i(u.toLowerCase())(t);return o&&n.isArray(e)&&(o=r(o,e)),o||f(u)},t.truthy=a,t.request=h,t.get=c,t.fetch=function(n){return typeof n!="string"?Promise.resolve(t):Promise.all(n.split(",").map(c))},u("HA",function(i){n.extend(t,i.SCStrings)}),t}]);i.factory("haSitecore",["haGlobals","haConfig","haHttpService",function(t,i,r){function u(t,i){i||(i={});t=t.toLowerCase();i.src=o("/static/images/"+t);var r=n.element("<img alt>").attr(i);return u.alt(t).then(function(n){r.attr("alt",n||"")}),["catch"](function(n){console.error(n)}),r}function e(n){return!!e[n.toLowerCase()]}var f=0,o=i.getImgUrl,s=i.getDynamicJsonUrl("sitecoreimages");return u.alt=function(t){if(t=t.toLowerCase(),f){var i=u[t];return typeof i=="undefined"?Promise.reject(new Error("Sitecore image not found: "+t)):Promise.resolve(i)}return r.GET(s).then(function(i){if(i.data){f++;n.extend(u,i.data);return}return f<3?u.alt(t):Promise.reject(new Error("Data unavailable"))})},t("HA",function(t){n.extend(e,t.SCSwitches)}),{$switch:e,$img:u}}]);["scsText","scsHtml","scsLabel","scsEyebrow","scsPlaceholder","scsErrorMessage","scsHref","scsSrc","scsDescription","scsHeader","scsValue"].forEach(function(n){var t=s(n);i.directive(n,function(){return{priority:500,link:{pre:function(i,r,u){e(r,u,u[n],t)}}}})});i.directive("i18nContent",function(){return{restrict:"A",link:function(n,i,u){var e=r(u.i18nContent,[],n),f=i.attr("format")||i.text();t.fetch(e).then(function(t){var u=i.contents(),e;if(u.length>1||u.length===1&&u[0].nodeType!==3&&u[0].nodeType!==8)return console.error("i18n-content directive can only only be applied to an element with a text node child.");e=i[0].nodeName==="INPUT"?"val":"html";i[e](f?r(f,t,n):t.join(" "))})}}});i.directive("i18nBackgroundImage",function(){return{restrict:"A",link:function(n,i,u){var f=r(u.i18nBackgroundImage,[],n);t.get(f).then(function(t){i.css("background-image",r("url('{0}')",[n.getMediaImage(t)]))})}}});i.directive("i18nSrc",function(){return{restrict:"A",link:function(n,i,u){var f=r(u.i18nSrc,[],n);t.get(f).then(function(t){i.attr("src",n.getMediaImage(t))})}}});i.directive("i18nimage",["haUtils",function(n){return{restrict:"E",replace:!0,scope:{},template:'<img ng-src="{{object.src}}" alt=""/>',link:function(i,r){var u=r.attr("key");t.get(u).then(function(t){t!=="["+u+"]"?(i.object=n.getImageObjectFromSiteCoreString(t),i.object.alt&&r.attr("alt",i.object.alt),i.object.width&&r.attr("width",i.object.width),i.object.height&&r.attr("height",i.object.height)):r.replaceWith(t)})}}}]);i.directive("i18nLink",["$window",function(n){return{restrict:"E",replace:!0,scope:{},template:"<a><\/a>",link:function(i,r){var u=r.attr("key");t.get(u).then(function(t){var i=$(t);i[0]&&(r.attr("href","http://"+(i.attr("linktype")==="internal"?n.location.host:"")+i.attr("url")),r.attr("title",i.attr("title")),r.text(i.attr("text")))})}}}]);i.directive("i18n",function(){return{restrict:"E",link:function(n,i){var u=i.attr("key")||i.attr("keys")||h(i);t.fetch(u).then(function(t){var u=i.text();i.replaceWith(u?r(u,t,n):t.join(" "))})}}});i.directive("scsAttrs",["$parse",function(t){return{link:{pre:function(i,r,u){var f=t(u.scsAttrs)(i);typeof f=="object"&&n.forEach(f,e.bind(this,r,u))}}}}]);i.run(["$rootScope","haSitecoreStrings","haSitecore",function(n,t,i){n.constructor.prototype.$scs=t;n.constructor.prototype.$switch=i.$switch;n.constructor.prototype.$img=i.$img;window.$scs=t;window.$switch=i.$switch;window.$img=i.$img}])}(angular),function(n){"use strict";var t;try{t=n.module("haViewModelModule")}catch(i){t=n.module("haViewModelModule",[])}t.factory("haViewModelSvc",["$log","$q",function(n,t){var i={},r={},u=function(t,i){n.debug("_defer",t);var u=r[t]=r[t]||[];u.push(i)},f=function(t){var u,f;if(i[t]!=null)for(u=r[t]||[];u.length>0;)n.debug("_resolve",t),f=u.pop(),f.resolve(i[t])},e=function(n,t){i[n]=t;f(n)},o=function(n){var r=t.defer();return i[n]!=null?r.resolve(i[n]):u(n,r),r.promise},s=function(n){return i[n]};return{put:e,get:o,getSync:s}}])}(angular),function(n){"use strict";var t=n.module("haSecondaryHeaderModule",[]);t.factory("haSecondaryHeaderSvc",["$log",function(){return{template:null,ctrl:{}}}]);t.controller("haSecondaryHeaderCtrl",["$log","$scope","haSecondaryHeaderSvc",function(n,t,i){return i.ctrl}])}(angular),function(n){"use strict";var t;try{t=n.module("haGeoDataModule")}catch(i){t=n.module("haGeoDataModule",["haHttpService"])}t.factory("haGeoDataSvc",["$q","$log","$filter","$cacheFactory","haGeoDataAPI",function(n,t,i,r,u){var f=r("haGeoDataCache"),s=r("regexCache"),e=null,o="COUNTRY",h="STATES_",c="CITIES_",l="COUNTRY_PHONE_CODES";return{setCountryData:function(n){return n=i("orderBy")(n,["Sorting","DisplayName"]),f.put(o,n)},setActiveCountry:function(n){e=n},getCountries:function(){var r=o,e=f.get(r),t;return e!=null?(t=n.defer(),t.resolve(e),t.promise):u.getCountries().then(function(n){return n=i("orderBy")(n,"Sorting"),f.put(r,n)})},getStates:function(t){var r=h+t,e=f.get(r),i;return e!=null?(i=n.defer(),i.resolve(e),i.promise):u.getStates(t).then(function(n){return f.put(r,n)})},getStateAndCities:function(t,i){var e=c+t+i,o=f.get(e),r;return o!=null?(r=n.defer(),r.resolve(o),r.promise):u.getStateAndCities(t,i).then(function(n){return f.put(e,n)})},getAddressStyle:function(n){var i,r,t;if(n=n||e&&e.Key,i=f.get(o),i!=null)for(r=0;r<i.length;r++)if(t=i[r],t!=null&&t.Key===n)return t.AddressStyle||t.Iso2Code;return null},noStates:function(n){var t,i,r;if(n=n||e&&e.Key,t=f.get(o),t!=null)for(i=0;i<t.length;i++)if(r=t[i],r!=null&&r.Key===n){if(r.StateValidation==="X")return!0;break}return!1},hasPostalCode:function(n){var t,i,r;if(n=n||e&&e.Key,t=f.get(o),t!=null)for(i=0;i<t.length;i++)if(r=t[i],r!=null&&r.Key===n){if(r.PostalCodeValidation==="X")return!1;break}return!0},getPostalCodeRegex:function(n){var t,r,u,i;if(n=n||e&&e.Key,t=s.get(n)||s.put(n,{}),t.PostalCodeValidation)return t.PostalCodeValidation;if(r=f.get(o),r!=null)for(u=0;u<r.length;u++)if(i=r[u],i!=null&&i.Key===n){if(i.PostalCodeValidation!=null&&i.PostalCodeValidation!=="X")return t.PostalCodeValidation=new RegExp(i.PostalCodeValidation),t.PostalCodeValidation;break}return t.PostalCodeValidation=/.*/,t.PostalCodeValidation},getPhoneNumberRegex:function(n){var t,r,u,i;if(n=n||e&&e.Key,t=s.get(n)||s.put(n,{}),t.PhoneNumberValidation)return t.PhoneNumberValidation;if(r=f.get(o),r!=null)for(u=0;u<r.length;u++)if(i=r[u],i!=null&&i.Key===n){if(i.PhoneNumberValidation!=null)return t.PhoneNumberValidation=new RegExp(i.PhoneNumberValidation),t.PhoneNumberValidation;break}return t.PhoneNumberValidation=/.*/,t.PhoneNumberValidation},getCityRegex:function(n){var t,r,u,i;if(n=n||e&&e.Key,t=s.get(n)||s.put(n,{}),t.CityValidation)return t.CityValidation;if(r=f.get(o),r!=null)for(u=0;u<r.length;u++)if(i=r[u],i!=null&&i.Key===n){if(i.CityValidation!=null)return t.CityValidation=new RegExp(i.CityValidation),t.CityValidation;break}return t.CityValidation=/^[a-zA-Z- ]{0,30}$/,t.CityValidation},getPhoneCountryCodes:function(){var e=l,s=f.get(e),n,h,r,t;if(s!=null)return s;if(n=f.get(o),h=function(n){return n.IsoCode==="USA"?1:parseInt(n.CountryTier)===1?2:3},n=i("orderBy")(n,[h,"IsoCode"]),n!=null){for(r=[],t=0;t<n.length;t++){var u=n[t].PhoneCountryCode,c=n[t].IsoCode,a=n[t].Key;u>0&&r.push({Code:u,Key:a,Name:"+"+u,Value:c})}return f.put(e,r)}return[]},lookupCountryByCode:function(n){var r=f.get(o),t,i;if(r!=null)for(t=0;t<r.length;t++)if(i=r[t],i!=null&&i.IsoCode===n)return i;return null}}}])}(angular),function(n){"use strict";var t;try{t=n.module("haAncillariesModule")}catch(i){t=n.module("haAncillariesModule",["haHttpService"])}t.factory("haAncillariesSvc",["$q","$log","$cacheFactory","haAncillariesAPI",function(n,t,i,r){return{getNeatFallbackUrl:r.getNeatFallbackUrl,getAncillaries:r.getAncillaries,getAncillariesAsync:r.getAncillariesAsync,getVacationPackageList:r.getVacationPackageList,getRepriceHotelDetails:r.getRepriceHotelDetails,addHotel:r.addHotel,removeHotel:r.removeHotel,setRooms:r.setRooms,addRentalCar:r.addRentalCar,getRentalTerms:r.getRentalTerms,removeRentalCar:r.removeRentalCar,searchCarRentals:r.searchCarRentals,addAirportShuttle:r.addAirportShuttle,removeAirportShuttle:r.removeAirportShuttle,addLeiGreeting:r.addLeiGreeting,removeLeiGreeting:r.removeLeiGreeting,getGiftCardState:r.getGiftCardState,addTripInsurance:r.addTripInsurance,removeTripInsurance:r.removeTripInsurance}}])}(angular),function(n){"use strict";var t=n.module("haRegexModule",[]);t.factory("haRegexService",function(){var n=/^[a-zA-Z]{6}$/,t=/^[0-9]{13}$/,u=/^(((PB|pb|Pb|pB)[a-zA-Z0-9]{13,13})|\d{12,14})$/,i=/^(\d){9}$/,f=/^[\w\d\.\-]+@[a-zA-Z\d\.\-]+\.[a-zA-Z]{2,15}$/,r=/^(?=.*[a-zA-Z])([a-zA-Z0-9\.]{6,30})$/;return{alphaNumeric:/[a-zA-Z0-9- ]/gi,hmNumber:i,email:f,phone:/[0-9]{10,15}/,name:/^[a-zA-Z-\s]{0,30}$/,addressLine:/^[a-zA-Z0-9-\.\, ]{0,29}$/,city:/^[a-zA-Z-\s]{0,30}$/,state:/^[a-zA-Z0-9- ]{0,30}$/,username:r,login:new RegExp(i.source+"|"+f.source+"|"+r.source),password:/^(?=.*[a-z])(?=.*\d)(?=.*[A-Z]).{10,16}$/,usernameOrHmNumber:new RegExp(i.source+"|"+r.source),creditCard:/^[0-9]{15,16}$/,redress:/^[a-zA-Z0-9]{0,13}$/,knownTraveler:/^[a-zA-Z0-9]{0,25}$/,flightNumber:/^\d{3,4}$/,jalFlightNumber:/(^(JL|NU)?[0-9]{1,4}$)|^[0-9]{1,4}$/i,flightStatusByNumber:/^(ha|HA)?[0-9]{1,4}$/,pnr:n,confirmationCode:t,owwConfCode:u,pnrOrConfCode:new RegExp(n.source+"|"+t.source),pnrOrConfOrOwwConfCode:new RegExp(n.source+"|"+t.source+"|"+u.source),maikaiNumber:/^[0-9]{12}/,agentCode:/^[a-zA-Z0-9]{1,10}$/,giftcardnumber:/\d{19}/,giftcardpin:/\d{4}/,chinaRewardMemberShipNumber:/^(cr|CR)\d{16}$/,ticketOrMSR:/^\d{13}$/,cashbagNum:/^\d{16}$/,promoCode:/^[a-zA-Z0-9]{1,12}$/,carMembershipNumber:/^[a-zA-Z0-9]{6}$/,carDiscountNumber:/^[a-zA-Z]{1}[0-9]{6}$/,carCouponNumber:/^[a-zA-Z]{4}[0-9]{3}$/}});t.run(["$rootScope","haRegexService",function(n,t){n.$regex=t}])}(angular),function(n){"use strict";var t=n.module("haPaymentTypesService",[]);t.service("haPaymentTypesService",["haPaymentAPI","$log",function(n,t){var i={updatePaymentTypes:function(){i.getAvailablePaymentTypes()},getAvailablePaymentTypes:function(){n.getPaymentMethodsState().then(function(n){i.setPaymentTypes(n)},function(n){t.error("getPaymentMethodsState API call Failed: "+n)})},setPaymentTypes:function(n){var t=n&&n.data;if(t.IsPaymentRequired)i.enablePaymentMethods=!0;else{i.enablePaymentMethods=!1;return}i.paymentTypesState=t.PaymentMethods;!i.paymentTypesState.CreditDebit.Enabled||i.paymentTypesState.Gift.Visible||i.paymentTypesState.MasterPass.Visible||enableAliPay&&$language.toLowerCase()==="zh-cn"||(i.hidePaymentTypeRadios=!0);!i.paymentTypesState.CreditDebit.Enabled||i.paymentTypesState.Gift.Enabled||i.paymentTypesState.MasterPass.Enabled||(i.paymentMethod="creditDebit");t.IsBarclayReturned&&(i.paymentMethod="creditDebit")}};return i}])}(angular),function(n){"use strict";n.module("haPaxServiceModule",[]).factory("haPaxService",[function(){function t(){var t=function(t){n=t},i=function(){return n};return{get:i,set:t}}var n=[];return{selectedTravelers:t}}])}(angular),function(n){"use strict";var t=n.module("haAriaLiveModule",[]);t.service("haAriaLiveService",["$rootScope","$timeout","$log",function(n,t){return{updateMessage:function(i){n.ariaLiveMessage=i;t(function(){n.ariaLiveMessage=""},5e3)}}}])}(angular),function(n){"use strict";var t;try{t=n.module("haVerticalSeatmapModule")}catch(i){t=n.module("haVerticalSeatmapModule",["ui.router"])}t.service("haVerticalSeatmapService",["$log","$filter","haHttpService","$q","$timeout","$interval","$rootScope","haModal","haConfig","haSitecoreStrings","haUtils","haCitiesSvc",function(t,i,r,u,f,e,o,s,h,c,l,a){var v={legs:[],activeLegIndex:0,selectedPassengerIndex:0,pageLoading:!0,seatMapLoading:!1,passengerSeatSelection:[],seatChargeSubtotals:[],isForSelection:!0,error:null,strings:{},lastNameFirst:o.$language==="ja-jp"||o.$language==="ko-kr"||o.$language==="zh-cn"||o.$language==="zh-tw",svgScaleFactor:1,reshopSeatCredits:[],promiseResponses:{},currency:o.$currency,seatTypeFilters:{standard:{label:"Standard",value:!0},extra:{label:"Extra Comfort",value:!0},flat:{label:"Lie-Flat",value:!0},exit:{label:"Exit Row",value:!0},first:{label:"First Class",value:!0},preferred:{label:"Preferred",value:!0}},handleError:function(n){t.error(n);v.error=n},getSeatType:function(n){return n===1?2:n===2?1:0},getFlightVM:function(){function p(n){var t=n.match(/[\d]+/);return t=Number(t[0]),new Date(t)}function w(n){switch(n){case 2:return"first";case 3:return"business";case 0:case 1:case 4:return"coach";default:return t.error("Unknown CabinName:",n),""}}function s(n){var i=n.split(":"),t=parseInt(i[0]),u=t>12,r="a";return u&&(t-=12,r="p"),t+":"+i[1]+r}function u(n){switch(n){case"ExtraComfort":case"ec":return 1;case"Preferred":case"preferred":return 2;default:return 0}}function e(t){var i=!1;return n.forEach(t,function(n){n.Type&&n.Type.toLowerCase()==="infant"&&(i=!0)}),i}var f,h,y;c.get("InFlightOptionsInfo").then(function(n){v.strings=n});v.disableSeatUpgrades=o.IsDisableSeatUpgrade;v.disableExitRows=o.IsDisableExitRows;o.TripSummary?(n.forEach(o.TripSummary.Trips,function(t){n.forEach(t.Flights[0].Legs,function(n){n.SelectedFareClass=t.Flights[0].SelectedFareClass.toLowerCase();v.legs.push(n);v.seatChargeSubtotals.push(0)})}),v.passengers=o.TripSummary.Passengers,v.currency=o.TripSummary.currency,o.PassengerTripSummary&&o.PassengerTripSummary.Passengers&&n.forEach(v.passengers,function(t,i){var r=o.TripSummary.Passengers[i].FirstName,u=o.TripSummary.Passengers[i].LastName;n.extend(t,o.PassengerTripSummary.Passengers[i]);t.FirstName=r;t.LastName=u;o.IsChangeFlightBooking&&t.Seats&&t.Seats.length&&n.forEach(t.Seats,function(n){n.SeatLocation=null;n.Type=0;n.SeatAmount=0});t.Seats||(t.Seats=[],n.forEach(v.legs,function(n,i){t.Seats.push({SegmentID:i+1})}))}),n.forEach(v.passengers,function(t){t.Seats||(t.Seats=[]);n.forEach(v.legs,function(n,i){t.Seats[i]||t.Seats.push({SegmentID:i+1,SeatLocation:null,SeatAmount:0,Type:0})})}),o.IsChangeFlightBooking?(f=l.getReshopFlightQueryModelCookie(),t.debug("reshop cookie",f),v.reshopPNR=f.PNR_ID,v.reshopSegmentsIDs=[],n.forEach(f.OldFlightSearchSegmentList,function(n){v.reshopSegmentsIDs.push(n.SegmentID)}),n.forEach(v.passengers,function(n){n.FirstName=v.convertToSentenceCase(n.FirstName);n.LastName=v.convertToSentenceCase(n.LastName)}),h="/api/trip/"+v.reshopPNR+"/"+v.passengers[0].LastName,r.GET(h).success(function(i){t.debug("trip data",i);n.forEach(i.segments,function(i,r){n.forEach(i,function(i){n.forEach(v.legs,function(r,u){var e=r.OperatingCarrier+"-"+r.FlightNumber,o=moment(i.depart).format("YYYY-MM-DD"),f=i.cabin;f==="extracomfort"&&(f="coach");i.flight===e&&o===r.DepartureDate&&f===r.SelectedFareClass&&n.forEach(i.seats,function(i){n.forEach(v.passengers,function(n){i.traveler===n.TravelerAssociationID&&(t.debug("same flight - seat "+i.id+" persisted"),n.Seats[u].SeatLocation=i.id,n.Seats[u].SeatAmount=i.cost)})})});var f=v.reshopSegmentsIDs.indexOf(r+1)!==-1;n.forEach(i.seats,function(n){f&&n.cost>0&&v.reshopSeatCredits.push({type:u(n.type),price:n.cost,isExtraComfort:n.type==="ec",isPreferred:n.type==="preferred",TravelerAssociationID:n.traveler})})})});v.disableRow4=e(v.passengers);v.pageLoading=!1}).error(function(n,i){t.error("Error getting original trip data: "+i);v.disableRow4=e(v.passengers);v.pageLoading=!1})):(v.disableRow4=e(v.passengers),v.pageLoading=!1)):o.AirGroup?(v.isChangeSeats=!0,n.forEach(o.AirGroup.Flight,function(n){var t=n.OperatingCarrier.AirlineCode,i;t==="EM"&&(t="HA");i={FlightNumber:n.Carrier.FlightNumber.Value,OperatingCarrier:t,DepartureDate:moment(p(n.Departure.Date)).format("MM/DD/YYYY"),DepartureTime:s(n.Departure.Time),DepartureCityCode:n.Departure.AirportCode,DepartureCity:n.Departure.City,ArrivalCityCode:n.Arrival.AirportCode,ArrivalCity:n.Arrival.City,Duration:n.FlightDuration,ClassOfService:[{ClassValue:n.ClassOfService}],IsCodeShare:n.IsCodeshare,SelectedFareClass:w(n.CabinName),ElementNumber:parseInt(n.ElementNumber)};v.legs.push(i)}),v.passengers=[],n.forEach(o.Traveler,function(t,i){if(v.paxOkayToAdd(t.ElementNumber)){var r={type:"Adult",isUser:i===0,FirstName:v.convertToSentenceCase(t.TravelerName.GivenName),LastName:v.convertToSentenceCase(t.TravelerName.Surname),Id:t.ElementNumber,TravelerAssociationID:t.ElementNumber};r.Seats=[];n.forEach(v.legs,function(t,i){var u={SegmentID:i+1};o.Seat&&o.Seat.length&&(v.currency=o.Seat[0].CurrencyCode,n.forEach(o.Seat,function(n){if(parseInt(n.SegmentElementNumber.Value)===t.ElementNumber&&n.Assignment.TravelerElementNumber.Value===r.Id){var i=n.Assignment.SeatLocation;i.indexOf("0")===0&&(i=i.substr(-2));u.SeatLocation=i;u.Type=v.getSeatType(n.SeatType);u.SeatAmount=n.SeatAmount;u.originalSeat={type:v.getSeatType(n.SeatType),price:n.SeatAmount,credit:n.SeatCredit,isExtraComfort:n.SeatType===2,isPreferred:n.SeatType===1}}}));r.Seats.push(u)});v.passengers.push(r)}}),v.pageLoading=!1):o.ExpertBookingSeatmapData?(v.legs=[],n.forEach(o.ExpertBookingSeatmapData.segments,function(t){n.forEach(t.legs,function(n){var t={FlightNumber:n.flight,OperatingCarrier:n.carrier,DepartureDate:moment(n.departure).format("MM/DD/YYYY"),DepartureTime:s(moment(n.departure).format("h:mma")),DepartureCityCode:n.origin,DepartureCity:a.getCityByCodeSync(n.origin).LongDescription,ArrivalCityCode:n.destination,ArrivalCity:a.getCityByCodeSync(n.destination).LongDescription,Duration:i("formatMinutes")(n.duration),IsCodeShare:n.operator&&n.operator!=="HA",SelectedFareClass:n.cabin,id:n.id,disableFirstClass:o.ExpertBookingSeatmapData.existingPNR&&n.cabin!=="FIRST",disableMainCabin:n.cabin==="FIRST"};v.legs.push(t)})}),v.passengers=[],n.forEach(o.ExpertBookingSeatmapData.travelers,function(t){var i={type:t.type,isUser:t.hmnumber&&t.hmnumber==o.user.haMiles,FirstName:t.firstname,LastName:t.lastname,TravelerID:t.travelerid,ID:t.id};i.Seats=[];n.forEach(v.legs,function(r,f){var e={SegmentID:f+1};t.seats&&t.seats.length&&(v.currency=o.ExpertBookingSeatmapData.currency,n.forEach(t.seats,function(n){if(n.id===r.id){var t=n.seat;e.SeatLocation=t;e.Type=u(n.type);e.SeatAmount=n.amount/100;e.originalSeat={type:u(n.type),price:n.amount/100,isExtraComfort:u(n.type)===1,isPreferred:u(n.type)===2}}}));i.Seats.push(e)});v.passengers.push(i)}),o.ExpertBookingSeatmapData.restrictions&&(v.disableSeatUpgrades=o.ExpertBookingSeatmapData.restrictions.blockseatupgrades,v.disableExitRows=o.ExpertBookingSeatmapData.restrictions.blockexitrows),v.passengersInitial=n.copy(v.passengers),v.pageLoading=!1):(y="View model is missing from root scope.",v.handleError(y),v.pageLoading=!1)},paxOkayToAdd:function(n){return o.infantLapList&&o.infantLapList.indexOf(n)>-1?!1:o.groupPNRSelectedPax&&o.groupPNRSelectedPax.length>0&&o.groupPNRSelectedPax.indexOf(n)===-1?!1:!0},applyAnyAvailableSeatCredits:function(t){var i="none";v.legs[t].seatModel&&v.legs[t].seatModel.hasPreferred?i="preferred":v.legs[t].seatModel&&v.legs[t].seatModel.hasExtraComfort&&(i="extraComfort");v.reshopSeatCredits.length&&n.forEach(v.reshopSeatCredits,function(r){!r.used&&(i==="preferred"&&r.isPreferred||i==="extraComfort"&&r.isExtraComfort)&&n.forEach(v.passengers,function(i){var u=i.Seats[t];r.TravelerAssociationID!==i.TravelerAssociationID||u.originalSeat||(u.originalSeat=n.copy(r),u.IsCredit=!0,u.SurchargeOk=!0,r.used=!0)})})},initPreviewSegments:function(t,i,r){v.isForSelection=!1;v.disableSeatUpgrades=r;v.legs=[];c.get("InFlightOptionsInfo").then(function(n){v.strings=n});var u=Boolean(i>2);n.forEach(t,function(n){n.OperatingAirline==="EM"?(n.IsCodeShare=!1,n.OperatingCarrier="HA"):n.OperatingCarrier=n.OperatingAirline;n.DepartureDate=moment(n.DepartureDateTime).format("MM/DD/YYYY");n.DepartureCityCode=n.DepartureCityCode||n.OriginCityCode;n.DepartureCity=n.DepartureCity||n.OriginCityName;n.DepartureTime=moment(n.DepartureDateTime).format("h:mma");n.ArrivalCityCode=n.ArrivalCityCode||n.DestinationCityCode;n.ArrivalCity=n.ArrivalCity||n.DestinationCityName;n.IsInternational=u;v.legs.push(n)});v.pageLoading=!1},createSeatsPostObject:function(){var t={InFlightOptions:[],Legs:[],TotalPremiumSeatAmount:0};return n.forEach(v.legs,function(i,r){var u={AirlineCode:i.OperatingCarrier,ArrivalCityCode:i.ArrivalCityCode,ClassOfService:i.ClassOfService[0].ClassValue,DepartureCityCode:i.DepartureCityCode,DepartureDate:i.DepartureDate,DepartureTime:i.DepartureTime,FlightNumber:i.FlightNumber,IsCodeShare:Boolean(i.IsCodeShare),SeatSelections:{ExtraComfortSelectionsCount:0,PreferredSeatSelectionsCount:0,InFlightOptions:[],Seats:[]}},f=0,e=0;i.ExtraComfortFee&&(f=i.ExtraComfortFee);i.PreferredSeatFee?e=i.PreferredSeatFee:i.seatModel&&i.seatModel.extraComfortPrice?f=i.seatModel.extraComfortPrice:i.seatModel&&i.seatModel.preferredSeatPrice&&(e=i.seatModel.preferredSeatPrice);v.isChangeSeats?u.ElementNumber=r+1:(u.SelectedFareClass=i.SelectedFareClass,u.ExtraComfortFee=f,u.PreferredSeatFee=e,u.IsExtraComfortAvailable=i.IsExtraComfortAvailable);n.forEach(v.passengers,function(n){var s=n.Seats[r],h,c,l,a;u.SeatSelections[n.TravelerAssociationID]=s.SeatLocation;h={Flight:i.OperatingCarrier+i.FlightNumber,PaxId:n.TravelerAssociationID,SeatAmount:s.SeatAmount,SeatName:s.SeatLocation,SeatType:v.getSeatType(s.Type),SelectedFareClass:i.SelectedFareClass,ExtraComfortFee:f,PreferredSeatFee:e,IsExtraComfortAvailable:i.IsExtraComfortAvailable};v.isChangeSeats&&(h.InFlightOptions=[]);v.includeSeatNumber&&(h.SeatNumber=s.SeatLocation);s.Type>0&&(c="",s.Type===2?(c=v.strings.preferredseattext,u.SeatSelections.PreferredSeatSelectionsCount++):s.Type===1&&(c=v.strings.extracomfortupgradetext,u.SeatSelections.ExtraComfortSelectionsCount++),l={Description:c,Flight:i.OperatingCarrier+i.FlightNumber,Price:s.SeatAmount,SeatName:s.SeatLocation},v.isChangeSeats?v.isChangeSeats&&s.originalSeat&&h.SeatAmount>s.originalSeat.price&&h.InFlightOptions.push(l):(s.Type===1&&i.SelectedFareClass!=="extracomfort"||s.Type===2&&i.SelectedFareClass!=="preferred")&&(u.SeatSelections.InFlightOptions.push(l),t.InFlightOptions.push(l),t.TotalPremiumSeatAmount+=s.SeatAmount));s.DowngradeOk&&s.SeatAmount===0&&!o.IsChangeFlightBooking&&(a={Description:v.strings.extracomfortdowngradetext,SeatName:s.SeatLocation,Flight:i.OperatingCarrier+i.FlightNumber,Price:s.SeatAmount},h.IsDowngrade=!0,u.SeatSelections.InFlightOptions.push(a),t.InFlightOptions.push(a));u.SeatSelections.Seats.push(h)});t.Legs.push(u)}),t},getSeatsForLeg:function(n){var i=u.defer(),t="/api/seats/",f;return t+="ha-",t+=v.legs[n].FlightNumber+"/",t+=moment(v.legs[n].DepartureDate).format("YYYY-MM-DD"),f={o:v.legs[n].DepartureCityCode,d:v.legs[n].ArrivalCityCode,currency:o.$currency,time:v.legs[n].DepartureTime,arrivalTime:v.legs[n].ArrivalTime,arrivalDate:moment(v.legs[n].ArrivalDate).format("YYYY-MM-DD")},f.hm=v.getHMNumbers(),t+="?"+$.param(f),r.GET(t).success(function(t,r,u){v.legs[n].EquipmentCode||(v.legs[n].EquipmentCode=u("X-Plane-Type"));v.legs[n].seatModel={seats:t.SeatDetails,disableSeatUpgradeFlx:t.DisableSeatUpgradeFlx};Object.getOwnPropertyNames(t).length===0&&v.noSeatsAvailableForLeg(n);i.resolve()}).error(function(n,t){i.reject("Error getting seat availability data: "+t)}),i.promise},getHMNumbers:function(){var t=[];return o.isLoggedIn&&o.user&&o.user.haMiles&&t.push(o.user.haMiles),n.forEach(v.passengers,function(n){n.AccountNo&&t.push(n.AccountNo)}),t.join(",")},setUpgradableSeat:function(n){var t=u.defer();return r.POST("/book/shared/SetUpgradeSeat?available="+n).success(function(){t.resolve()}).error(function(){t.resolve()}),t.promise},upgradeToMainCabin:function(){return r.POST("/Book/InFlightOptions/UpgradeToMainCabin")},getSeatsForChangeSeats:function(t){var i=u.defer(),f=v.createSeatsPostObject();return r.POST("/MyAccount/PostPurchaseEditSeats/GetSeatMap",{seatMapRequest:f.Legs[t]}).success(function(r,u,f){v.legs[t].EquipmentCode=f("X-Plane-Type");v.BlockRowFour=r.BlockRowFour;var e={},o=0;n.forEach(r.rows,function(t){t.number&&t.number.length&&n.forEach(t.cols,function(n){if(n.isSeat&&n.available){o++;var t=0;n.extraComfortSeatPrice&&n.extraComfortSeatPrice>0?t=n.extraComfortSeatPrice:n.preferredSeatPrice&&n.preferredSeatPrice>0&&(t=n.preferredSeatPrice);e[n.name]={price:t}}})});v.legs[t].seatModel={seats:e};o||v.noSeatsAvailableForLeg(t);i.resolve()}).error(function(){i.reject("Error getting seat availability data: "+status)}),i.promise},noSeatsAvailableForLeg:function(n){v.legs[n].seatModel={seatsUnavailable:!0};c.get("InFlightOptions.NoSeatsAvailableContent").then(function(n){v.noSeatsAvailableErrorMessage=n})},getAvailableSeatsForLeg:function(n){var i;return(t.debug("get available seats for index:",n),v.legs[n].seatModel)?(i=u.defer(),i.resolve(),i.promise):v.legs[n].IsCodeShare?(i=u.defer(),i.reject("Can't get available seats for codeshare flight."),i.promise):v.isChangeSeats?v.getSeatsForChangeSeats(n):v.getSeatsForLeg(n)},loadGetPromise:function(n){if(!v.promiseResponses[n]){var t=u.defer();v.promiseResponses[n]=t.promise;r.GET(n).success(function(n){t.resolve(n)}).error(function(n,i){t.reject(i)})}return v.promiseResponses[n]},loadPlaneConfiguration:function(){return v.loadGetPromise("/planes/configuration")},loadSvgByUrl:function(n){return v.loadGetPromise(n)},loadSvgSeatmapForLeg:function(n){var i=u.defer(),r,o;return $("#svgSeatmap"+n).find("svg").length?(i.resolve(),i.promise):(r=v.legs[n].EquipmentCode,!r)?(i.reject("Missing the equipment code for this leg."),i.promise):(t.debug("equipment code:"+r),v.loadPlaneConfiguration().then(function(u){var h=function(n){for(var i,r=u||[],t=0,f=r.length;t<f;t++)if(i=r[t],$.inArray(n,i.codes)>-1)return i;return undefined},s=h(r);if(!s)return c.get("BookingWidget.equipmentcodesvgerrortext").then(function(n){i.reject(n)}),i.promise;v.legs[n].EquipmentName=s.name;o=s.url;v.loadSvgByUrl(o).then(function(r){if(v.error="",$("#svgSeatmap"+n).length)$("#svgSeatmap"+n).html(r),i.resolve();else var u=e(function(){$("#svgSeatmap"+n).length&&(e.cancel(u),$("#svgSeatmap"+n).html(r),t.debug("svg loaded after waiting for container"),i.resolve())},100,500);f(v.getNextLeg,1e3)},function(n){i.reject("Error getting SVG seatmap: "+n)})},function(n){i.reject("Error getting SVG seatmap: "+n)}),i.promise)},loadIFE:function(){var n=u.defer(),t=h.getDynamicJsonUrl("/sitecoreresources/entertainment_data");return r.GET(t).success(function(t){n.resolve(t)}).error(function(){n.resolve([])}),n.promise},setIFE:function(n){var t=u.defer();return r.GET("/book/shared/setinflightentertainment?enabled="+!!n).success(function(n){t.resolve(n)}).error(function(){t.reject()}),t.promise},getNextLeg:function(){var n,i,t;if(v.legs.length>1){if(t=0,v.activeLegIndex===v.legs.length-1){for(n=v.legs.length-1;n>=0;n--)if(v.legs[n]){if(v.legs[n].IsCodeShare)continue;if(!v.legs[n].promise){t=n;break}}}else for(n=0,i=v.legs.length;n<i;n++)if(v.legs[n]){if(v.legs[n].IsCodeShare)continue;if(!v.legs[n].promise){t=n;break}}v.legs[t]&&!v.legs[t].promise&&f(function(){v.legs[t].promise=v.getAvailableSeatsForLeg(t).then(v.getNextLeg)},500)}},openSeatClassModalWindow:function(n){var t="InFlightOptionsInfo."+n,i=c(t);s("",{id:"contextual-help",backdrop:"true",template:i})},convertToSentenceCase:function(n){if(n.length!==0){var t=n.substr(0,1),i=n.substr(1,n.length);return t.toUpperCase()+i.toLowerCase()}},convertToMilitaryTime:function(n){var i=n.split(":"),t=i[0],r=i[1].substr(0,2),u=i[1].substr(2,1);return t=u.toLowerCase()==="p"?parseInt(t)+12:"00"+t.slice(-2),""+t+r},disallowAdvanceSeatSelection:function(n,t,i,r){var u=n.ArrivalCityCode+"-"+n.DepartureCityCode;return t&&u.toLowerCase().indexOf(i)>-1&&n.SelectedFareClass!=="business"?!0:(n.faaRestricted=!1,r&&(r.faaRestricted=!1),!1)},setFAARestriction:function(n,t){n.resolved=n.faaRestricted=!0;t&&(t.faaRestricted=!0)},formatNameWithLastInitial:function(n,t){var i=v.convertToSentenceCase(n),u=t.substr(0,1).toUpperCase()+".",r=" ";return i.length===1&&(r=".",v.lastNameFirst&&(i+=".")),v.lastNameFirst?u+r+i:i+r+u}};return v}])}(angular),function(n){"use strict";var t;try{t=n.module("haMobileService")}catch(i){t=n.module("haMobileService",[])}t.service("haMobileSvc",[function(){var n=767;this.determineIsMobile=function(){return window.innerWidth>n?(window.isMobile=!1,!1):(window.isMobile=!0,!0)}}]);t.directive("haFlushFittingCol",["$rootScope",function(n){return{restrict:"A",link:function(t,i,r){if(n.isMobile){var u=0-i.offset().left;i.css({marginLeft:u,marginRight:u,width:"auto",overflow:"hidden"});r.preservepadding!=="true"&&i.css({padding:0})}}}}]);t.directive("haEqualHeightColumns",["$rootScope","$interval",function(n,t){return{restrict:"A",link:function(i,r){if(n.isMobile)var u=0,f=50,e=t(function(){r.children(":last").outerHeight()>f&&(t.cancel(e),r.children().each(function(){$(this).outerHeight()>u&&(u=$(this).outerHeight())}),r.children().each(function(){$(this).outerHeight()<u&&$(this).css("height",u)}))},50)}}}])}(angular),function(n){"use strict";var t=n.module("haAirportTimezonesModule",[]);t.factory("haAirportTimezones",["haHttpService",function(n){var t="/Scripts/app/services/airport-timezones.json";return{getAirportTimeZone:function(i){return n.GET(t).then(function(n){return n.data.filter(function(n){return n.code===i})[0]})}}}])}(angular),function(n){"use strict";var t=n.module("haReAuthServiceModule",[]);t.service("haReAuthService",[function(){function i(t){return n.element('[name="'+t+'"]').val()}function r(n,t,i){for(var r=0;r<n.length;r+=1)if(n[r][t]===i)return r;return-1}var t=this;return t.criticalFields=[],t.getField=function(n){var i=t.criticalFields.filter(function(t){return t.name===n});return i[0]},t.registerField=function(n){var r={name:n,changed:!1,initialValue:i(n)};t.criticalFields.push(r)},t.updateField=function(n){n=t.getField(n);n.value=i(n.name);n.changed=n.value!==n.initialValue;var u=r(t.criticalFields,"name",n.name);u>-1&&t.criticalFields.splice(u,1,n)},t.fieldIsRegistered=function(n){return t.criticalFields.length&&n&&n.name?t.criticalFields.some(function(t){return t.name===n.name}):!1},t.formRequiresReAuth=function(n){return n.forEach(function(n){t.updateField(n)}),t.criticalFields.some(function(n){return n.changed})},t.cleanUp=function(){t.criticalFields=[]},t}])}(angular),function(n){"use strict";var t,i;try{t=n.module("haUpgradeModalModule")}catch(r){t=n.module("haUpgradeModalModule",[])}i="/Api/OnlineUpgrade/Purchase";t.factory("haUpgradeService",["haHttpService",function(n){return{submitUpgradeRequest:function(t){return n.POST(i,t)}}}])}(angular),function(n){"use strict";var t;try{t=n.module("haAncillaryUpsellsServiceModule")}catch(i){t=n.module("haAncillaryUpsellsServiceModule",[])}t.factory("haAncillaryUpsellsService",["haUtils","haSitecoreStrings",function(n,t){function c(n){var u=t("carrentalbuffertimes");u.onewaydays&&(o=parseInt(u.onewaydays));switch(n){case 1:u.interislandpickup&&u.interislanddropoff&&(i=parseInt(u.interislandpickup),r=parseInt(u.interislanddropoff));break;case 2:u.transpacificpickup&&u.transpacificdropoff&&(i=parseInt(u.transpacificpickup),r=parseInt(u.transpacificdropoff));break;case 3:u.southpacificpickup&&u.southpacificdropoff&&(i=parseInt(u.southpacificpickup),r=parseInt(u.southpacificdropoff));break;default:u.otherpickup&&u.otherdropoff&&(i=parseInt(u.otherpickup),r=parseInt(u.otherdropoff))}}function s(n,t){t=t||0;var i=moment(n);return i.add(t,"minutes"),i.format("YYYY-MM-DD HH:mm:ss")}function u(n,t){var r=n.Segments[0],u=r.Flights[r.Flights.length-1];return s(u.IsoArrivalDatetime,t?0:i)}function h(n,t,i){var e,f,h,c;return t==1?(f=moment(u(n)),f=f.add(o,"days"),e=f.format("YYYY-MM-DD HH:mm:ss")):t==2&&(h=n.Segments[1],c=h.Flights[0],e=s(c.IsoDepartureDatetime,i?0:-r)),e}function f(n){var t=n.Segments[0],i=t.Flights[t.Flights.length-1];return i.ArrivalCityCode}function l(n){for(var t=0;t<n.Travellers.length;t++)if(n.Travellers[t].IsPrimaryPassenger)return n.Travellers[t]}function a(n){if(n.DOB){var t=moment(n.DOB),i=moment(new Date);return i.diff(t,"years")}}function v(t,i,r,e){var s,y="{params}",w,b,nt,tt,it,rt,v,o;if(c(r.ItineraryMarketType),s=window.location.href.match(/confirmation/i)?t.ConfirmationPageTrackingID:t.ItineraryPageTrackingID,t.AncillaryType==="GTAIRPORTSHUTTLE"){if(o=t.DeepLinkURL.split(y),o.length<2)throw"DeepLinkURL parameter placeholder not found";var k=t.DeepLinkParams,p=f(r),d={adults:r.Travellers.filter(function(n){return n.Type==="ADT"}).length,oneway:!0,pickupIATACode:p,pickupDateTime:u(r),clientId:s},g=n.createQueryString(d)+"&"+k;return o[0]+g+o[1]}if(t.AncillaryType==="CAR"){if(t.DeepLinkURL&&i>0){if(v=t.DeepLinkURL,v.indexOf(y)!=-1)o=v.split(y);else throw"DeepLinkURL parameter placeholder not found";var k=t.DeepLinkParams,p=f(r),d={age:a(l(r)),pickupIATACode:p,returnIATACode:p,pickupDateTime:u(r),returnDateTime:h(r,i),clientId:s},g=n.createQueryString(d)+"&"+k;return o[0]+g+o[1]}if(t.LinkURL.match(/cartrawler/i))return w=t.LinkURL.indexOf("?"),b=t.LinkURL.indexOf("#"),w>0?(nt=t.LinkURL.substr(0,w+1),tt=t.LinkURL.substr(w+1),nt+"clientID="+s+"&"+tt):b>0?(it=t.LinkURL.substr(0,b),rt=t.LinkURL.substr(b),it+"?clientID="+s+rt):t.LinkURL+"?clientID="+s}else{if(t.LinkURL.match(/select-or-upgrade-seats/i))return typeof e=="undefined"?t.LinkURL:e;if(t.AncillaryType==="HOTEL"){if(t.DeepLinkURL&&i>0){if(v=t.DeepLinkURL,v.indexOf(y)!=-1)o=v.split(y);else throw"DeepLinkURL parameter placeholder not found";var k=t.DeepLinkParams,p=f(r),d={MDPCID:s,destination:p,startDate:moment(u(r,!0)).format("YYYY-MM-DD"),endDate:moment(h(r,i,!0)).format("YYYY-MM-DD")},g=n.createQueryString(d)+"&"+k;return o[0]+g+o[1]}}else return t.LinkURL}}var e={},i=60,r=180,o=5;return e.getLinkURL=v,e}])}(angular),function(n){"use strict";n.module("haEncryptionModule",[]).factory("haEncryptionService",["haEncryptionAPI",function(n){function i(){return"Format of data is invalid in EncryptionService."}function t(n){return n&&typeof n=="string"&&n!==""?!0:!1}return{Encrypt:function(r,u){return t(r)&&t(u)?n.encryptString(r,u):Promise.reject(i())},EncryptString:function(n,t){return this.Encrypt(n,t).then(function(n){return n.data},function(n){return console.error("Encryption Error: "+n),""})}}}])}(angular),function(n){"use strict";n.module("haLaunchDarklyModule",[]).factory("haLaunchDarklyService",["haLaunchDarklyAPI","$q",function(n){function t(n,t){return"Format of variant "+t+" is invalid for type "+n+" in LaunchDarklyService."}function i(n){return n===!0||n===!1?!0:!1}function r(n){return typeof n=="number"?!0:!1}function u(n){return typeof n=="number"&&n.toString().includes(".")?!0:!1}function f(n){return typeof n=="string"?!0:!1}function e(n){return typeof n=="string"&&n.indexOf("-")!==n.length-1?!0:!1}return{GetFlagVariant:function(o,s,h,c){var l=!1;switch(s){case"boolean":l=i(h);break;case"integer":l=r(h);break;case"float":l=u(h);break;case"dictionary":l=e(h);break;case"string":l=f(h);break;default:return Promise.reject("Invalid type: "+s+" sent to LaunchDarklyService.")}return l?n.getFeatureFlag(o,s,h.toString(),c):Promise.reject(t(s,h))},trackResult:function(t){n.trackResult(t)},GetFlagVariantAsBoolean:function(n,t,i){return this.GetFlagVariant(n,t,i).then(function(n){return n.data==="ENABLED"?!0:!1},function(n){return console.error("Launch Darkly Error: "+n+"\tKEY: "+attributes.key),!1})}}}])}(angular),function(n){"use strict";var t;try{t=n.module("haAncillariesModule")}catch(i){t=n.module("haAncillariesModule",["haHttpService"])}t.service("haAncillariesAPI",["$q","haHttpService","$cacheFactory",function(n,t){function a(n){return t.POST(o,JSON.stringify(n))}var f="/Book/Itinerary/GetAncillary?type={0}",e="/Book/Itinerary/NEATFallBackURL",o="/Book/Itinerary/GetCarRentalWidgetResults",s=function(n){return"/Book/Itinerary/GetCompleteVacationPackageList?hotelID="+n},h=function(n){return"/Book/Itinerary/RepriceHotelDetails?hotelID="+n},u=function(t){if(t==null||typeof t.ErrorCode=="string"){var i={code:t.ErrorCode,message:t.ErrorMessage,pathType:t.PathType,redirectUrl:t.RedirectURL};return n.reject(i)}return!1},r=function(n){return function(i){return i=i||{},i.cache=!1,i.headers={"Cache-Control":"no-cache"},t.GET(n,i).then(function(n){var t=n.data,i=u(t);return i?i:typeof t=="string"?JSON.parse(t):t})}},i=function(n){return function(i,r){return r=r||{},t.POST(n,i,r).then(function(n){var t=n.data,i=u(t);return i?i:typeof t=="string"?JSON.parse(t):t})}},c=function(){return"?"+Math.random()*94445+5555},l=function(i,r){var u,o,e;return i.length?(o=f,e={},i.forEach(function(n){if(window.performance.clearMarks("mark_end_"+n),e[n]=t.GET(o.format(n),{timeout:r}),window.performance.mark("mark_end_"+n),window.performance.getEntriesByName("mark_end_"+n)&&window.performance.getEntriesByName("mark_end_"+n)[0]){var i=window.performance.getEntriesByName("mark_end_"+n)[0].startTime;window.BOOMR&&BOOMR.version&&window.BOOMR.sendTimer(n+"_Timer",i)}}),n.allSettled(e)):(u=n.defer(),u.reject("No eligible types"),u.promise)};return{getItineraryDetails:r("/Book/Itinerary/GetItineraryDetails"+(/Windows /i.test(window.navigator.userAgent)?c():"")),getAncillaries:r("/Book/Itinerary/GetAncillaries"),getAncillariesAsync:l,getAncillariesFallback:r("/Content/assets/models/GetAncillaries-HNL-ITO-1A.json"),getVacationPackageListFallback:r("/Content/assets/models/GetVacationPackageList-HNL-ITO-1A.json"),getNeatFallbackUrl:function(){return r(e)().then(function(n){return n.url})},getRepriceHotelDetails:function(n,t){return t=t||{},r(h(n))(t)},getVacationPackageList:function(n,t){return t=t||{},r(s(n))(t)},addHotel:i("/Book/Itinerary/AddHotel"),removeHotel:i("/Book/Itinerary/RemoveHotel"),setRooms:i("/Book/Itinerary/SetRooms"),addRentalCar:i("/Book/Itinerary/AddRentalCar"),getRentalTerms:i("/Book/Itinerary/GetRentalTerms"),removeRentalCar:i("/Book/Itinerary/RemoveRentalCar"),searchCarRentals:a,addAirportShuttle:i("/Book/Itinerary/AddAirportShuttle"),removeAirportShuttle:i("/Book/Itinerary/RemoveAirportShuttle"),addLeiGreeting:i("/Book/Payment/AddLeiGreetings"),removeLeiGreeting:i("/Book/Payment/RemoveLeiGreetings"),addTripInsurance:i("/Book/Payment/AddTripInsuranceToItinerary"),removeTripInsurance:i("/Book/Payment/RemoveTripInsuranceFromItinerary")}}])}(angular),function(n){"use strict";n.module("haCitiesAPI",["haHttpService"]).service("haCitiesAPI",["haHttpService","$cacheFactory","haConfig","haUtils","$rootScope","$q",function(t,i,r,u,f,e){function a(n,t){if(n=n.toLocaleLowerCase(),!n)return t;var i=t.filter(function(t){return t.text.indexOf(n)>-1});return i.sort(function(t,i){return v(i.text,n)-v(t.text,n)})}function v(n,t){return Number(n.indexOf(" "+t)>-1)}var h=i.get("$http"),c=$scs("Cities_Version").versionnumber||"5.0.7",s,l,o={CITY_LIST_URL:r.getDynamicJsonUrl(["/Book/City/",c,"/GetCities"].join("")),getCityList:function(){return t.GET(o.CITY_LIST_URL,{cache:h,timeout:1e4}).then(function(n){return f.$broadcast("citiesavailable"),n.data.CityList.Cities})},CITY_PAIRS_URL:r.getDynamicJsonUrl(["/Book/City/",c,"/GetValidCities"].join("")),getCityPairs:function(){return t.GET(o.CITY_PAIRS_URL,{cache:h,timeout:1e4}).then(function(n){return n.data.CityList.Cities})},EXPERT_BOOKING_LIST_URL:r.getDynamicJsonUrl(["/Book/City/",c,"/GetCitiesExpertBooking"].join("")),getCityListExpertBooking:function(){return t.GET(o.EXPERT_BOOKING_LIST_URL,{cache:h,timeout:1e4}).then(function(n){return n.data.CityList.Cities})},EXPERT_BOOKING_PAIRS_URL:r.getDynamicJsonUrl(["/Book/City/",c,"/GetValidCitiesExpertBooking"].join("")),getCityPairsExpertBooking:function(){return t.GET(o.EXPERT_BOOKING_PAIRS_URL,{cache:h,timeout:1e4}).then(function(n){return n.data.CityList.Cities})},NITP_MAP_URL:"/Content/assets/models/NitpMap.json",getNitpMap:function(){return t.GET(o.NITP_MAP_URL,{cache:h,timeout:1e4}).then(function(n){return n.data})},FILTERED_CITY_LIST_URL:function(n,t){return"/Book/City/"+c+"/FilterCityList?index="+n+"&isDepartCity="+t},getFilteredCityList:function(n,i){return t.GET(o.FILTERED_CITY_LIST_URL(n,i),{cache:h,timeout:1e4}).then(function(n){return n.data.CityList!=null&&n.data.CityList.Cities||[]})},EXPEDIA_SUGGEST_URL:function(n){var t=u.getStandardLocale(),i;return t=t==="en_US"||t==="ja_JP"||t==="en_AU"||t==="en_NZ"||t==="ko_KR"?t:"en_US",i="?regiontype=1631&locale="+t+"&lob=HOTELS&format=json&ab=7140.1%7C7949.1&features=ta_hierarchy&maxresults=5&client=HawaiianHotelWidget&siteid=70209","https://suggest.expedia.com/api/v4/typeahead/"+n+i},getExpediaCityList:function(n){return t.GET(o.EXPEDIA_SUGGEST_URL(n),{cache:h,timeout:1e4}).then(function(n){return n.data.sr}).catch(function(n){return n})},RENTAL_CAR_LOCATION_URL:r.getDynamicJsonUrl("/api/v2/cars/locations"),searchCarLocations:function(n,t){return o.getAllCarLocations().then(function(i){var r=a(n,i[t[0]]);return r.length<15&&t[1]&&t[0]!==t[1]&&(r=r.concat(a(n,i[t[1]]))),r.length=Math.min(r.length,15),r})},getAllCarLocations:function(){return s?s.then?s:e.resolve(s):s=t.GET(o.RENTAL_CAR_LOCATION_URL,{cache:h,timeout:6e5}).then(function(t){return s=_.groupBy(t.data,"country"),l=_.indexBy(t.data,"id"),n.forEach(Object.keys(s),function(t){n.forEach(s[t],function(n){n.text=["",n.name,n.postal,n.city,n.airport].join(" ").toLocaleLowerCase()})}),s}).catch(function(n){return n})},getCarLocationById:function(n){return o.getAllCarLocations().then(function(){return l[n]})}};return o}])}(angular),function(n){"use strict";var t=n.module("haEcertAPI",["haHttpService"]);t.service("haEcertAPI",["haHttpService",function(n){return{getPassengerCredit:function(t){return n.POST("/TravelCreditRedemption/GetPassengerCredit",t)},selectDuplicatePassenger:function(t){return n.POST("/TravelCreditRedemption/SelectDuplicatePassenger",{index:t})},fetchPopup:function(t){return n.GET("/TravelCreditRedemption/"+t)},isValidPromo:function(t){return n.POST("/Book/Home/PromotionValid",t)},validateRedeemPromoCode:function(t){return n.POST("/Book/ECert/ValidateRedeemPromoCode",{OfferCode:t})},removePromoCodeFromSession:function(){return n.POST("/Book/ECert/RemovePromoCodeFromSession")},HandleAffiliates:function(t){return n.POST("/Program/Affiliate/ValidateAffiliate",{promoCode:t})}}}])}(angular),function(n){"use strict";n.module("haEmailAPI",["haHttpService"]).service("haEmailAPI",["haHttpService",function(n){return{emailAvailabilityCheck:function(t,i){return n.POST("/MyAccount/EmailAvailability/EmailAvailabilityCheck",{emailAddress:t},{timeout:i.promise}).then(function(n){return n.data.IsSuccess||n.data.Message==="Internal Processing Error"})}}}])}(angular),function(n){"use strict";n.module("haUsernameAPI",["haHttpService"]).service("haUsernameAPI",["haHttpService",function(n){return{checkAvailability:function(t,i){return n.POST("/MyAccount/UserNameAvailability/UserNameAvailabilityCheck",{userName:t},{timeout:i.promise}).then(function(n){return n.data.IsSuccess||n.data.Message==="service Error"})}}}])}(angular),function(n){"use strict";var t=n.module("haFlightResultsAPI",["haHttpService"]);t.service("haFlightResultsAPI",["haHttpService",function(n){return{SEARCH_FLIGHTS_URL:"/Book/FlightResults/SearchFlights",fetch:function(){return n.POST(this.SEARCH_FLIGHTS_URL,{})},SEARCH_FLIGHTS_ALTERNATE_DATE_URL:"/Book/FlightResults/SearchFlightsAlternateDate",fetchTab:function(t,i){return n.POST(this.SEARCH_FLIGHTS_ALTERNATE_DATE_URL,{tripId:t,selectedDate:i})},SEARCH_FLIGHTS_STEP_THROUGH_URL:"/Book/FlightResults/SearchFlightsStepThrough",SearchFlightsStepThrough:function(t,i,r){return n.POST(this.SEARCH_FLIGHTS_STEP_THROUGH_URL,{JDDataList:t.JDDataList,tripId:i,isEdit:r})},fetchCurrency:function(){return n.GET("/scripts/modules/BOS_BKK_miles.json")},bookFlights:function(t,i){return n.POST("/Book/FlightResults/ContinueBooking",{selectedFares:t,tripSummary:i})},fetchModalContent:function(t){return n.GET("/Book/FlightResults/ModalContent",{params:{modalName:t}})},checkFlightAvailability:function(t){return n.POST("/Book/FlightResults/CheckFlightAvailability",{selectedFares:t})},fetchPopup:function(t){return n.GET("/Book/FlightResults/"+t)},toggleCurrencyMilesService:function(t,i){return n.POST("/Book/FlightResults/toggleCurrencyMiles",null,{params:{segmentID:t,isMiles:i}})},updateChangeFlightModel:function(){return n.POST("/Book/FlightResults/EditSearch")},updateSelectedHoldFare:function(t){return n.POST("/Book/FlightResults/UpdatedSelectedHoldFare",{selectedfare:t})},fetchOnTimePerformanceDetails:function(t){return n.GET("/Book/FlightResults/FetchOnTimePerformanceDetails",{params:{flightNumbers:t}})}}}])}(angular),function(n){"use strict";var t=n.module("haFlightResultsEndOnEndAPI",["haHttpService"]);t.service("haFlightResultsEndOnEndAPI",["haHttpService",function(n){return{selectPromo:function(t){return n.POST("/Book/FlightResults/SelectPromo",{OfferId:t})},removePromo:function(){return n.POST("/Book/FlightResults/RemoveSelectedPromo",{})},SEARCH_FLIGHTS_URL:"/Book/FlightResults/SearchFlightsEndOnEnd",fetch:function(){return n.POST(this.SEARCH_FLIGHTS_URL,{priority:6})},changeMilesOption:function(t){return n.POST("/Book/FlightResults/ChangeMilesOption",{pricingType:t})},SEARCH_FLIGHTS_ALTERNATE_DATE_URL:"/Book/FlightResults/SearchFlightsAlternateDateEndOnEnd",fetchTab:function(t,i,r){return n.POST(this.SEARCH_FLIGHTS_ALTERNATE_DATE_URL,{JDDataList:t,tripId:i,selectedDate:r})},SEARCH_FLIGHTS_STEP_THROUGH_URL:"/Book/FlightResults/SearchFlightsStepThroughEndOnEnd",SearchFlightsStepThrough:function(t,i,r){return n.POST(this.SEARCH_FLIGHTS_STEP_THROUGH_URL,{JDDataList:t,tripId:i,isEdit:r})},GET_TRIP_SUMMARY_URL:"/Book/FlightResults/FlightResultsTripSummary",GetTripSummary:function(t){return n.POST(this.GET_TRIP_SUMMARY_URL,{JDDataList:t})},fetchCurrency:function(){return n.GET("/scripts/modules/BOS_BKK_miles.json")},bookFlights:function(t,i){return n.POST("/Book/FlightResults/ContinueBookingEndOnEnd",{selectedFares:t,tripSummary:i})},fetchModalContent:function(t){return n.GET("/Book/FlightResults/ModalContent",{params:{modalName:t}})},checkFlightAvailability:function(t){return n.POST("/Book/FlightResults/CheckFlightAvailabilityEndOnEnd",{selectedFares:t})},fetchPopup:function(t){return n.GET("/Book/FlightResults/"+t)},toggleCurrencyMilesService:function(t,i){return n.POST("/Book/FlightResults/toggleCurrencyMiles",null,{params:{segmentID:t,isMiles:i}})},updateChangeFlightModel:function(){return n.POST("/Book/FlightResults/EditSearch")},updateSelectedHoldFare:function(t){return n.POST("/Book/FlightResults/UpdatedSelectedHoldFare",{selectedfare:t})},fetchOnTimePerformanceDetails:function(t){return n.GET("/Book/FlightResults/FetchOnTimePerformanceDetails",{params:{flightNumbers:t}})},fetchPlaneConfiguration:function(){return n.GET("/planes/configuration",{priority:1})},fetchPlaneMarketingData:function(){return n.GET("/planes/marketingdata",{priority:1})},getSocialProofData:function(t,i,r){return n.GET("/Book/FlightResults/GetSocialProofData",{params:{origin:t,destination:i,departureDate:r}})}}}])}(angular),function(n){"use strict";var t=n.module("haGlobalHeaderAPI",["haHttpService"]);t.service("haGlobalHeaderAPI",["haHttpService",function(n){return{selectCountry:function(t,i){return n.POST("/Header/SelectCountry",{selectedCountry:t,contextItemId:i})},searchGoogle:function(t){return n.POST("/Header/NewSearch",{GoogleText:t})}}}])}(angular),function(n){"use strict";var t=n.module("haInterstitialAPI",["haHttpService"]);t.service("haInterstitialAPI",["haHttpService","haConfig",function(n,t){return{getAirAvailability:function(){return n.GET(t.getRazorTemplateUrl("InterstitialAirAvailability"))},changeSeatInterstitial:function(){return n.GET("/my-account/my-trips/Shared/InterstitialUpdateSeats")}}}])}(angular),function(n){"use strict";n.module("haItineraryAPI",["haHttpService"]).service("haItineraryAPI",["haHttpService",function(n){return{updatePassengerInfo:function(t,i){return n.POST("/MyAccount/ItineraryDetails/UpdatePassengerInfo",{pnr:t,travellerInformation:i})},GetReceiptInfo:function(t){return n.POST("/MyAccount/ItineraryDetails/GetReceiptInfo",{ticketNo:t})},UpdatePaxAndFlightDetails:function(t){return n.POST("/MyAccount/ItineraryDetails/UpdatePaxAndFlightDetails",{ChangeFlightModel:t})},isValidHMAccount:function(t,i,r){return n.POST("/MyAccount/ItineraryDetails/IsValidHMAccount",{hmNumber:t,firstName:i,lastName:r,timeout:6e4})},HMEnrollAndUpdatePNR:function(t,i){return n.POST("/MyAccount/ItineraryDetails/HMEnrollAndUpdatePassengerInfo",{pnr:t,travellerInformation:i,timeout:6e4})},IsEligibleForChangeFlight:function(){return n.POST("/MyAccount/ItineraryDetails/IsEligibleForChangeFlight")},CancelHoldTrip:function(t){return n.POST("/MyAccount/ItineraryDetails/CancelHoldTrip",{cancelHoldTripRequest:t})},GroupPNRSelectTravellers:function(t){return n.POST("/MyAccount/ItineraryDetails/GroupPNRSelectTravellers",{travellers:t})},CancelWaiverPnr:function(t,i,r){return n.POST("/MyAccount/ItineraryDetails/CancelWaiverPnr",{pnr:t,lastName:i,optionalCancellationEmailAddress:r})}}}])}(angular),function(n){"use strict";n.module("haLoginAPI",["haHttpService"]).service("haLoginAPI",["haHttpService",function(n){return{login:function(t){return n.POST("/MyAccount/Login/Login",t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},pageLoad:function(){return n.GET("/MyAccount/Login/AuthenticateLoad?dummy="+Math.random())},ResetEmail:function(t){return n.POST("/MyAccount/Login/ResetEmailAddressUpdate",{newEmailAddress:t})},ResetEmailAddress:function(t){return n.POST("/MyAccount/Login/ResetEmailAddressLoad",t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},ValidateSecurityAnswers:function(t,i,r,u,f,e,o){return n.POST("/MyAccount/Login/ForgotEmailValidateSecurityAnswersSubmit",{accountNo:t,question1:i,question2:r,question3:u,answer1:f,answer2:e,answer3:o})},UpdatePassword:function(t){return n.POST("/MyAccount/Login/UpdatePassword",t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},ForgotEmailAddressSubmit:function(t,i,r,u,f){return n.POST("/MyAccount/Login/ForgotEmailAddressLoad",{firstName:t,lastName:i,phoneNumber:r,country:u,zipCode:f})},CreateUsername:function(t){return n.POST("/MyAccount/Login/CreateUsernameSubmit",{username:t})},AuthenticateEmailOnly:function(t,i){return n.POST("/MyAccount/EmailOnly/AuthenticateEmailOnly",{email:t,zip:i})},EmailOnlyPreferencesSubmit:function(t){return n.POST("/MyAccount/EmailOnly/GetEmailOnlyPreferences",{EmailOnlyPreferences:t})},UnsubscribeEmailAddressSubmit:function(t,i,r){return n.POST("/MyAccount/EmailOnly/EmailUnsubscribe",{EmailAddress:t,UnSubscriptionID:i,UnSubscribeAll:r})},UpdateEmailPreferencesSubmit:function(t,i){return n.POST("/MyAccount/EmailOnly/Unsubscribe",{EmailAddress:t,ZipCode:i})}}}])}(angular),function(n){"use strict";var t=n.module("haPassengersAPI",["haHttpService"]);t.service("haPassengersAPI",["haHttpService",function(n){return{addeditpax:function(t){return n.POST("/Book/Pax/AddEditPax",{travellerInformation:t})},editPaxLink:function(){return n.POST("/Book/Pax/PaxLoadLoggedIn")},editLoggedInPax:function(t){return n.POST("/Book/Pax/EditLoggedInPax",{editLoggedInTraveler:t})},addPaxToPNR:function(t){return n.POST("/Book/Pax/AddPaxToPNR",{travellerInformationList:t})},addExtraLoggedTravellerInfo:function(t){return n.POST("/Book/Pax/AdditionalLoggedInTravelerInfo",{additionalLoggedInTravelerInfo:t})},associateinfants:function(t){return n.POST("/Book/Pax/AssociateInfants",{travellerInformationList:t})},updatecontactinfo:function(t){return n.POST("/Book/Pax/UpdateContactInfo",{ContactInfo:t})}}}])}(angular),function(n){"use strict";n.module("haPaymentAPI",["haHttpService"]).service("haPaymentAPI",["haHttpService",function(n){return{FlightAvailability:function(t){return n.POST("/Book/Payment/FlightAvailability",t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},validateCreditCard:function(t){return n.POST("/Book/Payment/ValidateCreditCard",t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},ValidatePaymentAuthorization:function(t){return n.POST("/Book/Payment/ValidatePaymentAuthorization",t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},fetchScheduleMismatchPopup:function(){return n.GET("/Book/Payment/FlightScheduleMismatch")},postPaymentProcess:function(t,i,r){var u="/Book/Payment/ProcessPayment?UpdateSchedule="+i+"&Token="+r;return n.POST(u,t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},postProcessPaymentForAsyncPNR:function(t,i,r){var u="/Book/Payment/ProcessPaymentForAsyncPNR?UpdateSchedule="+i+"&Token="+r;return n.POST(u,t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},postProcessPaymentForHoldPNR:function(t,i,r){var u="/Book/Payment/ProcessPaymentForHoldPNR?UpdateSchedule="+i+"&Token="+r;return n.POST(u,t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},postProcessNITPRedemption:function(){return n.POST("/Book/Payment/ProcessNITPRedemption",{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},removePriceLockSession:function(){return n.POST("/Book/Payment/RemovePriceLockSession")},getPaymentOptionsState:function(){return n.GET("/Book/Payment/GetPaymentMethods")},fetchModalContent:function(t){return n.GET("/Shared/TermsAndConditions/ModalContent",{params:{modalName:t}})},getPaymentMethodsState:function(){return n.POST("/Book/Payment/GetPaymentMethods")},fetchMasterPassToken:function(t){return n.POST("/Book/MasterPass/GetMasterPassRequestToken",{purchaseType:t})},fetchMasterPassPaymentInfo:function(t){return n.POST("/Book/MasterPass/GetMasterPassPaymentInfo",{oauthToken:t.oauth_token,oauthVerifier:t.oauth_verifier,checkOutUrl:t.checkout_resource_url})},getAliPaySignedUrl:function(){return n.POST("/Api/AliPay/GetAliPaySignedUrl")},upgradeToMainCabin:function(){return n.POST("/Book/Payment/UpgradeToMainCabin")}}}])}(angular),function(n){"use strict";n.module("haPaymentMethodsAPI",["haHttpService"]).service("haPaymentMethodsAPI",["haHttpService",function(n){return{PaymentMethodsAddEdit:function(t){return n.POST("/MyAccount/PaymentMethods/PaymentMethodAddEdit",t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},PaymentMethodsDelete:function(t){return n.POST("/MyAccount/PaymentMethods/PaymentMethodDelete",null,{params:{ccID:t}})},PaymentMethodsAddInitialize:function(){return n.POST("/MyAccount/PaymentMethods/PaymentMethodAdd")},PaymentMethodsAdd:function(t){return n.POST("/MyAccount/PaymentMethods/PaymentMethodAddEdit",{ccPaymentInfo:t})},getCDESavedCard:function(t){return n.GET("/MyAccount/PaymentMethods/GetCDEDataForSavedCard",{cache:!1,params:{ccID:t}})}}}])}(angular),function(n){"use strict";var t=n.module("haProfileSettingsAPI",["haHttpService"]);t.service("haProfileSettingsAPI",["haHttpService",function(n){return{updateAccountSettings:function(t){return n.POST("/MyAccount/ProfileSettings/AccountSettingsSubmit",{accountSettingsVM:t})},updateTravelPreferences:function(t){return n.POST("/MyAccount/ProfileSettings/TravelPreferencesLoad",t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},updateEmailSubscrption:function(t){return n.POST("/MyAccount/ProfileSettings/EmailSubscriptionsSubmit",{emailSubscriptionviewmodel:t})}}}])}(angular),function(n){"use strict";n.module("haPurchaseMilesAPI",["haHttpService"]).service("haPurchaseMilesAPI",["haHttpService",function(n){return{checkEligibility:function(t,i,r,u,f){return n.POST("/MyAccount/PurchaseMiles/PurchaseMilesEligibility",{selectedMiles:t,iSGiftPurchaseSelected:i,recipientAccountNumber:r,recipientlastName:u,recipientEmail:f})}}}])}(angular),function(n){"use strict";var t=n.module("haSeatMapAPI",["haHttpService"]);t.service("haSeatMapAPI",["haHttpService",function(n){return{getSeatMapForLeg:function(t,i){return n.POST(i?"/Book/InFlightOptions/GetSeatMapPreview":"/Book/InFlightOptions/GetSeatMap",{seatMapRequest:t})},UpdateInflightOptionsService:function(t,i){return n.POST("/Book/InFlightOptions/UpdateInflightOptions",{seatmapSelection:t,model:i})},UpdateChangeFlightInflightoptions:function(t,i){return n.POST("/Book/InFlightOptions/UpdateChangeFlightInflightoptions",{seatmapSelection:t,model:i})},ShowDownGradePopUp:function(t){return n.POST("/Book/InFlightOptions/ShowDownGradePopUp",{seatmapSelection:t})},getSeatMapForPostLeg:function(t){return n.POST("/MyAccount/PostPurchaseEditSeats/GetSeatMap",{seatMapRequest:t})},ValidateEditSeatFareDifference:function(t){return n.POST("/MyAccount/PostPurchaseEditSeats/ValidateEditSeatFareDifference",{seatMapSelection:t})},ConfirmEditSeatsService:function(t){return n.POST("/MyAccount/PostPurchaseEditSeats/ConfirmEditSeats",{model:t})}}}])}(angular),function(n){"use strict";n.module("haTravelersAPI",["haHttpService"]).service("haTravelersAPI",["haHttpService",function(n){return{TravelerAddEdit:function(t){return n.POST("/MyAccount/TravelersList/TravelerAddEdit",t,{headers:{"Content-Type":"application/x-www-form-urlencoded"}})},TravelerDelete:function(t){return n.POST("/MyAccount/TravelersList/TravelerDelete",null,{params:{travelerID:t}})},GetTravelers:function(t){return n.GET("/my-account/travelers",{params:{include:t}})},AddEditTraveler:function(t,i){var r=i?{temp:!0}:undefined;return n.POST("/my-account/travelers/TravelerAddEdit",t,{params:r})},getUserType:function(){return n.POST("/my-account/Travelers/getUserType")}}}])}(angular),function(n){"use strict";n.module("haUserProfileAPI",["haHttpService"]).service("haUserProfileAPI",["haHttpService",function(n){return{checkUsernameAvailability:function(t,i){return n.POST("/MyAccount/UserProfile/CheckUsernameAvailability",t,{timeout:i.promise})}}}])}(angular),function(n){"use strict";n.module("haPriceApiModule",["haHttpService"]).service("haPriceApiService",["$http","$q","$rootScope","haConfig",function(n,t,i){var r=i.$switch("BookingWidget:EnableDealsandOffersGetReq"),u=r?"GET":"POST";return{fetchInitialPrices:function(i){var e=r?"?searchRequest="+JSON.stringify(i.data.searchRequest)+"&isCalendar="+JSON.stringify(i.data.isCalendar):"",o="/Book/LowFareSearchChart/GetPriceChart{0}".format(e),f=t.defer(),s=r?{}:i.data;return n({method:u,url:o,data:s}).then(function(n){f.resolve(n.data)},function(n){f.reject(n)}),f.promise},fetchPrices:function(t,i,r){r=r||{};var u=r.config,f=r.url||"/Book/LowFareSearchChart/GetPriceChartAdditionalDays";return n.post(f,{dateStr:t,direction:i},u)}}}])}(angular),function(n){"use strict";var t;try{t=n.module("haGeoDataModule")}catch(i){t=n.module("haGeoDataModule",["haHttpService"])}t.service("haGeoDataAPI",["haHttpService","haConfig",function(n,t){return{GET_COUNTRIES_URL:function(){return"/MyAccount/AccountShared/GetCountries?languagecode="+t.getLanguageCode()},getCountries:function(){return n.GET(this.GET_COUNTRIES_URL()).then(function(n){return n.data})},GET_STATES_URL:function(n){return"/MyAccount/AccountShared/GetStatesByCountry?countrykey="+n+"&languagecode="+t.getLanguageCode()},getStates:function(t){return n.GET(this.GET_STATES_URL(t)).then(function(n){return n.data})},GET_STATE_AND_CITIES_URL:function(n,i){return"/MyAccount/AccountShared/GetCityAndStateByCountryAndPostalCode?countrykey="+n+"&postalcode="+i+"&languagecode="+t.getLanguageCode()},getStateAndCities:function(t,i){return n.GET(this.GET_STATE_AND_CITIES_URL(t,i)).then(function(n){return n.data})}}}])}(angular),function(n){"use strict";var t=n.module("haBookNonMemberEcertAPI",["haHttpService"]);t.service("haBookNonMemberEcertAPI",["haHttpService",function(n){return{isGAFETCO:function(t){return n.POST("/Book/ECert/IsGAFETCO",{validateNoNameOfferRequest:t})},validatePromo:function(t){return n.POST("/Book/ECert/ValidateRedeemEcert",{validateNoNameOfferRequest:t})},validateAccount:function(t){return n.POST("/Book/ECert/ValidateRedeemHMNumber",{validateHMNumberRequest:t})},depositMiles:function(t){return n.POST("/Book/ECert/DepositMilesToUserAccount",{depositMilesRequest:t})}}}])}(angular),function(n){"use strict";var t=n.module("haMyAccountAPI",["haHttpService"]);t.service("haMyAccountAPI",["haHttpService",function(n){return{getcontactsalesrepform:function(){return n.GET("/myaccount/mydashboardform/getcontactsalesrepform")},getchangerequestform:function(){return n.GET("/myaccount/mydashboardform/getchangerequestform")},getcorpwebaccountupdate:function(){return n.GET("/myaccount/mydashboardform/getcorpwebaccountupdate")}}}])}(angular),function(){"use strict";function n(n){function t(){function t(n){return n.data}function i(n){console.log("XHR Failed for getSessionTime."+n.data)}return n.GET("/Book/Shared/GetSessionTimeout").then(t).catch(i)}function i(){function t(n){return n}function i(n){return console.log("XHR Failed for Extend Session: "+n.status),n}return n.POST("/json/v1/session/extend").then(t).catch(i)}return{getUserSessionTime:t,restartUserSessionTime:i}}angular.module("haSessionTimeoutAPI",[]).factory("haSessionTimeoutAPI",n);n.$inject=["haHttpService"]}(),function(n){"use strict";n.module("haLaunchDarklyModule").service("haLaunchDarklyAPI",["haHttpService",function(n){var t=window.location.protocol+"//"+window.location.host+"/api/v2/LaunchDarkly";return{getFeatureFlag:function(i,r,u,f){return n.GET(t+"/"+i+"/"+r+"/"+u+"/"+f).success(function(n){return Promise.resolve(n)}).error(function(n){return Promise.reject(new Error(n))})},trackResult:function(i){return n.GET(t+"/TrackResult/"+i).success(function(n){return Promise.resolve(n)}).error(function(n){return Promise.reject(new Error(n))})}}}])}(angular),function(n){"use strict";n.module("haEncryptionModule").service("haEncryptionAPI",["haHttpService",function(n){var t=window.location.protocol+"//"+window.location.host+"/api/v2/Encryption";return{encryptString:function(i,r){return n.GET(t+"/String/"+i+"/"+r).success(function(n){return Promise.resolve(n)}).error(function(n){return Promise.reject(new Error(n))})}}}])}(angular),function(n){"use strict";var t;try{t=n.module("haAirportsModule")}catch(i){t=n.module("haAirportsModule",["haCitiesModule","haAdvanceToNextInputService","ui.bootstrap.typeahead.ha"])}t.directive("haAirportPair",[function(){var n=["$scope",function(){var n={originCtrl:null,destinationCtrl:null,register:function(t){if(t.pairCtrl=n,t.isOrigin)n.originCtrl=t;else if(t.isDestination)n.destinationCtrl=t;else throw new Error("Attempted to register a non-origin/destination inputCtrl.");},getOriginCode:function(){return n.originCtrl!=null?n.originCtrl.getCode():null},getDestinationCode:function(){return n.destinationCtrl!=null?n.destinationCtrl.getCode():null}};return n}];return{restrict:"A",scope:!0,controller:n}}])}(angular),function(n){"use strict";var t;try{t=n.module("haAirportsModule")}catch(i){t=n.module("haAirportsModule",["haCitiesModule","haAdvanceToNextInputService","ui.bootstrap.typeahead.ha"])}t.controller("haAirportInputCtrl",["$log","$scope","$timeout","haTemplateCache","haCitiesSvc","haConfig",function(n,t,i,r,u,f){i(function(){r.get(f.getRazorTemplateUrl("destination-modal-base"));r.get(f.getRazorTemplateUrl("destination-modal-hawaii"));r.get(f.getRazorTemplateUrl("destination-modal-na"));r.get(f.getRazorTemplateUrl("destination-modal-asia"))},500+1e3*Math.random());var e={isOrigin:!1,isDestination:!1,isReshop:!1,isExpertBooking:!1,legIndex:0,pairCtrl:null},o=function(){if(e.pairCtrl!=null){if(e.isDestination)return e.pairCtrl.getOriginCode();if(e.isOrigin)return e.pairCtrl.getDestinationCode()}return null};return e.getCode=function(){return t.ngModel?t.ngModel.Code:null},t.getMatchingAirports=function(n){return e.isReshop?u.getMatchingFilteredCities(n,e.legIndex,e.isOrigin):e.isExpertBooking?u.getMatchingCitiesExpertBooking(n,o(),t.filterFn):u.getMatchingCities(n,null,t.filterFn)},e}]);t.filter("isHACity",function(){return function(n){return n!=null&&n.IsHACity===!0}});t.directive("haAirportInput",["$log","$timeout","$window","haConfig",function(n,t,i){return{restrict:"A",require:["haAirportInput","?^haAirportPair"],scope:{ngModel:"=",preselectCode:"=",onChange:"@",filterFn:"@",label:"@",placeholder:"@",required:"@",disabled:"@",id:"@",name:"@",hidePin:"@",labelStyle:"@",size:"@"},template:'<div> <div has-autofill ng-class="{invalid: (invalid && !isFocused)}"> <label class="ha-label" ng-class="{\'required-asterisk\':required, \'ha-form-lg\': !size || size==\'large\', \'ha-form-sm\':size==\'small\', \'inline\': labelStyle==\'inline\' || !labelStyle || labelStyle !==\'eyebrow\', \'wrap-on-mobile\': labelStyle==\'inlineWrapOnMobile\'}"> <span ng-if="label">{{label}}<span class="mandatory-flag" ng-if="required">*<\/span><\/span> <input type="hidden" name="{{name}}Code" ng-value="ngModel.Code"/> <div class="mobile-tap-mask" ng-if="$root.isMobile" ha-location-modal="hawaii" ng-click="pinClicked()" filter-fn="{{filterFn}}"><\/div><input role="combobox" aria-owns="airportMatch-{{elNumber}}" aria-expanded="{{isOpen() || false}}" placeholder="{{placeholder}}"  id="{{id}}" type="text" name="{{name}}" autocomplete="off" ng-model="ngModel" allow-non-english="true" ha-typeahead="airport as airport.DisplayName for airport in getMatchingAirports($viewValue)" typeahead-editable="false" typeahead-min-length="3" typeahead-wait-ms="150" typeahead-on-select="onSelect($item, $model, $label)" ng-required="required" ng-disabled="disabled" ng-focus="onFocus($event)" ng-blur="onBlur($event)" ng-class="{\'has-pin\':!hideWhereweflyPin}" ha-errors > <div class="location-dropdown"> <div class="ha-typeahead-results" role="textbox" id="airportMatch-{{elNumber}}"><\/div><\/div><a href="" ha-location-modal="hawaii" ng-if="!hideWhereweflyPin" ng-click="pinClicked()" title="{{pinTitle || label}}" filter-fn="{{filterFn}}" city-list-type="{{cityListType}}" class="ha-airport-input-pin"> <i class="ha-icon fontIcon32-mapPin"><\/i> <\/a> <em for="airportInput-{{elNumber}}"><\/em> <\/label> <\/div><\/div>',controller:"haAirportInputCtrl",link:function(n,r,u,f){var e,o,s;n.$root.isMobile&&r.find('input[role="combobox"]').attr("readonly","readonly");n.elNumber=Math.floor(Math.random()*1e4+1);e=f[0];e.isOrigin=typeof u.origin!="undefined";e.isDestination=typeof u.destination!="undefined";e.isReshop=typeof u.reshop!="undefined";e.isExpertBooking=typeof u.expertBooking!="undefined";e.legIndex=u.legIndex!=null&&u.legIndex;n.cityListType="normal";e.isReshop?n.cityListType=e.isOrigin?"reshop-"+e.legIndex+"-origin":"reshop-"+e.legIndex+"-destination":e.isExpertBooking&&(n.cityListType="expertbooking");o=f[1];o!=null&&o.register(e);n.preselectCode!=null&&(s=n.preselectCode,n.getMatchingAirports(s).then(function(t){for(var i=0;i<t.length;i++)if(t[i].Code===s){n.ngModel=t[i];break}}));n.$parent.setLocationPathname=function(n){i.location.pathname!==n&&(console.log("$window.location.pathname = "+n),i.location.pathname=n)};n.$parent.setLocationPathname=function(n){i.location.pathname!==n&&(console.log("$window.location.pathname = "+n),i.location.pathname=n)};n.$watch("ngModel",function(t){n.onChange!=null&&t&&n.$parent.$eval(n.onChange);n.$emit("airportChanged")});n.onSelected=function(i){n.ngModel=i;t(function(){n.focus()},0)};n.onSelect=function(){t(function(){n.focus()},0)};n.pinClicked=function(){n.$emit("haWhereWeFlyPinClicked")};n.onClick=function(n){n.target.select()};n.hideWhereweflyPin=n.$eval(n.hidePin);n.labelStyle=n.$eval(n.labelStyle);n.size=n.$eval(n.size);n.focus=function(){setTimeout(function(){r.find('input[type="text"]').focus()},0)};n.pinTitle="pinTitle"in u?u.pinTitle:$scs("BookingWidget.AirportInputPinTitle");n.onFocus=function(i){n.isFocused=!0;t(function(){i.target.select()},0);n.$emit("airportInputFocused",r)};n.onBlur=function(){n.isFocused=!1}}}}])}(angular),function(n){"use strict";var t=n.module("haStickyBookingWidgetModule",["haModalService"]);t.directive("haStickyBookingWidget",["$rootScope","$window","haUtils","haCitiesSvc","haConfig","haDateUtils","$timeout","haModal","haSitecoreStrings",function(t,i,r,u,f,e,o,s,h){var c=function(t,e,c){function a(){var f;c.$observe("defaultDestinationImage",function(n){t.defaultDestinationImage=n||""});c.$observe("multiCity",function(n){t.multiCity=n&&n==="false"?!1:!0});t.stickyBookingOffsetY=!1;t.leg={};var n=r.getFlightQueryModelCookie(),e=moment().format("YYYY-MM-DD"),i=r.getFlightQueryModelRecentCookie();if(i)for(f=0;f<i.length;f++)i[f].FlightSearchSegmentList[0].DepartureDate.substr(0,10)<e&&i.splice(f,1),t.flightQueryCookieArr=i;n&&n.FlightSearchSegmentList[0]&&n.FlightSearchSegmentList[0].OriginCityCode?u.getCityByCode(n.FlightSearchSegmentList[0].OriginCityCode).then(function(n){t.leg.origin=n}):h.get("BookingWidget['originplaceholderstickywidget']").then(function(n){t.leg.origin=n});n&&n.FlightSearchSegmentList[0]&&n.FlightSearchSegmentList[0].DestinationCityCode?u.getCityByCode(n.FlightSearchSegmentList[0].DestinationCityCode).then(function(n){t.leg.destination=n}):h.get("BookingWidget['destinationplaceholderstickywidget']").then(function(n){t.leg.destination=n})}t.openFlightSearchEdit=function(){s(f.getTemplateUrl("ha-book-flight-search-edit-modal.html"),{id:"fare-help-modal",backdrop:"false",scope:t,modalLock:!0})};var l=function(){if(t.stickyBookingOffsetY===!1){var i=n.element("[ha-sticky-booking-widget]");if(i!=null)t.stickyBookingOffsetY=i.offset().top;else return}return t.stickyBookingOffsetY};t.recallSearch=function(n){t.$broadcast("recallSearch",n);t.recent=!1};n.element(i).bind("scroll",function(){var n=this.pageYOffset;$("html").hasClass("lte-ie8")&&(n=this.document.documentElement.scrollTop);t.fixed=n>=l()?!0:!1;t.$digest()});t.recentSearches={open:!1};t.$watch("recentSearches.open",function(n){typeof n!="undefined"&&(n?o(function(){$("body").on("click.recent",function(){t.$apply(function(){t.recentSearches.open=!1})})},10):$("body").off("click.recent"))});a()};return{restrict:"A",scope:!0,link:c,templateUrl:f.getTemplateUrl("ha-sticky-booking-widget-base-template.html")}}])}(angular),function(n){"use strict";var t=n.module("haProgressBarModule",[]);t.directive("haProgressBar",["haConfig",function(n){var t=function(){},i;return t.$inject=["$scope"],i=function(n,t,i){n.steps=i.steps;n.current=i.current;n.completed=n.current-1;n.empty=n.steps-n.current;n.getIterations=function(n){return new Array(n)};n.$emit("$haProgressBarReady")},{restrict:"A",scope:!0,link:i,controller:t,templateUrl:n.getTemplateUrl("ha-progress-bar-base-template.html")}}])}(angular),function(n){"use strict";var t=n.module("haErrorPageModule",[]);t.directive("haErrorPage",["haConfig",function(t){var i=function(){},r;i.$inject=["$scope"];r=function(u,f,e){return u.header=e.header,u.subtext=e.subtext,u.hasTransclude=n.element("[ng-transclude]").contents().length>0?!0:!1,{restrict:"A",scope:!0,link:r,controller:i,transclude:!0,templateUrl:t.getTemplateUrl("ha-error-page-base-template.html")}}}])}(angular),function(n){"use strict";var t=n.module("haMapNavigatorModule",[]);t.directive("haMapNavigator",["haConfig",function(t){var i=function(n,t){t.onresize=function(){n.reinitializeMap();n.$apply()}},r;return i.$inject=["$scope","$window"],r=function(t,i,r){var b=100,f=172,e=0,ft,w;t.zoomLevel=.75;var o=t.zoomLevel,k=0,s=0,et=t.$eval(r.model),u=i.find(".focus-magnifier"),c=i.find(".main-image-container"),l=0,a=0,h=i.width()/2,ot=.5,v=.2;t.model=et;var d=function(){s=parseInt(i.css("width"),10)/f/t.zoomLevel},g=function(){var s=parseInt(u.width(),10),r=t.zoomLevel*f,h=parseInt(u.height(),10),o=r*ot,n,i;t.magnifierStyle={width:r+"px",height:o+"px",borderWidth:Math.round(b/t.zoomLevel)+"px"};n=parseInt(u.css("top"),10)+(h-o)/2;i=parseInt(u.css("left"),10)+(s-r)/2;i+r>f&&(i=f-r);n+o>e&&(n=e-o);i<0&&(i=0);n<0&&(n=0);u.css("top",n+"px");u.css("left",i+"px")},nt=function(){var r=i.find(".main-image").width(),n;t.mapImageStyle={width:parseInt(i.css("width"),10)/t.zoomLevel};n=parseInt(i.find(".main-image").height(),10)*(t.mapImageStyle.width/r);l=n-h;a=t.mapImageStyle.width-parseInt(i.css("width"),10);t.mainImageConstraintStyle={width:t.mapImageStyle.width*2-parseInt(i.css("width"),10),height:n*2-h,left:-a,top:-l}},tt=function(){var n=Math.round(b/t.zoomLevel),i=n*2+f,r=n*2+e-1;t.focusContainerStyle={top:-n+"px",left:-n+"px",width:i+"px",height:r+"px"}},y=function(){var n=parseInt(u.css("left"),10)*s,t=parseInt(u.css("top"),10)*s;c.css("left",-(n-a)+"px");c.css("top",-(t-l)+"px")},st=function(){var n=(parseInt(c.css("left"),10)-a)/s,t=(parseInt(c.css("top"),10)-l)/s;u.css("left",-n+"px");u.css("top",-t+"px")},p=function(){d();g();tt();nt();y()};t.zoomOut=function(){t.zoomLevel<1&&(t.zoomLevel=t.zoomLevel+v<=1?t.zoomLevel+v:1,p())};t.zoomIn=function(){t.zoomLevel>o&&(t.zoomLevel=t.zoomLevel-v>=o?t.zoomLevel-v:o,p())};var it=0,rt=function(){it++;it===2&&(u.css("left","28px"),u.css("top","13px"),y(),t.$apply())},ht=i.find(".main-image").attr("image-id"),ut=function(){i.css("height",h);i.find(".ha-map-navigator").css("height",h);o=i.width()/k;o>t.zoomLevel&&(t.zoomLevel=o);d();nt();rt()};t.$on(ht,function(){k=i.find(".main-image").width();ut()});ft=i.find(".preview-background").attr("image-id");w=function(){f=i.find(".preview-background").width();e=i.find(".preview-background").height();i.find(".preview-container").css("height",e+1);i.find(".tap-zoom-panel").css("height",e+1);g();tt();rt()};t.$on(ft,function(){i.find(".preview-background")[0].ondragstart=function(){return!1};w()});i.find("[ha-draggable]").each(function(){var t=n.element(this).scope();t.updateDraggableSettings({containment:"parent"})});t.$on("$dragging",function(n,t){$(t.toElement).hasClass("main-image")?st():y()});t.reinitializeMap=function(){h=i.width()/2;w();ut();p()};t.setGrab=function(n){t.grabbing=n};new window.Hamster(i.find(".focus-magnifier")[0]).wheel(function(n,i){i>0?t.zoomIn():t.zoomOut();t.$apply()});new Hammer(i.find(".main-image-container")).on("pinchin",function(){t.zoomOut();t.$apply()});new Hammer(i.find(".main-image-container")).on("pinchout",function(){t.zoomIn();t.$apply()});t.$emit("$haMapNavigatorReady")},{restrict:"A",scope:!0,link:r,templateUrl:t.getTemplateUrl("ha-map-navigator-base-template.html"),controller:i}}]);t.directive("loadWatch",function(){return{restrict:"A",link:function(n,t,i){t.bind("load",function(t){n.$emit(i.imageId,t)})}}})}(angular),function(n){"use strict";var t=n.module("haGlobalMessageModule",["ngAnimate","haAlertModule"]);t.directive("haGlobalMessage",["haConfig","$timeout",function(n,t){var i=function(n,t){n.alert={type:"success",header:"",description:null};n.closeMessage=function(){n.isShown=!1};n.setAutoFade=function(){t(n.closeMessage,n.messageCloseTime)}},r;return i.$inject=["$scope","$timeout"],r=function(n,i,r){n.alert.header=r.header;n.alert.description=r.description;n.alert.type=r.type;n.isShown=!n.alert.header||n.alert.header===""?!1:!0;n.messageCloseTime=r.messageCloseTime||3e3;n.setAutoFade();n.exampleMethod=function(){return n};n.$emit("$haGlobalMessageReady");t(function(){i.children().find('[role="alert"]').focus()},300)},{restrict:"A",scope:!0,link:r,templateUrl:n.getTemplateUrl("ha-global-message-base-template.html"),controller:i}}])}(angular),function(n){"use strict";var t=n.module("haGlobalAlertModule",[]);t.directive("haGlobalAlert",["haConfig",function(n){var t=function(n){n.showAlert=!0;n.$on("$showAlert",function(){n.showAlert=!0});n.$on("$hideAlert",function(){n.showAlert=!1});n.hideAlert=function(){n.showAlert=!1}},i;return t.$inject=["$scope"],i=function(n,t,i){n.type=i.type;n.noIcon=!1;i.noicon&&(n.noIcon=!0);n.header=i.header;n.description=i.description;n.btntext=i.btntext;n.btnlink=i.btnlink;i.$observe("header",function(){n.header=i.header;n.showAlert=!0});i.$observe("type",function(){n.type=i.type;n.showAlert=!0});i.$observe("description",function(){n.description=i.description});i.$observe("noicon",function(){n.noIcon=!1;i.noicon&&(n.noIcon=!0);n.showAlert=!0});i.$observe("btntext",function(){n.btntext=i.btntext});i.$observe("btnlink",function(){n.btnlink=i.btnlink});n.$emit("$haGlobalAlertReady")},{restrict:"A",scope:!0,link:i,templateUrl:n.getTemplateUrl("ha-global-alert-base-template.html"),controller:t}}])}(angular),function(n){"use strict";var t=n.module("haTooltipModule",[]);t.directive("haTooltip",["haConfig","$timeout",function(t,i){var r=function(){},u;return r.$inject=["$scope"],u=function(t,r,u){function o(){var l=29,v=8,h=12,p={position:"absolute",margin:0},i=$("#"+t.targetElId),c=i.position(),o=c.top,u=c.left,a=i.offset(),y=s(r);f=Number(t.width)||r.width();switch(e[0]){case"top":o+=i.height()+v;break;case"bottom":o-=y+v;break;case"left":u+=i.width()+v;break;case"right":u-=f+h}switch(e[1]){case"left":u-=l+h/2-i.width()/2;break;case"right":u-=f-l-h/2-i.width()/2;break;case"top":o-=l+h/2-i.height()/2;break;case"bottom":o-=y-l-h/2-i.height()/2;break;case"center":e[0]==="top"||e[0]==="bottom"?u-=f/2-i.width()/2:o-=y/2-i.height()/2}a.left-r.width()/2<0?u-=a.left-r.width()/2:a.left+r.width()/2>window.innerWidth-10&&(u+=window.innerWidth-10-(a.left+r.width()/2));c.top=o;c.left=u;n.extend(p,c);r.css(p)}function s(n){var t=n.attr("style"),i,r;return n.css({position:"absolute",visibility:"hidden",display:"block"}),n.hasClass("ng-hide")&&(n.removeClass("ng-hide"),i=!0),r=n.find(".ha-tooltip").outerHeight(),n.attr("style",t?t:""),i&&n.addClass("ng-hide"),r}var e,f;t.subtext=u.subtext;t.position=u.position;t.arrowPosition=u.arrowPosition;f=u.width;f>window.innerWidth&&(f=window.innerWidth-20);t.width=f;t.targetElId=u.targetElId;t.setWidth=function(){if(t.width)return{width:t.width}};t.width&&r.css({width:t.width});t.targetElId&&t.position==="absolute"&&t.arrowPosition&&(e=t.arrowPosition.split("-"),f=parseInt(t.width)||r.width(),i(o),u.ngShow&&t.$watch(u.ngShow,function(n){n&&o()}));t.$emit("$haTooltipReady")},{restrict:"A",scope:!0,link:u,controller:r,transclude:!0,templateUrl:t.getTemplateUrl("ha-tooltip-base-template.html")}}])}(angular),function(n){"use strict";var t=n.module("haAvatarModule",[]);t.directive("haAvatar",["haConfig",function(n){var t=function(){},i;return t.$inject=["$scope"],i=function(n,t,i){i.$observe("size",function(){n.setAvatarSize()});n.name=i.name;i.$observe("name",function(){n.name=i.name});n.alt=i.alt;n.src=i.src;i.$observe("src",function(){n.src=i.src});n.initials=i.initials;i.$observe("initials",function(){n.initials=i.initials});n.seatSelection=i.seatSelection;i.$observe("seatSelection",function(){n.seatSelection=i.seatSelection});n.setAvatarSize=function(){n.size=i.size;n.size||(n.size="large");n.size==="small"&&(n.avatarWidth=70,n.avatarHeight=70);n.size==="large"&&(n.avatarWidth=125,n.avatarHeight=125)};n.setAvatarSize();n.$emit("$haAvatarReady")},{restrict:"A",scope:!0,link:i,controller:t,templateUrl:n.getTemplateUrl("ha-avatar-base-template.html")}}])}(angular),function(n){"use strict";var t=n.module("haAvatarSelectionModule",[]),i,r;t.directive("haAvatarSelectionWrapper",["haGlobals",function(n){var t=function(t){t.selectedAvatar={};t.defaultAvatarID="1";t.controlID="AvatarID";t.imageControlID="AvatarUrl";t.avatars=[];n("jsonProfileAvatarModel",function(n){t.avatars=n.AvatarImages;n&&n.MemberAvatarID!=null?t.defaultAvatarID=n.MemberAvatarID:n.DefaultAvatarID&&(t.defaultAvatarID=n.DefaultAvatarID);n.AvatarControlID&&(t.controlID=n.AvatarControlID);n.AvatarImageControlID&&(t.imageControlID=n.AvatarImageControlID)});var i=$(t.avatars).filter(function(){return this.ID===t.defaultAvatarID}).get(0);i&&(t.selectedAvatar=i);t.$on("$selectedAvatarURL",function(n,i){t.selectedAvatar=i});t.selectProfileImg=function(){t.$broadcast("$openCustomDropdown")}};return{restrict:"A",scope:!0,link:t}}]);i=Math.random();r=49727;t.directive("haAvatarSelection",["haGlobals","haHttpService","haConfig","$rootScope",function(n,t,u,f){var e=function(e,o,s,h){function c(){if(s.defaultIndex&&e.avatars.length){var n=Math.floor(i*e.avatars.length),t=(r*parseInt(s.defaultIndex)+n)%e.avatars.length;e.$emit("$defaultAvatarURL",e.avatars[t])}}e.avatars=[];e.selectedAvatarUrl=s.selectedAvatarUrl;e.dropdownLabel=s.dropdownLabel;e.doneText=s.doneText;(s.onDark==="true"||s.onDark==="")&&(e.onDark=!0);n("jsonProfileAvatarModel",function(n){e.avatars=n.AvatarImages});e.avatars.length?c():t.GET("/myaccount/profileavatar/getavatars").then(function(n){n=n.data||n;e.avatars=n.Avatars.length?n.Avatars.map(function(n){return{ID:n.ID,ProfileImageSrc:n.Src}}):[];c()});s.$observe("selectedAvatarUrl",function(){e.selectedAvatarUrl=s.selectedAvatarUrl});e.selectAvatar=function(n){e.$emit("$selectedAvatarURL",n);h&&h.$setDirty&&h.$setDirty();f.isMobile&&(e.$modalClose(),e.doneText&&e.closeAvatarSelector())};e.closeAvatarSelector=function(){e.$broadcast("$closeCustomDropdown");e.$emit("$closeCustomDropdown")};e.openAvatarSelector=function(){e.$broadcast("$openCustomDropdown")};e.showAvatarSelectionModal=function(){haModal(u.getTemplateUrl("ha-avatar-selection-modal.html"),{id:"avatar-selection-modal",backdrop:!0,scope:e})}};return{restrict:"A",require:"^?form",scope:!0,link:e,templateUrl:function(){return isMobile?u.getTemplateUrl("ha-avatar-selection-base-template-mobile.html"):u.getTemplateUrl("ha-avatar-selection-base-template.html")}}}])}(angular),function(n){"use strict";var t=n.module("haBreadcrumbModule",[]);t.directive("haBreadcrumb",["haConfig",function(n){var t=function(){},i;return t.$inject=["$scope"],i=function(n,t,i){n.$emit("$haBreadcrumbReady");n.breadcrumbPath=n.$eval(i.haBreadcrumbPath)},{restrict:"A",scope:!0,link:i,controller:t,templateUrl:n.getTemplateUrl("ha-breadcrumb-base-template.html")}}])}(angular),function(n){"use strict";var t=n.module("haCreditCardTypesModule",[]);t.directive("haCreditCardTypes",["haConfig",function(n){var t=function(){},i;return t.$inject=["$scope"],i=function(n){n.exampleMethod=function(){return n};n.$emit("$haCreditCardTypesReady");n.$on("cctype",function(t){n.cctype=t.type})},{restrict:"A",scope:!0,link:i,controller:t,templateUrl:n.getTemplateUrl("ha-credit-card-types-base-template.html")}}]);t.directive("haCheckCreditCard",function(){var n=function(n,t,i){n.$watch(i.ngModel,function(){n.setCreditCardType(t[0].value)});n.setCreditCardType=function(t){var i="unknown";/^5[1-5]|^2(?:2(?:2[1-9]|[3-9]\d)|[3-6]\d\d|7(?:[01]\d|20))/.test(t)?i="mastercard":/^4/.test(t)?i="visa":/^3[47]/.test(t)&&(i="amex");n.$broadcast("cctype",{type:i})}};return{restrict:"A",scope:!0,link:n}})}(angular),function(n){"use strict";var t=n.module("haDynamicModalModule",[]);t.directive("haDynamicModal",function(){var t=function(t,i,r){t.body=n.element(document).find("body");t.backdropEl=n.element('<div class="modal-backdrop" ng-click="$modalCancel()">');t.handleEscPressed=function(n){n.keyCode===27&&t.$modalCancel()};t.closeFn=function(){t.body.unbind("keydown",t.handleEscPressed);t.backdropEl.removeClass("fade in");t.modalEl.removeClass("in");r(function(){t.body.removeClass("modal-active")},300)};t.body.bind("keydown",t.handleEscPressed)},i;return t.$inject=["$scope"],i=function(n){n.exampleMethod=function(){return n};n.$emit("$haDynamicModalReady")},{restrict:"A",scope:!0,transclude:!0,link:i,controller:t}})}(angular),function(n){"use strict";var t=n.module("haAlertModule",[]);t.directive("haAlert",["$window","haConfig",function(n,t){var i=function(t){t.showAlert=!0;t.$on("$showAlert",function(n,i){i===t.alertId&&(t.showAlert=!0)});t.$on("$hideAlert",function(){t.showAlert=!1});t.hideAlert=function(){t.showAlert=!1;t.$emit("haAlertClosed",t.alertId)};t.postTealeaf=function(){n.TLT!=null&&n.TLT.logCustomEvent("HAErrorMessage",{ErrorHeader:t.header,ErrorMessage:t.description})}},r;return i.$inject=["$scope"],r=function(n,t,i){if(n.type=i.type,n.alertId=i.alertId,n.noClose=i.noClose!==undefined,n.noIcon=!!i.noicon,n.header=i.header,n.description=i.description,n.customIconClass=i.customIconClass,i.$observe("header",function(){n.header=i.header;n.showAlert=!0}),i.$observe("type",function(){n.type=i.type;n.showAlert=!0;n.type==="error"&&(n.noClose=!0)}),i.$observe("description",function(){n.description=i.description}),i.$observe("noicon",function(){n.noIcon=!!i.noicon;n.showAlert=!0}),i.$observe("customIconClass",function(){n.customIconClass=i.customIconClass}),typeof t.context!="undefined"&&n.header!==""&&typeof(t.context.offsetHeight!==undefined)&&t.context.offsetHeight!==0){if(t.find(".alert-content [ng-transclude]").children().length>0){var r=t.find(".alert-content [ng-transclude]").text().trim();t.find(".alert-hidden-content.sr-only").append('<p class="sr-only">'+r+"<\/p>")}["promo","info"].indexOf(i.type.toLowerCase())===-1&&i.disableAutofocus!=="true"&&t.find('[role="alert"]').focus();n.description!==undefined&&n.postTealeaf()}},{restrict:"A",scope:!0,link:r,transclude:!0,templateUrl:t.getTemplateUrl("ha-alert-base-template.html"),controller:i}}])}(angular),function(n){"use strict";var t=n.module("haBookStickyProgressBarModule",["haFlightResultsAPI","haItineraryAPI"]);t.directive("haBookStickyProgressBar",["$window","haUtils","haFlightResultsAPI","haItineraryAPI","$timeout","haGlobals","haConfig","haCustomerSelections",function(t,i,r,u,f,e,o,s){var h=function(t,i,r,u){i.$pax=u;i.numAdults=0;i.numChildren=0;n.forEach(u.passengers,function(n){n.type==="Adult"&&i.numAdults++;n.type==="Child"&&i.numChildren++});e("enablePassengerTripSummary",function(n){n!=null&&(i.enablePassengerTripSummary=n)});i.displayEditReshopModal=function(){i.reshopEditModal=r(o.getTemplateUrl("ha-reshop-selection-modal.html"),{backdrop:"true",id:"reshop-edit-selection",scope:i})};t.$on("grandTotal",function(n,t){i.grandTotal=t});i.promos=!1;i.isPromoApplied=!1;i.showPromoList=!1;i.$on("updatePromoList",function(n,t){i.updatePromoList(t)});i.updatePromoList=function(t){i.isPromoApplied=!1;i.promos=!1;n.element(".promos-button").removeClass("applied selected");t&&t.length>0&&(i.promos=[],n.forEach(t,function(t){i.promos.push(t);t.Active&&(i.isPromoApplied=!0,n.element(".promos-button").addClass("applied"))}));i.showPromoList=!0};i.showPromos=function(){i.showPromoList?i.showPromoList=!1:i.resultsLoaded&&(i.showPromoList=!0)};i.hidePromos=function(){i.showPromoList=!1};i.applyPromo=function(t){f(function(){n.forEach(i.promos,function(n){n.Active=!1});i.promos[t].Active=!0;i.isPromoApplied=!0;i.$emit("applyPromo",i.promos[t].PromoCode);i.hidePromos()},0)};i.removePromo=function(t){f(function(){i.isPromoApplied=!1;n.element(".promos-button").removeClass("applied selected");i.promos[t].Active=!1;i.$emit("removePromo",i.promos[t].PromoCode);i.hidePromos()},0)};i.body=n.element(document).find("body");i.handleEscPressed=function(n){n.keyCode===27&&i.showPromoList&&f(function(){i.hidePromos()},0)};i.body.bind("keydown",i.handleEscPressed);i.body.bind("touchstart click",function(t){var r=n.element(".section.promos").find(t.target).length>0;r||i.showPromoList&&f(function(){i.hidePromos()},0)});i.tripSummaryDetailsModal=function(){i.summaryModel=n.copy(i.PassengerTripSummary);r({backdrop:"true",id:"trip-details-modal",templateUrl:"/tripSummaryDetailsModal.html",scope:i})}},c;return h.$inject=["$rootScope","$scope","haModal","haPassengersService"],c=function(o,h,c){o.seeFlightsDisabled=!0;o.selectedLegs=[];o.isInvalidSearch=!1;o.isFlightSearchMsg="";o.showBookingWidget=!1;o.stickyBarType=c.barType;o.receiptDetails=!1;o.editSearch=function(){o.showBookingWidget=!0;f(function(){o.stickyBar=h.find("[ha-book-sticky-progress-bar]");o.stickyBar.hide();o.bookingWidget=h.parent().find("[booking-widget]");o.bookingWidgetContainer=h.parent().find(".bookingWidgetContainer");o.bookingWidgetContainer.show();o.bookingWidget.show();$("body, html").animate({scrollTop:h.offset().top-1},"fast");o.bookingWidget.scope().activateWidget()},0)};o.viewDetails=function(){o.receiptDetails?($("body").removeClass("modal-active"),o.receiptDetails=!1,o.scrollFixed=!1):(o.receiptDetails=!0,o.scrollIfFixed())};o.displayChangeFlightModal=function(){o.modalData=JSON.parse(c.modalData);o.paxHide=!0;o.flightSelectExpand=!0;r.updateChangeFlightModel().success(function(t){t.responseBaseModel.IsSuccess&&(n.forEach(t.ChangeFlight,function(n){n.OriginDateTime=new Date(parseInt(n.OriginDateTime.match(/\d+/)[0],10));n.DestinationDateTime=new Date(parseInt(n.DestinationDateTime.match(/\d+/)[0],10));n.isSelectedFlight=!1}),n.forEach(t.OldFlightDetails,function(n){n.OriginDateTime=new Date(parseInt(n.OriginDateTime.match(/\d+/)[0],10));n.DestinationDateTime=new Date(parseInt(n.DestinationDateTime.match(/\d+/)[0],10))}),o.ChangeFlightModel=t,o.trips=t.ChangeFlight,o.tripsOld=t.OldFlightDetails,o.paxDetails=t.travellerInfo,o.selectedPax=[],$(".blockUIblockOverlay").css("display","none"),$(".LoadingText").css("display","none"),n.forEach(t.travellerInfo,function(n,t){n.IsSelectedPax&&o.selectedPax.push(t)}),o.Init(),o.displayEditReshopModal())}).error(function(){$(".blockUIblockOverlay").css("display","none");$(".LoadingText").css("display","none");o.$rootScope.errorMsg="Session has expired";o.$rootScope.hasError=!0});setTimeout(function(){$(".ha-modal").animate({scrollTop:0},"slow")},0)};o.Init=function(){o.createLegs(o.trips.length);var t=0;n.forEach(o.trips,function(){o.selections.legs[t].origin=o.trips[t].OriginCityCode;o.selections.legs[t].originCityData={};o.selections.legs[t].originCityData.Code=o.trips[t].OriginCityCode;o.selections.legs[t].destination=o.trips[t].DestinationCityCode;o.selections.legs[t].destinationCityData={};o.selections.legs[t].destinationCityData.Code=o.trips[t].DestinationCityCode;var n=new Date(o.trips[t].OriginDateTime);o.selections.legs[t].date={year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate()};t++})};o.closeReshopModal=function(n){o.$modalCancel(n);o.resetReshopModal();o.$modalClose&&o.$modalClose()};o.resetReshopModal=function(){o.paxHide=!1;o.flightSelectExpand=!1;$("#changeflight").css("display","block");o.selectedLegs=[]};o.closeChangeFlightsBtnClick=function(){o.closeReshopModal()};o.showFlightControlsForLeg=function(n,t){t===!0||t==="true"||(o.$currentLegControls=h.find(".leg-"+n+"-controls"),o.isLegSelected(n)?(o.showLeg=undefined,o.removeLeg(n)):(o.showLeg=n,o.addLeg(n)),o.enableSeeFlightsBtn(o.selectedLegs.length>0))};o.enableSeeFlightsBtn=function(n){o.seeFlightsDisabled=n?!1:!0};o.addLeg=function(n){o.selectedLegs.indexOf(n)===-1&&o.selectedLegs.push(n)};o.removeLeg=function(n){o.selectedLegs.indexOf(n)!==-1&&o.selectedLegs.splice(o.selectedLegs.indexOf(n),1)};o.isLegSelected=function(n){return o.selectedLegs.indexOf(n)>=0};o.openCalendar=function(n){return o.trips[n].calExpanded=!0,o.activeCalendar=n,o};o.closeCalendar=function(){return n.forEach(o.trips,function(n){n.calExpanded=!1}),o};o.preventDefault=function(n){n.preventDefault()};o.$on("HaLocationInput:focused",function(){o.activateWidget()});o.activateWidget=function(){h.removeClass("closed");h.addClass("expanded");setTimeout(function(){h.addClass("active");h.find("[ha-carousel]").each(function(){$(this).scope().gotoSlide(2)})},1e3)};o.$on("HaDateInput:focused",function(n,t){var i=parseInt(t.attr("target-leg"),10);isNaN(i)||o.openCalendar(i,t.parents(".date-picker"))});o.$on("HaDateInput:selected",function(){o.closeCalendar()});o.activeCalendar=0;o.SearchNewFlights=function(t){t.preventDefault();$(".LoadingTextReshop").css("display","block");n.forEach(o.ChangeFlightModel.travellerInfo,function(n,t){n.IsSelectedPax=o.selectedPax.indexOf(t)>-1?!0:!1});n.forEach(o.ChangeFlightModel.ChangeFlight,function(n,t){o.selectedLegs.indexOf(t)>-1&&(n.isSelectedFlight=!0,o.selections.legs[t].date?n.OriginDate=moment(n.OriginDateTime).format("MM/DD/YYYY"):n.isSelectedFlight=!1)});u.UpdatePaxAndFlightDetails(o.ChangeFlightModel).success(function(t){t.IsSuccess?($(".LoadingTextReshop").css("display","none"),o.isInvalidSearch=!1,o.isFlightSearchMsg="",n.element("#changeFlightForm").submit()):(o.isInvalidSearch=!0,o.isFlightSearchMsg=t.Message,$(".LoadingTextReshop").css("display","none"))}).error(function(){console.log("Error in Flight Search")})};o.createLegs=function(n){s.createLegs(n,!1)};o.scrollIfFixed=function(){o.windowHeight=n.element(t).height();o.scrollFixed=!1;$("body").removeClass("modal-active");o.receiptDetails&&(o.expandedDetailsHeight=n.element(".receipt-details").height()+65,o.expandedDetailsHeight>o.windowHeight&&o.$root.fixed&&($("body").addClass("modal-active"),o.scrollFixed=!0))};var l=!1;n.element(t).bind("scroll",function(){l||(o.progressBarOffsetY=n.element("[ha-book-sticky-progress-bar]").offset().top,l=!0);this.pageYOffset>=o.progressBarOffsetY?(o.$root.fixed=!0,o.receiptDetails&&o.scrollIfFixed()):o.$root.fixed=!1;o.$digest()});o.Initialize=function(){var n,t,r;(o.bookingWidget=h.parent().find("[booking-widget]"),o.bookingWidgetContainer=h.parent().find(".bookingWidgetContainer"),o.bookingWidgetContainer.show(),o.bookingWidget.show(),o.$emit("$haBookStickyProgressBarReady"),setTimeout(function(){o.$root.fixed=!1;o.bookingWidgetContainer.hide();o.bookingWidget.hide()},500),n=i.getFlightQueryModelCookie(),t=i.getReshopFlightQueryModelCookie(),t!==null&&t.FlightQueryTypeId===3&&($.extend(o,t),o.SelectedPassengersCount=t.SelectedPassengers.length),n!=null)&&(document.referrer.indexOf("deals-and-offers")!=-1?(n.FlightQueryTypeId=2,o.TripTypeID=2,o.TripType=1,o.isValidLowFareDuration=!1,o.enableTCR=!1):o.TripTypeID=n.FlightQueryTypeId,o.PassengerCount=n.PassengerCount,o.PassengerTripSummary!=null&&o.PassengerTripSummary.SelectedHotel!=null&&o.PassengerTripSummary.SelectedHotel.SelectedRooms!=null?(o.HotelRoomCount=o.PassengerTripSummary.SelectedHotel.SelectedRooms.length,o.NumberOfNights=o.PassengerTripSummary.SelectedHotel.Nights):e("itineraryDetails",function(n){n.PassengerTripSummary!=null&&n.PassengerTripSummary.SelectedHotel!=null&&n.PassengerTripSummary.SelectedHotel.SelectedRooms!=null&&(o.HotelRoomCount=n.PassengerTripSummary.SelectedHotel.SelectedRooms.length,o.NumberOfNights=n.PassengerTripSummary.SelectedHotel.Nights)}),r=n.FlightSearchSegmentList[0],o.TripOrigin=r.OriginCityCode,o.TripDestination=r.DestinationCityCode,o.DepartureDate=r.DepartureDate,n.FlightQueryTypeId===2?o.ReturnDate=n.FlightSearchSegmentList[1].DepartureDate:n.FlightQueryTypeId!==1&&(o.ReturnDate=n.FlightSearchSegmentList[n.FlightSearchSegmentList.length-1].DepartureDate,o.TripTypeID=n.FlightQueryTypeId=0))};o.UpdateBar=function(n){var t=i.getFlightQueryModelCookie(),r=i.getReshopFlightQueryModelCookie();(r!==null&&+r.FlightQueryTypeId==3&&($.extend(o,r),o.$$phase||o.$apply()),t!=null)&&(o.TripOrigin=t.FlightSearchSegmentList[0].OriginCityCode,o.TripDestination=t.FlightSearchSegmentList[0].DestinationCityCode,o.PassengerCount=t.PassengerCount,o.DepartureDate=t.FlightSearchSegmentList[0].DepartureDate,n===t.FlightSearchSegmentList.length&&(o.ReturnDate=t.FlightSearchSegmentList[t.FlightSearchSegmentList.length-1].DepartureDate),o.TripTypeID=t.FlightQueryTypeId)};o.Initialize()},{restrict:"A",scope:!0,link:c,controller:h}}])}(angular),function(n){"use strict";var t=n.module("haHelpAndTipsModule",[]);t.directive("haHelpAndTips",["haConfig",function(n){var t=function(n,t){n.getData=function(i,r){t.getData(i,function(t){n.cityName=t.cityName;n.month=t.months[(r-1)%12];n.monthDate=new Date(2e3,r-1);n.$emit("$haHelpAndTips:dataLoaded")})}},i;return t.$inject=["$scope","haHelpAndTips"],i=function(n,t,i){i.$observe("city",function(){n.getData(i.city,i.month)});n.$on("$haHelpAndTips:dataLoaded",function(){n.$emit("$haHelpAndTips:Ready")})},{restrict:"A",scope:!0,link:i,templateUrl:n.getTemplateUrl("ha-help-and-tips-base-template.html"),controller:t}}])}(angular),function(n){"use strict";var t=n.module("haRecentSearchesModule",[]);t.directive("haRecentSearches",["haConfig",function(n){var t=function(n,t){n.restoreSearch=function(i){t.restoreSearch(i);n.deactivate()};n.activate=function(){return n.active=!0,n};n.deactivate=function(){return n.active=!1,n};n.active=!1},i;return t.$inject=["$scope","haSearchCache","haCustomerSelections"],i=function(n,t){n.toggleActive=function(){return n.active?n.deactivate():(t.find(".toggle").focus(),n.activate()),n};n.preventDefault=function(n){n.preventDefault()};n.$emit("$haRecentSearchesReady")},{restrict:"A",scope:!0,templateUrl:n.getTemplateUrl("ha-recent-searches-base-template.html"),link:i,controller:t}}])}(angular),function(n){var t=n.module("haLocationInputModule",["haUtilsModule","haTemplateCache","haCitiesAPI","ui.bootstrap.typeahead","haAdvanceToNextInputService"]);t.directive("haLocationInput",["$compile","$timeout","haTemplateCache","haConfig",function(n,t,i,r){t(function(){i.get(r.getRazorTemplateUrl("destination-modal-hawaii"));i.get(r.getRazorTemplateUrl("destination-modal-na"));i.get(r.getRazorTemplateUrl("destination-modal-asia"));i.get(r.getRazorTemplateUrl("destination-modal-base"))},1e3);var u=function(n,t,i){var r=n.haLocationInput=n.haLocationInput||{};i.$observe("required",function(t){n.required=t});n.errorMessage=i.errorMessage;r.placeholder=i.placeholder;r.label=i.label;r.required=i.required;r.tagname=i.tagname;r.tagPrefix=i.tagPrefix!==undefined?i.tagPrefix:"";r.tagname2=i.tagname2;r.tagPrefix2=i.tagPrefix2!==undefined?i.tagPrefix2:"";r.disabledInput=i.disabledInput==="true";r.selectedCity=r.selectedCity||i.haLocationSelectedCity};return{restrict:"A",scope:{preset:"=",disabledInput:"=",originLeg:"=",destinationLeg:"=",cityFilterIndex:"=",cityFilterIsDeparture:"="},link:u,templateUrl:r.getRazorTemplateUrl("ha-location-input-base-template"),controller:"haLocationInputController"}}]);t.controller("haLocationInputController",["$scope","$log","haCitiesAPI",function(n,t,i){function u(){n.$root.DefaultCity==null||r.selectedCity||(r.selectedCity=n.$root.DefaultCity);var u=function(i){t.debug("SEND: haLocationInput:ready:CityList");r.CityList=i;n.$broadcast("haLocationInput:ready:CityList")};r.cityFilterIndex!=null?i.getFilteredCityList(r.cityFilterIndex,r.cityFilterIsDeparture).then(u):i.getCityList().then(u)}var r=n.haLocationInput=n.haLocationInput||{};r.CityList=[];r.preset=n.preset;r.disabled=n.disabledInput;r.originLeg=n.originLeg;r.destinationLeg=n.destinationLeg;r.cityFilterIndex=n.cityFilterIndex;r.cityFilterIsDeparture=!!n.cityFilterIsDeparture;u()}])}(angular),function(n){"use strict";var t=n.module("haGenericLocationInputModule",["haCitiesModule","ui.bootstrap.typeahead.ha"]);t.directive("haGenericLocationInput",["haConfig","haUtils","haCitiesSvc","$q","$log","$timeout",function(t,i,r,u,f,e){return{templateUrl:t.getTemplateUrl("ha-generic-location-input-template.html"),restrict:"A",scope:{ngModel:"=",name:"@",label:"@",placeholder:"@",required:"@",classes:"@",disabled:"@",countries:"="},link:function(t,o){t.getComboResultsForInput=function(e){return u.all([r.getMatchingCities(e),r.searchCarLocations(e,t.countries),r.getAllCarLocations()]).then(function(r){var u=[],o=r[0],e=r[1],s=r[2],f;return n.forEach(o,function(n){if(_.includes(t.countries,n.CountryCode)){var i=_.find(s[n.CountryCode],"airport",n.Code);i&&u.push({DisplayName:n.DisplayName,IsHACity:n.IsHACity,Country:n.CountryCode,Code:n.Code,Id:i.id})}}),u=i.removeDuplicatesFromArray(u,"DisplayName").slice(0,5),u.length&&(u[0].firstAirportResult=!0),e&&e.length&&(f=e.filter(function(n){return!n.airport||!_.some(u,"Code",n.airport)}).map(function(n){return{DisplayName:n.name,isAddress:!0,Country:n.country,Id:n.id}}),f.length&&(f[0].firstPlacesResult=!0,u=u.concat(f))),u}).catch(function(n){return f.error(n),t.Error=n,u.reject(n)})};t.onSelected=function(n){t.ngModel=n;e(function(){t.focus()},0)};t.onSelect=function(){e(function(){t.focus()},0)};t.onClick=function(n){n.target.select()};t.onFocus=function(){t.$root.isMobile&&$("html, body").animate({scrollTop:o.offset().top-60})};t.pinClicked=function(){t.$emit("haWhereWeFlyPinClicked")};t.focus=function(){setTimeout(function(){o.find('input[type="text"]').focus()},0)}}}}])}(angular),function(n){"use strict";var t=n.module("haLocationInputModule");t.directive("haLocationTypeahead",["$compile","$log","$filter","$timeout","haAdvanceToNextInput","haConfig",function(n,t,i,r,u,f){var e=function(n,f){var e=n.haLocationData,s=function(){n.$apply(function(){e.focused=!0;n.$emit("HaLocationInput:focused",f);n.$root.DefaultCity==null||e.selectedCity||(e.selectedCity=n.$root.DefaultCity)})},h=function(t){r(function(){if(e.focused=!1,t!=null){var i=t.target;(i!=null&&i.value==null||i.value==="")&&n.clearSelection()}n.$emit("HaLocationInput:blurred")},350)},o;f.find("input[typeahead]").on("focus",s).on("blur",h);o=function(){var r,f,u;e.CityList!=null&&e.CityList.length!==0&&(t.debug("haLocationTypeahead._onCityListReady"),f=i("filter"),e.preset?(r=f(e.CityList,{Code:e.preset}),r.length>0?(t.debug('haLocationTypeahead: Matched "preset" ('+e.preset+")."),n.processSelection(r[0])):t.debug('haLocationTypeahead: Could not set "preset" ('+e.preset+"). No match in CityList.")):(e.originLeg!=null&&e.originLeg.origin!=null?u=e.originLeg.origin:e.destinationLeg!=null&&e.destinationLeg.destination!=null&&(u=e.destinationLeg.destination),u!=null?(r=f(e.CityList,{Code:u}),r.length>0?(t.debug('haLocationTypeahead: Matched "code" ('+u+")."),n.processSelection(r[0])):t.debug('haLocationTypeahead: Could not set "code" ('+u+"). No match in CityList.")):t.debug("haLocationTypeahead: No legs specified.")))};t.debug("ON: haLocationInput:ready:CityList");n.$on("haLocationInput:ready:CityList",function(){t.debug("RCVD: haLocationInput:ready:CityList");o()});t.debug("ON: $root.selections.legs:ready");n.$on("$root.selections.legs:ready",function(){t.debug("RCVD: $root.selections.legs:ready");o()});o();n.$watch("currentCityDisplayName",function(n){if(n!==undefined){var t=f.parents("[ha-input]").scope();t!=null&&t.$model!=null&&(t.$model.$setViewValue(n),t.$model.$render())}});n.advanceToNextInput=function(){u.next(f)}};return{restrict:"AE",link:e,scope:{haLocationData:"=haLocationData"},replace:!0,controller:"haLocationTypeaheadController",templateUrl:f.getRazorTemplateUrl("ha-location-typeahead")}}]);t.controller("haLocationTypeaheadController",["$scope","$timeout","haUtils",function(t,i,r){var u=t.haLocationData,f,e,o;u.focused=!1;f=function(n){for(var i=[],t=0;t<n.length-1;t++)i.push(n[t]+" "+n[t+1]),i.push(n[t]+n[t+1]);return n.concat(i)};t.haAirportSort=function(t){return function(i){var r=0,u,e,o,s;return t==null?r:(i.DisplayName===t&&(r=100),u=t.split(" ").join(""),i.Code!=null&&i.Code.toUpperCase()===t.toUpperCase()&&(r+=1),i.DisplayName!=null&&(e=f(i.DisplayName.split(" ")),n.forEach(e,function(n){n.toLowerCase().indexOf(t.toLowerCase())===0?r+=.3:n.toLowerCase().indexOf(u.toLowerCase())===0&&(r+=.15)})),i.LinkedAirportCodes!=null&&(o=i.LinkedAirportCodes.split(","),n.forEach(o,function(n){n.toUpperCase()===t.toUpperCase()&&(r+=.2)})),i.SearchTags!=null&&(s=f(i.SearchTags.split(" ")),n.forEach(s,function(n){(n.toLowerCase().indexOf(t.toLowerCase())===0||n.toLowerCase().indexOf(u.toLowerCase())===0)&&(r+=.1)})),r>0&&i.IsHACity&&(r+=.5),i._weight=r,-r)}};t.haAirportFilter=function(n){return n._weight>0};e=r.isJP()||r.isKR()||r.isCN()||r.isTW();t.typeaheadMinLength=function(){return e?2:3};o=function(n){u.originLeg!=null&&(u.originLeg.origin=n.Code,u.originLeg.originCityData=n);u.destinationLeg!=null&&(u.destinationLeg.destination=n.Code,u.destinationLeg.destinationCityData=n)};t.processSelection=function(n){t.$root.DefaultCity=null;t.currentCityDisplayName=n.DisplayName;u.selectedCity=n;u.currentCityCode=n.Code;u.linkedCityCode=n.LinkedAirportCodes;o(n)};t.clearSelection=function(){u.currentCityCode=null;u.linkedCityCode=null};t.onSelected=function(n){i(function(){u.focused=!1;t.processSelection(n);t.advanceToNextInput()},200)}}])}(angular),function(n){"use strict";var t=n.module("haLocationInputModule");t.directive("haLocationModal",["haModal","haCitiesSvc","haConfig","$timeout",function(n,t,i,r){function u(u,f,e){var l=e.eventName||"click",s,o,h,c;u.filterName=e.filterFn!==""?e.filterFn:null;u.cityListType=e.cityListType||"normal";s=function(t){u.updateAvailableCities(u.region);var f=t.currentTarget;n(i.getRazorTemplateUrl("destination-modal-base"),{id:"locationModal",backdrop:"true",scope:u,cancel:{fn:function(){r(function(){$(f).prevAll("[ha-typeahead]").focus()},300)}}})};f.on(l,s);u.cityListType.match("^reshop")?(o=u.cityListType.split("-"),o.length===3&&(h=o[1],c=o[2]==="origin",t.getFilteredCities(h,c).then(function(n){u.cities=n}))):u.cityListType.match("^expertbooking")?t.getAllCitiesExpertBooking().then(function(n){u.cities=n}):t.getAllCities().then(function(n){u.cities=n})}return{restrict:"A",link:u,controller:"haLocationModalController",scope:{region:"@haLocationModal",selectedCity:"=haLocationSelectedCity"}}}]);t.controller("haLocationModalController",["$scope","$filter",function(t,i){function u(n){var t=0;switch(n){case"hawaii":t=1;break;case"na":t=2;break;case"asia":t=3}return t}function f(n){switch(n){case"hawaii":t.$root.isMobile&&r(t.regionalCities,"IslandName",1);break;case"na":r(t.regionalCities,"State",4);break;case"asia":r(t.regionalCities,"CountryName",4)}}function r(r,u,f){var o=0,e=[],h,s;t.regionalCities=[];r=i("citiesOrderBy")(r,u,!1);h=r.length;r=_.groupBy(r,u);s=Math.round((h+Object.keys(r).length)/f);n.forEach(r,function(n,r){if(n=i("citiesOrderBy")(n,"NonLocalisedCityName",!1),o+n.length>s*1.5)if(s-o<s/3&&(t.regionalCities.push(e),o=0,e=[]),n.length>s*1.5){var u=s-o+3;e.push({Name:r,Cities:n.slice(0,u)});t.regionalCities.push(e);e=[];e.push({Name:r,Cities:n.slice(u)});o=n.length-u}else e.push({Name:r,Cities:n}),o=n.length+1;else o+=n.length+1,e.push({Name:r,Cities:n});o>=s&&t.regionalCities.length<f-1&&(o=0,t.regionalCities.push(e),e=[])});u==="IslandName"&&n.forEach(e,function(n){n.islandSortOrder=!n.Cities?9:n.Cities[0].IslandSortOrder});t.regionalCities.push(e)}t.regionalCities=[];t.$watch("region",function(n,i){n!==i&&t.updateAvailableCities(n)});t.selectCity=function(n){var i;do if(i=t.$parent,i.onSelected!=null){i.onSelected(n);break}while(i!=null);t.$modalClose()};t.selectRegion=function(n){t.region=n};t.isRegion=function(n){return this.region===n};t.getCitiesByMarket=function(n){return t.cities?t.filterName==="isHACity"?t.cities.filter(function(t){return t.Market===n&&t.IsHACity===!0}):t.cities.filter(function(t){return t.Market===n}):[]};t.regionHasCities=function(n){var i=u(n),r=t.getCitiesByMarket(i);return!!r.length};t.updateAvailableCities=function(n){var i=u(n);t.regionalCities=t.getCitiesByMarket(i);f(n)}}]);t.filter("citiesOrderBy",[function(){return function(t,i,r){var u=[];return n.forEach(t,function(n){u.push(n)}),u.sort(function(n,t){return n[i]>t[i]?1:-1}),r&&u.reverse(),u}}])}(angular),function(n){"use strict";var t=n.module("haDateInputModule",["haAdvanceToNextInputService"]);t.directive("haDateInput",["haUtils","haConfig","haAdvanceToNextInput",function(n,t,i){var r=function(t,i){t.updateTimestamp=function(i){i?(t.date=n.leftPad(i.month,2)+n.leftPad(i.day,2)+i.year.toString(),t.timestamp=new Date(i.year,i.month-1,i.day),t.updated=i.updated):t.date=t.timestamp=undefined};t.setDate=i.setLegDate;t.getLegData=function(n){return i.getLeg(n)}},u;return r.$inject=["$scope","haCustomerSelections"],u=function(n,t,r){n.onFocus=function(){t.addClass("focused");n.$emit("HaDateInput:focused",t)};n.onBlur=function(){t.removeClass("focused");n.$emit("HaDateInput:selected",t)};n.advanceToNextInput=function(){i.next(t)};n.legData=n.getLegData(r.targetLeg);n.$watch("$root.selections.legs",function(){var t=n.updated;n.legData=n.getLegData(r.targetLeg);n.updateTimestamp(n.legData.date);n.updated!==t&&n.advanceToNextInput()},!0);n.$watch("date",function(t,i){t!==i&&n.date&&n.legData&&n.setDate(r.targetLeg,{month:n.date.substr(0,2),day:n.date.substr(2,2),year:n.date.substr(4,4)})});n.label=r.label;n.tagname=r.tagname;n.tagPrefix=r.tagPrefix!==undefined?r.tagPrefix:"";n.placeholder=r.placeholder;n.required=r.required;n.errorMessage=r.errorMessage;n.$emit("$haDateInputReady")},{restrict:"A",scope:!0,templateUrl:t.getTemplateUrl("ha-date-input-base-template.html"),link:u,controller:r}}]);t.directive("haDateFormatter",["$filter","$locale",function(n,t){function i(){return t.DATETIME_FORMATS.shortDate}return{require:"ngModel",link:function(t,r,u,f){f.$formatters.push(function(t){if(t==null||typeof t!="string")return"";var r={month:parseInt(t.substr(0,2),10)-1,day:parseInt(t.substr(2,2),10),year:parseInt(t.substr(4,4),10)},u=new Date(r.year,r.month,r.day,0,0,0,0);return n("date")(u,i())})}}}]);t.run(["$locale","haUtils",function(n,t){t.isEN()&&(n.DATETIME_FORMATS.shortDate="M/d/yyyy")}])}(angular),function(n){"use strict";var t=n.module("shareWidgetModule",[]);t.directive("shareWidget",["haConfig",function(n){var t=function(n){n.shareServices=["Twitter","LinkedIn","Facebook","Google+"]},i=function(n){n.$emit("$methodsBound")};return t.$inject=["$scope"],{restrict:"A",scope:!0,link:i,controller:t,templateUrl:n.getTemplateUrl("share-widget-base-template")}}])}(angular),function(n){"use strict";var t=n.module("haCalendarEventsModule",[]);t.directive("haCalendarEvents",[function(){var n=function(n,t){n.getCalendarEvents=function(n,i){t.getEvents(n,function(n){i(n)})}},t;return n.$inject=["$scope","haCalendarEventsService"],t=function(n,t,i){n.getCalendarEvents(i.haCalendarEvents,function(t){$.extend(n,t);n.$broadcast("$haCalendarEventsLoaded")})},{restrict:"A",scope:!0,link:t,controller:n}}])}(angular),function(n){"use strict";function t(n){return n.format("YYYY-MM-DD")}function i(n){return n.format("YYYY-MM")}var r=n.module("haCalendarModule",[]);r.directive("haCalendar",["$compile","$locale","haConfig","haUnavailableDays","haAriaLiveService",function(n,r,u,f,e){return{templateUrl:u.getTemplateUrl("ha-calendar.html"),restrict:"A",controller:["$timeout","$rootScope","$scope","$element","$attrs","$parse",function(u,o,s,h,c,l){function g(n){if(o.isMobile)a.calendars=1;else{if(typeof n=="undefined")return;a.calendars=n===2?2:1}}function nt(n,t){if(n&&n.origin&&n.origin.Code&&n.destination&&n.destination.Code)return t?n.destination.Code+"-"+n.origin.Code:n.origin.Code+"-"+n.destination.Code}function ut(){return a.viewing&&moment(a.viewing).startOf("month")}function b(n){a.viewing.year(n.year()).month(n.month())}function v(){var u=ut(),r=moment(u),n,i;for(y.empty(),n=0;n<a.calendars;n++)ft(r),r.add(1,"months");i=moment(w()||NaN);i.isValid()&&y.find("td[date="+t(i)+"]").addClass("selected");a.render.calendar(h,a.isReturn)}function k(n){return t(n).valueOf()>=t(a.range_start)&&t(n).valueOf()<t(a.range_end)}function d(n){return moment(y.find(n).attr("date"),"YYYY-MM-DD")}function ft(n){var f=s.$new(!0),r=moment(n).startOf("month"),e=moment(r).endOf("month").date(),u=r.day();rt(f,function(f){a.render.caption(f.find("caption"),r);f.attr("date",i(n)).find("tbody>tr>td").each(function(n){var f=n-u+1;if(!(n<u)&&!(f>e)){var i=moment(r).date(f),o=i.diff(tt,"days"),s=$(this).attr("date",t(i)).addClass(o?o<0?" past":" future":" today").toggleClass("disabled",!k(i));a.render.day(s,i)}});y.append(f)})}var a=$.extend(!0,{calendars:1,range_start:moment([1900]),range_end:moment([3e3]),double_wide:!1,render:{calendar:function(n,t){var i,r,u;if(a.rangeRender&&a.rangeRender(n),a.double_wide&&n.addClass("double-wide"),i=a.idx||0,s.legs&&s.legs[i]&&(r=nt(s.legs[i],t),r&&r.length&&f.get(r).then(function(t){n.find("td[date]:not(.disabled)").each(function(){var n=$(this);t.contains(moment(n.attr("date"),"YYYY-MM-DD").toDate())&&n.addClass("disabled")})}),s.tripType===2?n.addClass("double-wide"):n.removeClass("double-wide")),s.messages&&(u=n.closest(".datepicker"),u.find("header > p").html(s.messages[i]),e.updateMessage(s.messages[i])),a.onRender)a.onRender(n)},caption:function(n,t){var i=t.month(),u=r.DATETIME_FORMATS.MONTH,f=t.year();n.html(u[i]+" "+f)},day:function(n,t){n.html(t.date())}}},s.$eval(c.haCalendar)),p,w;g(s.tripType);s.$on("trip type changed",function(n,t){g(t);v()});s.$on("airport changed",function(){v()});h.children("header").children("h2").text(a.calendarHeading);var tt=moment().startOf("day"),it=h.find("li").remove()[0].outerHTML,rt=n(it),y=h.find("ol.months");a.hasOwnProperty("watch")&&s.$watch(a.watch,v);s.$watch(function(){return a.range_start.valueOf()},v);s.$watch(function(){return a.range_end.valueOf()},v);s.$watch(function(){return a.viewing.valueOf()},v);p=l(c.haCalendarModel||"date");w=p.bind(p,s);this.select=function(n){u(function(){p.assign(s,n)},0);s.$emit("select",n)};s.$watch(w,function(n){if(y.find(".selected").removeClass("selected"),n||(n=Math.max(new Date,a.range_start.valueOf())),n=moment(n),n.isValid()&&k(n)){a.sticky_viewer&&b(n);var t=y.find("li[date="+i(n)+"]");if(t.length)return v()}});this.render=v;s.prev=function(){var n=d("li:first").add(-1,"month");b(n);s.$emit("prev",n)};s.next=function(){var n=d("li:first");b(n.add(1,"month"));s.$emit("next",n)};this.inRange=k;this.dateOf=d;a.viewing||(a.viewing=moment(w()||moment()).startOf("month"));s.$emit("ready",this)}],compile:function(n){return n.find("th").each(function(n,t){t.innerText=r.DATETIME_FORMATS.SHORTDAY[n]}),function(n,t,i,r){t.find("ol.months").on("click","td[date]:not(.disabled)",function(t){n.$apply(function(){r.select(r.dateOf(t.target).toDate())})});t.find(".prev").click(function(){n.$apply(n.prev)});t.find(".next").click(function(t){t.preventDefault();n.$apply(n.next)})}}}}])}(angular),function(n){"use strict";var t=n.module("haCalendar2Module",[]);t.directive("haCalendar2",["haDateUtils","$timeout","$rootScope","$parse","haConfig",function(t,i,r,u,f){return{templateUrl:f.getTemplateUrl("ha-calendar2.html"),restrict:"A",link:function(f,e,o){function d(n){var i=new Date;return f.pastDisabled||f.futureDisabled?f.pastDisabled&&t.isBefore(n,i)&&!t.isSameDay(n,i)||f.futureDisabled&&t.isAfter(n,i):!1}function p(){a=!1;h.removeClass("animating");f.$apply(function(){f.limitTrailer=-1*f.monthsToShow;h.css("left")==="0px"?f.limitIndex--:h.css("left",w)})}function g(){var i=document.createElement("div"),n={transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend"};for(var t in n)if(i.style[t]!==undefined)return n[t];return!1}function k(n,t,i,r){return t&&n.getDate()>7||r>=4&&n.getDate()>=1&&n.getDate()<15}var s,c;o.mode&&(f.mode=o.mode);o.monthsBackward&&(f.monthsBackward=parseInt(o.monthsBackward,10));o.monthsForward&&(f.monthsForward=parseInt(o.monthsForward,10));o.monthsToShow&&(f.monthsToShow=parseInt(o.monthsToShow,10));o.dayTemplate&&(f.dayTemplate=o.dayTemplate);o.departDate&&(s=u(o.departDate)(f));o.returnDate&&(c=u(o.returnDate)(f));o.getIsUnavailable&&(f.getIsUnavailable=u(o.getIsUnavailable)(f));o.departDate&&f.$watch(o.departDate,function(n){s=n});o.returnDate&&f.$watch(o.returnDate,function(n){c=n});f.mode=f.mode||"single";f.monthsBackward=f.monthsBackward||0;f.monthsForward=typeof f.monthsForward!="undefined"?f.monthsForward:11;f.monthsToShow=f.monthsToShow||1;f.dayTemplate=f.dayTemplate||"ha-datepicker-day-template";f.getIsUnavailable=f.getIsUnavailable||function(){return!1};f.pastDisabled=typeof f.pastDisabled!="undefined";f.futureDisabled=typeof f.futureDisabled!="undefined";f.monthsBackward=f.pastDisabled?0:f.monthsBackward;f.monthsForward=f.futureDisabled?0:f.monthsForward;var w="0",b=f.monthsToShow===2?"-50%":"-100%",h=$("#months",e),v=g(),a=!1,l,y=f.mode==="single";f.months=t.getVisibleMonths(f.monthsBackward,f.monthsForward);f.weekdays=f.weekdays||t.getDaysOfWeek();f.limitIndex=f.monthsBackward>0?f.monthsBackward+1:f.monthsToShow;f.limitTrailer=-1*f.monthsToShow;y?l=f.inputModel:s?l=s:!s&&c&&(l=c);l&&n.isDate(l)&&(f.limitIndex+=moment(l).diff(moment().startOf("month"),"months"));h.on(v,p);f.next=function(n){(n=n||1,a||f.limitIndex===f.monthsBackward+f.monthsForward+1)||(f.$emit("calendarForward"),f.limitIndex+=n,f.limitTrailer=f.mode==="stack"?f.limitTrailer-=n:-1*(f.monthsToShow+1),f.mode!=="stack"&&(h.addClass("animating"),i(function(){a=!0;h.css("left",b);v||p()})))};f.prev=function(){a||f.limitIndex===f.monthsToShow||(f.$emit("calendarBackward"),f.limitTrailer=f.mode==="stack"?f.limitIndex*-1:-1*(f.monthsToShow+1),f.mode!=="stack"&&(h.css("left",b),i(function(){a=!0;h.addClass("animating");h.css("left",w);v||p()})))};f.$on("calendarGoForward",function(n,t){f.next(t)});f.$on("calendarGoBackward",f.prev);f.setDate=function(n,t){r.$broadcast("setDate",new Date(t.day),n.target)};f.displayDay=function(n,t,i){return k(n,t,i)?"-":n.getDate()};f.isEdgeDay=function(n,t,i,r){return k(n,t,i,r)};f.isDepart=function(n){return y?t.isSameDay(f.inputModel,n):s?t.isSameDay(s,n):!1};f.isReturn=function(n){return y?t.isSameDay(f.inputModel,n):c?t.isSameDay(c,n):!1};f.isSelected=function(n){return!!s&&!!c&&t.isBetween(n,s,c)};f.isUnavailable=function(n){return f.getIsUnavailable(n)||d(n)};f.dayPlus=function(t,i){return n.isDate(t)?new Date(+t).dateAdd("day",i):new Date}}}}])}(angular),function(n){"use strict";var t=n.module("haCarouselModule",[]);t.directive("haCarousel",["$timeout","$compile","haUtils","haConfig","$rootScope",function(n,t,i,r,u){return{restrict:"A",scope:!0,priority:20,transclude:!0,templateUrl:r.getTemplateUrl("ha-carousel-template.html"),link:function(t,r,f,e,o){var c=t.$eval(f.onlyPage),l=t.$eval(f.noTransition),s=f.allowWrap?t.$eval(f.allowWrap):!0,h=t.$eval(f.mobileSlide),a=u.isMobile,v=f.paginationType,y=t.$eval(f.largePaddles),p=f.paginationAriaHidden?f.paginationAriaHidden:!1;r.find(".transclude").append(o(t,function(){}));r.find("[ha-draggable]").each(function(){$(this).scope().updateDraggableSettings({distance:40,axis:"x"});$(this).scope().$on("$dragEnd",function(n,i,r){c&&t.gotoNextSlideInDirection(r.position.left-r.originalPosition.left);t.gotoNearestSlide()})});t.slideWrapper=r.find(".ha-carousel-slide-wrapper").first();n(function(){t.slides=t.slideWrapper.children(".ha-carousel-slide");t.currentSlide=0;t.paginationType=v;t.largePaddles=y;t.paginationAriaHidden=p;t.allowWrap=s;t.slideCount=t.slides.length;t.slideWrapperWidth=t.slideCount*100+"%";t.slideWidth=100/t.slideCount+"%"});t.gotoSlide=function(i,u,f){return n(function(){var o=t.slides[i],n,e,s,c;t.isAnimating&&o||!o||(t.isAnimating=!0,typeof u=="undefined"&&(u=350),n=o.getBoundingClientRect(),e=r.get(0).getBoundingClientRect(),s=function(){t.isAnimating=!1;u>0&&r.trigger("haCarouselAtSlide",i);f&&f()},c=function(){t.slideWrapper.animate({left:(n.right-n.left)/(e.right-e.left)*-100*i+"%"},u,s)},l?h&&(!h||a)?c():(t.slideWrapper.css("left",(n.right-n.left)/(e.right-e.left)*-100*i+"%"),s()):c(),t.currentSlide=i)},0),t};t.gotoNextSlide=function(){var n=this.slideWrapper.children(".ha-carousel-slide"),t=!s||this.currentSlide+1<n.length?this.currentSlide+1:0;return this.gotoSlide(t),this};t.gotoPreviousSlide=function(){var n=this.slideWrapper.children(".ha-carousel-slide"),t=!s||this.currentSlide-1>=0?this.currentSlide-1:n.length-1;return this.gotoSlide(t),this};t.gotoNextSlideInDirection=function(n,t){var i=this.slideWrapper.children(".ha-carousel-slide");if(i.length!==0)return t=t||$(i[0]).width()/4,n>0&&n>t&&this.currentSlide>0?this.gotoPreviousSlide():n<0&&n<-t&&this.currentSlide<i.length-1?this.gotoNextSlide():this.gotoSlide(this.currentSlide),this.$apply(),this};t.gotoNearestSlide=function(){var t=this.slideWrapper.children(".ha-carousel-slide"),n=i.getChildrenPositions(r,t),u=i.closestInArray(n,0);return this.gotoSlide(n.indexOf(u)),this.$apply(),this};t.getAltText=function(){var n="",t=$(this.slide).children(".main-image");return t.length>0&&(n=t[0].dataset.alt),n};t.currentSlide=0;t.$emit("$haCarouselReady")}}}]);t.directive("haCarouselPaddles",["haConfig",function(n){return{restrict:"A",templateUrl:n.getTemplateUrl("ha-carousel-paddles-template.html")}}]);t.directive("haCarouselPagination",["haConfig",function(n){return{restrict:"A",templateUrl:n.getTemplateUrl("ha-carousel-pagination-template.html")}}]);t.directive("haCarouselPaginationWithPaddles",["haConfig",function(n){return{restrict:"A",templateUrl:n.getTemplateUrl("ha-carousel-pagination-with-paddles-template.html")}}])}(angular),function(n){"use strict";var t=n.module("haPassengerCountModule",[]);t.directive("haPassengerCount",[function(){return{restrict:"A",require:"ngModel",scope:{otherDropdownCount:"="},link:function(n,t,i,r){var u=function(t){var u=typeof n.otherDropdownCount=="undefined"?0:parseInt(n.otherDropdownCount,10),i=parseInt(t,10)+u,f=i>0&&i<8;return r.$setValidity("haPassengerCount",f),t};r.$parsers.unshift(u);r.$formatters.push(u);n.$watch("otherDropdownCount",function(){return u(r.$viewValue)})}}}])}(angular),function(n){"use strict";var t=n.module("haThumbGalleryModule",[]);t.directive("haThumbGallery",["$log","haConfig",function(n,t){return{restrict:"A",scope:{images:"=",fallbackImage:"="},priority:20,templateUrl:t.getTemplateUrl("ha-thumb-gallery-template.html"),controller:["$scope","$rootScope",function(n,t){n.$on("haEmitError",function(i,r){var u,f;i.stopPropagation();u=r.target;u!=null&&u.tagName==="IMG"&&(f=n.images.indexOf(u.src),n.images.splice(f,1),n.updateImage(n.images[0],0),t.$$phase||n.$digest())});n.updateImage=function(t,i){n.displayImage=t;n.currentImageIndex=i};n.gotoNextSlide=function(t){t!=null&&t.preventDefault();var i=n.currentImageIndex+1<n.images.length?n.currentImageIndex+1:0;n.updateImage(n.images[i],i)};n.gotoPreviousSlide=function(t){t!=null&&t.preventDefault();var i=n.currentImageIndex-1>=0?n.currentImageIndex-1:n.images.length-1;n.updateImage(n.images[i],i)};n.updateImage(n.images[0],0)}]}}])}(angular),function(n){"use strict";var t,i;try{t=n.module("haLowFareSearchModule")}catch(r){t=n.module("haLowFareSearchModule",["haPriceApiModule","ngAnimate","ngTouch"])}i=!1;t.directive("haPriceChart",["haPriceApiService","$animate","haConfig",function(n,t,r){var s=.33,h=331,u=25,f=15,c=1e3,e,l="/Book/home?searchDetails=",o=function(r){function v(){r.selectedPrice={date:new Date(r.tripData.departureDate),price:0};r.currentDate=new Date(r.selectedPrice.date);r.currentDate.setDate(r.currentDate.getDate()-parseInt(u/2))}function y(n){for(var t,u,i=0;i<n.length;i++)t=n[i],u=new Date(t.DepartDate),u.getTime()===r.selectedPrice.date.getTime()&&(r.selectedPrice.price=t.Price),r.buffer[u.getTime()]={price:t.Price,originalDate:t.date}}function o(){var h=[],f,n,e,o,i;for(r.minPrice=Number.POSITIVE_INFINITY,r.maxPrice=Number.NEGATIVE_INFINITY,f=0;f<u;f++)n=new Date(r.currentDate),n.setDate(r.currentDate.getDate()+f),e=new Date(n),e.setDate(n.getDate()+parseInt(r.tripData.tripLength)),o={date:n,returnDate:e},r.buffer[n.valueOf()]&&(i=r.buffer[n.valueOf()].price,i&&(r.minPrice=Math.min(r.minPrice,i),r.maxPrice=Math.max(r.maxPrice,i)),o.price=i),h.push(o);r.minPrice=Math.min(r.minPrice,r.selectedPrice.price);r.maxPrice=Math.max(r.maxPrice,r.selectedPrice.price);r.maxPrice+=Math.round(r.maxPrice*s);r.visible=h;w();window.setTimeout(function(){t.enabled(!0)},0)}function w(){for(var n=0;n<r.visible.length;n++)r.visible[n].price&&(r.visible[n].ratio=r.visible[n].price===r.minPrice&&r.visible[n].price===r.maxPrice?1:r.visible[n].price/r.maxPrice);r.selectedPrice.ratio=Math.min(r.selectedPrice.price/r.maxPrice,1)}function b(n){for(var i,t={startDate:undefined,days:undefined},e=!1,o=-f;o<u+f;o++)if(i=new Date(r.currentDate),n<0&&i.setDate(i.getDate()+u),i.setDate(i.getDate()+o*n),r.buffer[i.valueOf()])e&&(e=!1);else if(e)t.days++;else if(t.startDate){t.startDate=new Date(r.currentDate);t.startDate.setDate(r.currentDate.getDate()-f);t.days=u+2*f;break}else t.startDate=i,t.days=1,e=!0;return t}function k(t){var i=b(t);r.moving=!1;i.startDate&&(r.loading=!0,n.fetchPrices(a(i.startDate),t).success(function(n){n.IsSuccess&&(y(n.LowFareTripResponseList),o());r.loading=!1}));r.$apply()}function p(){var i;r.preventLeft=!1;r.preventRight=!1;r.endOfMonthIndex=null;var u=[],n=r.visible[0].date,t={month:n.getMonth(),year:n.getFullYear(),days:1};for(i=1;i<r.visible.length;i++)n=r.visible[i].date,n.getMonth()!==t.month?(u.push(t),r.endOfMonthIndex=i-1,t={month:n.getMonth(),year:n.getFullYear(),days:1}):t.days++,n<=Date.now()&&(r.preventLeft=!0),g(new Date,n)>=h&&(r.preventRight=!0);u.push(t);r.visibleMonths=u}function a(n){var t="";return t+=("0"+(n.getMonth()+1)).slice(-2)+"/",t+=("0"+n.getDate()).slice(-2)+"/",t+n.getFullYear()}function g(n,t){var i=n.getTime(),r=t.getTime(),u=r-i;return Math.round(u/864e5)}r.minPrice=Number.POSITIVE_INFINITY;r.maxPrice=Number.NEGATIVE_INFINITY;v();r.buffer={};r.visibleMonths=[];r.endOfMonthIndex=undefined;r.moving=!1;r.move=function(n){if(!i){r.moving=!0;i=!0;r.currentDate.setDate(r.currentDate.getDate()+n);var t=n/Math.abs(n);window.clearTimeout(e);e=window.setTimeout(function(){k(t)},c);o();p()}};var d=["januarytext","februarytext","marchtext","apriltext","maytext","junetext","julytext","augusttext","septembertext","octobertext","novembertext","decembertext"];r.monthFilter=function(n){return r.sitecoreStrings[d[n]]};r.barClicked=function(n){var t=["o="+r.tripData.origin,"d="+r.tripData.destination,"dd="+a(n.date),"a="+r.tripData.adultCount,"c="+r.tripData.childCount,"rd="+a(n.returnDate),"tt="+r.tripData.tripType];window.location.href=l+t.join(";")};r.$watch("results",function(n){n&&(t.enabled(!1),r.buffer={},v(),y(n),o(),p())})};return o.$inject=["$scope"],{restrict:"A",scope:{tripData:"=",sitecoreStrings:"=",sitecoreStringsLoaded:"=",results:"=",loading:"=",error:"="},controller:o,templateUrl:r.getTemplateUrl("ha-price-chart-base-template.html")}}]);t.animation(".month-animation",function(){return{enter:function(n,t){n.css({opacity:0});n.delay(500).animate({opacity:1},{complete:t})}}});t.animation(".price-item-animation",function(){return{enter:function(n,t){if(n.hasClass("first-item")){var r=n.css("margin-left");return n.css({"margin-left":0}),n.animate({"margin-left":r},{easing:"linear",duration:500,complete:t}),function(){n.css({"margin-left":""});i=!1}}n.animate({"background-color":"transparent"},{duration:500,complete:t})},leave:function(n,t){if(n.animate({"margin-left":0},{easing:"linear",duration:500,complete:t}),n.hasClass("first-item")){var r=n.nextAll(".first-item").first();return r.css({"margin-left":0}),function(){r.css({"margin-left":""});i=!1}}}}})}(angular),function(n){"use strict";var t=n.module("haDatepickerModule",[]);t.directive("haDatepicker2",["$rootScope","haTemplateCache","haConfig","$filter","$locale","$compile",function(n,t,i,r,u,f){return{require:"ngModel",restrict:"A",scope:!0,link:function(t,i,e,o){function y(){c=!1;$(document.body).off("mouseup blur",y)}function l(){if(n.isMobile){i.select();return}document.activeElement!==i[0]&&i.focus().select()}function p(n){return n.valueOf()>=s.range_start&&n.valueOf()<=s.range_end}function w(n){return b(n)?"":r("date")(n,s.display)}function b(n){return!n||!moment.isMoment(n)&&!(n instanceof Date)||isNaN(n)}var a=i.attr("autocomplete","off").attr("ha-datepicker2"),s=t.$eval(a)||{},v,c;s.format=s.format||"MM/DD/YYYY";s.display=s.display||"EEEE, "+u.DATETIME_FORMATS.shortDate;var k=$(i[0].form),d=t.$new(),g='<div ha-calendar="'+a+'" ha-calendar-model="'+e.ngModel+'"><\/div>',nt=f(g)(d),h=$('<div class="datepicker">').click(l).insertAfter(i).append(nt);i[0].name==="_"&&i.attr("name",null);n.isMobile&&i.attr("readonly","readonly");i.on("focus",function(){h.css("top",i.position().top+i.outerHeight()+"px");h.toggle(!0);i.addClass("open");clearTimeout(v);i.val(o.$viewValue||"").select()});i.on("blur",function(){c||(v=setTimeout(function(){h.toggle(!1);i.removeClass("open");o.$valid&&i.val(o.$modelValue?w(o.$modelValue):"")},200))});h.on("mousedown",function(){c=!0;$(document.body).on("mouseup blur",y)});t.$on("prev",l);t.$on("next",l);t.$on("select",function(){s.next!==!1&&setTimeout(function(){if(s.next)return $(s.next).focus();var t=k.find(":input:visible:enabled:not(button.prev,button.next)"),r=t.eq(t.index(i)+1);n.isMobile&&i.blur();r.focus()},10)});o.$parsers.push(function(n){var i,t,r,u;if(n&&typeof n=="string"&&!n.match(/^\d{2}\/\d{2}\/\d{4}$/)){for(i=n.match(/\d+/g),t=0;t<2&&t<i.length;t++)i[t].length===1&&(i[t]="0"+i[t]);n=i.join("/")}return r=n instanceof Date?moment(n):moment(n,s.format,!0),u=!n||r.isValid()&&p(r),o.$setValidity("date",u),u&&n?r.toDate():undefined});o.$formatters.push(function(n){var t=!n||!b(n)&&p(n);return o.$setValidity("date",t),t&&n&&!i.is(":focus")&&setTimeout(function(){i.val(w(n))},50),t&&n?moment(n).format(s.format):""})}}}]);t.directive("haRangeDatepicker",["$parse","haSitecoreStrings",function(n,t){return{restrict:"A",link:{pre:function(i,r,u){function o(n){return $.extend({},f,{range_start:moment(f.range_start),range_end:moment(f.range_end),calendarHeading:n?f.return_cal_title:f.depart_cal_title,isReturn:n})}function s(t){var r=n(t);return{get:r.bind(r,i),set:r.assign.bind(r,i)}}function l(n){var t=e.end.get(),r=e.start.get(),u,f;return t&&r&&i.tripType===2&&n.isBefore(t)&&n.isAfter(r)?"between":(u=r&&n.isSame(r),f=t&&n.isSame(t),u&&f)?void 0:u?"start":f&&i.tripType===2?"end":void 0}var f=$.extend(!0,{calendars:2,viewing:moment().startOf("month"),namespace:"",format:"MM/DD/YYYY",range_start:moment().startOf("day"),range_end:moment().add(331,"days"),depart_cal_title:t("BookingWidget.departdate"),return_cal_title:t("BookingWidget.returndate"),rangeRender:function(n){n.find("td[date]").removeClass("start end between").each(function(){var n=$(this),i=moment(n.attr("date"),"YYYY-MM-DD"),t=l(i);t&&n.addClass(t)})}},i.$eval(u.haRangeDatepicker));i[f.namespace+"_configs"]={start:o(!1),end:o(!0)};var h=r.find(f.start).attr("ha-datepicker2",f.namespace+"_configs.start").attr("ng-model"),c=r.find(f.end).attr("ha-datepicker2",f.namespace+"_configs.end").attr("ng-model"),e={start:s(h),end:s(c)};i.$watch(h,function(n){var t,i;n&&(n=moment(n),t=e.end.get(),t&&n.isAfter(t)&&e.end.set(undefined),i=n.month(),n.year()>f.viewing.year()&&(i+=12),i>f.viewing.month()?f.viewing.year(n.year()).month(n.month()-1):f.viewing.year(n.year()).month(n.month()));f.viewing.add(1,"ms")});i.$watch(c,function(n){if(n){n=moment(n);var t=e.start.get();t&&n.isBefore(t)&&e.start.set(undefined)}f.viewing.add(1,"ms")})}}}}]);t.directive("haDatepicker",["haTemplateCache","haConfig",function(n,t){return n.get(t.getTemplateUrl("ha-calendar2.html")),n.get(t.getTemplateUrl("ha-booking-day-template.html")),n.get(t.getTemplateUrl("ha-datepicker-day-template.html")),{templateUrl:t.getTemplateUrl("ha-datepicker.html"),restrict:"A",scope:{label:"@",eyebrow:"@",placeholder:"@",name:"@",inputModel:"=",monthsBackward:"=",monthsForward:"=",monthsToShow:"=",dayTemplate:"@",errorMessage:"@",pastDisabled:"@",futureDisabled:"@"},link:function(n,t,i){function r(){$("body").off("click.closeCalendar");$("body").on("click.closeCalendar",function(t){var i=$(t.target);!n.calendarOpen||n.calendarOpen&&i.closest("[ha-datepicker]").length||i.closest(".calendarPopupWrap").length>0||i.is(".calendarPopupWrap")||($("body").off("click.closeCalendar"),n.currentDateChoice="",n.calendarOpen=!1,n.$digest())})}n.calendarOpen=!1;n.monthsToShow=n.monthsToShow||1;n.pastDisabled=i.hasOwnProperty("pastDisabled");n.futureDisabled=i.hasOwnProperty("futureDisabled");n.dayTemplate=n.dayTemplate||"ha-datepicker-day-template.html";n.required=!1;i.$observe("required",function(){i.hasOwnProperty("required")&&(n.required=!0)});n.$on("dateInputFocused",function(){n.calendarOpen=!0;r()});n.$on("setDate",function(t,i){n.calendarOpen&&(n.inputModel=i||"",n.$apply())});n.$watch("inputModel",function(){n.calendarOpen=!1});i.$observe("eyebrow",function(t,i){t!==i&&(n.eyebrow=t)});i.$observe("label",function(t,i){t!==i&&(n.label=t)});i.$observe("placeholder",function(t,i){t!==i&&(n.placeholder=t)})}}}]);t.directive("haDatepickerInput",["haTemplateCache","haConfig",function(n,t){return n.get(t.getTemplateUrl("ha-calendar2.html")),n.get(t.getTemplateUrl("ha-booking-day-template.html")),{templateUrl:t.getTemplateUrl("ha-datepicker-input.html"),scope:{inputModel:"=",calendarOpen:"=",currentDateChoice:"=",inputName:"@name",label:"@",eyebrow:"@",placeholder:"@",disabled:"=",ngRequired:"=",errorMessage:"="},link:function(n,t,i){n.onFocus=function(){n.$emit("dateInputFocused",t)};n.isActive=function(){return n.calendarOpen};i.$observe("eyebrow",function(t,i){t!==i&&(n.eyebrow=t)});i.$observe("label",function(t,i){t!==i&&(n.label=t)});i.$observe("placeholder",function(t,i){t!==i&&(n.placeholder=t)})}}}])}(angular),function(n){"use strict";var t=n.module("haTravelGoalModule",[]);t.directive("haTravelGoal",["haHttpService","$filter","$window","haConfig","$document","haCitiesSvc","$log","haSitecoreStrings","$timeout",function(t,i,r,u,f,e,o,s,h){return{templateUrl:u.getTemplateUrl("ha-travel-goal.html"),restrict:"A",scope:{},link:function(f){function a(){h(function(){document.getElementById("travel-goal-plane")&&(document.getElementById("travel-goal-plane").style.display="none");document.getElementById("leftPin")&&(document.getElementById("leftPin").setAttribute("fill","#6F6F6F"),document.getElementById("rightPin").setAttribute("fill","#6F6F6F"),document.getElementById("leftPinMobile").setAttribute("fill","#6F6F6F"),document.getElementById("rightPinMobile").setAttribute("fill","#6F6F6F"),document.getElementById("flight-progress").setAttribute("stroke","none"))})}function v(){h(function(){document.getElementById("travel-goal-plane")&&(document.getElementById("travel-goal-plane").style.display="block");document.getElementById("leftPin")&&(document.getElementById("leftPin").setAttribute("fill","#4D2E91"),document.getElementById("rightPin").setAttribute("fill","#FFC324"),document.getElementById("leftPinMobile").setAttribute("fill","#4D2E91"),document.getElementById("rightPinMobile").setAttribute("fill","#FFC324"),document.getElementById("flight-progress").setAttribute("stroke","#F4846B"))})}function y(t,u){var e=this,c,h,s;for(e.plane=typeof t=="string"?document.getElementById(t):t,e.milesEl=typeof u=="string"?document.getElementById(u):u,n.element("html.ie8").length>0&&(e.IE8=!0),this.setPath=function(){e.path=document.getElementById("flight-path");e.len=e.path.getTotalLength();var n=document.getElementById("svg-contain"),t=document.getElementById("travel-arc"),i=parseFloat(t.getAttribute("width"));e.scaleRatio=n.offsetWidth/i;e.planeTopDist=0;f.$root.isMobile&&(e.planeTopDist=22);o.debug("travel goal scale: "+e.scaleRatio)},e.resetProgressPath=function(){e.pp=document.getElementById("flight-progress");e.ppLength=e.pp.getTotalLength();e.pp.style.strokeDasharray=e.ppLength+" "+e.ppLength;e.pp.style.strokeDashoffset=-e.ppLength;f.$root.isMobile&&(e.pp.setAttribute("stroke-width",40),document.getElementById("flight-path-bkgd").setAttribute("stroke-width",40))},this.resetMilesCount=function(){e.milesStartVal=f.model.MilesRequired;e.milesEndVal=f.milesRemaining},this.start=function(n,t){e.stop();e.startTime=null;e.reverse=n>t;var r=.02;if(t===0&&(t=r),n===t)if(t>r)n=r;else return!1;t>0&&e.IE&&(e.pp.style.opacity=1);e.startPercent=n||0;e.endPercent=t||1;e.milesReq=f.model.MilesRequired;e.milesEl.innerHTML=i("number")(e.milesStartVal);e.milesEndVal=f.milesRemaining;e.duration=Math.abs(t-n)/.1*500;e.duration<500&&(e.duration=500);e.duration>5e3&&(e.duration=5e3);e.rAF=requestAnimationFrame(e.step)},this.stop=function(){e.rAF&&cancelAnimationFrame(e.rAF)},this.reset=function(){e.stop();e.startTime=null;e.resetMilesCount();e.IE8||(e.setPath(),e.resetProgressPath())},e.reset(),this.easeOutQuart=function(n,t,i,r){return-i*((n=n/r-1)*n*n*n-1)*1024/1023+t},this.step=function(n){var r,t,c,u,l,a,v,y;if(e.startTime===null&&(e.startTime=n),e.timestamp=n,r=n-e.startTime,e.remaining=e.duration-r,t=r/e.duration,e.reverse?(c=e.easeOutQuart(r,0,e.startPercent-e.endPercent,e.duration),t=e.startPercent-c,t<e.endPercent&&(t=e.endPercent)):(t=e.easeOutQuart(r,e.startPercent,e.endPercent,e.duration),t>e.endPercent&&(t=e.endPercent)),r<e.duration){if(u=Math.round(e.milesReq-t*e.milesReq),e.reverse?u>e.milesEndVal&&(u=e.milesEndVal):u<e.milesEndVal&&(u=e.milesEndVal),l=i("number")(u),e.milesEl.innerHTML=l,!e.IE8){e.pp.style.strokeDashoffset=(t-1)*e.ppLength;var h=e.len*t,s=[e.path.getPointAtLength(h-1),e.path.getPointAtLength(h+1)],f=Math.atan2(s[1].y-s[0].y,s[1].x-s[0].x)*180/Math.PI,o=e.path.getPointAtLength(h);f>-25&&f<25&&f!==0&&(a=o.x*e.scaleRatio,v=o.y*e.scaleRatio+e.planeTopDist,o.x!==e.lastPointX&&(e.IE&&(o.y+=1),y="top:"+v+"px;left:"+a+"px;transform:rotate("+f+"deg);-ms-transform:rotate("+f+"deg);-webkit-transform:rotate("+f+"deg); display:block",e.plane.style.cssText=y,e.lastPointX=o.x))}e.rAF=requestAnimationFrame(e.step)}else e.milesEl.innerHTML=i("number")(e.milesEndVal),e.milesStartVal=e.milesEndVal,cancelAnimationFrame(e.rAF)},c=0,h=["webkit","moz","ms","o"],s=0;s<h.length&&!r.requestAnimationFrame;++s)r.requestAnimationFrame=r[h[s]+"RequestAnimationFrame"],r.cancelAnimationFrame=r[h[s]+"CancelAnimationFrame"]||r[h[s]+"CancelRequestAnimationFrame"];r.requestAnimationFrame||(r.requestAnimationFrame=function(n){var t=(new Date).getTime(),i=Math.max(0,16-(t-c)),u=r.setTimeout(function(){n(t+i)},i);return c=t+i,u});r.cancelAnimationFrame||(r.cancelAnimationFrame=function(n){clearTimeout(n)})}var p="/myaccount/travelgoals/SaveTravelGoal",c,l;f.noModelError=!1;f.currencyCode="USD";f.error="";f.getImgUrl=u.getImgUrl;f.indexes={tripTypeIndex:0,last_tripTypeIndex:0,cabinTypeIndex:0,last_cabinTypeIndex:0,paxCountIndex:0,last_paxCountIndex:0};s.get("TRAVEL_GOAL_DATA").then(function(n){f.strings=n});f.determinePaxLabel=function(n){n=Number(n);var t=n===1?f.strings.personText:f.strings.personsText;return n+" "+t};f.animatePlane=function(){if(f.model.isTravelGoalEnabled)var n=setInterval(function(){f.flight&&(clearInterval(n),f.flight.start(f.startPercent,f.percentComplete))},50)};f.processTripInfo=function(){var t,i;if(f.model&&f.model.TripInformation){for(f.startPercent=f.percentComplete==null?0:f.percentComplete,f.milesRemaining=Number(f.model.MilesRequired)-Number(f.model.MilesAvailable),f.goalMet=!1,f.model.isTravelGoalEnabled&&f.milesRemaining<=0&&f.model.MilesAvailable>0?(f.goalMet=!0,f.percentComplete=1):(f.percentComplete=(f.model.MilesRequired-f.milesRemaining)/f.model.MilesRequired,f.percentComplete<0&&(f.percentComplete=0)),f.model.isTravelGoalEnabled?v():a(),e.getCityByCode(f.model.TripInformation.OriginCode).then(function(n){f.model.originCity=n}),e.getCityByCode(f.model.TripInformation.DestinationCode).then(function(n){f.model.destinationCity=n}),t=0;t<f.model.TripTypeDropdown.length;t++)f.model.TripTypeDropdown[t].Value===f.model.TripInformation.SelectedTripType&&(f.indexes.tripTypeIndex=t,f.indexes.last_tripTypeIndex=t);for(t=0;t<f.model.CabinTypeDropdown.length;t++)f.model.CabinTypeDropdown[t].Value===f.model.TripInformation.SelectedCabinType&&(f.indexes.cabinTypeIndex=t,f.indexes.last_cabinTypeIndex=t);for(t=0;t<f.model.PaxCountDropdown.length;t++)f.model.PaxCountDropdown[t].Value===f.model.TripInformation.SelectedPaxCount&&(f.indexes.paxCountIndex=t,f.indexes.last_paxCountIndex=t);f.flight?f.animatePlane():n.element("html.ie8").length>0?(f.flight=new y("travel-goal-plane","miles-remaining"),f.flight.reset(),f.animatePlane()):i=setInterval(function(){document.getElementById("svg-contain")&&document.getElementById("svg-contain").offsetWidth>0&&(clearInterval(i),f.flight=new y("travel-goal-plane","miles-remaining"))},50);f.tripInfoProcessed=!0}};t.GET("/myaccount/travelgoals/GetDefaultGoal").then(function(n){n.data.IsSuccess?(f.noModelError=!1,f.model=n.data,f.processTripInfo()):(f.noModelError=!0,f.error=n.data.TranslateServiceError)});f.saveTravelGoal=function(n){if($("#travel-goal input").blur(),!f.invalidRoute){n||(f.working=!0);f.model.DisplayBannerMessage=!1;var i={isTravelGoalEnabled:String(f.model.isTravelGoalEnabled),OriginCode:f.model.originCity.Code,DestinationCode:f.model.destinationCity.Code,SelectedTripType:f.model.TripTypeDropdown[f.indexes.tripTypeIndex].Value,SelectedCabinType:f.model.CabinTypeDropdown[f.indexes.cabinTypeIndex].Value,SelectedPaxCount:f.model.PaxCountDropdown[f.indexes.paxCountIndex].Value,DisplayBannerMessage:"false"};f.model.TripInformation.DestinationCityName="";f.tripInfoProcessed=!1;t.POST(p,i).success(function(n){f.working=!1;n.IsSuccess?(f.model.MilesRequired=n.SaveTravelGoalResponse.MilesRequired,f.model.MilesAvailable=n.SaveTravelGoalResponse.MilesAvailable,f.model.TripInformation=n.SaveTravelGoalResponse.TripInformation,f.model.IsPurchaseMilesRedirect=n.SaveTravelGoalResponse.IsPurchaseMilesRedirect,f.model.RedirectionCaptionForButton=n.SaveTravelGoalResponse.RedirectionCaptionForButton,f.model.DisplayImageButton=n.SaveTravelGoalResponse.DisplayImageButton,f.processTripInfo()):(o.error("error saving travel goal"),o.debug(n),f.error=n.TranslateServiceError)}).error(function(n,t){f.working=!1;o.error("error saving travel goal: "+t)})}};f.chooseOption=function(){(+f.indexes.tripTypeIndex!=+f.indexes.last_tripTypeIndex||+f.indexes.cabinTypeIndex!=+f.indexes.last_cabinTypeIndex||+f.indexes.paxCountIndex!=+f.indexes.last_paxCountIndex)&&(f.$broadcast("$closeCustomDropdown"),f.$broadcast("$modalCancel"),f.indexes.last_tripTypeIndex=f.indexes.tripTypeIndex,f.indexes.last_cabinTypeIndex=f.indexes.cabinTypeIndex,f.indexes.last_paxCountIndex=f.indexes.paxCountIndex,o.debug("save goal for new option chosen"),f.saveTravelGoal())};f.checkForInvalidRoute=function(){f.invalidRoute=!1;f.model&&f.model.destinationCity&&f.model.originCity&&f.model.destinationCity.Code===f.model.originCity.Code&&(f.invalidRoute=!0,f.flight.reset())};f.$watch(function(n){if(n.model)return n.model.originCity},function(n){!c&&n&&n.Code?c=n.Code:n!=null&&n.Code&&n.Code!==c&&(c=n.Code,f.checkForInvalidRoute(),f.saveTravelGoal())});f.$watch(function(n){if(n.model)return n.model.destinationCity},function(n){!l&&n&&n.Code?l=n:n!=null&&n.Code&&n.Code!==l&&(l=n.Code,f.invalidRoute=!1,f.checkForInvalidRoute(),f.saveTravelGoal())});f.$watch("invalidRoute",function(n){n?a():v()});f.$watch(function(n){if(n.model)return n.model.isTravelGoalEnabled},function(n){f.travelGoalEnabledInitialized?typeof n=="boolean"&&(f.flight&&f.flight.reset(),f.percentComplete=0,f.saveTravelGoal(!0),n?v():a()):f.model!=null&&(f.travelGoalEnabledInitialized=!0)});f.$on("haAlertClosed",function(n,t){t==="migrationAlert"&&(f.model.DisplayBannerMessage=!1,f.saveTravelGoal(!0))});f.$on("elementFirstScrolledIntoView",function(n,t){t==="travel-goal"&&f.animatePlane()});f.openTripTypeModal=function(){haModal({id:"travelGoal-tripTypeModal",backdrop:"true",templateUrl:"/travelGoalTripTypeModal.html",scope:f})};f.openCabinTypeModal=function(){haModal({id:"travelGoal-cabinTypeModal",backdrop:"true",templateUrl:"/travelGoalCabinTypeModal.html",scope:f})};f.openPaxCountModal=function(){haModal({id:"travelGoal-paxCountModal",backdrop:"true",templateUrl:"/travelGoalPaxCountModal.html",scope:f})}}}}]);t.filter("isHACity",function(){return function(n){return n!=null&&n.IsHACity===!0}})}(angular),function(n){"use strict";var t=n.module("haNeatFormsModule",[]);t.directive("haNeatForms",["haUtils","haDateUtils","$window","haCitiesSvc","$filter","localShortDateFilter","$timeout","haConfig","haSitecoreStrings","$log",function(n,t,i,r,u,f,e,o,s,h){return{templateUrl:o.getTemplateUrl("ha-neat-forms-template.html"),restrict:"A",scope:{formType:"@",onMauve:"@"},link:function(t,i,f){function o(n){if(!t.strings.departdate)return"";var i=t.strings.departdate,r=t.strings.returndate;return t.model.packageType.indexOf("A")<0&&f.formType==="hotels"&&(i=t.strings.checkintext,r=t.strings.checkouttext),n!=="returnDate"?i:r}function v(){var i=0,r=!1,n;if(f.formType==="hotels")r=!0;else{for(n=0;n<t.model.rooms.length;n++)i+=t.model.rooms[n].adultCount,i+=t.model.rooms[n].child.length;i>=1&&i<=6&&(r=!0)}return r}function y(){for(var i,u=0,r=0,f=!1,n=0;n<t.model.rooms.length;n++)for(r+=t.model.rooms[n].adultCount,i=0;i<t.model.rooms[n].child.length;i++)t.model.rooms[n].child[i].age>=12?r+=1:t.model.rooms[n].child[i].seat==="Lap"&&(u+=1);return u<=r&&(f=!0),f}function a(n){var i=n.substr(0,10),t=i.split("-");return new Date(t[0],t[1]-1,t[2])}var e,c,l;t.language=$language;t.Error="";t.passengerOptions=[1,2,3,4,5,6];t.childPassengerOptions=[0,1,2,3,4,5,6];t.childPassengerAge=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17];t.roomOptions=[];t.packageTimes=[{name:s("BookingWidget.anytime"),val:"Anytime"},{name:s("BookingWidget.morning"),val:"Morning"},{name:s("BookingWidget.noon"),val:"Noon"},{name:s("BookingWidget.evening"),val:"Evening"},{name:"12:00 am",val:"TwelveAm"},{name:"1:00 am",val:"OneAm"},{name:"2:00 am",val:"TwoAm"},{name:"3:00 am",val:"ThreeAm"},{name:"4:00 am",val:"FourAm"},{name:"5:00 am",val:"FiveAm"},{name:"6:00 am",val:"SixAm"},{name:"7:00 am",val:"SevenAm"},{name:"8:00 am",val:"EightAm"},{name:"9:00 am",val:"NineAm"},{name:"10:00 am",val:"TenAm"},{name:"11:00 am",val:"ElevenAm"},{name:"12 Noon",val:"Noon"},{name:"1:00 pm",val:"OnePm"},{name:"2:00 pm",val:"TwoPm"},{name:"3:00 pm",val:"ThreePm"},{name:"4:00 pm",val:"FourPm"},{name:"5:00 pm",val:"FivePm"},{name:"6:00 pm",val:"SixPm"},{name:"7:00 pm",val:"SevenPm"},{name:"8:00 pm",val:"EightPm"},{name:"9:00 pm",val:"NinePm"},{name:"10:00 pm",val:"TenPm"},{name:"11:00 pm",val:"ElevenPm"}];t.getMediaImage=n.getImageFromSiteCoreString;t.language==="en"&&(t.packageTimes=t.packageTimes.map(function(n){if(n.val==="Anytime")n.val=362;else if(n.val==="Morning")n.val=361;else if(n.val==="Noon")n.val=721;else if(n.val==="Evening")n.val=1081;else{var t=2;n.name.indexOf(":")===1&&(t=1);n.val=n.name.substr(0,t)+n.name.substr(-2).toUpperCase()}return n}));t.tripType=2;t.legs=[];t.strings={};s.get("BookingWidget").then(function(n){var i,r;if(t.strings=n,f.formType==="hotels"){for(t.maxRooms=8,t.model.neatformbuttontext=t.strings.bookhotelbuttontext,t.model.dynamicDestinationText=t.strings.destinationtext,t.model.dynamicDepartText=t.strings.checkintext,t.model.dynamicReturnText=t.strings.checkouttext,t.model.thirdPartyPartnerImage=t.onMauve==="true"?t.strings.bghotelsthirdpartypartnerimage:t.strings.nobghotelsthirdpartypartnerimage,i=0;i<t.maxRooms;i++)t.roomOptions[i]=i+1;t.model.enableHelpLink=!0;t.strings.vacationrentalshelpurl||(t.model.enableHelpLink=!1)}else if(f.formType==="packages")for(t.maxRooms=3,t.model.neatformbuttontext=t.strings.continuebuttontext,t.model.dynamicDestinationText=t.strings.to,t.model.dynamicDepartText=t.strings.departtext,t.model.dynamicReturnText=t.strings.returntext,t.model.thirdPartyPartnerImage=t.onMauve==="true"?t.strings.bgpackagesthirdpartypartnerimage:t.strings.nobgpackagesthirdpartypartnerimage,r=0;r<t.maxRooms;r++)t.roomOptions[r]=r+1});t.model={adultCount:1,childCount:0,roomCount:1,rooms:[{adultCount:1,childrenCount:0,child:[]}],departDate:"",returnDate:"",originCity:"",destinationCity:"",packageType:"",airClass:"EconomyClass",fromTime:t.packageTimes[0],toTime:t.packageTimes[0],formType:t.formType,onMauve:t.onMauve,neatforms_datepicker_config:{start:"[name=_FromDate]",end:"[name=_ToDate]",depart_cal_title:o("departDate"),return_cal_title:o("returnDate"),namespace:"neatforms",onRender:function(n){n.addClass("double-wide")}}};t.$on("airportChanged",function(){t.model.packageType.indexOf("A")>=0&&t.model.originCity&&t.model.originCity.Code&&t.model.destinationCity&&t.model.destinationCity.Code&&(t.legs[0]={origin:{Code:t.model.originCity.Code},destination:{Code:t.model.destinationCity.Code}},t.$broadcast("airport changed"))});t.$watch("model.rooms",function(){t.Error!==""&&(t.Error="")},!0);f.formType==="hotels"?t.model.packageType="H":f.formType==="packages"&&(t.model.packageType="AH",t.$watch(function(n){if(n.model)return n.model.packageType},function(n){n&&n.indexOf("A")<0?(t.model.dynamicDestinationText=t.strings.destinationtext,t.model.dynamicDepartText=t.strings.checkintext,t.model.dynamicReturnText=t.strings.checkouttext):(t.model.dynamicDestinationText=t.strings.to,t.model.dynamicDepartText=t.strings.departtext,t.model.dynamicReturnText=t.strings.returntext)}));e=n.getFlightQueryModelCookie();e&&(t.model.adultCount=e.AdultCount||1,t.model.childCount=e.ChildCount||0,e.FlightSearchSegmentList[0]&&(c=e.FlightSearchSegmentList[0].OriginCityCode,l=e.FlightSearchSegmentList[0].DestinationCityCode,r.getCityByCode(c).then(function(n){t.model.originCity=n}),r.getCityByCode(l).then(function(n){t.model.destinationCity=n}),t.model.departDate=a(e.FlightSearchSegmentList[0].DepartureDate)),e.FlightSearchSegmentList[1]&&(t.model.returnDate=a(e.FlightSearchSegmentList[1].DepartureDate)));t.updateChildren=function(n,i){var r,u,f;if(i>t.model.rooms[n].child.length)for(r=i-t.model.rooms[n].child.length,u=0;u<r;u++)t.model.rooms[n].child.push({});else if(r=t.model.rooms[n].child.length-i,r!==0)for(f=0;f<r;f++)t.model.rooms[n].child.pop()};t.updateRooms=function(n){var i,r,u;if(n>t.model.rooms.length)for(i=n-t.model.rooms.length,r=0;r<i;r++)t.model.rooms.push({adultCount:1,childrenCount:0,child:[]});else if(i=t.model.rooms.length-n,i!==0)for(u=0;u<i;u++)t.model.rooms.pop()};t.clearRooms=function(){t.model.roomCount=1;t.model.rooms=[{adultCount:t.model.rooms[0].adultCount,childrenCount:t.model.rooms[0].childrenCount,child:t.model.rooms[0].child}]};t.formatString=function(t,i){return n.formatDynamicString(t,i)};t.setForm=function(n){t.form=n};t.bizClassAvailable=function(){return typeof t.model.destinationCity=="object"&&+t.model.destinationCity.Market==3?!0:typeof t.model.originCity=="object"&&+t.model.originCity.Market==3?!0:!1};t.submitForm=function(n){t.Error="";t.language==="cn"||t.language==="kr"?t.submitNeatForm(n):t.submitExpediaForm(n)};t.hotelAndCarContentCheck=function(){return s("BookingWidget.hotelandcartext")==null||s("BookingWidget.hotelandcartext")===""||s("BookingWidget.hotelandcartext")==="[BookingWidget.hotelandcartext]"?!1:!0};t.enableVacationTab=!1;s("BookingWidget.enablevacationrentals")==="1"&&(t.enableVacationTab=!0);t.submitNeatForm=function(i){var a,c,l,e,w,o;i.preventDefault();t.neatFormSubmitAttempt=!0;c=t.model.destinationCity;typeof t.model.destinationCity=="object"&&(c=t.model.destinationCity.LongDescription,a=t.model.destinationCity.Code);typeof t.model.originCity=="object"&&(l=t.model.originCity.Code);var v=u("localShortDate")(t.model.departDate,"en"),y=u("localShortDate")(t.model.returnDate,"en"),r={DD:t.model.packageType!=="H"?s("BookingWidget.neatgroupddparam")||"HAWAIIANAIR":s("BookingWidget.hotelneatgroupddparam")||"HAWAIIANAIR",combinationType:t.model.packageType,adultsNum:t.model.adultCount,doSearch:"T"},p=Number(t.model.childCount);if(p>0)for(e=0;e<p;e++)w="minorAge"+(e+1),r[w]=6;f.formType==="hotels"?(r.toLocation=t.isJP()?t.model.destinationCity.SearchTags.split(",").slice(0,2).join(","):c,r.hotelFromDate=v,r.hotelToDate=y,r["WT.mc_id"]=n.webtrends.token("HotelWidget")):(r.toLocation=a,r.fromLocation=l,r.fromDate=v,r.toDate=y,r.fromTime=t.model.fromTime.val,r.toTime=t.model.toTime.val,r["WT.mc_id"]=n.webtrends.token("PackageWidget"));t.model.packageType.indexOf("H")>=0&&(r.roomsNum=t.model.roomCount);t.model.packageType.indexOf("A")>=0&&(r.airClass=t.model.airClass,r.fromLocation=l);f.formType==="packages"&&($language==="en-au"||$language==="en-nz")&&(r.referrerId="Intl");t.form.$valid?(f.formType==="packages"?(r.DD=s("BookingWidget.neatgroupddparam")||"HAWAIIANAIR",o=s("BookingWidget.searchpackagesurl")+n.createQueryString(r)):o=s("BookingWidget.bookhotelurl")+n.createQueryString(r),h.debug(o),location.href=o):t.Error=s("BookingWidget.pleasecorrecttheerrorsbelow")};t.submitExpediaForm=function(i){var r,c,p,e,ut,o,l,a,w;f.formType==="hotels"&&t.model.packageType==="HC"&&(f.formType="packages");i.preventDefault();t.neatFormSubmitAttempt=!0;var b=v(),k=y(),u={},d=!t.model.departDate?undefined:t.model.departDate.YYYY_MM_DD(),g=!t.model.returnDate?undefined:t.model.returnDate.YYYY_MM_DD(),nt=!t.model.destinationCity?undefined:t.model.destinationCity.Code,ft=!t.model.originCity?undefined:t.model.originCity.Code;f.formType==="hotels"?u.cityName=nt||!!t.model.destinationCity&&!!t.model.destinationCity.DisplayName?t.model.destinationCity.DisplayName:"":(u.FromAirport=ft,u.Destination=nt,u.ToTime=t.model.toTime.val,u.FromTime=t.model.fromTime.val);t.model.packageType.indexOf("H")>=0&&(u.NumRoom=t.model.roomCount);t.model.packageType.indexOf("A")>=0&&(u.cabinClass=t.model.airClass.substr(0,1).toLowerCase());var tt=0,it=0,rt=!1;for(r=0;r<t.model.rooms.length;r++)for(tt+=t.model.rooms[r].child.length,it+=t.model.rooms[r].adultCount,f.formType==="hotels"?c="NumAdult"+(r+1):t.model.packageType==="AC"?(c="NumAdult",p="NumChild"):(c="NumAdult-Room"+(r+1),p="NumChild-room"+(r+1)),u[c]=t.model.rooms[r].adultCount,f.formType==="packages"&&(u[p]=t.model.rooms[r].child.length),e=0;e<t.model.rooms[r].child.length;e++)ut=f.formType==="hotels"?"Rm"+(r+1)+"Child"+(e+1)+"Age":t.model.packageType==="AC"?"Child"+(e+1)+"Age":"Room"+(r+1)+"-Child"+(e+1)+"Age",t.model.rooms[r].child[e].seat==="Seat"&&(rt=!0),u[ut]=rt&&t.model.rooms[r].child[e].age<2&&t.model.rooms[r].child[e].seat==="Seat"?2:t.model.rooms[r].child[e].age;f.formType==="packages"&&(u.NumAdult=it,u.NumChild=tt);switch(t.model.packageType){case"AH":o="FlightHotel";break;case"AHC":o="FlightHotelCar";break;case"AC":o="FlightCar";break;case"HC":o="HotelCar";break;case"VR":o="VacationRental";break;default:o="FlightHotel"}u.mdpcid=f.formType==="hotels"?n.webtrends.tokenV2("HTLWIDGET.HOTEL"):f.formType==="packages"?typeof campaignid_0030!="undefined"?campaignid_0030:n.webtrends.tokenV2("PKGWIDGET.PACKAGE"):n.webtrends.tokenV2("FLTWIDGET.PACKAGE");t.form.$valid&&b&&k?(w=n.createQueryString(u),f.formType==="packages"?(a=s("BookingWidget.searchpackagesurl"),l=a+o+"/"+d+"/"+g+w):(a=s("BookingWidget.bookhotelurl"),l=a+d+"/"+g+w),h.debug(l),location.href=l):(t.Error=s("BookingWidget.pleasecorrecttheerrorsbelow"),b||(t.Error=s("BookingWidget.InvalidPackagePassengerCount")),k||(t.Error=s("BookingWidget.LapChildErrorText")))}}}}])}(angular),function(n){"use strict";var t=n.module("haCartrawlerFormsModule",[]);t.directive("haCartrawlerForms",["haUtils","haDateUtils","$window","haCitiesSvc","$timeout","haConfig","haSitecoreStrings","$log","haFeatureFlags","haEncryptionService","$q",function(n,t,i,r,u,f,e,o,s,h,c){return{templateUrl:f.getTemplateUrl("ha-cartrawler-forms-template.html"),restrict:"A",scope:{onMauve:"@"},link:function(t,i){function g(){var n,i=t.scContent.searchshuttlesurl,h=window.location.href.toLowerCase(),r,u,f,e,s;r=h.match(/book/i)?t.scContent.cartrawlerclientidbookpage:t.scContent.cartrawlerclientidhomepage;n={clientID:r,residenceID:t.scContent.cartrawlerresidencyidparam,curr:t.scContent.cartrawlercurrencycodeparam,adults:t.model.shuttlePassengers,oneway:Boolean(t.tripType===1),pickupName:t.model.pickUpLocation.DisplayName};u=moment(t.model.departDate).format("YYYY-MM-DD");f="T"+d(t.model.pickUpHour,t.model.pickUpMinute);n.pickupDateTime=u+f;t.model.pickUpLocation.Code?(n.countryID=t.model.pickUpLocation.CountryCode,n.pickupIATACode=t.model.pickUpLocation.Code):t.model.pickUpLocation.geocode&&(n.countryID=t.model.pickUpLocation.countryCode||"US",n.pkLat=t.model.pickUpLocation.geocode.lat,n.pkLng=t.model.pickUpLocation.geocode.long);t.model.dropOffLocation&&t.model.dropOffLocation.DisplayName&&(n.returnName=t.model.dropOffLocation.DisplayName,t.model.dropOffLocation.Code?n.returnIATACode=t.model.dropOffLocation.Code:t.model.dropOffLocation.geocode&&(n.rtLat=t.model.dropOffLocation.geocode.lat,n.rtLng=t.model.dropOffLocation.geocode.long),t.tripType===2&&(e=moment(t.model.returnDate).format("YYYY-MM-DD"),s="T"+d(t.model.returnHour,t.model.returnMinute),n.returnDateTime=e+s));i=o(i,n);window.location.href=i}function nt(){var i,n=t.scContent.searchcarrentalsurl,s="AmazonCarRentalKey",a=t.model.destinationCity.Code,w=t.model.carDropoff?t.model.carDropoff.Code:a,l=t.model.pickupTime,r,y,p;if(+l==24&&(l=10),r=t.model.dropoffTime,+r==24&&(r=11),y=tt(),i={ops:"spec",srch:"car",eapid:"11428-30001",GOTO:"CARSEARCH",lang:t.scContent.cartrawlerlanguageparam,rfrr:"-34980",age:"30",pickupIATACode:a,returnIATACode:w,pickupYear:t.model.departDate instanceof Date?t.model.departDate.getFullYear():"",pickupMonth:t.model.departDate instanceof Date?t.model.departDate.getMonth():"",pickupDate:t.model.departDate instanceof Date?t.model.departDate.getDate():"",pickupHour:l,pickupMinute:"00",returnYear:t.model.returnDate instanceof Date?t.model.returnDate.getFullYear():"",returnMonth:t.model.returnDate instanceof Date?t.model.returnDate.getMonth():"",returnDate:t.model.returnDate instanceof Date?t.model.returnDate.getDate():"",returnHour:r,returnMinute:"00",currency:t.scContent.cartrawlercurrencycodeparam||"USD",residencyId:t.scContent.cartrawlerresidencyidparam||"US",c:t.scContent.cartrawlerlanguageparam,clientID:y},t.model.carPricing.toLowerCase()==="dollars"&&t.model.carDiscount&&t.model.carDiscount.selected&&t.model.discountCode){var u=t.model.discountCode.avisWizard,f=t.model.discountCode.budgetFastbreak,e=t.model.discountCode.paylessPerks;if(t.encryptionEnabled){var k=u&&u!==""?h.EncryptString(u,s):v(),d=f&&f!==""?h.EncryptString(f,s):v(),g=e&&e!==""?h.EncryptString(e,s):v(),nt=[k,d,g];c.allSettled(nt).then(function(t){var r=b(t[0].value,t[1].value,t[2].value);n=o(n,i,r);window.location.href=n})}else p=b(u,f,e),n=o(n,i,p),window.location.href=n}else n=o(n,i),window.location.href=n}function tt(){var i=window.location.href.toLowerCase(),n=t.model.carPricing&&t.model.carPricing.toLowerCase()==="dollars",r=i.match(/book/i);return r?n?t.scContent.cartrawlercarsclientidbookpage:t.scContent.cartrawlercarsclientidmilesbook:n?t.scContent.cartrawlercarsclientidhomepage:t.scContent.cartrawlercarsclientidmileshome}function v(){return new Promise(function(n){n("")})}function b(n,i,r){return{AV:{CORPORATE_RATE:t.model.discountCode.awd,MEMBERSHIP_NUMBER:n,PROMOTIONAL_CODE:t.model.discountCode.avisCoupon},BG:{CORPORATE_RATE:t.model.discountCode.bcd,MEMBERSHIP_NUMBER:i,PROMOTIONAL_CODE:t.model.discountCode.budgetCoupon},ZA:{CORPORATE_RATE:t.model.discountCode.pdn,MEMBERSHIP_NUMBER:r,PROMOTIONAL_CODE:t.model.discountCode.paylessCoupon}}}function o(t,i,r){var u=n.splitUrl(t);return u.params.length>0?t=u.url+n.createQueryString(i,r,u.params):t+=n.createQueryString(i,r),t}function k(n){var i=n.substr(0,10),t=i.split("-");return new Date(t[0],t[1]-1,t[2])}function d(n,t){var i=parseInt(n);return n.indexOf("pm")>-1&&i!==12&&(i+=12),i===12&&n.indexOf("am")>-1&&(i=0),n="0"+i,n.slice(-2)+":"+t+":00"}var y,l="https://maps.googleapis.com/maps/api/js?",f,a,u,p,w;for(l+="libraries=places&key=",l+=s.get("GoogleMapApiKey"),n.injectScriptDependency(i,l),t.scContent={},t.scDiscountContent={},t.scBookingContent={},t.Error="",t.showTabGroup=!1,t.model={transportType:"car",departDate:"",returnDate:"",originCity:"",destinationCity:"",onMauve:t.onMauve,transp_datepicker_config:{start:"[name=_TranspFromDate]",end:"[name=_TranspToDate]",depart_cal_title:"",return_cal_title:"",namespace:"cartrawler",onRender:function(n){t.tripType===2?n.addClass("double-wide"):n.removeClass("double-wide")}},dropOffLocation:"",shuttlePassengers:1,pickupTime:"24",dropoffTime:"24",carPricing:"dollars"},t.tripType=2,t.legs=[],t.shuttlePassengers=[],f=1;f<=7;f++)t.shuttlePassengers.push(f);t.encryptionEnabled=!1;e.get("CarTrawler").then(function(n){t.scContent=n;t.carPickUpTimes=t.scContent.cartimes.slice();t.carDropOffTimes=t.scContent.cartimes.slice();t.showTabGroup=t.scContent.enablervs||t.scContent.enableshuttles;t.model.thirdPartyPartnerImage=t.onMauve==="true"?t.scContent.bgcarsthirdpartypartnerimage:t.scContent.nobgcarsthirdpartypartnerimage;t.scContent.enableencryptionforvendorloyalty==="1"&&(t.encryptionEnabled=!0)});e.get("BookingWidget").then(function(n){t.scBookingContent=n;y=n.pleasecorrecttheerrorsbelow});t.showDiscountBanners=!1;e.get("CarRentalDiscountCode").then(function(n){t.scDiscountContent=n;var i=t.scDiscountContent.discountbanners;i&&(t.discountBanners=i.slice(),t.discountBanners&&t.discountBanners.length>0&&(t.showDiscountBanners=!0))});t.$emit("cartrawlerFormsLoaded");t.setCarPricing=function(n){t.model.carPricing=n;t.$broadcast("car pricing changed",t.model.carPricing)};t.setTripType=function(n){t.tripType=n;t.$broadcast("trip type changed",t.tripType)};t.$watch("model.transportType",function(n){n&&(n==="shuttle"?(t.setTripType(1),t.model.thirdPartyPartnerImage=t.onMauve==="true"?t.scContent.bgshuttlesthirdpartypartnerimage:t.scContent.nobgshuttlesthirdpartypartnerimage):(t.setTripType(2),t.model.thirdPartyPartnerImage=n==="rv"?t.onMauve==="true"?t.scContent.bgrvsthirdpartypartnerimage:t.scContent.nobgrvsthirdpartypartnerimage:t.onMauve==="true"?t.scContent.bgcarsthirdpartypartnerimage:t.scContent.nobgcarsthirdpartypartnerimage))});t.$on("airportOrAddressInputChanged",function(n,i){if(t.model.transportType==="shuttle"){var r=!0;(i.model.Code&&i.model.Code==="MKK"||i.model.Code==="LNY"||i.model.Code==="ITO")&&(r=!1);i.model.isAddress&&i.model.DisplayName.match(/\sLanai\,\s|Lanai\sCity\,|Molokai\,?\s|\sHoolehua\,\s|Ho\'olehua\,?\s|Kaunakakai\,?\s|\sHilo\,?\s/g)&&(r=!1);t.form[i.name].$setValidity("location",r);t.Error=r?"":t.scContent.shuttleservicenotavailabletext}});t.submitButtonText=function(){if(t.scContent&&t.scContent.searchcarrentalstext)switch(t.model.transportType){case"shuttle":return t.scContent.searchshuttlestext;default:return t.scContent.searchcarrentalstext}else return""};t.updateDropOffTimes=function(){if(t.scContent.cartimes&&t.model.departDate&&t.model.returnDate)if(t.model.departDate.getTime()===t.model.returnDate.getTime()){var n=+t.model.pickupTime;n!==24?(t.carDropOffTimes=t.scContent.cartimes.slice(n+1),+t.model.dropoffTime<=n&&(t.model.dropoffTime=String(n+1))):t.carDropOffTimes=t.scContent.cartimes.slice()}else t.carDropOffTimes=t.scContent.cartimes.slice()};t.$watch(function(n){if(n.model)return n.model.departDate},t.updateDropOffTimes);t.$watch(function(n){if(n.model)return n.model.returnDate},t.updateDropOffTimes);t.$watch(function(n){if(n.model)return n.model.pickupTime},t.updateDropOffTimes);a=function(){return t.model.departDate&&t.model.returnDate&&t.model.departDate.getTime()===t.model.returnDate.getTime()&&t.model.pickUpHour&&t.model.returnHour&&(parseInt(t.model.pickUpHour)>parseInt(t.model.returnHour)||t.model.pickUpHour===t.model.returnHour&&t.model.pickUpMinute&&t.model.returnMinute&&parseInt(t.model.pickUpMinute)>=parseInt(t.model.returnMinute))?!1:!0};t.$watchGroup(["model.pickUpHour","model.pickUpMinute","model.departDate"],function(){a()||(t.model.returnHour=t.model.returnMinute=undefined)});t.$watchGroup(["model.returnHour","model.returnMinute","model.returnDate"],function(){a()||(t.model.pickUpHour=t.model.pickUpMinute=undefined)});t.$watch("model.pickUpLocation",function(n){n&&t.model.dropOffLocation&&(n.placeId&&n.placeId===t.model.dropOffLocation.placeId?t.model.dropOffLocation=undefined:n.Name&&n.Name===t.model.dropOffLocation.Name&&(t.model.dropOffLocation=undefined))});t.$watch("model.dropOffLocation",function(n){n&&t.model.pickUpLocation&&(n.placeId&&n.placeId===t.model.pickUpLocation.placeId?t.model.pickUpLocation=undefined:n.Name&&n.Name===t.model.pickUpLocation.Name&&(t.model.pickUpLocation=undefined))});u=n.getFlightQueryModelCookie();u&&(u.FlightSearchSegmentList[0]&&(p=u.FlightSearchSegmentList[0].OriginCityCode,w=u.FlightSearchSegmentList[0].DestinationCityCode,r.getCityByCode(p).then(function(n){t.model.originCity=n}),r.getCityByCode(w).then(function(n){t.model.destinationCity=n}),t.model.departDate=k(u.FlightSearchSegmentList[0].DepartureDate)),u.FlightSearchSegmentList[1]&&(t.model.returnDate=k(u.FlightSearchSegmentList[1].DepartureDate)));t.setForm=function(n){t.form=n};t.submitCarForm=function(n){if(n.preventDefault(),!t.form.$valid){t.Error=y;return}t.Error="";t.model.transportType==="shuttle"?g():t.model.transportType==="car"&&nt()}}}}])}(angular),function(n){"use strict";var t=n.module("haPersonalMessageModule",[]);t.directive("haPersonalMessage",[function(){return{restrict:"A",link:function(n,t,i){var r,u;n.label=i.label;n.charsLeftText=i.charsLeftText||"characters remaining";n.textarea=t.find("textarea");r=n.textarea.attr("ng-maxlength");n.charactersRemaining=r+" "+n.charsLeftText;n.countCharacters=function(){n.charsExceeded=!1;var i=n.textarea.val(),t=r-i.length;t<0&&(n.charsExceeded=!0);n.charactersRemaining=t+" "+n.charsLeftText};u=setInterval(function(){n.textarea.outerWidth()>0&&(clearInterval(u),n.countCharacters(),n.$digest())},50);n.$on("$clearPersonalMessage",function(){n.textarea.val("");n.countCharacters()})}}}])}(angular),function(n){"use strict";var t=n.module("haAncillaryUpsellsModule",[]);t.directive("haAncillaryUpsells",["haConfig","haUtils","haAncillaryUpsellsService",function(t,i,r){return{restrict:"A",scope:{upsellsModel:"=",specialOffersText:"=",itineraryUrl:"@",confirmationViewmodel:"=",tripType:"="},templateUrl:t.getTemplateUrl("ha-ancillary-upsells-template.html"),link:function(t){function i(){var n="";return typeof ItineraryDetailsJson!="undefined"&&(n=ItineraryDetailsJson.ItineraryMarketType===1?"preferred":"extracomfort"),typeof modelJson!="undefined"&&(n=modelJson.marketType===1?"preferred":"extracomfort"),n}function u(n){return n+(n==="seatupgrade"?"-"+i().toLowerCase():"")+"-upsell"}t.upsellsModel.sort(function(n,t){return n.SortOrder-t.SortOrder});t.UVM=t.upsellsModel;t.tripType=t.tripType?parseInt(t.tripType):undefined;t.UVM!=null&&n.forEach(t.UVM,function(n){n.LinkURL=r.getLinkURL(n,t.tripType,t.confirmationViewmodel,t.itineraryUrl);n.DtmClassName=u(n.AncillaryType.toLowerCase());switch(n.AncillaryTypeEnum){case 0:document.body.dispatchEvent(new CustomEvent("RentalCarOffered"));break;case 2:document.body.dispatchEvent(new CustomEvent("HotelsOffered"));break;case 4:document.body.dispatchEvent(new CustomEvent("TripInsuranceOffered"));break;case 5:document.body.dispatchEvent(new CustomEvent("LeiGreetingOffered"));break;case 10:document.body.dispatchEvent(new CustomEvent("ShuttleServiceOffered"));break;case 11:var f=i();document.body.dispatchEvent(new CustomEvent("UpgradeSeatOffered",{detail:{seatType:f}}))}})}}}])}(angular),function(n){"use strict";var t=n.module("haAncillaryUpsellsMytripsModule",[]);t.directive("haAncillaryUpsellsMytrips",["haConfig","haAncillaryUpsellsService",function(t,i){return{restrict:"A",scope:{upsellsModel:"=",ancillaryLoc:"=",specialOffersText:"@",itineraryUrl:"@",tripType:"=",viewModel:"="},template:'<ng-include src="getTemplateUrl()" />',link:function(r){function u(){var n="";return typeof ItineraryDetailsJson!="undefined"&&(n=ItineraryDetailsJson.ItineraryMarketType===1?"PREFERREDSEAT":"EXTRACOMFORT"),n}function f(n){return n+(n==="seatupgrade"?"-"+u().toLowerCase():"")+"-upsell"}r.getTemplateUrl=function(){return r.ancillaryLoc==="right"?t.getTemplateUrl("ha-ancillary-upsells-mytrips-right-template.html"):t.getTemplateUrl("ha-ancillary-upsells-mytrips-template.html")};r.UVM=r.upsellsModel;r.tripType=r.tripType?parseInt(r.tripType):undefined;r.UVM!==null&&(n.forEach(r.UVM,function(n){n.LinkURL=i.getLinkURL(n,r.tripType,r.viewModel,r.itineraryUrl);n.DtmClassName=f(n.AncillaryType.toLowerCase());switch(n.AncillaryTypeEnum){case 0:document.body.dispatchEvent(new CustomEvent("RentalCarOffered"));break;case 2:document.body.dispatchEvent(new CustomEvent("HotelsOffered"));break;case 4:document.body.dispatchEvent(new CustomEvent("TripInsuranceOffered"));break;case 5:document.body.dispatchEvent(new CustomEvent("LeiGreetingOffered"));break;case 10:document.body.dispatchEvent(new CustomEvent("ShuttleServiceOffered"));break;case 11:var t=u();document.body.dispatchEvent(new CustomEvent("UpgradeSeatOffered",{detail:t}))}}),r.UVM.sort(function(n,t){return n.SortOrder-t.SortOrder}))}}}])}(angular),function(n){"use strict";var t=n.module("haPurchasedAncillariesModule",[]);t.directive("haPurchasedAncillaries",["haConfig",function(n){return{restrict:"A",scope:{model:"="},templateUrl:n.getTemplateUrl("ha-purchased-ancillaries-template.html"),link:function(n){n.PVM=n.model}}}])}(angular),function(n){"use strict";var t=n.module("haNitpDashboardModule",[]);t.directive("haNitpDashboard",["haHttpService","$document","$timeout","haConfig","$window","haUtils","haSitecoreStrings",function(t,i,r,u,f,e,o){return{templateUrl:u.getTemplateUrl("ha-nitp-dashboard.html"),restrict:"A",scope:{},link:function(i){function r(t,i,r){function k(n){return!isNaN(parseFloat(n))&&isFinite(n)}function d(n,t,i){return k(t)&&n>t?t:k(i)&&n<i?i:n}function tt(n,t){var i=-1.57,r=4.7131,u=s+Math.cos(i)*n,f=h+Math.sin(i)*n,e=s+Math.cos(i)*t,o=h+Math.sin(i)*t,c=s+Math.cos(r)*n,l=h+Math.sin(r)*n,a=s+Math.cos(r)*t,v=h+Math.sin(r)*t,y=["M",u,f,"A",n,n,0,1,1,c,l,"Z","M",a,v,"A",t,t,0,1,0,e,o,"Z"];return y.join(" ")}function it(n){var t,e,c,r,l;if(u.availableIndex>=0&&(u.tripsAvailable.innerHTML=Math.round(i[u.availableIndex].value*n)),u.usedIndex>=0&&(u.tripsUsed.innerHTML=Math.round(i[u.usedIndex].value*n)),t=-a/2,e=n,u.IE8)c=i[u.availableIndex].value/u.segmentTotal*n*100,u.usedBar.style.left=c+"%";else{if(w.setAttribute("opacity",n),i.length===1&&4.7122<e*i[0].value/u.segmentTotal*a*2+t){o[0].setAttribute("d",tt(u.doughnutRadius,u.cutoutRadius));return}for(r=0,l=i.length;r<l;r++){var v=e*i[r].value/u.segmentTotal*a*2,f=t+v,y=(f-t)%(a*2)>a?1:0,p=s+Math.cos(t)*u.doughnutRadius,b=h+Math.sin(t)*u.doughnutRadius,k=s+Math.cos(t)*u.cutoutRadius,d=h+Math.sin(t)*u.cutoutRadius,g=s+Math.cos(f)*u.doughnutRadius,nt=h+Math.sin(f)*u.doughnutRadius,it=s+Math.cos(f)*u.cutoutRadius,rt=h+Math.sin(f)*u.cutoutRadius,ut=["M",p,b,"A",u.doughnutRadius,u.doughnutRadius,0,y,1,g,nt,"L",it,rt,"A",u.cutoutRadius,u.cutoutRadius,0,y,0,k,d,"Z"];o[r].setAttribute("d",ut.join(" "));t+=v}}}function g(){var n=d(u.easingFunction(u.cnt),null,0);it(n);u.cnt+=u.animFrameAmount;u.cnt<=1?requestAnimationFrame(function(){g(u.cnt)}):c.callback()}var u=this,y=240,p=240,s=y/2,h=p/2,a=Math.PI,c={segmentShowStroke:!1,segmentStrokeColor:"#0C1013",segmentStrokeWidth:0,edgeOffset:5,percentageInnerCutout:50,animationSteps:120,animationEasing:"easeInOutExpo",callback:function(){}},nt={linear:function(n){return n},easeInOutExpo:function(n){var t=n<.5?8*n*n*n*n:1-8*--n*n*n*n;return t>1?1:t}},w,o,e,b,v,l;if(u.IE8=!1,n.element("html.ie8").length>0&&(u.IE8=!0),u.tripsAvailable=document.getElementById("tripsAvailable"+r),u.tripsUsed=document.getElementById("tripsUsed"+r),u.usedBar=document.getElementById("usedBar"+r),u.easingFunction=nt[c.animationEasing],u.segmentTotal=0,u.usedIndex=i.map(function(n){return n.title}).indexOf("Used"),u.availableIndex=i.map(function(n){return n.title}).indexOf("Available"),u.IE8)for(e=0;e<i.length;e++)u.segmentTotal+=i[e].value;else for(u.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),u.svg.setAttribute("width",y),u.svg.setAttribute("height",p),u.svg.setAttribute("viewBox","0 0 "+y+" "+p),t.appendChild(u.svg),u.doughnutRadius=Math.min(p/2,y/2)-c.edgeOffset,u.cutoutRadius=u.doughnutRadius*(c.percentageInnerCutout/100),w=document.createElementNS("http://www.w3.org/2000/svg","g"),u.svg.appendChild(w),o=[],e=0;e<i.length;e++)u.segmentTotal+=i[e].value,o[e]=document.createElementNS("http://www.w3.org/2000/svg","path"),o[e].setAttribute("stroke-width",c.segmentStrokeWidth),o[e].setAttribute("stroke",c.segmentStrokeColor),o[e].setAttribute("fill",i[e].color),o[e].setAttribute("data-order",e),w.appendChild(o[e]);for(this.start=function(){u.animFrameAmount=1/d(c.animationSteps,Number.MAX_VALUE,1);u.cnt=0;g(u.cnt)},this.remove=function(){u.IE8||t.removeChild(u.svg)},b=0,v=["webkit","moz","ms","o"],l=0;l<v.length&&!f.requestAnimationFrame;++l)f.requestAnimationFrame=f[v[l]+"RequestAnimationFrame"],f.cancelAnimationFrame=f[v[l]+"CancelAnimationFrame"]||f[v[l]+"CancelRequestAnimationFrame"];f.requestAnimationFrame||(f.requestAnimationFrame=function(n){var t=(new Date).getTime(),i=Math.max(0,16-(t-b)),r=f.setTimeout(function(){n(t+i)},i);return b=t+i,r});f.cancelAnimationFrame||(f.cancelAnimationFrame=function(n){clearTimeout(n)})}i.nitpDataEndpoint="/program/nitppurchase/GetDashboardDetails";i.noModelError=!1;i.error="";i.chart=[];o.get("NITP_DASHBOARD_PANEL").then(function(n){i.strings=n});i.animateChart=function(n){var t=setInterval(function(){i.chart[n]&&(clearInterval(t),i.chart[n].start())},50)};i.initChart=function(n){var t,u;i.model.DisplayNITPDashboard&&(t=[],i.model.plans[n].FlightsUsed>0?(t[0]={title:"Used",value:i.model.plans[n].FlightsUsed,color:"#4d2e91"},i.model.plans[n].FlightsAvailable>0&&(t[1]={title:"Available",value:i.model.plans[n].FlightsAvailable,color:"#B83292"})):t[0]={title:"Available",value:i.model.plans[n].FlightsAvailable,color:"#B83292"},u=document.getElementById("chartContain"+n),i.chart[n]=new r(u,t,n),i.model.plans[n].chartReady=!0,e.safeApply(i))};i.processModel=function(){n.forEach(i.model.plans,function(n){n.chartReady=!1});setTimeout(function(){n.forEach(i.model.plans,function(n,t){i.initChart(t)})},500)};t.GET(i.nitpDataEndpoint).then(function(n){n.data.IsSuccess?(i.noModelError=!1,n.data&&n.data.DashboardVM&&n.data.DashboardVM.length>0?(i.model={plans:n.data.DashboardVM,DisplayNITPDashboard:n.data.DashboardVM[0].DisplayNITPDashboard},i.processModel()):i.model.DisplayNITPDashboard=!1):(i.noModelError=!0,i.error="We're sorry, there was an error retrieving data.")});i.$on("elementFirstScrolledIntoView",function(n,t){var u=t.match(/nitp-dashboard/),r,f;u&&u.length>0&&(r=t.match(/\d/),r.length===1&&(f=Number(r[0]),i.animateChart(f)))})}}}])}(angular),function(n){"use strict";var t=n.module("haPremierClubDashboardModule",[]);t.directive("haPremierClubDashboard",["haHttpService","haConfig","$window","haSitecoreStrings",function(n,t,i,r){return{templateUrl:t.getTemplateUrl("ha-premier-club-dashboard.html"),restrict:"A",scope:{},link:function(t){t.noModelError=!1;t.error="";r.get("PREMIER_CLUB_DASHBOARD_PANEL").then(function(n){t.strings=n});t.dateStringToDate=function(n){var t=n.match(/[\d]+/);return t=Number(t[0]),new Date(t)};n.GET("/myaccount/mydashboard/GetPremierClubPanel").then(function(n){n.data.IsSuccess?(t.noModelError=!1,t.model=n.data,t.model.ExpiryDate=t.dateStringToDate(n.data.ExpiryDate)):(t.noModelError=!0,t.error="We're sorry, there was an error retrieving data.")})}}}])}(angular),function(n){"use strict";var t=n.module("haFoodlandRegistrationModule",[]);t.directive("haFoodlandRegistration",["haHttpService","haConfig","haSitecoreStrings","$log",function(n,t,i,r){return{templateUrl:t.getTemplateUrl("ha-foodland-registration.html"),restrict:"A",link:function(t){function f(n){var i=String(n),t,r;if(i.length===0)return!0;if(i.length===12){var u=i.split(""),f=u.slice(0,11),e=0,o=0,s=Number(u[11]);for(t=0;t<f.length;t++)r=Number(f[t]),t%2?o+=r:e+=r;var h=e*3,c=h+o,l=(10-c%10)%10;return l===s}return!1}var u="/Program/FoodLand/MakaiRegistration";t.error="";t.foodlandVM={};t.state="register";i.get("FoodlandMakaiRegistration").then(function(n){t.strings=n});t.setForm=function(n){t.form=n};t.checkMaikaiNumberValidity=function(){t.form.maikaiNumber.$setValidity("pattern",f(t.foodlandVM.MaikaiAccountNumber))};t.submitForm=function(i,f){i.preventDefault();f.$valid&&(t.submitting=!0,n.POST(u,t.foodlandVM).success(function(n){t.submitting=!1;n.IsRegistrationSuccess?(f.$setPristine(),t.state="complete"):t.error=n.ErrorMessage}).error(function(n,i){t.submitting=!1;r.debug("submit error: "+i)}))};t.resetForm=function(){t.foodlandVM={};t.state="register";t.submitting=!1;t.error=""}}}}])}(angular),function(n){"use strict";var t=n.module("haUpcomingTripsDashboardModule",[]);t.directive("haUpcomingTripsDashboard",["haGlobals","haHttpService","haConfig","haModal","$rootScope","$window","$log","haSitecoreStrings","$timeout",function(t,i,r,u,f,e,o,s,h){return{templateUrl:r.getTemplateUrl("ha-upcoming-trips-dashboard.html"),restrict:"A",scope:{},link:function(e){function c(n,t){var i=Math.abs(n.getTime()-t.getTime());return i/864e5}function l(n,t){window.localStorage&&window.localStorage.setItem(n,t)}function a(n){var t;return window.localStorage&&(t=window.localStorage[n]),t?t:null}function v(){f.isMobile||s.get("UPCOMING_TRIPS_NATIVE_APP_BANNER").then(function(n){e.nativeAppBannerCookie="upcomingTripsNativeAppBannerDismissed";e.nativeAppBannerHeader=n.header;e.nativeAppBannerLinkText=n.linktext;e.nativeAppBannerCookieDays=n.cookiedays;e.nativeAppBannerEnabled=!!n.enable})}e.dataEndpoint="/myaccount/mydashboard/GetUpcomingTrips"+(/Windows /i.test(window.navigator.userAgent)?"?"+Math.floor(Math.random()*9999)+1:"");e.isReloading=!1;e.noModelError=!1;e.error="";e.hasUpcomingTrips=!1;e.model={sortUpcomingByOptions:[],sortUpcomingByIndex:0,tripCountByImminence:[]};var o=f.$language.toLowerCase();t("enableOnlineUpgrade",function(n){e.enableOnlineUpgrade=n&&o==="en"});e.lastNameFirst=/^ja|ko|zh|zh$/.test(o);e.strings={};s.get("UPCOMING_TRIPS").then(function(n){e.strings=n;e.model.sortUpcomingByOptions[0]=e.strings.alldatestext});s.get("UPGRADE_MODAL").then(function(n){n.starthoursbeforedeparture!==undefined&&n.endhoursbeforedeparture!==undefined&&(e.upgradeStart=Number(n.starthoursbeforedeparture),e.upgradeEnd=Number(n.endhoursbeforedeparture))});e.getViewModel=function(){i.GET(e.dataEndpoint).then(function(t){var s,f,o,i;if(t.data.IsSuccess){if(e.noModelError=!1,e.VM=t.data,e.VM.ShowUpComingTripsFilterDropDown)for(i=0;i<e.VM.ShowUpComingTripsFilterDropDown.length;i++)e.model.sortUpcomingByOptions.push(e.VM.ShowUpComingTripsFilterDropDown[i].Name);if(h(function(){$("#sortUpcomingByOptions").width($("#sortUpcomingByOptions").width())}),e.VM.UpComingTripsList.length&&(e.hasUpcomingTrips=!0,v()),e.VM.AllTripsMaxRecordsPerPage===0&&(e.VM.AllTripsMaxRecordsPerPage=3),e.VM.UpComingTripsList.length>0){for(e.VM.UpcomingTripsCount=e.VM.UpComingTripsList.length,s=new Date,i=0;i<e.VM.UpComingTripsList.length;i++){var l=moment(e.VM.UpComingTripsList[i].DepartureDateTime).toDate(),u=c(l,s),r=0;u<=1?(r=1,e.model.tripCountByImminence[1]+=1):u<=3?(r=2,e.model.tripCountByImminence[2]+=1):u<=7?(r=3,e.model.tripCountByImminence[3]+=1):u<=30?(r=4,e.model.tripCountByImminence[4]+=1):u<=365&&(r=5,e.model.tripCountByImminence[5]+=1);e.VM.UpComingTripsList[i].threshold=r}for(n.forEach(e.VM.UpComingTripsList,function(n){var t=n.PAXList.filter(function(n){return n.IsLoggedinPassenger})[0];t===undefined&&(n.IsOnlineUpgradeEligible=!1)}),f=Number(a("sortUpcomingByIndex"))||0,o=0,i=e.model.tripCountByImminence.length;i>=0;i--)i>0&&e.model.tripCountByImminence[i]>0&&!e.VM.IsIndividual&&(o=i);e.model.sortUpcomingByIndex=e.model.tripCountByImminence[f]>0?f:o}}e.isReloading=!1})};n.element(document).ready(function(){e.getViewModel()});e.tripsByImminence=function(n){return+e.model.sortUpcomingByIndex==0||n.threshold<=e.model.sortUpcomingByIndex};e.dismissDropdown=function(){e.$broadcast("$closeCustomDropdown")};e.chooseTripFilter=function(n){e.model.sortUpcomingByIndex=n;l("sortUpcomingByIndex",n);e.dismissDropdown()};e.openUpgradeModal=function(n){n.allLegs=Array.prototype.concat.apply([],n.Segments.map(function(n){return n.Flights}));u(r.getTemplateUrl("ha-upgrade-modal.html"),{id:"upgrade-modal",backdrop:"true",scope:e,extendScope:{trip:n,parent_view:"dashboard"},cancel:{label:"Close",fn:function(){e.resetModalData()}}})};e.resetModalData=function(){n.forEach(e.VM.UpComingTripsList,function(t){n.forEach(t.allLegs,function(n){n.selected=!1;n.platinum_pax=!1;n.optional_pax=""})})};e.$on("OnlineUpgradeRqSuccess",function(){e.hasUpcomingTrips=!1;e.isReloading=!0;e.getViewModel()})}}}])}(angular),function(n){"use strict";var t=n.module("haShareItineraryModule",[]);t.directive("haShareItinerary",["haConfig","haHttpService","haSitecoreStrings","haModal","$rootScope","$log",function(n,t,i,r,u,f){return{restrict:"A",scope:{tripVM:"=trip",isExpertBooking:"="},link:function(e,o){function h(){e.$broadcast("$closeCustomDropdown")}function c(){h();e.shareTripVM={PNR:e.tripVM.ReservationCode,EncryptedReservationCode:e.tripVM.EncryptedReservationCode||"",EncryptedLastName:e.tripVM.EncryptedLastName,ReadOnlyItineraryDetailsURL:e.tripVM.ReadOnlyItineraryDetailsURL};r(n.getTemplateUrl("ha-share-itinerary-modal.html"),{id:s,backdrop:"true",scope:e})}function l(n){var i,t;if(n&&n.length){for(i=n.split(","),t=0;t<i.length;t++)if(!i[t].trim().match(u.$regex.email))return!1;return!0}return!1}var s="share-itinerary";e.shareVM={ShareItinerarySuccess:!1,ShareItineraryError:!1};e.strings={};i.get("UPCOMING_TRIPS").then(function(n){e.strings=n});o.on("click",c);e.shareItinerary=function(n){e.isExpertBooking&&n.preventDefault();e.shareTripVM.PersonalMessage=e.shareVM.ShareItineraryMessage;e.shareTripVM.RecipientEmailIDs=e.shareVM.ShareItineraryRecipients;e.shareTripVM.SendersName=e.shareVM.ShareItinerarySendersName;e.shareTripVM.PNR||(e.shareTripVM.PNR=e.tripVM.pnr);e.shareTripVM.ReadOnlyItineraryDetailsURL||(e.shareTripVM.ReadOnlyItineraryDetailsURL=e.tripVM.readonlyitinerarydetailsurl);e.sharing=!0;t.POST("/myaccount/mytrips/ShareItineraryDetails",e.shareTripVM).success(function(){e.sharing=!1;e.shareVM.ShareItinerarySuccess=!0;e.shareVM.ShareItineraryError=!1;e.shareVM.ShareItineraryRecipients="";e.shareVM.ShareItineraryMessage="";e.shareVM.ShareItinerarySendersName="";e.$broadcast("$clearPersonalMessage");e.form.recipientEmails.$touched=!1;e.form.$setPristine();e.form.$submitted=!1;$("form[name="+e.form.$name+"]").removeClass("submitted");e.isExpertBooking&&e.$modalClose()}).error(function(n,t){f.error("Share Itinerary error: "+t);e.sharing=!1;e.shareVM.ShareItinerarySuccess=!1;e.shareVM.ShareItineraryError=!0})};e.$on("haModalClosed",function(n,t){t===s&&(e.sharing=!1,e.shareVM.ShareItinerarySuccess=!1,e.shareVM.ShareItineraryError=!1)});e.setForm=function(n){e.form=n};e.checkMultipleEmailValidity=function(){e.form.recipientEmails.$setValidity("pattern",l(e.shareVM.ShareItineraryRecipients))}}}}])}(angular),function(n){"use strict";var t=n.module("haPaymentTypeMasterPassModule",[]);t.directive("haPaymentTypeMasterpass",["haConfig","$log","haPaymentAPI","haPaymentTypesService","haUtils","$timeout",function(n,t,i,r,u,f){var o=function(n,t,i){n.isSandboxEnv=i.sandboxEnviornment;n.purchaseType=i.purchaseType},e=function(t){var s;t.working=!1;t.state="loading";t.haPaymentTypesSvc=r;t.getImg=n.getImgUrl;var h=jsonCCTypes,c=jsonMemberAddress.CountryStateDropDown,e=!1,o=function(n,t,i){for(var r=0;r<n.length;r++)if(n[r][i]===t)return n[r].Name;return t},u=function(){t.working=!1;t.state="error";t.errorMessage={header:"An Error Occured with Logging In",description:"Please do something"}},l=function(){var n=setInterval(function(){typeof MasterPass!="undefined"&&(e=!0,t.state="login",t.$apply(),clearInterval(n))},300);f(function(){e||(u("MasterPass Global Variable Not Available"),clearInterval(n))},1e4)};e||l();t.fetchToken=function(){t.working=!0;i.fetchMasterPassToken(t.purchaseType).success(function(n){t.working=!1;n.IsSuccess?MasterPass.client.checkout({requestToken:n.RequestToken,merchantCheckoutId:n.MerchantId,allowedCardTypes:n.AllowedCardTypes,suppressShippingAddressEnable:!0,loyaltyEnabled:!1,requestBasicCheckout:!1,version:"v6",successCallback:s,failureCallback:u}):u("There was a server error with the haPaymentAPI.fetchMasterPassToken response")},function(n){u(n);t.working=!1})};s=function(n){t.state="loading";i.fetchMasterPassPaymentInfo(n).success(function(n){n.IsSuccess?(t.cardName=o(h,n.CCInfo.CardType,"Value"),t.countryName=o(c,n.AddressInfo.Country,"Iso2Code"),n.CCInfo.CardNumber=n.CCInfo.CardNumber.replace(/\d(?=\d{4})/g,"*"),t.paymentData=n,t.state="paymentDetails"):(u("There was a server error with the haPaymentAPI.fetchMasterPassPaymentInfo response"),t.working=!1)},function(n){u(n);t.working=!1})};t.changeMpPaymentType=function(){t.state="login";t.fetchToken();t.working=!0};t.startOver=function(){t.state="login"}};return e.$inject=["$scope"],{restrict:"A",templateUrl:n.getTemplateUrl("ha-payment-type-masterpass-base-template.html"),scope:{},controller:e,link:o}}])}(angular),function(n){"use strict";var t=n.module("haProgressBreadcrumbModule",[]);t.directive("haProgressBreadcrumb",["haConfig",function(n){var t=function(n){n.breadcrumbs=n.breadcrumbData};return{restrict:"A",scope:{breadcrumbData:"="},link:t,replace:!0,templateUrl:n.getTemplateUrl("ha-progress-breadcrumb.html")}}])}(angular),function(n){"use strict";var t=n.module("haStickyMessageBarModule",[]);t.directive("haStickyMessageBar",["haConfig","$log","$window","$timeout","haVerticalSeatmapService","$rootScope",function(t,i,r,u,f,e){return{restrict:"A",templateUrl:t.getTemplateUrl("ha-sticky-message-bar-template.html"),scope:!0,link:function(t,o){function p(){var n=window.pageYOffset||document.documentElement.scrollTop;n>=d?c||(c=!0,h.css({position:"fixed","z-index":9,top:y})):c&&(h.css({position:"relative",top:0}),c=!1)}function v(){w("hideBar",300);w("showBar",300)}function w(n,t,i){for(var u=!0,r=0,f=s.length;r<f;r++)if(s[r].name===n){u=!1;break}u&&s.push({name:n,duration:t,callback:i});l||b()}function b(){if(!s[0]){l=!1;return}l||(l=!0);g[s[0].name]();u(function(){s[0].callback&&s[0].callback();s.shift();b()},s[0].duration)}var h;t.svc=f;h=o.children(".containerFullBleed");t.$on("legResolvedAtIndex",function(n,r){r===t.svc.activeLegIndex&&(i.debug("received legResolvedAtIndex"),v())});t.$on("seatSelectionLegChanged",function(){i.debug("recieved seatSelectionLegChanged");t.svc.legs[t.svc.activeLegIndex]&&t.svc.legs[t.svc.activeLegIndex].resolved&&v()});t.$watch("svc.selectedPassengerIndex",function(n){n!==undefined&&t.svc.legs[t.svc.activeLegIndex]&&t.svc.legs[t.svc.activeLegIndex].resolved&&v()});var c=!1,nt=e.isMobile?120:70,k=o.offset().top,y=$("[ha-book-sticky-progress-bar]").length?$("[ha-book-sticky-progress-bar]").outerHeight():0,d=y>0?y:k;p();n.element(r).bind("scroll",p);var s=[],l=!1,a=!1,g={hideBar:function(){a&&(h.removeClass("animate-show-bar").addClass("animate-hide-bar"),t.showSeatCreditTooltip=!1,u(function(){a=!1},300))},showBar:function(){if(!a){var n=t.svc.passengers[t.svc.selectedPassengerIndex],i=n.Seats[t.svc.activeLegIndex],r=t.svc.legs[t.svc.activeLegIndex].SelectedFareClass;t.ready||(t.ready=!0,e.$broadcast("haStickyResize"));t.selectingPassenger=n;t.currency=e.$currency;r!=="first"&&i.originalSeat&&i.originalSeat.credit>0&&(h.removeClass("animate-hide-bar waiting-in-the-wings").addClass("animate-show-bar"),u(function(){a=!0},300))}}};t.svc.legs[t.svc.activeLegIndex]&&t.svc.legs[t.svc.activeLegIndex].resolved&&v()}}}])}(angular),function(n){"use strict";var t=n.module("haPrimaryNavAccountMenuModule",[]);t.directive("haPrimaryNavAccountMenu",["haHttpService","$compile","$timeout","haGlobals","$q","$rootScope",function(n,t,i,r,u,f){var e=function(e,o){var s,h;if(window.returnUrlQs!==undefined&&!f.isMobile){var c=$(".nav-primary-right-list"),l=$('a[href^="/my-account/login"]',c),a=$('a[href^="/my-account/join-hawaiianmiles"]',c);l.prop("href",l.prop("href")+window.returnUrlQs);a.prop("href",a.prop("href")+window.returnUrlQs);return}s="/Header/GetMyAccountMenu/";h=u.defer();window.onunload=function(){h.resolve()};r("areaName",function(n){n&&(s+="?area="+n)});n.GET(s,{timeout:h.promise}).success(function(n){o.replaceWith(t(n)(e));i(function(){r(["registrationUrl"],function(n){e.$root.registrationUrl=n})},0)}).error(function(){console.error("haPrimaryNavAccountMenu ajax call to /Header/GetMyAccountMenu/ failed")})};return{restrict:"A",scope:!0,link:e}}])}(angular),function(n){"use strict";var t=n.module("haPrimaryNavAlertsModule",[]);t.directive("haPrimaryNavAlerts",["haHttpService","$compile","$location",function(n,t,i){var r=function(r,u){var f=i.absUrl(),e=f.indexOf("?")>-1?f.split("?")[1]:"",o="/Header/GetAlerts/";e!==""&&(o+="?"+e);n.GET(o).success(function(n){u.replaceWith(t(n)(r))}).error(function(){console.error("haPrimaryNavAlerts ajax call to /Header/GetAlerts/ failed")})};return{restrict:"A",scope:!0,link:r}}])}(angular),function(){"use strict";function n(n,r,u,f,e,o,s,h,c,l){i(n,r,u,f,e,o,s,h,c,l);t(s,l)}function t(n,t){n.get("Accessibility").then(function(n){var f=n.externallinkregex,e=n.subdomainexcludes,o=n.cssselector,s=n.externallinkmessage,r,u,i;try{r=new RegExp(f,"i");u=new RegExp(e,"i")}catch(h){t.error("invalid regex from sitecore for accessibility");return}(i=$(o),i.length)&&i.each(function(){var t=$(this),n=t.prop("href");n&&(!r.test(n)||u.test(n))&&t.append($('<span class="sr-only">{0}<\/span>'.format(s)))})})}function i(n,t,i,r,u,f,e,o,s,h){function it(){n.userTimeLeft>l?(n.myAccountAccess=window.location.href.search("dashboard"),n.userTimeLeft-=1e3):n.userTimeLeft===l?(n.showSessionTimeoutWarningModal(),n.userTimeLeft-=1e3):n.userTimeLeft<=l&&n.userTimeLeft>0?n.userTimeLeft-=1e3:n.stopSessionCounter();n.$digest()}function rt(n){window.location.href="/Book/Error?ErrorCode="+n}function w(){return o.restartUserSessionTime().then(function(t){t&&t.status===200&&t.data&&!isNaN(+t.data)?n.userTimeLeft=+t.data*6e4:rt("SessionExtendFailed")}).catch(function(n){h.error("ExtendSession API call Failed: ",n)})}var b=t.$switch("Global:EnableSessionTimeout"),k=t.$switch("Global:EnableSessionTimeoutBookingPath"),d=t.$switch("Global:EnableSessionTimeoutMyAccount"),a=/^\/book/i.test(location.pathname),v=/^\/my-account/i.test(location.pathname);if(b&&(!a||k)&&(!v||d)&&!/^\/$/.test(location.pathname)&&(!a||!/\/flights|\/home|\/hotels|\/car-rentals|\/vacation-packages|\/confirmation|\/expertbooking/i.test(location.pathname))&&(!v||!/\/login|\/hawaiianmiles|\/join-hawaiianmiles/i.test(location.pathname))){var c,y=!0,l,g="/book/shared/startover?redirect=myacount",nt="/book/shared/startover?redirect=home",tt="/Book/Home/Index",p="/my-account";n.userTimeLeft=0;n.myAccountAccess="";n.userTimeLeft=12e5;(a||v)&&e.get("SessionExpiration").then(function(n){l=parseInt(n.sessionseconds,10)*1e3;c=r(it,1e3,1e5,!1)});n.showSessionTimeoutWarningModal=function(){f(i.getTemplateUrl("ha-session-timeout-warning.html"),{id:"session-timeout-modal",backdrop:"true",modalLock:!0,scope:n,extendScope:{userTimeLeft:n.userTimeLeft},size:"modal-md"})};n.stopSessionCounter=function(){angular.isDefined(c)&&(r.cancel(c),c=undefined,y=!1)};n.resumeSession=function(){return w().then(function(){angular.isDefined(n.$modalCancel)&&n.$modalCancel()})};n.$on("$destroy",function(){n.stopSessionCounter()});t.$on("$locationChangeStart",function(t,i,r){/\#/.test(r)&&(n.myAccountAccess=window.location.href.search("dashboard"),y&&w())});n.accountPageRedirect=function(){n.isLoggedIn=!0;window.location.href=p};n.resetSession=function(){window.location.href=window.location.pathname===p?g:nt};n.restartBooking=function(){window.location.href=tt}}}angular.module("haBodyExtensionModule",[]).directive("body",function(){return{restrict:"E",scope:!0,controller:n}});n.$inject=["$scope","$rootScope","haConfig","$interval","$q","haModal","haSitecoreStrings","haSessionTimeoutAPI","$location","$log"]}(),function(n){"use strict";var t=n.module("haAirportOrAddressInputModule",["haCitiesModule","ui.bootstrap.typeahead.ha"]);t.directive("haAirportOrAddressInput",["haConfig","$timeout","haCitiesSvc","$q","$parse","$log",function(n,t,i,r,u,f){return{templateUrl:n.getTemplateUrl("ha-airport-or-address-input-template.html"),restrict:"A",scope:{ngModel:"=",name:"@",label:"@",placeholder:"@",required:"@",disabled:"@"},link:function(n,t){function s(t){f.error(t);n.Error=t}function c(){google&&google.maps&&google.maps.places?(u=new google.maps.places.AutocompleteService,h=new google.maps.Geocoder,e=new google.maps.places.PlacesService($("#"+n.name+"-details")[0]),o={east:-66.828,north:49.0324,south:-39.4678,west:100.0187},n.Error=""):s("Google API service not yet loaded or is not linked")}function l(n){var t=r.defer();return u||c(),u.getPlacePredictions({input:n,bounds:o},function(n,i){i!==google.maps.places.PlacesServiceStatus.OK&&i!==google.maps.places.PlacesServiceStatus.ZERO_RESULTS&&t.reject("Google Places API status: "+i);var r=[];n&&n.length&&(r=n.slice());t.resolve(r)}),t.promise}function a(n){for(var i,r,f,t=0,u=n.address_components.length;t<u;t++)for(i=n.address_components[t],r=0,f=i.types.length;r<u;r++)if(i.types[r]==="country")return i.short_name;return""}function v(n){return i.getMatchingCities(n)}var u,e,o,h;n.getComboResultsForInput=function(n){var t=r.defer();return r.all([v(n),l(n)]).then(function(n){var i=[],e=n[0],f=n[1],r,u,o;if(e.length&&(e[0].firstAirportResult=!0,i=i.concat(e)),f.length){for(r=[],u=0,o=f.length;u<o;u++)r.push({DisplayName:f[u].description,isAddress:!0,placeId:f[u].place_id});r[0].firstPlacesResult=!0;r[0].isFromGoogle=!0;i=i.concat(r)}t.resolve(i)},function(n){t.reject(n)}),t.promise};n.onSelect=function(){n.ngModel.isAddress&&e.getDetails({placeId:n.ngModel.placeId},function(t,i){if(i==="OK"){var r=t.geometry.location.lat(),u=t.geometry.location.lng();n.ngModel.geocode={lat:r,long:u};n.ngModel.countryCode=a(t)}else s("PlacesService error:",i)});t.find('input[type="text"]').focus();n.$emit("airportOrAddressInputChanged",{model:n.ngModel,name:n.name})};n.onFocus=function(){n.$root.isMobile&&$("html, body").animate({scrollTop:t.offset().top-10})}}}}])}(angular),function(n){"use strict";var t=n.module("haHotelsInputModule",["haCitiesModule","ui.bootstrap.typeahead.ha"]);t.directive("haHotelsInput",["haConfig","haUtils","haCitiesSvc","$q","$log","$timeout",function(n,t,i,r,u,f){return{templateUrl:n.getTemplateUrl("ha-hotels-input-template.html"),restrict:"A",scope:{ngModel:"=",name:"@",label:"@",placeholder:"@",required:"@",disabled:"@"},link:function(n,e){function o(t){u.error(t);n.Error=t}function s(n){return i.getHotelCities(n)}function h(n){return i.getMatchingCities(n)}n.getComboResultsForInput=function(n){var i=r.defer();return r.all([h(n),s(n)]).then(function(n){var e=[],u=n[0],o=n[1],s,f,r,h;if(u&&u.length){for(u=t.removeDuplicatesFromArray(u,"DisplayName").slice(0,5),s=[],r=0,h=u.length;r<h;r++)s.push({DisplayName:u[r].DisplayName,IsHACity:u[r].IsHACity,Code:u[r].Code});s[0].firstAirportResult=!0;e=e.concat(s)}if(o&&o.length){for(f=[],r=0,h=o.length;r<h;r++)f.push({DisplayName:o[r].regionNames.fullName,isAddress:!0});f=t.removeDuplicatesFromArray(f,"DisplayName");f[0].firstPlacesResult=!0;e=e.concat(f)}i.resolve(e)},function(n){o(n);i.reject(n)}),i.promise};n.onSelected=function(t){n.ngModel=t;f(function(){n.focus()},0)};n.onSelect=function(){f(function(){n.focus()},0)};n.onClick=function(n){n.target.select()};n.onFocus=function(){n.$root.isMobile&&$("html, body").animate({scrollTop:e.offset().top-10})};n.pinClicked=function(){n.$emit("haWhereWeFlyPinClicked")};n.focus=function(){setTimeout(function(){e.find('input[type="text"]').focus()},0)}}}}])}(angular),function(n){"use strict";var t=n.module("haRVFormModule",[]);t.directive("haRvForm",["haConfig","haUtils","$log","$http",function(n,t,i,r){return{templateUrl:n.getTemplateUrl("ha-rv-form.html"),restrict:"A",link:function(n){function e(t){return t.countryCode===""?!0:n.model.rvCountry&&n.model.rvCountry.length?t.countryCode===n.model.rvCountry?!0:!1:!0}function u(n){i.error(n)}function o(){if(!n.scContent.countrycitylisturl){u("Missing URL for RV country and city list");return}r.get(n.scContent.countrycitylisturl,{cache:!0}).then(function(t){var i,e;if(t&&t.data){var r=t.data,o=["AU","NZ","US"],f=[];for(i=0,e=r.length;i<e;i++)o.indexOf(r[i].CountryCode)>=0&&(n.model.rvCities.push({name:r[i].Name+", "+r[i].State,value:r[i].Name,country:r[i].CountryName,countryCode:r[i].CountryCode}),f.indexOf(r[i].CountryCode)<0&&(n.model.rvCountries.push({name:r[i].CountryName,code:r[i].CountryCode}),f.push(r[i].CountryCode)));n.model.rvDestCities=n.model.rvCities.slice();n.model.rvDestCities.unshift({name:n.scContent.rvlocationplaceholdertext,value:"",countryCode:""});n.model.rvReturnCities=n.model.rvCities.slice();n.model.rvReturnCities.unshift({name:n.scContent.sameaspickuptext,value:"SAME",countryCode:""})}else u("Error getting RV cities: incomplete response")},function(n){u("Error getting RV cities: "+n)})}var f=100,t;for(n.model.rvCountries||(n.model.rvCountries=[],n.model.rvCities=[],n.model.rvPickUp="",n.model.rvDropOffDisplay="SAME",n.model.rvDropOff="",n.model.driverAge="",n.model.countryOfResidence="US"),n.model.thirdPartyPartnerImage=n.onMauve==="true"?n.scContent.bgrvsthirdpartypartnerimage:n.scContent.nobgrvsthirdpartypartnerimage,n.driverAgesUS=[],t=21;t<=f;t++)n.driverAgesUS.push(t);for(n.driverAgesElsewhere=[],t=18;t<=f;t++)n.driverAgesElsewhere.push(t);n.$watch("model.rvCountry",function(t){t&&t==="US"?(n.driverAges=n.driverAgesUS,n.driverAgeLabel=n.scContent.driverageustext):(n.driverAges=n.driverAgesElsewhere,n.driverAgeLabel=n.scContent.driveragetext);t&&(n.model.rvDropOffDisplay="SAME")});n.$watch("model.rvPickUp",function(t){if(t&&!n.model.rvCountry)for(var i=0,r=n.model.rvCities.length;i<r;i++)if(n.model.rvCities[i].value===t){n.model.rvCountry=n.model.rvCities[i].countryCode;break}t&&n.model.rvDropOffDisplay==="SAME"&&(n.model.rvDropOff=t)});n.$watch("model.rvDropOffDisplay",function(t){t&&t!=="SAME"?n.model.rvDropOff=t:t&&t==="SAME"&&n.model.rvPickUp&&(n.model.rvDropOff=n.model.rvPickUp)});n.citiesForSelectedCountry=function(t){return n.model.rvDestCities&&n.model.rvReturnCities?t?n.model.rvReturnCities.filter(e):n.model.rvDestCities.filter(e):[]};n.model.rvCountries.length===0&&o()}}}])}(angular),function(n){"use strict";var t=n.module("haPersistentNativeAppBannerModule",["ngCookies"]);t.directive("haPersistentNativeAppBanner",["haConfig",function(n){return{restrict:"A",scope:{dismissalCookie:"=",keepHiddenLengthDays:"=",header:"=",linkText:"="},templateUrl:n.getRazorTemplateUrl("_PersistentNativeAppBannerPartial"),controller:"haPersistentNativeAppBannerController"}}]);t.controller("haPersistentNativeAppBannerController",["$scope","$cookies","haConfig",function(n,t){function i(){n.hideAppBanner=!!t.get(n.dismissalCookie)}function r(){var u=!n.keepHiddenLengthDays||isNaN(+n.keepHiddenLengthDays)?180:+n.keepHiddenLengthDays,i=new Date,r={path:"/"};i.setDate(i.getDate()+u);r.expires=i;t.put(n.dismissalCookie,!0,r)}n.dismiss=function(t){t.preventDefault();n.hideAppBanner=!0;r()};i()}])}(angular),function(n){"use strict";var t;try{t=n.module("haGiftCardModule")}catch(i){t=n.module("haGiftCardModule",[])}t.directive("haGiftcardPurchase",["haHttpService",function(n){return{restrict:"A",scope:!0,link:function(t){function i(){for(var n,r,i=0;i<t.giftCards.length;i++)n=t.giftCards[i],t.giftCardState.balance>=n.BalanceAmount&&(r=Math.min(n.BalanceAmount,t.giftCardState.balance),n.AmountApplied+=r,t.giftCardState.balance-=r,n.BalanceAmount-=r)}t.showInputRow=!0;t.maxGiftCardAllowed=4;t.addCard=function(){if(t.giftCardForm.$validate(),t.giftCardForm.$valid){var i={CardNumber:t.giftCard.Number,Pin:t.giftCard.Pin};if(_.some(t.giftCards,"Number",i.CardNumber))return t.giftCardForm.gcNumber.$setValidity("duplicate",!1);t.checkingGiftCard=!0;n.POST("/MyAccount/GiftCard/GiftCardBalance",JSON.stringify(i)).then(function(n){var r=n.data;n.data.Number=t.giftCard.Number;n.data.Status==="Active"&&r.BalanceAmount!==0?(r.AmountApplied=Math.min(r.BalanceAmount,t.giftCardState.balance),t.giftCardState.balance-=r.AmountApplied,r.BalanceAmount-=r.AmountApplied,n.data.Pin=i.Pin,t.giftCards.push(n.data),t.giftCardForm.$setPristine(),t.showInputRow=!1):t.giftCardForm.gcNumber.$setValidity("invalidcard",!1)},function(){t.giftCardForm.gcNumber.$setValidity("invalidcard",!1)}).finally(function(){t.checkingGiftCard=!1})}};t.addAnother=function(){t.giftCard.Number="";t.giftCard.Pin="";t.giftCardForm.$setUntouched();t.showInputRow=!0};t.removeCard=function(n){var r=t.giftCards.splice(t.giftCards.indexOf(n),1);r.length&&(t.giftCardState.balance+=r[0].AmountApplied,i());t.giftCards.length===0&&(t.showInputRow=!0)};t.$watch("giftCard.Number",function(){t.giftCardForm.gcNumber.$setValidity("invalidcard",!0);t.giftCardForm.gcNumber.$setValidity("duplicate",!0)})}}}])}(angular),function(n){"use strict";var t;try{t=n.module("haGiftCardModule")}catch(i){t=n.module("haGiftCardModule",[])}t.directive("haGiftcardBalance",["haModal","haHttpService","$rootScope","haConfig","haSitecoreStrings",function(n,t,i,r,u){return{restrict:"A",scope:!0,link:function(f){var e={lookup:"/MyAccount/GiftCard/GiftCardBalance"};f.loading=!0;u.get("gift_card_balance").then(function(n){f.strings=n;f.loading=!1})["catch"](function(){f.loading=!1});f.currentCard=undefined;f.error=!1;f.serviceError=!1;i.formData={};f.openGiftCardBalanceModal=function(){f.currentCard=undefined;f.error=!1;f.serviceError=!1;f.loading=!1;i.formData={};n(r.getTemplateUrl("ha-giftcard-balance-modal.html"),{id:"giftCardBalanceModal",backdrop:"true",scope:f})};f.setForm=function(n){f.gcBalanceForm=n};f.submitSearch=function(){var n={CardNumber:i.formData.number,Pin:i.formData.pin};f.loading=!0;t.POST(e.lookup,JSON.stringify(n)).then(function(n){n.data&&n.data.IsSuccess?(f.currentCard=n.data,f.serviceError=!1,i.formData.number="",i.formData.pin="",f.gcBalanceForm.$setPristine(),f.gcBalanceForm.CardNumber.$touched=!1,f.gcBalanceForm.PinNumber.$touched=!1,f.gcBalanceForm.$submitted=!1,f.gcBalanceForm.$setPristine(),$("form[name="+f.gcBalanceForm.$name+"]").removeClass("submitted")):(f.currentCard=undefined,f.serviceError=!0,f.strings.serviceErrorMessage=n.data.ErrorMessage||n.data.TranslateServiceError);f.error=!1},function(){f.error=!0;f.serviceError=!1})["finally"](function(){f.loading=!1})};f.$on("haAlertClosed",function(n,t){t==="balanceCheckErrorAlert"&&setTimeout(function(){f.serviceError=!1;f.$broadcast("$showAlert","balanceCheckErrorAlert")},1e3)})}}}])}(angular),function(n){"use strict";var t=n.module("haPairLinksModule",[]);t.directive("pairLinksMenu",["$window","$timeout",function(t,i){return{restrict:"A",scope:!0,link:function(r,u,f){function c(t){var i={};return n.forEach(t,function(n){i[n.ItemA+n.ItemB]=n.Link}),i}function h(t){var i="",r=!1;return n.forEach(t,function(n){(n.IsGroupHeader||n.IsTopLevel)&&r&&(i+="<\/optgroup>",r=!1);n.IsGroupHeader?(i+='<optgroup label="'+n.Label+'">',r=!0):i+='<option value="'+n.Id+'">'+n.Label+"<\/option>"}),r&&(i+="<\/optgroup>",r=!1),i}var o=u.find("select").first(),s=u.find("select").last(),e;f.$observe("name",function(n){e=r[n]});f.$observe("listA",function(n){n=JSON.parse(n);o.html(h(n));r.listA=n});f.$observe("listB",function(n){n=JSON.parse(n);s.html(h(n));r.listB=n});f.$observe("pairs",function(n){r.pairs=JSON.parse(n);r.pairMap=c(r.pairs)});f.$observe("defaultA",function(n){i(function(){o.val(n.Id).change()})});f.$observe("defaultB",function(n){i(function(){s.val(n.Id).change()})});r.$watchGroup(["itemA","itemB"],function(){e.itemA.$setValidity("notfound",!0);e.itemB.$setValidity("notfound",!0)});r.go=function(n){var i,u,f;n.preventDefault();i=r.pairMap[r.itemA+r.itemB];i&&i.Url?(u=i.Url,f=i.Target,t.open(u,f||"_self")):(e.itemA.$setValidity("notfound",!1),e.itemB.$setValidity("notfound",!1))}}}}])}(angular),function(n){"use strict";var t=n.module("haName",[]);t.directive("haName",["$compile","$interpolate",function(n,t){return{restrict:"A",terminal:!0,priority:1e5,scope:!1,link:function(i,r){var u=r.attr("ha-name"),f=t(u,!1,null,!0)(i);r.removeAttr("ha-name");r.attr("name",f);n(r)(i)}}}])}(angular),function(n){"use strict";var t=n.module("haCustomDropdownModule",[]);t.directive("haCustomDropdown",["haConfig","$timeout",function(t,i){return{restrict:"A",scope:{label:"@"},transclude:!0,templateUrl:t.getTemplateUrl("ha-custom-dropdown-base-template.html"),link:function(t,r){function f(n){r.has(n.target).length||(i(t.customDropdownDeactivate),$(n.target).is(":focusable")||u.focus())}function e(n){n.keyCode===27&&(n.stopPropagation(),i(t.customDropdownDeactivate),u.focus())}var u=n.element([]);t.customDropdownActivate=function(){n.element("body").on("focusin touchstart click",f);n.element(r).on("keydown",e);t.active=!0};t.customDropdownDeactivate=function(){n.element("body").off("focusin touchstart click",f);n.element(r).off("keydown",e);t.active=!1};t.toggleCustomDropdownActive=function(i){u=n.element(i.target);t.active?t.customDropdownDeactivate():t.customDropdownActivate()};t.$on("$closeCustomDropdown",function(){u.focus();t.customDropdownDeactivate()});t.$on("$openCustomDropdown",function(){t.customDropdownActivate()})}}}])}(angular),function(n){"use strict";var t=n.module("haBirthdateModule",[]);t.directive("haBirthdate",["haDateUtils","$parse",function(n,t){return{restrict:"A",require:"ngModel",link:function(i,r,u,f){var e=function(r){var e=t(u.monthModel)(i),o=t(u.dayModel)(i),s=t(u.yearModel)(i),h=n.isValid(s,e,o)&&n.isBefore(new Date(s,e-1,o),new Date);return f.$setValidity("haBirthdate",h),r};f.$parsers.unshift(e);f.$formatters.push(e);i.$watch(u.monthModel,function(){return e(f.$viewValue)});i.$watch(u.dayModel,function(){return e(f.$viewValue)});i.$watch(u.yearModel,function(){return e(f.$viewValue)})}}}])}(angular),function(n){"use strict";var t=n.module("haFormValidationModule",[]);t.directive("haFormValidation",["$timeout",function(n){var t=function(){},i;return t.$inject=["$scope"],i=function(t,i){n(function(){t.theFormName=i.attr("name");t.theForm=t[t.theFormName];t.$emit("$haFormValidationReady",t.theForm);t.theForm.validate=t.fireValidation},0);t.fireValidation=function(i){var u,r,f,e;t.$broadcast("validateForm");t.theForm.$valid?t.$emit("haFormValidationSuccess",{formName:t.theFormName,formScope:t.theForm,event:i}):(u=$("input.ng-invalid:first"),r=null,$("form[name='"+t.theFormName+"']").get(0)&&(u=$("form[name='"+t.theFormName+"']").find("input.ng-invalid:first"),r=$("form[name='"+t.theFormName+"']").parents().find(".ha-modal")),r!=null&&r.get(0)?(f=$(u).offset().top,e=$(r).offset().top,$(r).animate({scrollTop:e-f},"slow")):$("body, html").animate({scrollTop:$(".ng-invalid:not(form.ng-invalid):first").offset().top-140},"slow"),n(function(){$(u).focus()},300),i&&i.preventDefault&&i.preventDefault())};t.safeApply=function(n){var t=this.$root.$$phase;t==="$apply"||t==="$digest"?n&&typeof n=="function"&&n():this.$apply(n)};i.on("reset",function(){t.$broadcast("pristine");t.theForm.$setPristine()});i.on("submit",t.fireValidation)},{restrict:"A",scope:!0,link:i,controller:t}}])}(angular),function(n){"use strict";var t=function(){function n(n,t,i){return n<t&&n<i?n:t<n&&t<i?t:i}return function(t,i){var c,o,e,h,r,s,u,f;if(t===i)return 0;if(t.Length===0)return i.length;if(i.Length===0)return t.length;if(t.indexOf(i)>-1)return 0;for(o=t.length,e=i.length,o<e&&(h=t,t=i,i=h,h=o,o=e,e=h),r=[],r[0]=[],s=0;s<e+1;++s)r[0][s]=s;for(u=1;u<o+1;++u)for(r[u]=[],r[u][0]=u,f=1;f<e+1;++f)c=t.charAt(u-1)===i.charAt(f-1)?0:1,r[u][f]=n(r[u-1][f]+1,r[u][f-1]+1,r[u-1][f-1]+c);return r[r.length-1][r[r.length-1].length-1]}}(),i=n.module("haPasswordStrengthModule",[]);i.directive("haPasswordStrength",["$log","haRegexService",function(n,i){var r=["$scope",function(n){this.user=undefined;this.email=undefined;this.hmno=undefined;this.pass=undefined;n.$parent.pwStrength="NONE";this.test=function(r){var f,s,h,c,l,a,v,e,o,u;if(r.$setValidity("tooShort",!0),r.$setValidity("tooLong",!0),r.$setValidity("pattern",!0),r.$setValidity("alikeness",!0),this.pass&&this.pass.length<10){r.$setValidity("tooShort",!1);n.$parent.pwStrength="SHORT";return}if(this.pass&&this.pass.length>16){r.$setValidity("tooLong",!1);n.$parent.pwStrength="LONG";return}if(f=5,this.pass&&this.pass.length&&(this.user||this.email||this.hmno)&&(this.user&&(l=t(this.pass.toUpperCase(),this.user.toUpperCase()),s=l<f),this.email&&(a=t(this.pass.toUpperCase(),this.email.toUpperCase()),h=a<f),this.hmno&&(v=t(this.pass.toUpperCase(),this.hmno),c=v<f),e=s||h||c,r.$setValidity("alikeness",!e),e)){n.$parent.pwStrength="ALIKE";return}return o=!1,u="NONE",this.pass&&this.pass.length&&(u="WEAK",r.$setValidity("pattern",!1),i.password.test(this.pass)&&(r.$setValidity("pattern",!0),u="GOOD",o=!0,/[^A-Za-z0-9]+/.test(this.pass)&&(u="STRONG"))),n.$parent.pwStrength=u,o}}],u=function(n,t,i,r){var u=r[0],f=r[1];f.$parsers.unshift(function(n){return u.pass=n,u.test(f),n});n.$watch(i.usernameModel,function(n){n&&n.length&&(u.user=n,u.test(f))});n.$watch(i.emailModel,function(n){n&&n.length&&(u.email=n.substr(0,n.indexOf("@")),u.test(f))});n.$watch(i.hmnoModel,function(n){n&&n.toString().length&&(u.hmno=n.toString(),u.test(f))})};return{restrict:"A",require:["haPasswordStrength","ngModel"],link:u,controller:r,transclude:!0,templateUrl:""}}]);i.directive("haPasswordMatch",[function(){return{require:"ngModel",link:function(n,t,i,r){function e(){u!=null&&f!=null&&r.$setValidity("passwordMatch",u===f)}var u,f;r.$parsers.unshift(function(n){return u=n,e(),n});n.$watch(i.haPasswordMatch,function(n){f=n;e()})}}}])}(angular),function(n){"use strict";var t=n.module("haWindowEventsModule",[]);t.directive("body",function(){var n=function(n,t){t.on("click",function(t){n.$root.$emit("HaWindow:clicked",t)});n.$emit("$haWindowEventsReady")};return{restrict:"E",scope:!1,link:n}})}(angular),function(n){"use strict";var t=n.module("noClickFocusModule",[]);t.directive("noClickFocus",function(){var n=function(n,t){t.click(function(){t.blur()})};return{restrict:"A",scope:!1,link:n}})}(angular),function(n){"use strict";var t=n.module("haToggleModule",[]);t.directive("haToggle",["haConfig",function(n){return{restrict:"A",scope:{ngModel:"=",onLabel:"=",offLabel:"="},templateUrl:n.getTemplateUrl("ha-toggle-base-template.html"),transclude:!0,link:function(n,t){t.find("input").prop("checked",n.ngModel);n.toggle=function(){n.ngModel=!n.ngModel;t.find("input").prop("checked",n.ngModel)}}}}])}(angular),function(n){"use strict";var t=n.module("haKeyboardModule",[]);t.directive("haKeyEnter",function(){return function(n,t,i){t.bind("keydown keypress",function(t){t.which===13&&(n.$apply(function(){n.$eval(i.haKeyEnter)}),t.preventDefault())})}});t.directive("haKeyUp",function(){return function(n,t,i){t.bind("keydown keypress",function(t){t.which===38&&(n.$apply(function(){n.$eval(i.haKeyUp)}),t.preventDefault())})}});t.directive("haKeyDown",function(){return function(n,t,i){t.bind("keydown keypress",function(t){t.which===40&&(n.$apply(function(){n.$eval(i.haKeyDown)}),t.preventDefault())})}})}(angular),function(n){"use strict";var t=n.module("haErrorsModule",[]),i=["haSitecoreStrings","$timeout",function(t,i){var r={editable:t.get("Forms.patternError").then(function(n){return r.editable=n}),required:t.get("Forms.requiredError").then(function(n){return r.required=n}),language:t.get("Forms.languageError").then(function(n){return r.language=n}),pattern:t.get("Forms.patternError").then(function(n){return r.pattern=n}),date:t.get("Forms.dateError").then(function(n){return r.date=n}),parse:""};return{require:["?^form","?ngModel","?^haInput"],restrict:"E",link:function(t,u,f,e){function p(n){var t;if(o||(o=n),o.attempts++,o.$submitted=!0,t=$('[name="'+o.$name+'"]'),t.addClass("submitted"),i(function(){},0),o.$invalid){var r=$(".ng-invalid:not(div):first",t),u=r.closest(".modalContainer"),f=u.size()?u:$("html,body");f.animate({scrollTop:r.offset().top-50},function(){r.focus().select()})}return o.$valid}function b(){if(!(o.$submitted||s.$touched))return!1;if(c.required)return"required";if(c.language)return"language";if(c.pattern)return"pattern";for(var n in c)if(c.hasOwnProperty(n)&&c[n])return n}function k(n){var t=l[n];return typeof t=="undefined"?(console.error('Missing "'+n+'" message for input:',u[0]),"Unknown Error"):t.then?(t.then(function(t){h.html(l[n]=t)}),"..."):l[n]}var a=u[0].name,o=e[0],s=e[1],w=e[2],v=typeof f.allowNonEnglish!="undefined",c,l,h,y;if(!o||!s||w||!u.is("[ha-errors]")){if(v||!u.is(":not([ha-errors]):not(select):not(:checkbox):not(:radio):not(:hidden):not(:submit):not(:button)"))return;u.on("keydown input",function(n){if(n.ctrlKey||n.altKey||n.shiftKey||n.metaKey)return!0;var t=$(this).val(),i=!/[^\u0000-\u007F]+/.test(t);return n.type==="input"&&!i?(u.val(t.replace(/[^\u0000-\u007F]+/g,"")),!0):i});return}if(typeof o.attempts=="undefined"){o.attempts=0;$(u[0].form).on("submit",p)}if(c=s.$error,l=n.extend({},r,t.$eval(f.haErrors||"{}")),n.version.major===1&&n.version.minor<7){u.one("blur",function(){t.$evalAsync(function(){s.$untouched=!(s.$touched=!0);u.removeClass("ng-untouched").addClass("ng-touched")})});u.addClass("ng-untouched");s.$untouched=!(s.$touched=!1);o.$validate=p.bind(u[0].form)}i(function(){h=$('em[for="'+a+'"]');h.length||(h=$("<em>").attr("for",a),u.is("[required]:radio,[required]:checkbox")?u.closest(":not(ul):not(ol):not(li):not(input)").append(h):h.insertAfter(u));y=$(document.createComment("ha-errors for="+a)).insertBefore(h);!v&&u.is(":not(select):not(:checkbox):not(:radio):not(:hidden):not(:submit):not(:button)")&&t.$watch(function(){return u.val()},function(n){n&&s.$setValidity("language",!/[^\u0000-\u007F]+/.test(n))});t.$watch(b,function(n){u.attr("aria-invalid",s.$invalid);h.text("").detach();n&&h.html(k(n)).insertAfter(y)})})}}}];t.directive("input",i);t.directive("textarea",i);t.directive("select",i)}(angular),function(n){"use strict";var t=n.module("haRestrictSpacesModule",[]);t.directive("haRestrictSpaces",function(){return function(n,t){t.on("keydown input",function(n){return n.which!==32})}})}(angular),function(n){"use strict";var t=n.module("haFootNoteModule",[]),i=0,r=1;t.directive("haFootNote",["haConfig",function(n){var t=function(n,t){t.footnotes=t.footnotes||{};n.addFootnote=function(i){t.footnotes[n.type]=t.footnotes[n.type]||[];t.footnotes[n.type].push({id:n.id,label:n.label,text:i})}},u;return t.$inject=["$scope","$rootScope"],u=function(n,t,u){n.setValues=function(){typeof u.labelNumber=="string"?(n.type="numeric",n.id=r++):(n.type="static",n.label=u.label,n.id=String.fromCharCode(65+i++))};n.setValues();n.DisclaimerFootNote!==""?n.addFootnote(n.DisclaimerFootNote):n.addFootnote(t.find("[ng-transclude]").text())},{restrict:"A",transclude:!0,scope:!0,link:u,templateUrl:n.getTemplateUrl("ha-foot-note-base-template.html"),controller:t}}])}(angular),function(n){"use strict";var t=n.module("selectOnClickModule",[]);t.directive("selectOnClick",function(){return function(n,t){t.bind("click",function(){this.select()})}})}(angular),function(n){"use strict";var t=n.module("haRevealOnLoadModule",[]);t.directive("haRevealOnLoad",function(){return{restrict:"A",scope:!1,link:function(n,t){setTimeout(function(){t.addClass("ha-reveal-on-load-active");n.contentLoaded=!0},0)}}})}(angular),function(n){"use strict";var t=n.module("haDraggableModule",[]);t.directive("haDraggableContainer",function(){var n=function(n,t){n.exampleMethod=function(){return t.scope()};n.$emit("$methodsBound")};return{restrict:"A",scope:!0,link:n}});t.directive("haDraggable",function(){var n=function(n,t){t.draggable({start:function(t){n.$emit("$dragStart",t)},drag:function(t){n.$emit("$dragging",t)},stop:function(t,i){n.$emit("$dragEnd",t,i)}});n.updateDraggableSettings=function(n){return t.draggable(n),t.scope()}};return{restrict:"A",scope:!0,priority:10,link:n}})}(angular),function(n){"use strict";n.module("haScrollModule",["duScroll"]).directive("haScrollTo",["duSmoothScrollDirective",function(n){var t=function(t,i,r){var f="#"+r.haScrollTo,u=90;r.offset!=null&&(u=r.offset);r.$set("href",f);r.$set("offset",u);n[0].link(t,i,r)};return{restrict:"A",priority:-1,link:t}}])}(angular),function(n){"use strict";var t=n.module("haDataModule",["haDataCacheService"]),i=function(n){var t=function(t,i,r){t.haDataHref=r.haData||r.haDataCache;n.get(t.haDataHref).success(function(n){$.extend(t,n);t.$emit("$haDataLoaded")})};return{restrict:"A",scope:!0,priority:-1,link:t}};t.directive("haData",["haDataCacheService",i]);t.directive("haDataCache",["haDataCacheService",i])}(angular),function(n){"use strict";var t=n.module("haTailModule",["ng"]);t.directive("haTail",["$parse","$interval",function(n,t){var i=function(i,r,u){function f(n){if(o(i)){var t=$(n).get(0);t!=null&&(t.scrollTop=t.scrollHeight)}}var o=n(u.haTail),e;u.ngModel!=null?i.$watch(u.ngModel,function(){f(r)}):(e=t(function(){f(r)},500,!1),i.$on("$destroy",function(){t.cancel(e)}))};return{restrict:"A",priority:-1,link:i}}])}(angular),function(n){"use strict";var t=n.module("haJson",[]);t.filter("haJson",function(){function n(n){return n&&n.document&&n.location&&n.alert&&n.setInterval}function t(n){return n&&n.$evalAsync&&n.$watch}function i(i,r){var u=r;return n(r)?u="$WINDOW":r&&document===r?u="$DOCUMENT":t(r)&&(u="$SCOPE"),u}return function(n){return typeof n=="undefined"?undefined:JSON.stringify(n,i,"  ")}})}(angular),function(n){"use strict";var t=n.module("haFileModule",[]);t.directive("haFile",["haConfig","haUtils",function(n,t){return{restrict:"A",transclude:!0,scope:!0,templateUrl:n.getTemplateUrl("ha-file-base-template.html"),link:function(n,i,r){n.sizeLimit=r.sizeLimit;n.errorMessage=r.errorMessage;n.parentFormName=r.parentFormName||"theForm";n.ChooseFileText=r.chooseFile;n.NoFileChosen=r.noFile;n.$emit("$haFileReady");var u=i.find('input[type="file"]');n.open=function(){u.trigger("click")};u.change(function(){t.safeApply(n,function(){if(n.fileName=u.val(),n.sizeLimit&&u[0].files&&u[0].files.length===1){var r=n.sizeLimit*1048576,t=u[0].files[0],i=t.size>r;n.fileName=t.name||u.val();n.sizeError=i;n[n.parentFormName]&&n[n.parentFormName].$setValidity("sizeError",!i)}})})}}}])}(angular),function(n){"use strict";function u(n,t,i){var r;return function(){var u=this,f=arguments,e=function(){r=null;i||n.apply(u,f)},o=i&&!r;clearTimeout(r);r=setTimeout(e,t);o&&n.apply(u,f)}}function i(n){return parseInt(getComputedStyle(n).paddingBottom.replace("px",""))||0}function r(n){return n.clientHeight-i(n)}var t=n.module("haEqualHeightModule",["ng"]);t.directive("haEqualHeightContainer",["$log","$window","$interval",function(t,f,e){return{restrict:"A",controller:["$scope",function(t){var o=[];this.register=function(n){o.push({element:n,contentHeight:r(n),paddingBottom:i(n)})};this.update=function(){var i,u,t;if(o.length!==0){for(i=0,u=0;u<o.length;u++)t=o[u],t.contentHeight=r(t.element),i=Math.max(i,t.contentHeight+t.paddingBottom);n.forEach(o,function(n){var t=i-n.contentHeight+"px";t!==n.element.style.paddingBottom&&(n.element.style.paddingBottom=t)})}};var s=u(this.update,50),h=e(s,1e3,15,!1),c=n.element(f);c.bind("resize",s);t.$on("$destroy",function(){c.unbind("resize",s);e.cancel(h);h=undefined})}]}}]);t.directive("haEqualHeight",function(){return{restrict:"A",require:"^haEqualHeightContainer",link:function(n,t,i,r){var f=t[0],u;r.register(f);u=!0;n.$watch(function(){return f.clientHeight},function(n,t){(u||n!==t)&&(u=!1,r.update())})}}})}(angular),function(n){"use strict";var t=n.module("haEmitErrorModule",["ng"]);t.directive("haEmitError",["$log",function(){return{restrict:"A",link:function(n,t){t.bind("error",function(t){n.$emit("haEmitError",t)})}}}])}(angular),function(n){"use strict";var t=n.module("haIsWorkingModule",[]);t.directive("haIsWorking",["$compile",function(n){return{restrict:"A",scope:{haIsWorking:"=",haIsWorkingLabel:"@"},link:function(t,i){var r=i[0]||i,f,e,u,o;(r.tagName==="A"||r.tagName==="BUTTON")&&(u=r.innerHTML,f=function(){i.empty();r.innerHTML=t.haIsWorkingLabel},e=function(){i.empty();r.innerHTML=u;u.indexOf("{{")>-1&&n(i.contents())(t.$parent)});r.tagName==="INPUT"&&(u=r.value,f=function(){r.value=t.haIsWorkingLabel},e=function(){r.value=u});o=!0;t.$watch("haIsWorking",function(n,t){(o||n!==t)&&(o=!1,n?(i.addClass("is-working"),f()):(i.removeClass("is-working"),e()))});t.$watch("haIsWorkingLabel",function(n,i){n!==i&&t.haIsWorking&&f()})}}}])}(angular),function(n){"use strict";var t=n.module("haInputName",[]);t.directive("haInputName",["$interpolate",function(n){return{restrict:"A",priority:1e3,scope:!1,link:function(t,i){var u=n(i.attr("ha-input-name"),!1,null,!0)(t),r;i.removeAttr("ha-input-name");r=i.find("input");r.attr("name",u)}}}])}(angular),function(n){"use strict";var t=n.module("haScopeModule",[]);t.directive("haScope",[function(){return{restrict:"A",scope:!1,link:function(t,i,r){if(i[0].tagName==="SCRIPT"&&r.type==="text/ha-scope")try{var e=JSON.parse(i[0].text),f=t,u=r.haScope||null;u!=null&&(t[u]=t[u]||{},f=t[u]);n.extend(f,e)}catch(o){}}}}])}(angular),function(n){"use strict";var t;try{t=n.module("haViewModelModule")}catch(i){t=n.module("haViewModelModule",[])}t.directive("haViewModel",["$log","haViewModelSvc",function(n,t){return{restrict:"A",scope:!1,link:function(i,r,u){var f=u.haViewModel,e;if(f!=null&&r[0].tagName==="SCRIPT"&&u.type==="text/ha-view-model")try{e=JSON.parse(r[0].text);t.put(f,e)}catch(o){n.error(f,o)}}}}])}(angular),function(n){"use strict";var t=n.module("HaConfirmWhenDirtyModule",[]);t.directive("haConfirmWhenDirty",["$window",function(n){var t=function(t,i,r){t.confirmText=r.confirmText;t.theFormName=i.attr("name");t.theForm=t[t.theFormName];t.submitForm=function(){t.working=!0};window.onbeforeunload=function(){if(t.theForm&&t.theForm.$dirty&&!t.working)return t.confirmText};t.$on("$locationChangeStart",function(i){t.theForm&&t.theForm.$dirty&&(n.confirm(t.confirmText)||i.preventDefault())})};return{restrict:"A",scope:!0,link:t}}])}(angular),function(n){"use strict";var t=n.module("haWatchTrailerModule",[]);t.directive("haWatchTrailer",["$window","haModal","haConfig",function(n,t,i){var r=function(n){var r=i.getTemplateUrl("ha-watch-trailer-modal-template.html");n.$root.isMobile&&(r=i.getTemplateUrl("ha-watch-trailer-modal-mobile-template.html"));n.showTrailer=function(i){n.youtubeURL="//www.youtube.com/embed/"+i+"?autoplay=1&rel=0&origin=http://hawaiianairliens.comyoutubeID";t(r,{backdrop:"true",id:"watch-video",scope:n})}};return r.$inject=["$scope"],{restrict:"A",scope:!0,controller:r}}])}(angular),function(n){"use strict";var t=n.module("haScrollSpyModule",[]);t.directive("haScrollSpy",["$window","$rootScope",function(t,i){return{restrict:"A",link:function(r,u,f){function o(){var a=this,v=!1,o,e,r,y=0,s=!1,h=!1,c=!1,b=document.documentElement,l=f.id||"unknown element",p=!1,k=.9,w;this.determinePosition=function(){if(v){r=n.element(u).offset().top;r-y>e&&(y=r,s=!1);var t=window.pageYOffset||b.scrollTop;c||(t+o<r||t>r+e)&&(c=!0,h=!1,i.$broadcast("elementScrolledOutOfView",l));(t+o>=r+k*e&&r>t||t>=r&&p)&&(s||(s=!0,i.$broadcast("elementFirstScrolledIntoView",l)),h||(h=!0,c=!1,i.$broadcast("elementScrolledIntoView",l)))}};this.takeMeasurements=function(){o=n.element(t).height();e=n.element(u).outerHeight();r=n.element(u).offset().top;o<e&&(p=!0);s=!1;v=!0;a.determinePosition()};w=setInterval(function(){n.element(u).outerHeight()>2&&n.element(u).offset().top>0&&(clearTimeout(w),a.takeMeasurements())},50)}var e=f.id+"-scrollSpy";i[e]=new o;i.globalOnScrollFunctions||(i.globalOnScrollFunctions=[]);i.globalOnScrollFunctions.push(i[e]);i.globalOnScroll||(i.globalOnScroll=function(){n.forEach(i.globalOnScrollFunctions,function(n){n.determinePosition()})},t.onscroll=i.globalOnScroll)}}}])}(angular),function(n){"use strict";var t=n.module("HaFavoriteModule",[]);t.directive("haFavorite",["haConfig","haHttpService","$window","$timeout",function(t,i,r,u){var f=function(t,f,e){function s(){t.isFavorited?n.element(f).attr("title",o.titleOnString):n.element(f).attr("title",o.titleOffString)}function h(n,t){$scs.get(n).then(function(n){o[t]=n;s()})}var c="/IslandGuideFavorites/AddPlaceFavorite",l="/IslandGuideFavorites/DeletePlaceFavorite",o={titleOnString:"",titleOffString:""};t.isFavorited=e.favorited;t.placeID=e.placeId;n.element(f).attr("role","button");h("EXPLORE_SHARED.FavoriteOnText","titleOnString");h("EXPLORE_SHARED.FavoriteOffText","titleOffString");t.favorite=function(n){if(!t.working){var i={PlaceId:n};t.isFavorited?t.removeFavorite(i):t.addFavorite(i)}};t.strings=null;t.getStrings=function(n){t.strings||(t.strings={},t.strings.AddFavoriteMessageLine1=n.AddFavoriteMessageLine1,t.strings.AddFavoriteMessageLine2=n.AddFavoriteMessageLine2,t.strings.DeleteFavoriteMessageLine1=n.DeleteFavoriteMessageLine1,t.strings.DeleteFavoriteMessageLine2=n.DeleteFavoriteMessageLine2)};t.addFavorite=function(n){t.isFavorited=!0;s();t.working=!0;i.POST(c,n).success(function(n){console.log(n);t.working=!1;n.IsSuccess&&(t.isFavorited=!0,t.getStrings(n),t.addedPopover=!0,u(function(){t.addedPopover=!1},5e3))}).error(function(n){t.working=!1;n.RedirectURL&&(r.location=n.RedirectURL)})};t.removeFavorite=function(n){t.isFavorited=!1;s();i.POST(l,n).success(function(n){t.getStrings(n)}).error(function(n){n.RedirectURL&&(r.location=n.RedirectURL)})}};return{restrict:"A",scope:!0,templateUrl:t.getTemplateUrl("ha-favorite.html"),replace:!0,link:f}}])}(angular),function(n){"use strict";var t=n.module("haContextualHelpModule",[]);t.directive("haContextualHelp",["haConfig","haModal","haSitecoreStrings","$log",function(n,t,i,r){var u=function(n){n.showContextualHelp=function(){n.scsId?i.get(n.scsId).then(function(n){t("",{id:"contextual-help",backdrop:"true",template:n})})["catch"](function(){r.log("There was an error retreiving sitecore content.")}):t("ContextualHelpModal.html",{id:"contextual-help",backdrop:"true"})}},f;return u.$inject=["$scope","$rootScope"],f=function(n,t,i){n.scsId=i.scsId},{restrict:"A",replace:!0,template:'<a class="bodycopy-sans-4 textlink" href ng-click="showContextualHelp()"><span class="sr-only" i18n-content="inflightoptionsinfo.gethelpwiththispagelink"><\/span><i class="fontIcon fontIcon20-help pull-left"><\/i><div ng-transclude><\/div><\/a>',scope:!0,transclude:!0,link:f,controller:u}}])}(angular),function(n){"use strict";var t=n.module("haButtonSpinnerModule",[]);t.directive("haButtonSpinner",function(){return{template:'<span class="button-spinner"><span><span><\/span><\/span><\/span><span ng-transclude><\/span>',transclude:!0,restrict:"A",scope:{showSpinner:"="},link:function(n,t){n.$watch(function(n){return n.showSpinner},function(n){t.blur();n?(t.children(".button-spinner").css({opacity:1}),t.css({paddingLeft:60}),t.prop("disabled",!0)):(t.children(".button-spinner").css({opacity:0}),t.css({paddingLeft:30}),t.prop("disabled",!1))})}}})}(angular),function(n){"use strict";var t=n.module("haCountUpModule",[]);t.directive("countUp",["$filter",function(n){return{restrict:"A",scope:{endVal:"@",duration:"@"},link:function(t,i,r){function u(t,i,r,u){for(var f,s=0,o=["webkit","moz","ms","o"],e=0;e<o.length&&!window.requestAnimationFrame;++e)window.requestAnimationFrame=window[o[e]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[o[e]+"CancelAnimationFrame"]||window[o[e]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(n){var t=(new Date).getTime(),i=Math.max(0,16-(t-s)),r=window.setTimeout(function(){n(t+i)},i);return s=t+i,r});window.cancelAnimationFrame||(window.cancelAnimationFrame=function(n){clearTimeout(n)});this.d=document.getElementById(t);this.startVal=Number(i);this.endVal=r;this.countDown=this.startVal>this.endVal;this.frameVal=this.startVal;this.duration=u*1e3||2e3;f=this;this.printValue=function(t){var i=n("number")(t);this.d.innerHTML=i};this.easeOutExpo=function(n,t,i,r){return i*(-Math.pow(2,-10*n/r)+1)*1024/1023+t};this.count=function(n){f.startTime||(f.startTime=n);f.timestamp=n;var t=n-f.startTime;f.remaining=f.duration-t;f.frameVal=f.countDown?f.startVal-f.easeOutExpo(t,0,f.startVal-f.endVal,f.duration):f.easeOutExpo(t,f.startVal,f.endVal-f.startVal,f.duration);f.frameVal=f.countDown?f.frameVal<f.endVal?f.endVal:f.frameVal:f.frameVal>f.endVal?f.endVal:f.frameVal;f.frameVal=Math.round(f.frameVal);f.printValue(f.frameVal);t<f.duration?f.rAF=requestAnimationFrame(f.count):f.callback&&f.callback()};this.start=function(n){return f.callback=n,isNaN(f.endVal)||isNaN(f.startVal)||f.startVal===f.endVal?this.d.innerHTML=r:f.rAF=requestAnimationFrame(f.count),!1};this.reset=function(){f.paused=!1;delete f.startTime;f.startVal=i;cancelAnimationFrame(f.rAF);f.printValue(f.startVal)};this.update=function(n){delete f.callback;cancelAnimationFrame(f.rAF);f.paused=!1;delete f.startTime;f.startVal=f.frameVal;f.endVal=Number(n);f.countDown=f.startVal>f.endVal;f.rAF=requestAnimationFrame(f.count)};f.printValue(f.startVal)}function f(){t.end>9999?(t.countUp=new u(r.id,0,t.end-100,t.dur/2),t.countUp.start(function(){t.countUp.update(t.end)})):(t.countUp=new u(r.id,0,t.end,t.dur),t.countUp.start())}t.end=r.endVal||0;isNaN(t.end)&&(t.end=Number(t.end.match(/[\d\-]+/g).join("")));t.dur=Number(r.duration)||2.5;f();i.on("click",function(){f()})}}}])}(angular),function(n){"use strict";var t=n.module("haContentModalModule",[]);t.directive("haContentModal",["haConfig","haModal","haSitecoreStrings","$log",function(n,t,i,r){var u=function(n){n.showModal=function(){!n.hasError&&n.modalContent&&(n.modalType==="content"?t("",{modalClass:"ha-content-modal",id:n.modalId,backdrop:"true",template:n.modalContent}):t("",{id:n.modalId,backdrop:"true",template:n.modalContent,modalClass:"image-modal"}))};n.fetchModalContent=function(){n.scsId?i.get(n.scsId).then(function(t){n.modalContent=t})["catch"](function(){n.hasError=!0;r.error("There was an error retreiving sitecore content.")}):n.imgSrc&&(n.modalContent='<section class="modal-template ng-scope"><div class="modal-header centered-header"><h1>'+n.imgTitle+'<\/h1><\/div><div class="modal-main"><img src="'+n.imgSrc+'" alt=""><\/div><\/section>')}},f;return u.$inject=["$scope","$rootScope"],f=function(n,t,i){n.modalType="content";n.scsId=i.scsId;n.modalId=i.modalId;i.imgSrc&&(n.modalType="image",n.imgSrc=i.imgSrc,n.imgTitle=i.title);n.fetchModalContent();$(t).on("click",function(){n.showModal()})},{restrict:"A",scope:!0,link:f,controller:u}}])}(angular),function(n){"use strict";var t=n.module("haDomModalModule",[]);t.directive("haDomModal",["haModal",function(n){var t=function(t){t.showModal=function(){!t.hasError&&t.modalContent&&n(t.modalContent,{id:t.modalId,backdrop:"true"})}},i;return t.$inject=["$scope","$rootScope"],i=function(n,t,i){n.domId=i.domId;n.modalId=i.modalId;n.modalContent=i.domId;$(t).on("click",function(){n.showModal()})},{restrict:"A",scope:!0,link:i,controller:t}}])}(angular),function(n){"use strict";var t=n.module("haLoadingSpinnerModule",[]);t.directive("haLoadingSpinner",function(){var n=function(n,t,i){i.small!==undefined&&t.children(".ha-loading-spinner").addClass("small");i.white!==undefined&&t.children(".ha-loading-spinner").addClass("white");n.loadingText="";i.loadingText!==undefined&&(n.loadingText=i.loadingText);n.$emit("$haLoadingSpinnerReady")};return{restrict:"A",scope:!0,link:n,transclude:!0,template:'<div class="ha-loading-spinner" tabindex="0"><span class="sr-only">{{loadingText}}<\/span><div class="spin"><div><\/div><\/div><\/div>'}});t.directive("haLoadingSpinnerWithText",function(){var n=function(n){n.$emit("$haLoadingSpinnerWithTextReady")};return{restrict:"A",scope:!0,link:n,transclude:!0,template:'<div class="ha-loading-spinner-with-text" ha-reveal-on-load tabindex="0"><div class="ha-loading-spinner small"><div class="spin"><div><\/div><\/div><\/div><div class="ha-loading-text"><span ng-transclude><\/span><\/div><\/div>'}})}(angular),function(n){"use strict";var t=n.module("focusOnDisplayModule",[]);t.directive("focusOnDisplay",function(){return{restrict:"A",link:function(n,t,i){$("html").hasClass("lte-ie9")||i.$observe("focusOnDisplay",function(){t.focus()})}}})}(angular),function(n){"use strict";var t=n.module("haStickyModule",[]);t.directive("haSticky",["$window","$rootScope",function(t,i){return{restrict:"A",link:function(r,u,f){function s(){var i=this,c=f.haSticky||"margin",l=!1,a,n,r,e,v,y,p,t=0,o=!1,h,w,s=!1,k=document.documentElement,b;$("[ha-book-sticky-progress-bar]").length&&(t+=70);$("[ha-sticky-message-bar]").length&&(t+=70);$("[ha-sticky-booking-widget]").length&&(t+=75);$("#sessiontimer aside").length&&($("#sessiontimer aside").hasClass("ng-hide")||(t+=70));this.unfix=function(){u[0].style.removeProperty("position");u[0].style.removeProperty("width");u[0].style.removeProperty("top");u[0].style.removeProperty("left");u[0].style.removeProperty("padding-left");u[0].style.removeProperty("padding-right")};this.determinePosition=function(){var f,v;if(l&&r+t<=a)if(f=window.pageYOffset||k.scrollTop,c==="margin")f>=e-t?(v=f-e+t+n,v=Math.min(p,v),u.css("marginTop",v)):u.css("marginTop",n);else if(f>=e-t&&f<h+w-r){if(!o){o=!0;s=!0;var y=u.outerWidth(),b=u.offset().left,d=u.css("padding-left"),g=u.css("padding-right");u.css({position:"fixed",top:n,left:b,width:y,paddingLeft:d,paddingRight:g,marginTop:n})}}else o&&(i.unfix(),f<e-t?(s=!1,u.css({marginTop:n})):(s=!0,v=h-r+n,u.css({marginTop:v})),o=!1)};this.takeMeasurements=function(){clearTimeout(i.resizeTimeout);i.resizeTimeout=setTimeout(function(){n===undefined&&(n=parseInt(u.css("marginTop")));c==="margin"&&u.css({marginTop:n,position:"relative","z-index":8});a=window.innerHeight;v=u.position().top;r=u.outerHeight();y=u.closest(".container").height();p=y-r-v;h=u.parent().outerHeight();w=u.parent().offset().top;s||(e=u.offset().top);l=!0;i.determinePosition()},50)};b=setInterval(function(){u.outerHeight()>2&&(clearTimeout(b),i.takeMeasurements())},50)}if(!i.isMobile){var e=new s,o=e.id+"-sticky";i[o]=e;i.globalOnScrollFunctions||(i.globalOnScrollFunctions=[]);i.globalOnScrollFunctions.push(i[o]);i.globalOnScroll||(i.globalOnScroll=function(){n.forEach(i.globalOnScrollFunctions,function(n){n.determinePosition()})},t.onscroll=i.globalOnScroll);i.$on("haStickyResize",function(){e.takeMeasurements()});r.$watch(function(){return u.outerHeight()},function(){e.takeMeasurements()});r.$watch(function(){return window.document.body.scrollHeight},function(n){n&&e.takeMeasurements()});window.addEventListener("resize",e.takeMeasurements)}}}}]);t.directive("haStickyFooter",["$window","$rootScope","$timeout",function(t,i){return{restrict:"A",link:function(r,u,f){function s(){var s=this,n=!1,t=u.children(),i,r,h=f.id,e=0,o;$("[ha-sticky-footer]").each(function(){$(this).is(":visible")&&$(this).attr("id")!==h&&(e+=$(this).children().height())});this.determinePosition=function(){var f=u.offset().top,o=window.pageYOffset+i-r;o<f?n||(t.css({position:"fixed",bottom:e,left:0,right:0,zIndex:50}),n=!0,t.addClass("fixed")):n&&(t.css({position:"static"}),n=!1,t.removeClass("fixed"))};o=setInterval(function(){u.outerHeight()>2&&(clearTimeout(o),i=window.innerHeight,r=u.outerHeight(),s.determinePosition())},50)}var e=new s,o="stickyFooter-"+e.id;i[o]=e;i.globalOnScrollFunctions||(i.globalOnScrollFunctions=[]);i.globalOnScrollFunctions.push(i[o]);i.globalOnScroll||(i.globalOnScroll=function(){n.forEach(i.globalOnScrollFunctions,function(n){n.determinePosition()})},t.onscroll=i.globalOnScroll);i.$on("haStickyResize",function(){e.determinePosition()});r.$watch(u.outerHeight(),function(){e.determinePosition()});window.addEventListener("resize",e.determinePosition)}}}])}(angular),function(n){"use strict";var t=n.module("haElementDirectivesModule",[]);t.directive("select",["$interval","$timeout",function(n,t){return{restrict:"E",link:function(i,r){var u,f;$("html").hasClass("lte-ie9")&&(r.children("option").length<=1?(f=0,u=n(function(){f++;r.children("option").length>1&&(n.cancel(u),r.width(r.css("width")));f>40&&n.cancel(u)},50)):t(function(){r.width(r.css("width"))},50))}}}])}(angular),function(n){"use strict";var t=n.module("haClearDataModule",[]);t.directive("haClearData",[function(){return{scope:{haClearData:"="},link:function(n,t){var i=$(t);n.$watch("haClearData",function(n){n?i.addClass("clearable"):i.removeClass("clearable")});i.click(function(){n.haClearData="";n.$apply()})}}}])}(angular),function(n){"use strict";var t=n.module("haRangeModule",[]);t.directive("haRange",["$window","haConfig",function(n,t){var i=function(t,i){t.internalStart=t.start||t.min;t.internalEnd=t.end||t.max;var u=i.find(".slider")[0],r=n.noUiSlider.create(u,{start:[t.internalStart,t.internalEnd],connect:!0,range:{min:t.min||0,max:t.max||100},step:1});r.on("slide",function(){var n=r.get();t.internalStart=parseInt(n[0]);t.internalEnd=parseInt(n[1]);t.$apply()});r.on("change",function(){var n=r.get();t.internalStart=t.start=parseInt(n[0]);t.internalEnd=t.end=parseInt(n[1]);t.$apply()});t.inputChanged=function(){var n=[t.internalStart,t.internalEnd];r.set(n);t.start=t.internalStart;t.end=t.internalEnd};t.$watchCollection("[start, end]",function(){t.start=t.start||t.min;t.end=t.end||t.max;t.start=Math.max(Math.min(t.start,t.end),t.min);t.end=Math.min(Math.max(t.start,t.end),t.max);t.internalStart=t.start;t.internalEnd=t.end;r.set([t.start,t.end])});t.$watchCollection("[min, max]",function(n){if(n[0]=isNaN(parseInt(n[0]))?0:parseInt(n[0]),n[1]=isNaN(parseInt(n[1]))?0:parseInt(n[1]),!(n[0]>=n[1])){var i=r.get(),u,f;n[0]>=i[1]||n[1]<=i[0]?(u=n[0],f=n[1]):(u=Math.max(n[0],i[0]),f=Math.min(n[1],i[1]));t.internalStart=t.start=u;t.internalEnd=t.end=f;r.set([u,f]);r.updateOptions({range:{min:n[0],max:n[1]},step:1})}})};return{scope:{start:"=",end:"=",min:"=",max:"="},link:i,templateUrl:t.getTemplateUrl("ha-range-base-template.html")}}])}(angular),function(n){"use strict";var t=n.module("haTableReflowModule",[]);t.directive("haTableReflow",["$timeout","$compile",function(t,i){return{restrict:"A",scope:!1,link:function(r,u){function e(n){var u=n.find("thead"),e=n.find("tbody"),r=[];u.find("th").each(function(){var t=$(this).attr("i18n-content"),n;t?r.push('<b class="cell-label" i18n-content="'+t+'"><\/b>'):(n=$(this).html(),n?r.push('<b class="cell-label">'+n+"<\/b>"):r.push('<b class="cell-label">&nbsp;<\/b>'))});e.find("tr").each(function(){$(this).find("th,td").each(function(n){$(this).find(".cell-label").remove();r[n]?$(this).prepend(i(r[n])($(this).scope())):$(this).prepend('<b class="cell-label">&nbsp;<\/b>')})});t(function(){f(n)},0)}function f(n){var t=n.find("tbody");t.find("tr").each(function(){$(this).find("td").each(function(){$(this).css("height","auto");var n=$(this).find(".cell-label").height(),t=$(this).height();n>t?$(this).height(n):$(this).height(t)})})}r.$root.isMobile&&t(function(){var i=[],o;u.find("[ng-repeat]").each(function(){for(var r,u=$(this).attr("ng-repeat"),t=u.split(" "),n=0;n<t.length;n++)if(t[n]==="in"){r=t[n+1];i.indexOf(r)===-1&&i.push(r);break}});n.forEach(i,function(n){r.$watchCollection(n,function(){e(u)})});$(window).on("resize orientationchange",function(){o&&t.cancel(o);o=t(function(){f(u)},100)})},0)}}}])}(angular),function(n){"use strict";var t=n.module("haDisableOnClickModule",[]);t.directive("haDisableOnClick",["$timeout","$window",function(n,t){function i(i,r,u){var f=u.white!==undefined?"white ":"",e='<div class="ha-loading-spinner '+f+'small"><div><div><\/div><\/div><\/div>';i.disableHref=function(){if(!i.hrefIsDisabled&&!!u.href){var f=u.href;i.hrefIsDisabled=!0;r.append(e).focus().attr("href","#");n(function(){t.location=f;n(function(){r.attr("href",f);i.hrefIsDisabled=!1},6e4)},300)}};r.on("$destroy",function(){i.hrefIsDisabled=!1})}return{restrict:"A",link:i,scope:!0,template:'<a ng-mouseup="disableHref()" ng-transclude><\/a>',transclude:!0,replace:!0}}])}(angular),function(n){"use strict";var t=n.module("haLaunchDarklyModule");t.directive("launchDarklyFeature",["haLaunchDarklyService",function(n){return{restrict:"A",link:function(t,i,r){var u=t.$eval(r.launchDarklyFeature),f=u.useCache==undefined||u.useCache!==!0?!1:!0;i.addClass("hidden");n.GetFlagVariant(u.key,u.type,u.variant,f).then(function(n){n.data==="DISABLED"&&i.remove();n.data==="ENABLED"&&i.removeClass("hidden")},function(n){console.error("Launch Darkly Error: "+n+"\tKEY: "+u.key);i.remove()})}}}])}(angular),function(n){"use strict";var t=n.module("haTimedHideModule",["ngCookies"]),i="HA_TIMED_HIDE_";t.directive("haTimedHide",["$cookies",function(n){return{restrict:"A",scope:!0,link:function(t,r,u){var f=parseInt(u.hideMinutes),o,e;if(f=isNaN(f)?0:f,o=u.hideId,!o){r.addClass("shown");console.log("No id for ha-timed-hide");return}e=i+o;n.get(e)?n.get(e)!=f&&(n.remove(e),r.addClass("shown")):r.addClass("shown");t.timedClose=function(){if(r.removeClass("shown"),f&&o){var t=new Date;t.setMinutes(t.getMinutes()+f);n.put(e,f,{expires:t,path:"/"})}}}}}])}(angular),function(n){"use strict";var t=n.module("haResponsiveAttributeModule",[]);t.directive("haResponsiveAttribute",["$window","$parse",function(t,i){return{restrict:"A",link:function(r,u,f){var s=f.attributeName,h=f.baseValue,e=i(f.breakpoints)(),o=function(){for(var i=t.innerWidth,r=1,n=0;n<e.length;n++)if(i>e[n][0]&&i<e[n][1]){r=e[n][2];break}u.css(s,"calc("+h+" * "+r+")")};o();n.element(t).on("resize",o);r.$on("$destroy",function(){n.element(t).off("resize",o)})}}}])}(angular),function(n){"use strict";var t=n.module("haLocalizeNameModule",[]);t.filter("localName",[function(){var n={en:"{{ firstName }} {{ lastName }}","en-au":"{{ firstName }} {{ lastName }}","en-nz":"{{ firstName }} {{ lastName }}","zh-cn":"{{ lastName }} {{ firstName }}","ko-kr":"{{ lastName }} {{ firstName }}","ja-jp":"{{ lastName }} {{ firstName }}","zh-tw":"{{ lastName }} {{ firstName }}"};return function(t,i,r){if(n[r]){var u=n[r].replace(/\{\{ firstName \}\}/,t);return u.replace(/\{\{ lastName \}\}/,i)}}}])}(angular),function(n){"use strict";var t=n.module("haLocalizeDateModule",[]);t.filter("localDate",["$filter",function(n){var t={en:"EEE M/d","en-au":"EEE M/d","en-nz":"EEE M/d","zh-cn":"M月d日 EEE","ko-kr":"M월 d일 EEE","ja-jp":"M月d日(EEE)","zh-tw":"M月d日 EEE"};return function(i,r){var u=new Date,f=n("date");if(t[r])return u=i instanceof Date?i:new Date(i),f(u,t[r])}}]);t.filter("localShortDate",["$filter",function(n){var t={en:"MM/dd/yyyy","en-au":"MM/dd/yyyy","en-nz":"MM/dd/yyyy","zh-cn":"yyyy/MM/dd","ko-kr":"yyyy/MM/dd","ja-jp":"yyyy/MM/dd","zh-tw":"yyyy/MM/dd"};return function(i,r){var f=new Date,e=n("date"),u;if(t[r])return i instanceof Date?f=i:/^\d{4}-\d{1,2}-\d{1,2}/gi.test(i)?(u=i.split("T")[0].split("-"),f=u.length===3?new Date(parseInt(u[0],10),parseInt(u[1],10)-1,parseInt(u[2],10)):new Date):f=new Date(i),e(f,t[r])}}]);t.filter("dateWithDayButNoYear",["$filter",function(n){var t="EEE, MMM d",i={en:"EEE, MMM d","en-au":"EEE, MMM d","en-nz":"EEE, MMM d","zh-cn":"M月d日 EEE","ko-kr":"M월 d일 EEE","ja-jp":"M月d日(EEE)","zh-tw":"M月d日 EEE"};return function(r,u){return n("date")(r,i[u]||t)}}]);t.filter("localShortDateWithMonthandDay",["$filter",function(n){var t="MMM d",i={en:"MMM d","en-au":"MMM d","en-nz":"MMM d","zh-cn":"M月d日","ko-kr":"M월 d일","ja-jp":"M月d日","zh-tw":"M月d日"};return function(r,u){return n("date")(r,i[u]||t)}}]);t.filter("localTime",["$filter",function(n){var t="hh:mma",i={en:"h:mma","en-au":"h:mma","en-nz":"h:mma","zh-cn":"H:mm","ko-kr":"H:mm","ja-jp":"H:mm","zh-tw":"H:mm"};return function(r,u){return n("date")(r,i[u]||t)}}]);t.filter("localFullDateAbbreviated",["$filter",function(n){var t="EEE MMM d,yyyy",i={en:"EEE MMM d,yyyy"};return function(r,u){return n("date")(r,i[u]||t)}}])}(angular),function(n){"use strict";var t=n.module("haCurrencyModule",[]);t.filter("localCurrency",["$compile",function(){var i={USD:' <span class="currency-type">USD<\/span>',AUD:' <span class="currency-type">AUD<\/span>',NZD:' <span class="currency-type">NZD<\/span>',TWD:'<span class="currency-type">NT<\/span>',MILES:' <span class="currency-type">'+n.element("#SC_MilesText_Display").html()+"<\/span>"},t={USD:'<span class="currency-symbol">$<\/span>{{ amount }}{0}',AUD:'<span class="currency-symbol">$<\/span>{{ amount }}{0}',NZD:'<span class="currency-symbol">$<\/span>{{ amount }}{0}',CNY:'<span class="currency-symbol">¥<\/span>{{ amount }}',KRW:'<span class="currency-symbol">₩<\/span>{{ amount }}',JPY:'<span class="currency-symbol">¥<\/span>{{ amount }}',TWD:'{0}<span class="currency-symbol">$<\/span>{{ amount }}',MILES:"{{ amount }}{0}"},r=function(n){var t=n.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")},u=function(t,i){return t>-1?i+" "+n.element("#MoreText").val():i.replace(/-([1-9]+)/g,function(n,t){return t})+" "+n.element("#LessText").val()},f=function(n,t){return t==="CNY"?Math.ceil(n/10)*10:t==="KRW"||t==="JPY"?Math.ceil(n/100)*100:Math.ceil(n)};return function(n,e,o,s,h,c,l,a){var v,y,p,w;return e&&!o&&(o="USD AUD NZD".indexOf(e.toUpperCase())===-1),v=h?n:o?l?f(n,e):Math.round(n):(Math.round(n*100)/100).toFixed(2),typeof v!="undefined"&&v!=null&&(y=r(v)),e==="MILES"&&(y=y.split(".")[0]),t[e]?(p=t[e].format(c?"":i[e]||""),e!="USD"||a||(p=t[e].format("")),w=p.replace(/\{\{.*\}\}/,y),s?u(n,w):w):void 0}}]);t.filter("superCurrency",["$log","$filter","$locale","$sce",function(n,t,i,r){var u={USD:'<span class="currency-symbol">$<\/span><span class="currency-dollars">{{ dollars }}<\/span><span class="currency-cents">{{ cents }}<\/span>',AUD:'<span class="currency-symbol">$<\/span><span class="currency-dollars">{{ dollars }}<\/span><span class="currency-cents">{{ cents }}<\/span> <span class="currency-type">AUD<\/span>',NZD:'<span class="currency-symbol">$<\/span><span class="currency-dollars">{{ dollars }}<\/span><span class="currency-cents">{{ cents }}<\/span> <span class="currency-type">NZD<\/span>',CNY:'<span class="currency-symbol">¥<\/span><span class="currency-dollars">{{ dollars }}<\/span><span class="currency-cents">{{ cents }}<\/span>',KRW:'<span class="currency-symbol">₩<\/span><span class="currency-dollars">{{ dollars }}<\/span><span class="currency-cents">{{ cents }}<\/span>',JPY:'<span class="currency-symbol">¥<\/span><span class="currency-dollars">{{ dollars }}<\/span><span class="currency-cents">{{ cents }}<\/span>',TWD:'<span class="currency-type">NT<\/span><span class="currency-symbol">$<\/span><span class="currency-dollars">{{ dollars }}<\/span><span class="currency-cents">{{ cents }}<\/span>'},f=function(n,t,i){var f=u[n].replace("{{ dollars }}",t).replace("{{ cents }}",i);return r.trustAsHtml(f)};return function(n,r,u){r=r||"USD";var s=i.NUMBER_FORMATS,e=t("currency")(n,""),h=e.substring(0,e.indexOf(s.DECIMAL_SEP)),o=e.substring(e.indexOf(s.DECIMAL_SEP));return u===!0&&(o=""),u==="roundPrice"&&(n>=1||n<=-1)&&(o=""),u==="roundSavings"&&(n>=1||n<=-1)&&(o=""),f(r,h,o)}}]);t.filter("noFractionCurrency",["$filter","$locale",function(n,t){var i=n("currency"),r=t.NUMBER_FORMATS;return function(n,t){var u=i(n,t),f=u.indexOf(r.DECIMAL_SEP);return u.substring(0,f)}}]);t.directive("wholeCurrency",function(){return{require:"ngModel",link:function(n,t,i,r){function e(n){if(n){if(n=n+"",n.match(/\d/g)){var t=Number(n.match(/\d/g).join("")).toFixed(),i=f[u]+""+t;return i!=n&&(r.$setViewValue(i),r.$render()),parseInt(t)}return f[u]!=n&&(r.$setViewValue(f[u]),r.$render()),0}}function o(n){return f[u]+n}var u=n.$root.$currency,f={USD:"$",AUD:"$",NZD:"$",CNY:"¥",KRW:"₩",JPY:"¥",TWD:"NT$"};r.$parsers.unshift(e);r.$formatters.unshift(o)}}})}(angular),function(n){"use strict";var t=n.module("currencyNoDecimalsFilter",[]);t.filter("currencyNoDecimalsFilter",["$filter","$locale",function(n,t){var i=n("currency"),r=t.NUMBER_FORMATS;return function(n,t){var u=i(n,t),f=u.indexOf(r.DECIMAL_SEP);return n>=0?u.substring(0,f):u.substring(0,f)+")"}}])}(angular),function(n){"use strict";var t=n.module("addIconFilter",[]);t.filter("addIconFilter",["$filter",function(){return function(n,t){var i='<i class="ha-icon '+t+'"><\/i>';return n.replace("[icon]",i)}}])}(angular),function(n){"use strict";var t=n.module("haRoundingFiltersModule",[]);t.filter("roundPrice",[function(){return function(n){return n>1||n<-1?Math.ceil(n):n}}]);t.filter("roundSavings",[function(){return function(n){return n>1||n<-1?Math.floor(n):n}}])}(angular),function(n){"use strict";var t=n.module("uinqueFilter",[]);t.filter("unique",[function(){return function(t,i){var r=[],u=[];return n.forEach(t,function(n){var t=n[i];u.indexOf(t)===-1&&(u.push(t),r.push(n))}),r}}])}(angular),function(n){"use strict";var t=n.module("haDurationModule",[]);t.filter("formatMinutes",[function(){return function(n){var t=Math.floor(n/60);n=n%60;var i=t?t+"h":"",r=n?n+"m":"",u=i+" "+r;return u.trim()}}]);t.filter("formatTimeString",[function(){return function(n){var t=n.split(":");if(t.length<=1)return n;var i=Number(t[0]),r=Number(t[1]),u=i?i+"h":"",f=r?r+"m":"",e=u+" "+f;return e.trim()}}])}(angular),function(n){"use strict";var t=n.module("TitleCaseModule",[]);t.filter("TitleCase",[function(){return function(n){return n.toLowerCase().split(" ").map(function(n,t){return(n=="or"||n=="and"||n=="but")&&t!=0?n:n.charAt(0).toUpperCase()+n.slice(1)}).join(" ")}}])}(angular),function(n){"use strict";var t;try{t=n.module("haAncillariesModule")}catch(i){t=n.module("haAncillariesModule",["haHttpService","haFeatureFlagsModule"])}t.directive("haAncillaries",function(){return{restrict:"A",scope:!0,controller:"haAncillariesCtrl as Ancillaries"}});t.config(["haFeatureFlagsProvider",function(n){n.setDefault("AncillariesTimeoutMs",2e4);n.setDefault("HotelListTimeoutMs",2e4);n.setDefault("HotelRepriceTimeoutMs",2e4);n.setDefault("CarRentalForOneWayTimeoutMs",1e4)}]);t.controller("haAncillariesCtrl",["$log","$scope","haGlobals","haHotelCommonService","haAncillariesSvc","haFeatureFlags","$rootScope",function(t,i,r,u,f,e,o){function w(t,r){if(i.rentalCarsData=i.ancillariesData.RentalCars=t?t:undefined,i.HasRentalCarsData=r||t&&t.DisplayCount>0,t){var u=t.CarList||[],f=t.CarListForInitialDisplay||[];n.forEach(u.concat(f),function(n){n.Vendor.ImageUrl=n.Vendor.ImageUrl.replace("/vendor","/vendor/large")})}}var a={loading:!0,error:!1},l=window.eligibleAncillaries,h=window.HA.messages,y,p;if(!l||!l.length){a.loading=!1;return}var s=[],c=function(n){return l.some(function(t){return t.Description===n})},v=moment();return c(h.vacationPkgString)&&(i.TripSummary.SelectedHotel===null&&document.body.dispatchEvent(new CustomEvent("VacationPackageEligible")),s.push("1")),c(h.rentalCarString)&&(document.body.dispatchEvent(new CustomEvent("RentalCarEligible")),s.push("2")),c(h.shuttleHnlString)&&s.push("3"),c(h.shuttleLasString)&&s.push("4"),c(h.leiGreetingString)&&s.push("5"),c(h.tripInsuranceString)&&s.push("6"),y=i.$parent.selectedSegments.length>1?e.get("AncillariesTimeoutMs"):e.get("CarRentalForOneWayTimeoutMs"),f.getAncillariesAsync(s,y).then(function(n){var h,y;document.body.dispatchEvent(new CustomEvent("AncillaryResponseTime",{detail:{time:moment().diff(v,"milliseconds")}}));t.debug("ancillary response time: "+moment().diff(v,"milliseconds"));var u=n["1"]?n["1"].state:undefined,r=u==="fulfilled"&&n["1"].value.data.success?n["1"].value.data.ancillary:undefined,f=n["2"]?n["2"].state:undefined,o=f==="fulfilled"&&n["2"].value.data.success?n["2"].value.data.ancillary:undefined,c=~s.indexOf("3")?n["3"].state:~s.indexOf("4")?n["4"].state:undefined,l=~s.indexOf("3")&&n["3"].state==="fulfilled"&&n["3"].value.data.success?n["3"].value.data.ancillary:undefined,a=~s.indexOf("4")&&n["4"].state==="fulfilled"&&n["4"].value.data.success?n["4"].value.data.ancillary:undefined,e=l?l:a?a:undefined;u==="rejected"||!r&&u?(t.error("Vacation package failure when eligible"),document.body.dispatchEvent(new CustomEvent("EligibleVacationPackageError")),window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("Hot_Res_SchFail",1)):u==="fulfilled"&&r&&r.HotelSolutions&&r.HotelSolutions[0]?window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("Hot_Res_Search",1):u==="fulfilled"&&r&&r.HotelSolutions.length==0&&window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("Hot_Res_SchFail",1);f==="rejected"||!o&&f?(t.error("Rental Car failure when eligible"),window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("CarsLoadFailed",1),document.body.dispatchEvent(new CustomEvent("EligibleRentalCarError"))):f==="fulfilled"&&o&&window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("CarsLoaded",1);c==="rejected"||(~s.indexOf("3")||~s.indexOf("4"))&&!e?(t.error("Shuttle failure when eligible"),window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("ShtlLoadFailed",1),document.body.dispatchEvent(new CustomEvent("EligibleShuttleError"))):c==="fulfilled"&&e&&window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("ShuttleLoaded",1);i.ancillariesData={OrbitzPackage:r===null?undefined:r,AirportShuttle:e===null?undefined:e};h=i.ancillariesData.OrbitzPackage&&i.ancillariesData.OrbitzPackage.HotelSolutions.length;y=i.ancillariesData.AirportShuttle&&i.ancillariesData.AirportShuttle.shuttleDetails.isEligible;i.HasHotelData=h;i.$on("hidehoteldetails",function(){i.HasHotelData=!1});i.$on("showhoteldetails",function(){i.ancillariesData.OrbitzPackage.HotelSolutions.length&&(i.HasHotelData=!0)});w(o);i.HasAirportShuttleData=y;i.airportShuttleData=i.ancillariesData.AirportShuttle;h&&i.TripSummary.SelectedHotel!=null&&window.isExpediaEnabled&&(i.HasRentalCarsData=!1,i.HasAirportShuttleData=!1);(i.TripSummary.SelectedShuttleDetails!=null||i.TripSummary.SelectedCar.LastName!=null)&&(i.HasHotelData=!1);i.$emit("ancillariesOffered",{rentalCar:i.HasRentalCarsData&&(i.TripSummary.SelectedCar===null||!i.TripSummary.SelectedCar.LastName),airportShuttle:i.HasAirportShuttleData&&i.TripSummary.SelectedShuttleDetails===null,hotels:i.ancillariesData.OrbitzPackage&&i.ancillariesData.OrbitzPackage.HotelSolutions.length&&i.TripSummary.SelectedHotel===null})},function(){l.length&&(t.error("No ancillaries eligible"),document.body.dispatchEvent(new CustomEvent("NoAncillariesOfferedWhenEligible")))}).finally(function(){a.loading=!1}),p=function(){var n=null;switch(o.user.haMilesEliteStatus){case"PLT":n=$scs.get("Car_Ancillary.specialoffertextplatinum");break;case"GLD":n=$scs.get("Car_Ancillary.specialoffertextgold");break;case"PRM":n=$scs.get("Car_Ancillary.specialoffertextbasic");break;case"HML":n=$scs.get("Car_Ancillary.specialoffertextbasic");break;default:n=$scs.get("Car_Ancillary.specialoffertextnonmember")}return n},i.$on("ancillariesOffered",function(n,t){var r=location.href;/book\/itinerary/i.test(r)&&(t.rentalCar&&(document.body.dispatchEvent(new CustomEvent("RentalCarOffered")),p().then(function(n){i.ABGOfferText=n})),t.airportShuttle&&document.body.dispatchEvent(new CustomEvent("ShuttleServiceOffered")),t.hotels&&document.body.dispatchEvent(new CustomEvent("VacationPackageOffered")))}),i.searchCarRentals=function(n){return f.searchCarRentals(n).then(function(n){return w(n.data.ancillary,!0),n.data})},a}])}(angular),function(n){"use strict";var i,t;try{i=n.module("haAncillariesModule")}catch(r){i=n.module("haAncillariesModule",["haHttpService","haFeatureFlagsModule"])}t=function(n){return n.replace(/Z$/,"")};i.directive("haAncillariesRentalCar",function(){return{restrict:"A",scope:!0,controller:"haAncillariesRentalCarCtrl as ctrl"}});i.controller("haAncillariesRentalCarCtrl",["$q","$log","$scope","$rootScope","$window","$templateCache","haModal","haAncillariesSvc","haPaymentTypesService","haCitiesSvc","haSitecoreStrings","haTravelersAPI","haUtils",function(i,r,u,f,e,o,s,h,c,l,a,v,y){function d(n){return n.Address?i.resolve(n):l.getCarLocationById(n.LocationCode).then(function(t){return n.Address=t.address,n.Airport=t.airport,n})}var w=function(n){if(n!=="jsError")switch(n.code){case"SessionTimeOut":window.location.href="/book/error?ErrorType=SessionTimeOut";break;default:if(n.code!==undefined)window.location.href=n.RedirectURL;else return!1}else window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"},b=function(n){switch(n){case"add":document.body.dispatchEvent(new CustomEvent("RentalCarAdded"));break;case"remove":document.body.dispatchEvent(new CustomEvent("RentalCarRemoved"))}},k,p;return a.get("Car_Ancillary").then(function(n){u.scContent=n}),k=function(){var n="";switch(f.user.haMilesEliteStatus){case"PLT":n=u.scContent.specialoffermodaltextplatinum;break;case"GLD":n=u.scContent.specialoffermodaltextgold;break;case"PRM":n=u.scContent.specialoffermodaltextbasic;break;case"HML":n=u.scContent.specialoffermodaltextbasic;break;default:n=u.scContent.specialoffermodaltextnonmember}return n},p={rentalCars:null,agencies:[],classes:[],sortBy:"PRICE",selectCar:function(n){r.debug("Select",n)},showRentalCarsModal:function(){var n=f.$new(!0,u);n.ctrl=p;n.rentalCars=p.rentalCars.CarList;n.agencies=p.agencies;n.classes=p.classes;n.pickup=_.extend(p.rentalCars.PickUpLocation,{date:moment(p.rentalCars.StartDate).toDate()});n.dropoff=_.extend(p.rentalCars.DropLocation,{date:moment(p.rentalCars.EndDate).toDate()});n.ABGOfferModalText=k();s({id:"RentalCarsModal",backdrop:"true",scope:n,template:o.get("RentalCarsModal.html")})},showReserveVehicleModal:function(t){i.all([l.getCarLocationById(t.PickUpLocation.LocationCode),l.getCarLocationById(t.DropLocation.LocationCode)]).then(function(i){var r=f.$new(!0,u);t.PickUpLocation.Address=i[0].address;t.PickUpLocation.Airport=i[0].airport;t.DropLocation.Address=i[1].address;t.DropLocation.Airport=i[1].airport;r.car=t;r.ctrl=p;r.hasInvalidPax=!1;f.isLoggedIn&&v.GetTravelers("self").then(function(n){n.data.TravelersList.forEach(function(n){n.HMAccountNo===f.user.haMiles&&(r.car.FirstName=n.FirstName,r.car.LastName=n.LastName,r.car.HMNumber=n.HMAccountNo)})});r.doReserve=function(){r.validatePax(t)?h.addRentalCar(t).then(function(){r.hasInvalidPax=!1;u.TripSummary.SelectedCar=t;u.TripSummary.HasSelectedCar=!0;b("add");r.$modalCancel();window.isExpediaEnabled&&!window.enableAncillariesForExpedia&&f.$broadcast("hidehoteldetails")},w):(ReserveVehicleForm.$dirty=!0,r.hasInvalidPax=!0)};r.validatePax=function(t){var i=!0;return n.forEach(u.TripSummary.Passengers,function(n){t.FirstName.toLowerCase()===n.FirstName.toLowerCase()&&t.LastName.toLowerCase()===n.LastName.toLowerCase()&&n.Type.toLowerCase()==="child"&&(i=!1)}),i};s({id:"ReserveVehicleModal",backdrop:"true",scope:r,template:o.get("ReserveVehicleModal.html")})})},showFAQ:function(){s({id:"RentalCarFaqModal",backdrop:"true",template:o.get("RentalCarFaqModal.html")})},showTerms:function(n){var t=f.$new(!0,u);t.car=n;t.ctrl=p;t.terms={};t.showTermsfromCT=!1;t.showTermsError=!1;h.getRentalTerms(n).then(function(n){n!=null&&(t.terms=n,t.showTermsfromCT=!0)},function(n){r.error("getRentalTerms",n);t.showTermsError=!0});s({id:"RentalCarTermsModal",backdrop:"true",scope:t,template:o.get("RentalCarTermsModal.html")})},showRemoveRentalCarModal:function(){var n=f.$new(!0,u);n.doRemove=function(){h.removeRentalCar(u.TripSummary.SelectedCar).then(function(){b("remove");u.TripSummary.SelectedCar=null;u.TripSummary.HasSelectedCar=!1;c.updatePaymentTypes();f.$broadcast("ancelaryStateChange");window.isExpediaEnabled&&!window.enableAncillariesForExpedia&&f.$broadcast("showhoteldetails")},w)};s({id:"RemoveRentalCarModal",backdrop:"true",scope:n,template:o.get("RemoveRentalCarModal.html")})},UpdateRentalCarDefaultLoadTimeMark:function(){if(window.performance.clearMarks("mark_end_DefLoadTime_RentalCar"),window.performance.mark("mark_end_DefLoadTime_RentalCar"),window.performance.getEntriesByName("mark_end_DefLoadTime_RentalCar")&&window.performance.getEntriesByName("mark_end_DefLoadTime_RentalCar")[0]){var n=window.performance.getEntriesByName("mark_end_DefLoadTime_RentalCar")[0].startTime;window.BOOMR&&BOOMR.version&&window.BOOMR.sendTimer("CTDefault_Timer",n)}},redirectToCarSupplierSite:function(){var n=u.scContent.supplierloyaltywebsiteurl,t=u.scContent.supplierpartnerid,i=u.TripSummary.SelectedCar.SupplierConfirmationCode,r=u.TripSummary.SelectedCar.LastName,f=y.getLocale(u.$root.$language),e={pid:t,profileAddition:!0,locale:f,lastName:r,confNumber:i},n=u.scContent.supplierloyaltywebsiteurl;n+=y.createQueryString(e);window.location.href=n},scrollToReservedCar:function(){var n=document.getElementById("carRentalData"),t;n&&(t=n.offsetTop,window.scrollTo(0,t))}},u.getLocationDetails=function(n){return i.all([d(n.PickUpLocation),d(n.DropLocation)]).then(function(){return n})},u.$watch("rentalCarsData",function(i){var u,r,o,s,f,e;if(p.rentalCars=i,p.tripType=i&&i.TripType,i!=null&&i.CarListForInitialDisplay!=null)for(u=0;u<i.CarListForInitialDisplay.length;u++)r=i.CarListForInitialDisplay[u],r.PickUpDateTime=t(r.PickUpDateTime),r.ReturnDateTime=t(r.ReturnDateTime);if(i!=null&&i.CarList!=null){for(o={},s={},u=0;u<i.CarList.length;u++)r=i.CarList[u],f=r.Vendor,e=r.Vehicle,f&&f.Name&&f.Name!==""&&(o[f.Name]=f),e&&e.Class&&e.Class!==""&&(s[e.Class]=e.Class),r.PickUpDateTime=t(r.PickUpDateTime),r.ReturnDateTime=t(r.ReturnDateTime);p.agencies=[];n.forEach(o,function(n){p.agencies.push(n)});p.classes=[];n.forEach(s,function(n){p.classes.push(n)})}}),p}])}(angular),function(n){"use strict";var t;try{t=n.module("haAncillariesModule")}catch(i){t=n.module("haAncillariesModule",["haHttpService","haFeatureFlagsModule"])}t.directive("haAncillariesAirportShuttle",function(){return{restrict:"A",scope:!0,controller:"haAncillariesAirportShuttleCtrl as ctrl"}});t.controller("haAncillariesAirportShuttleCtrl",["$log","$scope","$rootScope","$window","$templateCache","haModal","haAncillariesSvc","haPaymentTypesService",function(n,t,i,r,u,f,e,o){var h=function(n){if(n!=="jsError")switch(n.code){case"SessionTimeOut":window.location.href="/book/error?ErrorType=SessionTimeOut";break;default:if(n.code!==undefined)window.location.href=n.RedirectURL;else return!1}else window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"},c=function(n){switch(n){case"add":document.body.dispatchEvent(new CustomEvent("AirportShuttleAdded"));break;case"remove":document.body.dispatchEvent(new CustomEvent("AirportShuttleRemoved"))}},s={AirportShuttle:null,addAirportShuttle:function(){e.addAirportShuttle(s.AirportShuttle).then(function(n){n&&(t.TripSummary.SelectedShuttleDetails=s.AirportShuttle,t.TripSummary.IsAirportShuttleSelected=!0,c("add"),i.$broadcast("ancelaryStateChange"),window.isExpediaEnabled&&!window.enableAncillariesForExpedia&&i.$broadcast("hidehoteldetails"))},h)},showRemoveAirportShuttleModal:function(){var n=i.$new(!0,t);n.doRemove=function(){e.removeAirportShuttle().then(function(){t.TripSummary.SelectedShuttleDetails=null;t.TripSummary.IsAirportShuttleSelected=!1;o.updatePaymentTypes();c("remove");i.$broadcast("ancelaryStateChange");window.isExpediaEnabled&&!window.enableAncillariesForExpedia&&i.$broadcast("showhoteldetails")},h)};f({id:"RemoveAirportShuttleModal",backdrop:"true",scope:n,template:u.get("RemoveAirportShuttleModal.html")})}};return t.$watch("airportShuttleData",function(n){n!=null&&(s.AirportShuttle=n.shuttleDetails)}),s}])}(angular),function(n){"use strict";var t;try{t=n.module("haAncillariesModule")}catch(i){t=n.module("haAncillariesModule",["haHttpService","haFeatureFlagsModule"])}t.directive("haAncillariesLeiGreeting",function(){return{restrict:"A",controller:"haAncillariesLeiGreetingCtrl as ctrl"}});t.controller("haAncillariesLeiGreetingCtrl",["$log","$scope","$rootScope","$window","$templateCache","haModal","haAncillariesSvc","haPaymentTypesService",function(n,t,i,r,u,f,e,o){var s=function(n){if(n!=="jsError")switch(n.code){case"SessionTimeOut":window.location.href="/book/error?ErrorType=SessionTimeOut";break;default:if(n.code!==undefined)window.location.href=n.RedirectURL;else return!1}else window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"},h=function(n){var t=/book\/payment/gi.test(location.href)?"Payment":"Confirmation";switch(n){case"add":document.body.dispatchEvent(new CustomEvent("LeiGreetingAdded"));break;case"remove":document.body.dispatchEvent(new CustomEvent("LeiGreetingRemoved"))}};return{addLeiGreeting:function(n){e.addLeiGreeting(n).then(function(i){i&&(t.TripSummary.SelectedLeiGreeting=n,t.TripSummary.isLeiGreetingsSelected=!0,o.updatePaymentTypes(),h("add"),t.$emit("ancelaryStateChange"))},s)},showRemoveLeiGreetingModal:function(){var n=i.$new(!0,t);n.doRemove=function(){e.removeLeiGreeting().then(function(){h("remove");t.TripSummary.SelectedLeiGreeting=null;t.TripSummary.isLeiGreetingsSelected=!1;o.updatePaymentTypes();t.$emit("ancelaryStateChange")},s)};f({id:"RemoveLeiGreetingModal",backdrop:"true",scope:n,template:u.get("RemoveLeiGreetingModal.html")})},showLegendOfTheLeiModal:function(){f({id:"LegendOfTheLeiModal",backdrop:"true",template:u.get("LegendOfTheLeiModal.html")})}}}])}(angular),function(n){"use strict";var t;try{t=n.module("haAncillariesModule")}catch(i){t=n.module("haAncillariesModule",["haHttpService","haFeatureFlagsModule"])}t.directive("haAncillariesTripInsurance",function(){return{restrict:"A",controller:"haAncillariesTripInsuranceCtrl as ctrl"}});t.controller("haAncillariesTripInsuranceCtrl",["$log","$scope","$rootScope","$window","$templateCache","haModal","haAncillariesSvc","haPaymentTypesService","haUtils",function(n,t,i,r,u,f,e,o){var a=/book\/payment/gi.test(location.href)?"true":"false",s,l,h,c;return a==="true"&&(s={updateAllianzQuoteResponseMetric:function(n){t.TripSummary.IsTripInsuranceEligible&&t.TripSummary.TripInsurance.QuoteID===undefined&&window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("Alnz_Quote_FL",1);t.TripSummary.IsTripInsuranceEligible&&!n&&window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("Alnz_Pt_Disp_FL",1)}}),l=/book\/Confirmation/gi.test(location.href)?"true":"false",l==="true"&&(s={updateAllianzPurchaseResFailureMetric:function(){window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("Alnz_Purchs_FL",1)}}),h=function(n){if(n!=="jsError")switch(n.code){case"SessionTimeOut":window.location.href="/book/error?ErrorType=SessionTimeOut";break;default:if(n.code!==undefined)window.location.href=n.RedirectURL;else return!1}else window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"},c=function(n){switch(n){case"add":document.body.dispatchEvent(new CustomEvent("TripInsuranceAdded"));break;case"remove":document.body.dispatchEvent(new CustomEvent("TripInsuranceRemoved"))}},t.tripInsuranceRadioButtonsDisabled=function(){return t.$switch("payment:EnableGiftCardsWhenAncillariesPresent")?!1:o.paymentMethod==="giftCard"},t.tripInsuranceRadioButtonsRequired=function(){return t.$switch("payment:EnableGiftCardsWhenAncillariesPresent")?!0:o.paymentMethod!=="giftCard"},t.addTripInsurance=function(n){e.addTripInsurance(n).then(function(n){n&&(t.TripSummary.TripInsurance=n.TripInsurance,t.TripSummary.TripInsurance.TravelStartDate!=null&&(t.TripSummary.TripInsurance.TravelStartDate=new Date(parseInt(t.TripSummary.TripInsurance.TravelStartDate.substr(6)))),t.TripSummary.TripInsurance.TravelEndDate&&(t.TripSummary.TripInsurance.TravelEndDate=new Date(parseInt(t.TripSummary.TripInsurance.TravelEndDate.substr(6)))),t.TripSummary.TripInsurance.IsTripInsuranceSelected=!0,o.updatePaymentTypes(),c("add"),t.$emit("ancelaryStateChange"))},h)},t.removeTripInsurance=function(){e.removeTripInsurance().then(function(n){t.TripSummary.TripInsurance=n.TripInsurance;t.TripSummary.TripInsurance.IsTripInsuranceSelected=!1;o.updatePaymentTypes();c("remove");t.$emit("ancelaryStateChange")},h)},t.toggleTripInsurance=function(){t.TripSummary.TripInsurance.IsTripInsuranceSelected===!1?i.addTripInsurance():i.removeTripInsurance()},s}]);t.directive("bindHtmlCompile",["$compile",function(n){return{restrict:"A",link:function(t,i,r){t.$watch(function(){return t.$eval(r.bindHtmlCompile)},function(r){i.html(r);n(i.contents())(t)})}}}])}(angular),function(n){"use strict";var t;try{t=n.module("haHotelPackagesModule")}catch(i){t=n.module("haHotelPackagesModule",["haUtilsModule","haGlobalsModule","haFeatureFlagsModule","haCurrencyModule","haAncillariesModule","haModalService","haEqualHeightModule","haPassengersService","haRoundingFiltersModule","haSitecoreModule"])}t.controller("haHotelAddedCtrl",["$log","$scope","$rootScope","$window","$templateCache","haConfig","haModal","haAncillariesSvc",function(n,t,i,r,u,f,e,o){var h=function(n){switch(n){case"remove":document.body.dispatchEvent(new CustomEvent("VacationPackageRemoved"))}},s={detailUrl:function(n){return"/Book/Itinerary/GetVacationPackageList#?hotelId="+(n.id||n.HotelId)},remove:function(n){o.removeHotel(n).then(function(){r.location.reload(!0)},function(n){c(n)})},showRemoveModal:function(n){var r=i.$new(!0,t);r.removeHotel=function(){h("remove");s.remove(n)};e(f.getTemplateUrl("RemoveHotelModal.html"),{id:"RemoveHotelModal",backdrop:"true",scope:r})}},c=function(n){if(n!=="jsError")switch(n.code){case"SessionTimeOut":window.location.href="/book/error?ErrorType=SessionTimeOut";break;default:if(n.code!==undefined)window.location.href=n.RedirectURL;else return!1}else window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"};return s}])}(angular),function(n){"use strict";function i(n,t){for(var i,u=["AC120","DC120","DC220","AC220","AIRCON","ALRMCK","ANNEX","AP","BALCON","BATH","BAY","BAYVW","BB","BCHVW","BEACH","BIDET","BP","BRKFST","BTHTEL","CANOPY","CASTLE","CB","CITYVW","COFMKR","COMPUT","CONN","CP","CRDTEL","CRIB","CRTYRD","DINNER","DOUBLE","DOWN","DWNIN","DWNOUT","EFFCY","EP","EXLEVL","FAMILY","FAP","FIRELT","FIREPL","GARDEN","GARDVW","GOLFVW","GRABBR","GRECTB","HAIR","HEAT","HNYSTE","IRON","IRONBD","JACUZ","KING","KITETT","KITFUL","LAKE","LAKEVW","LANAI","LOFT","MADSVC","MAP","MARINA","MARNVW","MDMRM","MICRWV","MINBAR","MODEM","MOVIES","MP","MTNVW","MURPHY","NWSSTD","OCEAN","OCNVW","OVRSZD","PARK","PARKVW","PHNSRV","POOLVW","QUEEN","RADIO","RECLNR","REFRIG","RIVER","RIVVW","RLWY","ROOMOR","ROOMWE","SAFDEP","SAFE","SHOWER","SICO","SINGLE","SITTNG","SLOPVW","SMKDET","SOFABD","SPRINK","STMBTH","SUITE","TDDTEL","TEL","TELEX","TERACE","THEMRM","TMPCTL","TOILET","TOWER","TPRCDR","TRNDWN","TV","TVCAB","TVRMOT","TWIN","UPSTRS","VALTCG","VCR","VIDEO","VILLA","VIP","WC","WETBAR","WTRBD","FRCLLS","CTYCTR","HSTCTY","BRKBUF","CDPLYR","DSKLMP","DVD","ELECDR","EXSTAY","MOUNT","PHSPKR","RURAL","STEKID","TVSAT","ORBBRK","SMOKING","HALF_BOARD","FULL_BOARD","BREAKFAST_BOARD","FOOD_WINE","HAMMOCK","DOUBLE_JACUZZI","BREAK_FAST","BUFFET_BREAK","SHARED_LOUNGE","SHARED_KITCHEN","WATER_PARK","SHARED_IN_BATHROOM","VERANDAH","BROBE","BTHAM","VMAIL","SHBTH","FLTSCR","WRDSK","CHDCR","CPLYRM","GRDNAR","DINRM","PHY2","PHY34","1","132","130","144","141","2058","26","2166","2544","143","1073743379","1073743378","145","2545","2381","2026","1073743291","2059","1073743371","2378","1073743370","1073743311","2370","2398","1073743284","136","3857","2399","2086","1073743373","2420","146","2423","2030","2655","2183","1073743312","2057","2653","4951","2396","4642","1073743823","1073742816","131","4315","4643","147","2150","1073743821","2034","2055","371","2421","4420","3858","2081","2575","331","4137","2162","2038","2037","1073743289","4216","4233","2180","1073743830","4321","2379","1073743704","2630","4327","139","2149","2631","1073743381","4096","1073742841","4950","4097","128","1073743828","4158","142","2397","1073743705","340","2168","4952","4948","4954","4316","4187","4098","4120","4303","1073743714","4953","312","1073743822","4162","1073743716","4132","4150","4226","4133","4104","4153","2854","2039","2054","4311","4100","1073743725","1073743713","1073743709","6147","2170","1073743826","2045","3502","4208","4143","1073743837","1073743829","4326","2044","135","1073743844","4224","2025","3501","1073743723","4183","1073743718","2559","4127","1073743707","4949","1073743824","1073743835","2389","1073743285","2571","4319","4103","2130","3911","2181","4121","4177","2035","4205","4310","1073743805","4218","4130","1073743722","4313","4302","2572","399","2402","4213","1073742840","1073742815","3982","4138","1073743734","1073743727","2036","4140","2807","1073743290","4307","4099","4135","1073743292","4126","3726","4156","1073743833","2576","2561","4147","4232","4188","1073743293","1073743732","4231","4209","4152","6148","1073742775","4308","1073743731","4129","1073743706","1073743836","4168","1073743825","4229","2573","1073743736","1073743743","1073743406","4946","5179","1073743375","1073743862","4228","4161","4304","1073743374","1073743715","4217","3923","2569","4333","1073743309","1073743569","1073743316","1073743741","1073743724","1073743806","6142","5178","4225","1073743740","4227","1073743840","4207","1073743838","4200","6140","1073743796","1073743283","1073743726","1073743752","4164","1073743745","1073743851","6143","1073743717","1073743804","1073743832","1073743733","1073743710","4191","1073743795","4206","5014","6141","5118","3856","1073743749","2837","4141","4314","1073743719","1073743735","1073743842","1073743750","4182","1073742782","1073743808","1073743761","2577","4215","4220","3924","1073743814","1073743556","1073743728","1073743799","1073743754","1073743797","2371","1073743560","1073743839","1073743742","5013","1073743794","1073743708","1073743758","1073743770","4180","2790","1073742604","1073743317","1073743744","2789","1073743737","1073743845","4945","1073743759","1073743767","1073743858","1073743779","1073743807","1073743763","4330","1073743561","1073743815","1073743843","1073743751","1073743803","1073743788","1073743558","4178","1073743776","1073743563","1073743772","1073743849","1073743768","1073743753","1073743746","1073743813","1073743847","1073743570","1073743809","1073743785","1073743760","1073743817","1073743781","1073743559","1073743810","1073743557","1073743777","1073743711","1073743762","1073743800","1073743790","1073743755","1073743729","1073743801","1073743720","1073743786","1073743769","1073743816","1073743738","1073743850","1073743771","1073743798","1073743764","1073743852","1073743856","1073743818","1073743846","1073743812","1073743564","1073743747","1073743778","1073743854","1073742865","1073743773","1073743780","1073743859","1073743782","1073743756","1073743787","1073743861","1073743789","1073743791","1073743857","1073743853","1073743880","1073742866","1073743765","1073743819","4644","6177","1073743774","1073743881"],f=["FPRKNG","PRKBUS","PRKIND","PRKNG","PRKOUT","PRKRV","PRKTRK","PRKVAL","FREE_PARKING","PRKCST","PHY50","HAC116","3861","1073742906","3862","3761","4454","2783","3863","4452","3864","2554","4450","4455","4451","4456","4453","1073743260","1073743261"],e=["DATAPT","INTHS","INTRNT","PHDATA","ORBWLS","HAC179","HAC261","HAC222","RMA207","2390","2403","1073742907","2405","2392","4348","2391","4347","4346","2393","2404","3191","3190","3179","4345","3178","1073742908","3189","2406","3188","2407","2408","3177","3176","4154","4155","1073743394","3199","1073743398","3185","1073743399","1073743395","1073743392","1073743393","3182","3184","3198","1073743397","1073743396","3197","3183","1073743402","3196","1073743401","1073743400","1073743251"],r=0;r<n.length;r++){if(i=n[r],e.indexOf(i.AmenityCode)>-1){t.internet.push(i);continue}if(f.indexOf(i.AmenityCode)>-1){t.parking.push(i);continue}if(u.indexOf(i.AmenityCode)>-1){t.room.push(i);continue}t.general.push(i)}}var t;try{t=n.module("haHotelPackagesModule")}catch(r){t=n.module("haHotelPackagesModule",["haUtilsModule","haGlobalsModule","haFeatureFlagsModule","haCurrencyModule","haAncillariesModule","haModalService","haEqualHeightModule","haPassengersService","haRoundingFiltersModule","haSitecoreModule"])}t.controller("haHotelDetailCtrl",["$log","$scope","$rootScope","$templateCache","$location","$timeout","$document","$window","$filter","haModal","haConfig","haHotelRoomService","haHotelCommonService","haAncillariesSvc","haFeatureFlags","haSitecoreStrings",function(n,t,r,u,f,e,o,s,h,c,l,a,v,y,p,w){window.scrollTo(0,0);var d=f.search().hotelId,k=[],ut=function(n){switch(n){case"add":document.body.dispatchEvent(new CustomEvent("VacationPackageAdded"))}},b={INITIAL_ROW_LIMIT:3,loadingRooms:!0,airportCode:null,destinationCity:null,hotel:null,checkIn:null,checkOut:null,travelers:[],adultTravelers:[],nights:1,description:"",fullDescription:"",amenities:{general:[],room:[],parking:[],internet:[]},visuals:[],lat:null,lon:null,rowLimit:[],checkInTraveler:[],guestPreferences:[],showGuestPrefs:!1,toggleGuestPrefs:function(){b.showGuestPrefs=!b.showGuestPrefs},showFullDescriptionModal:function(){c({id:"FullDescriptionModal",backdrop:"true",scope:t,template:u.get("FullDescriptionModal.html")})},openChangeRoomsModal:function(){a.openChangeRoomsModal()},incRowLimitTo:function(n,t,i){b.rowLimit[n]<t&&(b.rowLimit[n]+=1,e(function(){b.incRowLimitTo(n,t,i)},i))},resetRowLimit:function(n){b.rowLimit[n]=b.INITIAL_ROW_LIMIT},canAddToItinerary:function(){return k&&k.length>0},addToItinerary:function(){var t=function(t){n.error("addToItinerary(): ERROR:",t);st(t)};y.addHotel(ot(b)).then(function(n){n.Success?(ut("add"),s.location.assign("/Book/Itinerary/Index")):t(n)},t)},markerData:function(){return[{coords:b.hotel.coords}]},getFilteredSavings:function(n){var i=h("superCurrency")(n,t.$currency,"roundSavings");return w("Ancillary.savexwiththispackagetext").replace("{0}",i)},initRoomPicker:function(){var i=a,n={},u;n.rooms=i._rooms.map(function(n){return{RoomIndex:n.RoomIndex,AdultCount:n.AdultCount+n.SeniorCount,ChildCount:n.ChildCount+n.InfantCount,SeniorCount:0,InfantCount:0}});n.roomCount=n.rooms.length;n.changeRoomCount=function(){var r=n.roomCount-n.rooms.length,t;if(r<0)n.rooms.splice(n.roomCount);else for(t=0;t<r;t++)i.addRoom(n.rooms)};n.addRoom=function(){i.addRoom(n.rooms)};n.canAddRoom=function(){return i.canAddRoom(n.rooms)};u=function(n,t){for(var r=[],i=n;i<=t;i++)r.push(i);return r};n.getAdultOptions=function(){var n=Math.min(i._travelers.length,i.getMaxAdultsPerRoom(),i.getNumAdults());return u(1,n)};n.getChildOptions=function(){var n=Math.min(i._travelers.length,i.getMaxGuestsPerRoom(),i.getNumChildren());return u(0,n)};n.getRoomOptions=function(){var n=Math.min(i.getMaxRooms(),i.getNumAdults());return u(1,n)};n.updateRooms=function(){var l=i.validate(n.rooms),u,f,t;if(l==null){for(u=i._numSeniors,f=i._numInfants,angular.copy(n.rooms,i._rooms),t=n.rooms.length-1;t>=0;t--){var c=n.rooms[t],e=0,o=c.AdultCount,s=c.ChildCount,h=0;u>0&&(e=Math.min(o,u),o=o-e,u-=e);f>0&&(h=Math.min(s,f),s=s-h,f-=h);i._rooms[t]={RoomIndex:c.RoomIndex,SeniorCount:e,AdultCount:o,ChildCount:s,InfantCount:h}}n.errorMessage=null;r.$broadcast("haHotelRoomService:updateRooms",i._rooms)}else n.errorMessage=l.join("<br>")};t.roomPicker=n},UpdateHotelDetailMark:function(){if(window.performance.clearMarks("mark_end_HotelDetail"),window.performance.mark("mark_end_HotelDetail"),window.performance.getEntriesByName("mark_end_HotelDetail")&&window.performance.getEntriesByName("mark_end_HotelDetail")[0]){var n=window.performance.getEntriesByName("mark_end_HotelDetail")[0].startTime;window.BOOMR&&BOOMR.version&&(window.BOOMR.sendTimer("Hotel_Det_Time",n),window.BOOMR.sendMetric("UI_Detail_Load",1))}},UpdateRoomMark:function(){if(window.performance.clearMarks("mark_end_RoomDetail"),window.performance.mark("mark_end_RoomDetail"),window.performance.getEntriesByName("mark_end_RoomDetail")&&window.performance.getEntriesByName("mark_end_RoomDetail")[0]){var n=window.performance.getEntriesByName("mark_end_RoomDetail")[0].startTime;window.BOOMR&&BOOMR.version&&(window.BOOMR.sendTimer("Room_Det_Time",n),window.BOOMR.sendMetric("UI_Room_Load",1))}},UpdateRoomFailMetric:function(){window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("UI_Room_Fail",1)}};b.roomsRange=function(){for(var t=[],n=1;n<=b.roomsCount();n++)t.push(n);return t};b.select=function(n,t){if(typeof t=="undefined")for(var i=1;i<k.length;i++)k[i]=n;else k[t]=n;g()};b.isSelected=function(n,t){if(typeof t=="undefined")throw"Must specfiy room number.";return n===k[t]};b.priceDelta=function(n,t){if(typeof t=="undefined")throw"Must specfiy room number.";return n.nightlyPriceDiff-k[t].nightlyPriceDiff};var g=function(){var n=b.hotel.basePrice+b.hotel.taxes;b.hotel.totalCost=k.reduce(function(n,t){return n+t.totalPriceDiff},n);b.hotel.resortFees=k.reduce(function(n,t){return n+t.resortFees},0)},nt=function(){var i,t;if(v.hotels==null){n.debug("hotelSvc.hotels == null");e(function(){nt()},500);return}angular.forEach(v.hotels,function(n){n.id===d&&(b.hotel=n)});b.hotel.addressUrl="https://www.google.com/maps/embed/v1/place?q="+b.hotel.fullAddress+"&key=AIzaSyAsvniZHrYuaSY3T7n_LSlDd21i9HVJZAo";i=v.data;b.airportCode=i.DestinationAirport;b.destinationCity=i.DestinationCityName;b.roomsCount=a.count;b.travelers=i.Travellers;b.checkOut=b.hotel.checkOut;b.checkIn=b.hotel.checkIn;t=b.hotel.description;t.length>500?(b.fullDescription=t,b.description=t.slice(0,500)+"..."):(b.fullDescription=null,b.description=t);angular.forEach(b.travelers,function(n){(n.Type==="Adult"||n.Type==="ADT"||n.Type==="SRC")&&(n.FullName=n.FirstName+" "+n.LastName,b.adultTravelers.push(n))});b.initRoomPicker()},ft=function(n,i){var u=r.$new(!0,t);u.back=t.back;u.data=n;u.strings=i;c(l.getTemplateUrl("room-change-modal.html"),{id:"HotelChangeModal",backdrop:!0,scope:u,modalLock:!0})},tt=function(n){var t;if(f.search().hotelId&&f.search().hotelId.length!==0)if(n!=null&&n.MessageType!==0){t={};switch(n.MessageType){case 3:b.showPriceDecreaseAlert=!0;return;case 1:t.ModalTitle=w("Ancillary.repriceerrormessage");t.ModalExplanation=w("Ancillary.repriceerrortext");t.ModalCancel=w("Ancillary.orreturntotext");t.ModalContinue=w("Ancillary.selectadifferenthoteltext");window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("Room_Res_DtFail",1);break;case 2:n.showPriceChangeTable=!0;t.ModalTitle=w("Ancillary.pricechangealertmsg");t.ModalExplanation=w("Ancillary.pricechangealerttext");t.ModalQuery=w("Ancillary.wouldyouliketocontinuetext",[b.hotel.nights]);t.ModalCancel=w("Ancillary.selectadifferenthoteltext");t.ModalContinue=w("Ancillary.yescontinuebookingtext");t.OriginalPrice=w("Ancillary.originalpricetext");t.OriginalTotal=w("Ancillary.originaltotaltext");t.UpdatedPrice=w("Ancillary.updatedpricetext");t.UpdatedTotal=w("Ancillary.updatetotaltext");break;case 4:n.showPriceChangeTable=!0;t.ModalTitle=w("Ancillary.roomchangealertmsg");t.ModalExplanation=w("Ancillary.roomchangealerttext");t.ModalQuery=w("Ancillary.wouldyouliketocontinuetext");t.ModalCancel=w("Ancillary.selectadifferenthoteltext");t.ModalContinue=w("Ancillary.yescontinuebookingtext");t.OriginalPrice=w("Ancillary.originalpricetext");t.OriginalTotal=w("Ancillary.originaltotaltext");t.UpdatedPrice=w("Ancillary.updatedpricetext");t.UpdatedTotal=w("Ancillary.updatetotaltext")}ft(n,t)}},it=function(n){y.getRepriceHotelDetails(n,{timeout:p.get("HotelRepriceTimeoutMs")}).then(function(t){var r,u;if(n===f.search().hotelId){if(t==null||t.ErrorCode!=null||t.ErrorType!=null)return window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("Room_Res_DtFail",1),rt(t);window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("Room_Res_Detail",1);tt(t.APHMessages);r=t.PackageSolution;r!=null&&(b.hotel.basePrice=r.BasePrice.Amount,b.hotel.taxes=r.Taxes.Amount,b.hotel.savings=r.ServicePriceTotalSavings,b.hotel.total=r.Total);u=t.PkgHotelSolution&&t.PkgHotelSolution.HotelDetails;u!=null&&(i(u.Content.Amenities,b.amenities),b.visuals=u.Content.Visuals,b.lat=u.Geocoded.Latitude.Value,b.lon=u.Geocoded.Longitude.Value);et(t);g();b.loadingRooms=!1}},rt)},et=function(n){var t,u,i,r;for(b.hotel.rooms=v.mapOrbitzRepriceRooms(n,b.hotel.taxes),t=1;t<=b.roomsCount();t++){if(b.rowLimit[t]=b.INITIAL_ROW_LIMIT,u=!1,n.selectedHotelDetail!==null&&angular.isDefined(n.selectedHotelDetail)&&angular.isDefined(n.selectedHotelDetail.SelectedRooms[t-1]))for(i=0;i<b.hotel.rooms[t-1].length;i++)if(r=b.hotel.rooms[t-1][i],r.roomCode===n.selectedHotelDetail.SelectedRooms[t-1].RoomCode&&r.rateAccessCode===n.selectedHotelDetail.SelectedRooms[t-1].RateAccessCode){u=!0;k[t]=r;i>=b.INITIAL_ROW_LIMIT&&(b.rowLimit[t]=i+1);break}k[t]!=null&&u||b.hotel.rooms[t-1]==null||(k[t]=b.hotel.rooms[t-1][0]);angular.isDefined(n.selectedHotelDetail)&&n.selectedHotelDetail!=null&&angular.isDefined(n.selectedHotelDetail.SelectedRooms)?angular.forEach(n.selectedHotelDetail.SelectedRooms,function(n){angular.isDefined(n.GuestPreferences)&&(b.guestPreferences[t]={disabledAccess:n.GuestPreferences.DISABLED_ACCESS,lateCheckIn:n.GuestPreferences.LATE_CHECKIN,infantCot:n.GuestPreferences.INFANT_COT,extraBed:n.GuestPreferences.EXTRA_BED,nonSmoking:n.GuestPreferences.NON_SMOKING})}):b.guestPreferences[t]={};b.checkInTraveler[t]=b.adultTravelers[0]}},rt=function(n){b.loadingRooms=!1;n.code!=null?(b.error=n,n.code==="NO_DP_SOLUTIONS_FOUND"&&(b.error.redirectUrl=null,n.APHMessages=n.APHMessages||{},n.APHMessages.MessageType=1,tt(n.APHMessages))):b.error=n.status===0?{type:"TIMEOUT"}:!0;b.error.redirectUrl!=null?window.location.href=b.error.redirectUrl:n.RedirectURL!=null&&(window.location.href=n.RedirectURL)},ot=function(n){var t={HotelId:n.hotel.id,Name:n.hotel.name,ImageUrl:n.hotel.propertyImageUrl,CheckInDate:n.hotel.checkIn,CheckOutDate:n.hotel.checkOut,Nights:n.hotel.nights,PackageTaxes:n.hotel.taxes,PackageSubtotal:n.hotel.totalCost-n.hotel.taxes,PackageGrandTotal:n.hotel.totalCost,PackageSavings:n.hotel.savings,Address:n.hotel.address,ResortFees:n.hotel.resortFees,SelectedRooms:[]};return angular.forEach(k,function(i,r){i!=null&&(t.SelectedRooms[r-1]={RoomIndex:r,RoomCode:i.roomCode,RateCode:i.rateCode,RateAccessCode:i.rateAccessCode,RoomDescription:i.description,CheckInTraveler:n.checkInTraveler[r].FullName,GuestPreferences:{DISABLED_ACCESS:n.guestPreferences[r].disabledAccess||!1,LATE_CHECKIN:n.guestPreferences[r].lateCheckIn||!1,INFANT_COT:n.guestPreferences[r].infantCot||!1,EXTRA_BED:n.guestPreferences[r].extraBed||!1,NON_SMOKING:n.guestPreferences[r].nonSmoking||!1}})}),t},st=function(n){if(n!=="jsError")switch(n.code){case"SessionTimeOut":window.location.href="/book/error?ErrorType=SessionTimeOut";break;default:if(n.code!==undefined)window.location.href=n.RedirectURL;else return!1}else window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"};return nt(),it(d),t.$on("haHotelRoomService:updateRooms",function(){b.loadingRooms=!0}),t.$on("haHotelListCtrl:update",function(){b.loadingRooms=!0;it(d)}),b.updatePrefs=function(n){for(var t=1;t<b.guestPreferences.length;t++)b.guestPreferences[t]=b.guestPreferences[n]},b}])}(angular),function(n){"use strict";var t;try{t=n.module("haHotelPackagesModule")}catch(i){t=n.module("haHotelPackagesModule",["haUtilsModule","haGlobalsModule","haFeatureFlagsModule","haCurrencyModule","haAncillariesModule","haModalService","haEqualHeightModule","haPassengersService","haRoundingFiltersModule","haSitecoreModule"])}t.run(["$rootScope","haModal",function(n,t){n.hotelPromoTermsModal=function(n){if(n&&(n.customerFulfillmentRequirement||n.termsAndConditions)){var i='<div class="modal-template"><div class="modal-main containerFullBleed padded-main"><div class="container"><div class="row"><div class="col">';n.customerFulfillmentRequirements&&(i+="<p>"+n.customerFulfillmentRequirements+"<\/p>");n.termsAndConditions&&n.termsAndConditions!==n.customerFulfillmentRequirements&&(i+="<p>"+n.termsAndConditions+"<\/p>");i+="<p><\/p><\/div><\/div><\/div><\/div><\/div>";t(null,{id:"hotel-promo-tc-modal",backdrop:"true",template:i})}}}]);t.controller("haHotelListCtrl",["$log","$scope","$window","$rootScope","$timeout","$location","$filter","$templateCache","haUtils","haConfig","haModal","haGlobals","haFeatureFlags","haHotelRoomService","haHotelCommonService","haAncillariesSvc","haPassengersService","haSecondaryHeaderSvc","haSitecoreStrings",function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k){function it(n,i){for(var r=0;r<n;r++)t.$pax.add({type:i,isUser:!0})}b.template="/HotelSecondaryStickyHeader.html";b.ctrl.showHelpModal=function(){c(h.getTemplateUrl("ha-help-book-itinerary-modal.html"),{id:"itinerary-help",backdrop:"true"})};t.$on("haGoogleMap:markerClick",function(){r.isMobile||(t.ctrl.largerMap=!0)});l("itineraryDetails",function(n){$.extend(t,n);t.selectedSegments=[];t.currency=t.TripSummary.currency;t.PricingType=t.TripSummary.PricingType;angular.forEach(t.PNRs,function(n){angular.forEach(n.Trips,function(n){n.TripOriginCity=n.TripOriginCity.substring(0,n.TripOriginCity.length-5);n.TripDestinationCity=n.TripDestinationCity.substring(0,n.TripDestinationCity.length-5)})});angular.forEach(t.TripSummary.Trips,function(n){var i=n.Flights[0],r;for(i.IsMileagePricing=n.IsMileagePricing,r=0;r<i.AvailBookingFares.length;r++)i.selectedSeatClass=i.AvailBookingFares[r].Name,i[i.selectedSeatClass]=i.AvailBookingFares[r];t.selectedSegments.push(i);t.IsItineraryLoaded=!0});t.TripSummary.SelectedHotel!=null&&typeof t.TripSummary.SelectedHotel.HotelId=="string"&&(t.SelectedHotel=t.TripSummary.SelectedHotel)});var rt=a.get("HotelsPerPage",10),d={loading:!0,airportCode:"",destinationCity:null,hotels:[],travelers:[],adultTravelers:[],checkIn:null,checkOut:null,roomsCount:v.count,nights:null,nameFilter:null,starRatingFilter:{"2":!1,"3":!1,"4":!1,"5":!1},hotelsBackup:[],limitedAvailabilityLevel:a.get("HotelLimitedAvailabilityLevel",10),savingsThreshold:a.get("HotelShowSavingsThreshold",20),hotelId:function(){return y.data!=null?f.search().hotelId:null},showDetail:function(n,t){t=t||n.id;d.loading=!0;d.hotelsBackup=angular.copy(d.hotels);p.getVacationPackageList(t,{timeout:a.get("HotelRepriceTimeoutMs")}).then(function(n){nt(n,!0)},tt).then(function(){f.search("hotelId",t);d.loading=!1})},clearDetail:function(){f.search("hotelId",null)},openChangeRoomsModal:function(){v.openChangeRoomsModal()},count:function(n){var i,r,t;for(d.starCounts={"5":0,"4":0,"3":0,"2":0},d.userCounts={"5":0,"4":0,"3":0,"2":0},i=0;i<n.length;i++)for(r=n[i],t=5;t>1;t--)r.starRating>=t&&r.starRating<1+t&&(d.starCounts[""+t]+=1),r.userScore>=t&&(d.userCounts[""+t]+=1)},filteredHotels:[],hasActiveFilters:!1,filter:function(){var n=[],t=d.hotels;n.push(ot());n.push(et());n.push(st());n.push(ht());n.push(ft());d.hasActiveFilters=!1;angular.forEach(n,function(n){d.hasActiveFilters=d.hasActiveFilters||n.active;t=n(t)});d.pageTotal=t.length;d.filteredHotels=t;d.filters=n;d.resetPagination();d.pageChange()},clearFilter:function(n){n.clear();d.filter()},clearAllFilters:function(){angular.forEach(d.filters,function(n){n.clear!=null&&n.clear()});d.filter()},currentPage:1,pageSize:rt,pageStart:1,pageEnd:rt,pageTotal:0,pagedHotels:[],pageChange:function(){d.pagedHotels=ct(d.currentPage,d.pageSize)(d.filteredHotels)},resetPagination:function(){d.currentPage=1},markerData:function(){return d.pagedHotels.map(function(n){var t=angular.copy(n);return t.airportCode=d.airportCode,t.detailUrl="/Book/Itinerary/GetVacationPackageList#?hotelId="+(n.id||n.HotelId),{coords:n.coords,templateScope:{hotel:t}}})},getFilteredSavings:function(n){var i=e("superCurrency")(n,t.$currency,"roundSavings");return k("Ancillary.savexwiththispackagetext").replace("{0}",i)},UpdateHotelFailMetric:function(){window.BOOMR&&BOOMR.version&&window.BOOMR.sendMetric("UI_Detail_Fail",1)}},g=function(n){return n};g.clear=function(){};g.active=!1;d.sortByOptions=[{Name:k("Ancillary.bestvaluetext"),Value:"BestValueSortAsc"},{Name:k("Ancillary.pricelowtohightext"),Value:"PriceSortAsc"},{Name:k("Ancillary.pricehightolowtext"),Value:"PriceSortDesc"},{Name:k("Ancillary.starslowtohightext"),Value:"StarsSortAsc"},{Name:k("Ancillary.starshightolowtext"),Value:"StarsSortDesc"},{Name:k("Ancillary.hotelnameatoztext"),Value:"HotelNameSortAsc"},{Name:k("Ancillary.distancefromairporttext"),Value:"DistanceSortAsc"}];d.sortBy=d.sortByOptions[0].Value;var ut={BestValueSortAsc:"+owwRank",PriceSortAsc:"+morePerNight",PriceSortDesc:"-morePerNight",StarsSortAsc:"+starRating",StarsSortDesc:"-starRating",UserScoreSortAsc:"+userScore",UserScoreSortDesc:"-userScore",HotelNameSortAsc:"+name",DistanceSortAsc:"+distanceValue"},ft=function(){var n=ut[d.sortBy];return n!=null?function(t){return e("orderBy")(t,[n,"+owwRank"])}:function(n){return n}},et=function(){if(d.nameFilter==null||d.nameFilter.length===0)return g;var n=d.nameFilter,t=function(t){for(var f,r,u=[],i=0;i<t.length;i++){if(n.split(" ").length>1&&t[i].name.toLowerCase().indexOf(n.toLowerCase())>-1){u.push(t[i]);continue}for(f=t[i].name.split(" "),r=0;r<f.length;r++)if(f[r].toLowerCase().indexOf(n.toLowerCase())===0){u.push(t[i]);break}}return u};return t.clear=function(){d.nameFilter=undefined},t.label='"'+n+'"',t.active=!0,t},ot=function(){return function(n){for(var i=[],t=0;t<n.length;t++)n[t].starRating>1&&i.push(n[t]);return i}},st=function(){var t=d.starRatingFilter,n,i;return t==null||t["5"]===!1&&t["4"]===!1&&t["3"]===!1&&t["2"]===!1?g:(n=[],angular.forEach(t,function(t,i){t&&n.push(i)}),i=function(t){for(var u,r,f,e=[],i=0;i<t.length;i++)for(u=t[i],r=0;r<n.length;r++)if(f=parseInt(n[r],10),u.starRating>=f&&u.starRating<1+f){e.push(t[i]);break}return e},i.clear=function(){angular.forEach(t,function(n,t){n&&(d.starRatingFilter[t]=!1)})},i.label=n.slice(0,-1).join(", "),n.length>1&&(i.label+=" or "),i.label+=n[n.length-1]+" stars",i.active=!0,i)},ht=function(){if(d.guestRatingFilter==null)return g;var t=parseFloat(d.guestRatingFilter),n=function(n){for(var r=[],i=0;i<n.length;i++)n[i].userScore>=t&&r.push(n[i]);return r};return n.clear=function(){d.guestRatingFilter=undefined},n.label=d.guestRatingFilter,d.guestRatingFilter!=="5.0"&&(n.label+=" or better"),n.active=!0,n},ct=function(n,t){return function(i){var u=[],r;for(d.pageStart=(n-1)*t+1,d.pageEnd=Math.min(n*t,i.length),r=d.pageStart;r<=d.pageEnd;r++)u.push(i[r-1]);return u}},nt=function(n,i){if(n==null||n.ErrorType!=null||n.HasServiceError===!0)return tt(n);n.OrbitzPackage!=null&&(n=n.OrbitzPackage);d.hasPackages=n.HasRetrievedOrbitzPackage;d.airportCode=n.DestinationAirport;t.destinationCity=d.destinationCity=n.DestinationCityName;d.hotels=y.mapOrbitzPackages(n);d.travelers=n.Travellers;angular.forEach(d.travelers,function(n){(n.Type==="Adult"||n.Type==="ADT"||n.Type==="SRC")&&d.adultTravelers.push(n)});d.hotels[0]!=null&&(d.nights=d.hotels[0].nights,d.checkIn=d.hotels[0].checkIn,d.checkOut=d.hotels[0].checkOut);angular.forEach(d.hotels,function(n,t){n.owwRank=t+1});y.data=n;y.hotels=d.hotels;v.init(n);d.roomsCount=v.count;i||(d.count(d.hotels),d.filter(),t.$watch("ctrl.starRatingFilter",d.filter,!0),t.$watch("ctrl.guestRatingFilter",d.filter),t.$watch(function(){return f.search().hotelId},function(n,t){if(n===undefined&&t!==undefined){d.hotels=d.hotelsBackup;var i=$("#hotel-"+t);i&&setTimeout(function(){var n=$("#hotel-"+t).offset().top;$("html,body").animate({scrollTop:n-180},350)},100)}}));d.loading=!1;r.$broadcast("haHotelListCtrl:update")},tt=function(n){n.ErrorType!=null?d.error={type:n.ErrorType,code:n.ErrorCodeHandle,message:n.ErrorMessage,pathType:n.PathType,redirectUrl:n.RedirectURL}:n.HasServiceError===!0?d.error={type:"SERVICE_ERROR",code:n.ServiceErrors}:n.status===0&&(d.error={type:"TIMEOUT"});d.loading=!1;d.clearDetail();p.getNeatFallbackUrl().then(function(n){d.neatFallbackUrl=n})};return l("HA",function(n){n.vacationPackageList!=null&&nt(n.vacationPackageList)}),p.getVacationPackageList({timeout:a.get("HotelRepriceTimeoutMs")}).then(nt,tt).then(function(){f.search().hotelId&&d.showDetail(null,f.search().hotelId)}),t.$on("haHotelRoomService:updateRooms",function(n,t){d.loading=!0;p.setRooms({Rooms:t}).then(function(){return p.getVacationPackageList(f.search().hotelId,{timeout:a.get("HotelListTimeoutMs")}).then(function(n){nt(n,!0)},tt)}).then(nt,tt);d.loading=!1}),t.$pax=w,t.$pax.passengers=[],t.taxDetails=!1,t.TripSummary!=null&&(t.PricingType=t.TripSummary.PricingType,t.TripSummary.AdultCount>0&&it(t.TripSummary.AdultCount,"Adult"),t.TripSummary.ChildCount>0&&it(t.TripSummary.ChildCount,"Child"),t.TripSummary.InfantCount>0&&it(t.TripSummary.InfantCount,"Infant")),d}])}(angular);haDonateMilesModule=angular.module("haDonateMilesModule",[]);haDonateMilesModule.controller("DonateMilesController",["$scope","haGlobals","$timeout","haHttpService","haModal","haSitecoreStrings","$filter","$window",function(n,t,i,r,u,f,e,o){var s="/MyAccount/DonateMiles/DonateMiles";n.DonateMiles={ListCharities:null,SenderAccountNumber:"",CurrentMilesBalance:null};n.Error="";n.initializeCharities=function(){for(var t=0;t<n.DonateMiles.ListCharities.length;t++)n.DonateMiles.ListCharities[t].state="display",n.DonateMiles.ListCharities[t].Terms=!1,n.DonateMiles.ListCharities[t].Anonymous="",n.DonateMiles.ListCharities[t].Amount==null&&(n.DonateMiles.ListCharities[t].Amount=n.DonateMiles.CurrentMilesBalance>=50?"50":"0")};t("donateMilesJson",function(t){n.DonateMiles.SenderAccountNumber=t.SenderAccountNumber;n.DonateMiles.CurrentMilesBalance=t.CurrentMilesBalance;n.DonateMiles.ListCharities=t.Charities;n.initializeCharities()});t("ErrorMessage",function(t){t!==""&&(n.Error=t)});n.getHelpContent=function(){u("",{id:"donate-miles-help",backdrop:"true",template:angular.element(".getHelpContent")})};n.showTerms=function(){u("",{id:"terms-and-conditions",backdrop:"true",template:angular.element(".showTerms")})};n.toggleAmount=function(t,i){n.DonateMiles.ListCharities[i].Amount=t};n.toggleForm=function(t){n.initializeCharities();n.DonateMiles.ListCharities[t].state="form"};n.toggleConfirm=function(t){var i=n.$eval("form"+t);if(i&&i.$invalid){i.$validate(i);return}i.$submitted=!1;$('form[name="'+i.$name+'"]').removeClass("submitted");n.DonateMiles.ListCharities[t].state="confirm"};n.toggleSubmit=function(t){var i;if(!n.DonateMiles.ListCharities[t].Terms)return n.TermsInvalid=!0,!1;n.TermsInvalid=!1;n.DonateMiles.ListCharities[t].state="spinning";i={selectedMiles:n.DonateMiles.ListCharities[t].Amount!=="0"?n.DonateMiles.ListCharities[t].Amount:n.DonateMiles.ListCharities[t].AnotherAmount,recipientHMNumber:n.DonateMiles.ListCharities[t].CharityHMAccountNumber,isAnonymous:!!n.DonateMiles.ListCharities[t].Anonymous};r.POST(s,JSON.stringify(i)).then(function(i){if(i.data&&i.data.MilesDonationSuccessful&&!i.data.HasServiceError){n.DonateMiles.CurrentMilesBalance=i.data.DonorMilesBalance;n.DonateMiles.ListCharities[t].state="thankyou";var r=f("DONATE_MILES.currentbalancetext")+": "+e("number")(n.DonateMiles.CurrentMilesBalance);angular.element("#account-nav-list li:first-child").find("span.popover-link-secondary").text(r)}else console.log(i.data.ServiceErrors||o.DonateMilesGeneralErrorMessage),n.Error=o.DonateMilesGeneralErrorMessage,n.DonateMiles.ListCharities[t].state="error"},function(i){n.Error=o.DonateMilesGeneralErrorMessage;n.DonateMiles.ListCharities[t].state="error";console.log(i)})}}]);haDonateMilesModule.directive("maxmiles",function(){return{require:"ngModel",link:function(n,t,i,r){var u=i.maxmiles;r.$parsers.push(function(n){var t=n===""||parseInt(n)<=parseInt(u);return r.$setValidity("maxmiles",t),t?n:undefined})}}});haMilesMaximizerModule=angular.module("haMilesMaximizerModule",[]);haMilesMaximizerModule.controller("MilesMaximizerConfirmationCodeController",["$scope","haGlobals","haModal",function(n,t,i){n.MilesMaximizer={ConfirmationCode:"",LastName:""};n.Error="";n.submitting=!1;t("milesMaximizerConfirmationCodeJson",function(t){n.MilesMaximizer.ConfirmationCode=t.ConfirmationCode;n.MilesMaximizer.LastName=t.LastName});t("errorMessage",function(t){t!==""&&(n.Error=t)});n.getHelpContent=function(){i("",{id:"miles-maximizer-help",backdrop:"true",template:angular.element(".getHelpContent")})};n.submit=function(){n.MilesMaximizerForm.$valid&&(n.submitting=!0)}}]);haMilesMaximizerModule.controller("MilesMaximizerMaximizeController",["$scope","haGlobals","haModal","$timeout","haItineraryAPI","$window",function(n,t,i,r,u,f){n.MilesMaximize={IsDoubleMyMiles:!0,IsInterIslandMarket:!1,ConfirmationCode:"",CurrencyCode:"",ListFlightInfo:null,ListPaxInfo:null,TotalCost:null};n.Error="";n.emailRegex=/^[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;n.ActivateValidationSpinner=!1;n.ActivateEnrollSpinner=!1;t("milesMaximizerMaximizeJson",function(t){n.MilesMaximize.IsInterIslandMarket=t.IsInterIslandMarket;n.MilesMaximize.ConfirmationCode=t.ConfirmationCode;n.MilesMaximize.CurrencyCode=t.CurrencyCode;n.MilesMaximize.ListFlightInfo=t.ListFlightInfo;n.MilesMaximize.ListPaxInfo=t.ListPaxInfo});n.radio={amount:n.MilesMaximize.ListPaxInfo[0].BoostDoubleMiles};n.$watch("radio.amount",function(){parseInt(n.radio.amount)===n.MilesMaximize.ListPaxInfo[0].BoostDoubleMiles?(n.MilesMaximize.IsDoubleMyMiles=!0,n.MilesMaximize.TotalCost=parseFloat(n.MilesMaximize.DoubleMilesTotalCost)):(n.MilesMaximize.IsDoubleMyMiles=!1,n.MilesMaximize.TotalCost=parseFloat(n.MilesMaximize.TripleMilesTotalCost))});t("errorMessage",function(t){t!==""&&(n.Error=t)});n.getHelpContent=function(){i("",{id:"miles-maximizer-help",backdrop:"true",template:angular.element(".getHelpContent")})};n.openAddAccountNumber=function(t){n.currentPaxInfoIdx=t;n.currentPaxInfo=n.MilesMaximize.ListPaxInfo[t];n.currentPaxInfo.HMNumber="";r(function(){i({id:"addAccountNumberModal",backdrop:"true",scope:n,modalLock:!0,template:angular.element("#addAccountNumber"),size:"modal-lg"})})};n.accountNumberContinue=function(){n.ActivateValidationSpinner=!0;u.isValidHMAccount(n.currentPaxInfo.HMNumber,n.currentPaxInfo.FirstName,n.currentPaxInfo.LastName).success(function(t){if(t!=null&&t!=="false"&&t!=!1)n.ActivateValidationSpinner=!1,n.$modalCancel(),n.Error="",n.addAccountNumberForm.$setPristine();else{n.ActivateValidationSpinner=!1;n.Error=f.HMNotFoundMessage;return}}).error(function(){n.ActivateValidationSpinner=!1;n.Error=f.HMAccountLookupGeneralErrorMessage;return})};n.openEnrollAccount=function(t){n.currentPaxInfoIdx=t;n.currentPaxInfo=n.MilesMaximize.ListPaxInfo[t];r(function(){i({id:"enrollAccountNumberModal",backdrop:"true",scope:n,modalLock:!0,template:angular.element("#enrollAccountNumber"),size:"modal-lg"})})};n.enrollAccountContinue=function(){var i=new Date(n.currentPaxInfo.TravelDate.match(/\d+/)[0]*1),t;i=i.getMonth()+1+"/"+i.getDate()+"/"+i.getFullYear();t=new Date(n.currentPaxInfo.DOB.match(/\d+/)[0]*1);t=t.getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear();n.currentPaxInfo=angular.copy(n.currentPaxInfo);n.currentPaxInfo.TravelDate=i;n.currentPaxInfo.DOB=t;n.ActivateEnrollSpinner=!0;u.HMEnrollAndUpdatePNR(n.MilesMaximize.ConfirmationCode,n.currentPaxInfo).success(function(t){if(t===null||t.IsEnrollmentSuccess==="false"||n.accountIsEmpty(t.HMNumber)){n.ActivateEnrollSpinner=!1;n.Error=t.EnrollmentErrorMessage||f.EasyEnrollGeneralErrorMessage;return}n.ActivateEnrollSpinner=!1;n.currentPaxInfo.HMNumber=t.HMNumber;n.MilesMaximize.ListPaxInfo[n.currentPaxInfoIdx]=angular.copy(n.currentPaxInfo);n.$modalCancel();n.Error="";n.enrollAccountNumberForm.$setPristine()}).error(function(t,i){n.ActivateEnrollSpinner=!1;n.Error=i.EnrollmentErrorMessage||f.EasyEnrollGeneralErrorMessage;return})};n.closeModal=function(){n.$modalCancel();n.Error="";n.addAccountNumberForm&&(n.ActivateValidationSpinner=!1,n.addAccountNumberForm.$setPristine());n.enrollAccountNumberForm&&(n.ActivateEnrollSpinner=!1,n.enrollAccountNumberForm.$setPristine());r(function(){n.MilesMaximize.ListPaxInfo[n.currentPaxInfoIdx].HMNumber="1"},1e3)};n.showMissingAccountNumberModal=function(){r(function(){i("missingAccountNumber",{id:"missingAccountNumberModal",scope:n,backdrop:"true"})})};n.allAccountsAdded=function(){var i=!0,t;for(n.missingHmNumbers=[],t=0;t<n.MilesMaximize.ListPaxInfo.length;t++)n.accountIsEmpty(n.MilesMaximize.ListPaxInfo[t].HMNumber)&&(n.missingHmNumbers.push(n.MilesMaximize.ListPaxInfo[t]),i=!1);return i};n.submitMilesMaxCard=function(t){if(n.allAccountsAdded()){var r=document.getElementById("milesMaxForm"),i=document.createElement("input");i.name="card";i.type="hidden";i.id="card";i.value=t;r.appendChild(i);document.getElementById("milesMaxForm").submit()}else n.showMissingAccountNumberModal()};n.accountIsEmpty=function(n){return n!==null&&n!==""&&n!=="1"?!1:!0}}]);haMilesMaximizerModule.controller("MilesMaximizerPaymentController",["$scope","$rootScope","haGlobals","haModal","$timeout",function(n,t,i,r,u){n.MilesMaximizerPayment={EmailAddress:"",ConfirmEmailAddress:""};n.submitting=!1;i("milesMaximizerPaymentJson",function(t){n.MilesMaximizerPayment.EmailAddress=t.EmailAddress;n.MilesMaximizerPayment.ConfirmEmailAddress=t.ConfirmEmailAddress});n.getHelpContent=function(){r("",{id:"miles-maximizer-help",backdrop:"true",template:angular.element(".getHelpContent")})};n.showPrivacyPolicy=function(){r("",{id:"privacy-policy",backdrop:"true",template:angular.element(".showPrivacyPolicy")})};n.showTerms=function(){r("",{id:"terms-and-conditions",backdrop:"true",template:angular.element(".showTerms")})};n.haPaymentTypes={paymentMethod:"creditDebit"};n.CDESubmit=function(){t.$broadcast("CDESubmit")};n.$on("CDEPaymentSubmitted",function(){n.submitting=!0});n.$on("CDEPaymentSubmitError",function(){n.submitting=!1;u(function(){$("html, body").animate({scrollTop:$("#formIFrame").offset().top-50},"fast")},100)})}]);haMilesMaximizerModule.controller("MilesMaximizerConfirmationController",["$scope","haGlobals","haModal",function(n,t,i){t("errorMessage",function(t){t!==""&&(n.Error=t)});n.getHelpContent=function(){i("",{id:"miles-maximizer-help",backdrop:"true",template:angular.element(".getHelpContent")})}}]),function(n){"use strict";function i(n,t,i,r){var u=this;u.id=n;u.FlightRefKey=t;u.SelectedClass=i;u.IsMileagePricing=r}function t(n,t,i,r,u,f){var e=this;e.id=n;e.numberOfDays=t;e.msrCode=i;e.price=r;e.miles=u;e.disableHoldOption=f}var r;r=n.module("haBookFlightResultsModule");r.controller("holdReservationCtrl",["$log","$scope","$rootScope","$timeout","$location","$templateCache","haUtils","haConfig","haModal","haGlobals","haFeatureFlags","$http","$filter",function(n,r,u,f,e,o,s,h,c,l,a,v,y){function d(n,t){return n.replace("{{date}}",y("date")(t,"shortDate"))}function k(){angular.forEach(u.holdOptions,function(n){n.id===r.formData.pricelockSelectedOption&&(u.selectedHoldFare=n,r.oneDayHoldOptionEmail=+n.numberOfDays==1?!0:!1)});r.holdStrings.actionInstructions=r.addDays(p.actionInstructions,u.selectedHoldFare.numberOfDays)}var w,p,b;r.holdEligible=!0;u.mcbHoldSelected=!1;r.oneDayHoldOptionEmail=!1;u.isEligible=!1;r.loadingHoldFareForm=!1;r.holdDetailsState=!1;r.remindersEndDate="2015-12-23";u.holdLoginSuccess=!1;u.selectedSegment={};u.tripSmry={};u.selectedHoldFare={};u.tripSmry={};r.formData={};w={};r.addDays=function(n,t){return n.replace("[days]",t)};r.getDescriptionSubText=function(n){var t="";switch(n){case 1:t=p.FareHoldOnedayOptionText;break;case 2:t=p.FareHoldTwodayOptionText;break;case 3:t=p.FareHoldThreedayOptionText;break;case 7:t=p.FareHoldSevendayOptionText}return r.addDays(t,n)};r.maxHoldDays=4;u.holdOptions=[];u.NonMemberholdOptions=[];r.holdStrings=[];p=[];r.enableholdreservation=!1;l("HA",function(n){n.resources&&(p=n.resources.holdReservations,r.holdStrings.heldDefaultBlockHeader1=r.addDays(p.daysholdfaretext,"X"),r.holdStrings.heldDefaultBlockDescription=p.holdyourseattext,r.holdStrings.heldDefaultBlockBtnTxt=p.pricelockholdfarebutton,r.holdStrings.heldDetailHeader=p.selectpricelockhead,r.holdStrings.termsConditions=p.pricelocktermsandconditions,r.holdStrings.continueBtn=p.buttoncontinuewithprice,r.holdStrings.cancelBtn=p.buttoncancel,r.holdStrings.headerReminders=p.reminderstext,r.holdStrings.headerRemindersDetails=d(p.automatedremindertext,r.remindersEndDate),r.holdStrings.loginMessage=p.goldandplatinummemberstext,r.holdStrings.signInLink=p.signintomilestext,r.holdStrings.actionInstructions=r.addDays(p.actionInstructions,u.selectedHoldFare.numberOfDays),r.holdStrings.remindersEmail=p.emailonceperday,r.holdStrings.remindersTextMessage=p.textmessageonceperday,r.holdStrings.signInSuccess=p.mahalosigningin,r.holdStrings.priceLockOptionSubText=p.pricelockoptionsubtext,r.holdStrings.priceLockOption=p.pricelockoption,r.holdStrings.perPerson=p.perpersontext,r.holdStrings.heldLearnMoreLinkText=p.holdlearnmorelinktext,r.holdStrings.FareHoldOptionToolTipText=p.FareHoldOptionToolTipText,r.enableholdreservation=+p.enableholdreservation==0?!1:!0)});p.actionInstructions&&r.$watch("formData.pricelockSelectedOption",function(){k()});u.$watch("checkHoldBookingEligibility",function(n){n&&r.checkEligibility(n)});b=!1;r.checkEligibility=function(n,f){if(n&&r.enableholdreservation){w.FareDetails=[];var o="/Book/FlightResults/RetrieveFareLockOptions",e=0;r.selectedSegments&&r.selectedSegments.length>0?angular.forEach(r.selectedSegments,function(n){w.FareDetails.push(new i(e+1,n.UniquerefKey,n.selectedSeatClass,n.IsMileagePricing));e=e+1}):r.TripSummary&&r.TripSummary.Trips&&r.TripSummary.Trips.length>0&&(angular.forEach(r.TripSummary.Trips,function(n){w.FareDetails.push(new i(e+1,n.UniqueReferenceKey,n.selectedSeatClass,!1));e=e+1}),o="/Book/FlightResults/RetrieveFareLockOptionsEndOnEnd");u.mcbHoldSelected=r.TripSummary.Trips.filter(function(n){return n.selectedSeatClass==="MAINCABINBASIC"}).length>0;v.post(o,{holdReservationsRQ:w}).success(function(n){r.loading=!1;u.isEligible=n.IsEligible;n.IsEligible&&(u.holdOptionsData=n,n.IsLoggedIn?(u.holdOptions=[],u.NonMemberholdOptions=[],angular.forEach(n.MemberPriceOptions,function(n){u.holdOptions.push(new t(n.UniquePriceID,n.TimeLimitDays,n.MSRCode,n.HoldFee,n.HoldMiles,n.DisableHoldOption))}),angular.forEach(n.NonMemberPriceOptions,function(n){u.NonMemberholdOptions.push(new t(n.UniquePriceID,n.TimeLimitDays,n.MSRCode,n.HoldFee,n.HoldMiles,n.DisableHoldOption))})):(u.holdOptions=[],u.NonMemberholdOptions=[],angular.forEach(n.NonMemberPriceOptions,function(n){u.holdOptions.push(new t(n.UniquePriceID,n.TimeLimitDays,n.MSRCode,n.HoldFee,n.HoldMiles,n.DisableHoldOption))})),window.digitalDataLoaded.then(function(){b||(b=!0,document.body.dispatchEvent(new CustomEvent("FareHoldOffered")))}));typeof f=="function"&&f(u.isEligible)}).error(function(){typeof f=="function"&&f(u.isEligible)});u.checkHoldBookingEligibility=!1}else u.isEligible=!1,typeof f=="function"&&f(u.isEligible)};r.holdFare=function(){k();r.holdDetailsState=!0;r.holdDefaultOption=_.findIndex(r.holdOptions,{disableHoldOption:!1});u.selectedHoldFare=u.holdOptions[r.holdDefaultOption]};r.cancelHold=function(){r.holdDetailsState=!1};r.showLoginForm=function(){window.location="/my-account/login?ReturnUrl="+encodeURIComponent(window.location.pathname)};r.continuePriceLock=function(){};r.showTermsModal=function(){c("",{id:"sign-in-modal",backdrop:"true",template:angular.element(".terms-modal-content")})}}])}(angular),function(n){"use strict";function i(n){var t=n.match(/[\d]+/);return t=Number(t[0]),new Date(t)}var t=n.module("haPremierClubModule",[]);t.controller("PremierClubJoinController",["$scope","haGlobals","haModal","haHttpService","$filter","localCurrencyFilter","localShortDateFilter","$window","$log","haSitecoreStrings",function(t,r,u,f,e,o,s,h,c,l){t.Error="";t.lookingUp=!1;t.recipientVM={};t.recipientCandidate={};t.eligibleRecipientExists=!1;t.recipientEligibleHeader="";t.recipientEligibleSubHeader="";r("errorMessage",function(n){n!==""&&(t.Error=n)});t.setForm=function(n){t.pcForm=n};t.customSubmit=function(n){n.preventDefault();t.pcForm.$valid?t.showCheckEligibilityForm()?t.lookup():PremierClubForm.submit():t.Error=l("PREMIER_CLUB_DATA.pleasecorrecterrorstext")};t.personalizeString=function(n,t){if(n)return n.replace(/({\d})/g,function(n){if(n)return t[n.replace(/{/,"").replace(/}/,"")]})};t.createEnrollString=function(n,t){if(n)return parseInt(n.EnrollmentType)===2?l("PREMIER_CLUB_DATA.renewtext",[t,n.OfferTerm]):l("PREMIER_CLUB_DATA.enrolltext",[t,n.OfferTerm])};t.determineEnrollmentType=function(n){t.enrollmentType="gift only";$.each(n,function(n,i){i.IsGiftable||(t.enrollmentType=parseInt(i.EnrollmentType)===2?"renew":"purchase")})};r("premierClubJson",function(r){t.premierVM=r;r.ErrorMessage!==""&&(t.Error=r.ErrorMessage);t.premierVM.currentProduct="gift";r.PremierClubProductsList.length&&(t.premierVM.currentProduct=r.PremierClubProductsList[0].ProductID);t.currencyCode=t.premierVM.currencyCode||"USD";var f,o,u;t.premierVM.ExistingMemberExpirationDate&&(u=i(t.premierVM.ExistingMemberExpirationDate),u=e("localShortDate")(u,$language));t.determineEnrollmentType(t.premierVM.PremierClubProductsList);t.enrollmentType==="purchase"?(f=l("PREMIER_CLUB_DATA.enrolltodaytext"),o=""):t.enrollmentType==="renew"?(f=l("PREMIER_CLUB_DATA.renewtodaytext"),o=l("PREMIER_CLUB_DATA.giftofmembershipsubtext",[u])):t.enrollmentType==="gift only"&&(f=l("PREMIER_CLUB_DATA.giftofmembershiptext"),o=t.premierVM.IsAlreadyEnrolled?l("PREMIER_CLUB_DATA.giftofmembershipsubtext",[u]):!t.premierVM.IsUserEligible||t.premierVM.IsGift?l("PREMIER_CLUB_DATA.youarenoteligibletext"):"");t.enrolloptionsheader=f;t.enrolloptionssubheader=o;t.premierVM.IsGift&&(t.recipientVM=n.copy(t.premierVM),t.eligibleRecipientExists=!0)});t.getHelpContent=function(){u("",{id:"premier-club-help",backdrop:"true",template:n.element(".getHelpContent")})};t.lookup=function(){t.lookingUp=!0;t.premierVM.currentProduct="gift";f.POST("/MyAccount/PremierClub/GetRecipientEligibleProducts",{recipientHMNumber:t.recipientCandidate.HMAccountNumber,recipientLastName:t.recipientCandidate.LastName}).success(function(n){if(t.lookingUp=!1,$("#lookup").blur(),n.IsUserEligible){t.recipientVM=n;t.eligibleRecipientExists=!0;t.Error=!1;var i=t.recipientVM.EnrolleeDetails.FirstName+" "+t.recipientVM.EnrolleeDetails.LastName;t.recipientEligibleHeader=l("PREMIER_CLUB_DATA.iseligibleforpremiumclubtext",[i]);t.emailWillBeSentString=l("PREMIER_CLUB_DATA.emailconfirmingpurchasetext",[t.recipientVM.EnrolleeDetails.FirstName])}else t.Error=l("PREMIER_CLUB_DATA.hmaccountnotfoundineligibletext"),t.eligibleRecipientExists=!1}).error(function(n,i){t.lookingUp=!1;t.eligibleRecipientExists=!1;$("#lookup").blur();parseInt(i)===403&&(t.Error=l("PREMIER_CLUB_DATA.yoursessionhasexpiredtext"))})};t.makeRecipSubHeader=function(){var n=0;$.each(t.recipientVM.PremierClubProductsList,function(i,r){r.ProductID===t.recipientVM.currentProduct&&(n=i)});var r=i(t.recipientVM.RecipientPremierClubProductsList[n].OfferStartDate),u=i(t.recipientVM.RecipientPremierClubProductsList[n].OfferEndDate),f=[t.recipientVM.EnrolleeDetails.FirstName+"'s",e("localShortDate")(r,$language),e("localShortDate")(u,$language)];t.recipientEligibleSubHeader=l("PREMIER_CLUB_DATA.membershipexpiresbetweentext",f)};t.notOkToContinue=function(){return!t.premierVM.IsUserEligible||t.premierVM.currentProduct==="gift"?t.eligibleRecipientExists?!1:!0:t.premierVM.currentProduct&&t.premierVM.currentProduct==="gift"};t.showCheckEligibilityForm=function(){return t.premierVM.IsUserEligible&&t.premierVM.currentProduct!=="gift"?!1:t.eligibleRecipientExists?!1:!0};t.goBack=function(){t.eligibleRecipientExists=!1;t.recipientVM={}};t.premierVM.ShowSavedTravelers&&f.GET("/myaccount/travelerslist/gettravelerlist").then(function(n){n.data.TravelersList&&(t.FilteredTravelersList=n.data.TravelersList)},function(n){c.debug(n);t.premierVM.ShowSavedTravelers=!1});t.openSharedTravelers=function(){u({id:"sharedTravelersModal",backdrop:"true",scope:t,template:n.element("#sharedTravelers")})};t.travelerChosen=function(n){t.$modalCancel();t.recipientCandidate.LastName=n.LastName;t.recipientCandidate.HMAccountNumber=n.HMAccountNo||""};t.$watch("premierVM.currentProduct",function(n,i){(i!==undefined||n)&&n!==i&&(t.Error="")})}]);t.controller("PremierClubPaymentController",["$scope","$rootScope","haGlobals","$window","haModal","haSitecoreStrings","$filter","$timeout",function(t,i,r,u,f,e,o,s){t.premierClubPayment={};t.Error="";t.submitting=!1;t.personalizeString=function(n,t){if(n)return n.replace(/({\d})/g,function(n){if(n)return t[n.replace(/{/,"").replace(/}/,"")]});console.warn("MISSING STRING")};t.membershipTermText=e("PREMIER_CLUB_DATA.monthmembershiptext",[u.premierClubJson.ProductDetails.OfferTerm]);r("premierClubJson",function(n){t.premierVM=n;t.currentProduct=!n.ProductDetails?{}:n.ProductDetails;t.canPayWithMiles=t.premierVM.PurchaserDetail.MilesAvailable>=t.premierVM.ProductDetails.MilesCost;var i=t.premierVM.ProductDetails.OfferStartDate,r=t.premierVM.ProductDetails.OfferEndDate,u=o("localShortDate")(i,$language),f=o("localShortDate")(r,$language);t.offerTermText=e("PREMIER_CLUB_DATA.notetitletext")+" "+e("PREMIER_CLUB_DATA.notedescriptiontext")+" "+u+" "+e("PREMIER_CLUB_DATA.endontext")+" "+f});r("errorMessage",function(n){n!==""&&(t.Error=n)});t.getHelpContent=function(){f("",{id:"premier-club-help",backdrop:"true",template:n.element(".getHelpContent")})};t.showTerms=function(){f("",{id:"terms-and-conditions",backdrop:"true",template:n.element(".showTerms")})};t.haPaymentTypes={paymentMethod:"creditDebit"};t.$watch("premierClubPayment.paymentType",function(n){t.haPaymentTypes.paymentMethod=n==="card"?"creditDebit":"miles"});t.CDESubmit=function(){i.$broadcast("CDESubmit")};t.$on("CDEPaymentSubmitted",function(){t.submitting=!0});t.$on("CDEPaymentSubmitError",function(){t.submitting=!1;s(function(){$("html, body").animate({scrollTop:$("#formIFrame").offset().top-50},"fast")},100)})}]);t.controller("PremierClubConfirmationController",["$scope","haGlobals","$window","haModal","$filter",function(t,i,r,u,f){t.Error="";i("premierClubJson",function(i){var r;t.premierVM=i;r="Balance: "+f("number")(i.CurrentMilesBalance);n.element("#account-nav-list li:first-child").find("span.popover-link-secondary").text(r);var u=t.premierVM.OrderDetails.OfferStartDate,e=t.premierVM.OrderDetails.OfferEndDate,o=f("localShortDate")(u,$language),s=f("localShortDate")(e,$language);t.offerTermText=$scs("PREMIER_CLUB_DATA.notetitletext")+" "+$scs("PREMIER_CLUB_DATA.notedescriptiontext")+" "+o+" "+$scs("PREMIER_CLUB_DATA.endontext")+" "+s});i("errorMessage",function(n){n!==""&&(t.Error=n)});t.getHelpContent=function(){u("",{id:"premier-club-help",backdrop:"true",template:n.element(".getHelpContent")})};t.showTerms=function(){u("",{id:"terms-and-conditions",backdrop:"true",template:n.element(".showTerms")})}}])}(angular),function(n){"use strict";var t=n.module("haRequestPastMilesModule",[]);t.controller("requestPastMilesController",["$scope","haGlobals","haModal","$window","haDateUtils","$document","$timeout","haSitecoreStrings",function(t,i,r,u,f,e,o,s){t.requestStatuses={Pending:'<i class="ha-icon fontIcon-minus-circle"><\/i> '+s("REQUEST_PAST_MILES_DATA.pendingtext"),Fulfilled:'<i class="ha-icon fontIcon-check-circle"><\/i> '+s("REQUEST_PAST_MILES_DATA.approvedtext"),Rejected:'<i class="ha-icon fontIcon-times-circle"><\/i> '+s("REQUEST_PAST_MILES_DATA.rejectedtext")};t.noConfirmationCode=!1;t.submitAttempted=!1;t.languageCode=u.languageCode;t.model={};i("requestMilesJson",function(n){t.requestMilesVM=n;t.requestMilesVM.ClassOfServiceDropDown=["O","U","S","Y","E","K","H","Q","L","V","R","M"];t.requestMilesVM.Airlines="HA";t.currentRequest=t.requestMilesVM.RecentRequestsList.RecentRequestsList[0];t.HAformSubmitAttempt=!1;t.JBformSubmitAttempt=!1;t.JALformSubmitAttempt=!1});t.dateStringToDate=function(n){var t=n.match(/[\d]+/);return t=Number(t[0]),new Date(t)};t.showRequest=function(n){t.requestMilesVM.RecentRequestsList.RecentRequestsList[n].RequestStatus!=="Pending"&&(t.currentRequest=t.requestMilesVM.RecentRequestsList.RecentRequestsList[n],r({id:"requestStatus",backdrop:"true",templateUrl:"/requestStatus.html",scope:t}))};t.switchConfirmCode=function(){t.noConfirmationCode=!t.noConfirmationCode};t.getHelpContent=function(){r({id:"requestMilesHelp",backdrop:"true",template:n.element(".getHelpContent")})};t.onSubmit=function(n,i){n.preventDefault();t.submitting=!1;i.$valid?(t.submitting=!0,t.requestMilesVM.Airlines==="HA"?(t.HAformSubmitAttempt=!0,HawaiianAirlinesForm.submit()):t.requestMilesVM.Airlines==="B6"?(t.JBformSubmitAttempt=!0,JetBlueForm.submit()):(t.JALformSubmitAttempt=!0,JalForm.submit())):(t.submitting=!1,t.Error=s("PREMIER_CLUB_DATA.pleasecorrecterrorstext"),t.requestMilesVM.Airlines==="HA"?t.HAformSubmitAttempt=!0:t.requestMilesVM.Airlines==="B6"?t.JBformSubmitAttempt=!0:t.JALformSubmitAttempt=!0)};t.trim=function(n){n.target.value=n.target.value.replace(/^\s+|\s+$/g,"")}}]);t.controller("requestMilesConfirmationController",["$scope","haGlobals","haModal","$window",function(t,i,r,u){i("requestMilesJson",function(n){t.requestMilesVM=n;t.languageCode=u.languageCode});t.openFAQModal=function(){r({id:"requestMilesFAQ",backdrop:"true",template:n.element(".getHelpContent")})};t.openTermsModal=function(){r({id:"requestMilesTerms",backdrop:"true",template:n.element(".showTerms")})};t.getHelpContent=function(){r({id:"requestMilesHelp",backdrop:"true",template:n.element(".getHelpContent")})}}])}(angular),function(n){"use strict";var t=n.module("formValidation",[]);t.directive("showErrors",function(t,i){var r,u;return r=function(n){var t;return t=i.showSuccess,n&&n.showSuccess!=null&&(t=n.showSuccess),t},u=function(t,i,u,f){var s=!1,c=t.$eval(u.showErrors),l=r(c),a=i[0].querySelector("[name]"),h=n.element(a),e=h.attr("name"),o;if(!e)throw"show-errors element has no child input elements with a 'name' attribute";return h.bind("blur",function(){return s=!0,o(f[e].$invalid)}),t.$watch(function(){return f[e]&&f[e].$invalid},function(n){if(s)return o(n)}),t.$on("show-errors-check-validity",function(){return o(f[e].$invalid)}),o=function(n){return i.toggleClass("has-error",n),l?i.toggleClass("has-success",!n):void 0}},{restrict:"A",require:"^form",compile:function(n){if(!n.hasClass("form-group"))throw"show-errors element does not have the 'form-group' class";return u}}});t.provider("showErrorsConfig",function(){var n=!1;this.showSuccess=function(t){return n=t};this.$get=function(){return{showSuccess:n}}});t.controller("formController",function(n){n.save=function(){n.$broadcast("show-errors-check-validity")};n.saveHA=function(){n.$broadcast("show-errors-check-validity")}})}(angular),function(n){"use strict";var t,i;t=n.module("haMemberDiscountsModule",[]);i="/book/home";t.controller("haMemberDiscountsCtrl",["$log","$scope","haModal","haConfig","haGlobals",function(n,t,r,u,f){f(["enableTCR"],function(n){t.enableTCR=n});t.applyDiscount=function(n){t.enableTCR?r(u.getTemplateUrl("ecert-or-etco.html"),{backdrop:!0,extendScope:{discountHref:n,etcoHref:i}}):window.location.href=n}}])}(angular),function(n){"use strict";n.module("haFlightScheduleModule",[]).controller("haFlightScheduleCtrl",["$scope","haHttpService","haGlobals","haModal","haHttpService","$filter","$timeout","haDateUtils","haUtils","haConfig","haCitiesSvc","haSitecoreStrings",function(t,i,r,u,f,e,o,s,h,c,l,a){function k(n){var r,u,i;if(t.dateType.type==="d"&&n.length)for(r=t.departureDay.getMonth()+1+"/"+t.departureDay.getDate()+"/"+t.departureDay.getFullYear(),i=0;i<n.length;i++)if(u=n[i].ValidDates,jQuery.inArray(r,u)!==-1)return!1;return!0}function y(n){for(var i,r=0,t=0;t<n.length;t++)for(i=0;i<n[t].Legs.length;i++)r++;return r}var p={getFlights:"/flightschedule/getflightsschedules",getTinyUrl:"/flightschedule/gettinyurl"},w=function(i){t.loading=!1;t.modalData={leg:n.copy(t.leg),dateType:n.copy(t.dateType),departureDay:n.copy(t.departureDay),monthChoice:n.copy(t.monthChoice)};u(c.getTemplateUrl("ha-flightschedule-modal.html"),{id:"flightScheduleModal",backdrop:"true",scope:t,modalLock:!!i})},d=function(){for(var n=new Date,t=n.getMonth(),i,r=[],u=0;u<11;u++)i=t<12?new Date(n.getFullYear(),t,t===n.getMonth()?n.getDate():1):new Date(n.getFullYear()+1,t-12,1),r.push({name:e("date")(i,"MMMM yyyy"),date:i}),t++;return r},b,v={};t.FlightScheduleOptions=[];t.dateTypes=[{type:"d",name:a('FlightScheduleSearch["one day text"]')},{type:"m",name:a('FlightScheduleSearch["one month text"]')}];t.dateType=t.dateTypes[0];t.months=d();t.monthChoice=t.months[0];t.leg={};t.popover=!1;t.currentSort="default";t.flightFilter="all";t.error=!1;t.monthDataDaySearch=!1;t.editSearch=function(){w()};r("FlightScheduleOptions",function(n){var r,i,f,u;n.length?(r=h.getFlightQueryModelCookie(),r!==null&&(i=r.FlightSearchSegmentList[0],r&&i&&i.OriginCityCode&&i.DestinationCityCode&&i.DepartureDate&&(l.getCityByCode(i.OriginCityCode).then(function(n){t.leg.origin=n}),l.getCityByCode(i.DestinationCityCode).then(function(n){t.leg.destination=n}),f=i.DepartureDate.substr(0,10),u=f.split("-"),t.departureDay=new Date(u[0],u[1]-1,u[2]))),t.FlightScheduleOptions=n,t.monthDataDaySearch=k(n)):w(!0)});t.submitSearch=function(){var i={OriginCity:t.modalData.leg.origin.Code,DestinationCity:t.modalData.leg.destination.Code,FlightScheduleType:t.modalData.dateType.type==="d"?0:1,FlightScheduleStartDate:e("date")(t.modalData.dateType.type==="d"?t.modalData.departureDay:t.modalData.monthChoice.date,"yyyy-MM-dd")};t.loading=!0;f.POST(p.getFlights,JSON.stringify(i)).then(function(i){i.data&&i.data.Success&&i.data.FlightScheduleOptions?(t.FlightScheduleOptions=i.data.FlightScheduleOptions,t.$modalCancel(),n.extend(t,t.modalData),t.error=!1,t.monthDataDaySearch=t.dateType.type==="d"?k(t.FlightScheduleOptions):!1):(t.error=!0,t.loading=!1,t.monthDataDaySearch=!1,t.FlightScheduleOptions=[])},function(){t.error=!0;t.loading=!1;t.monthDataDaySearch=!1;t.FlightScheduleOptions=[]})};t.flightSearch=function(){var n=e("date")(t.dateType.type==="d"?t.departureDay:t.monthChoice.date,"yyyy-MM-dd"),i=e("date")(t.dateType.type==="d"?t.departureDay:t.monthChoice.date,"MM/dd/yyyy"),r=e("date")(new Date(n).dateAdd("day",7),"MM/dd/yyyy"),u=["searchDetails=o=",t.leg.origin.Code,";d=",t.leg.destination.Code,";dd="+i,";a=1;c=0;rd=",r,";tt=2"].join("");location.href="/book/home?"+u};t.flightsCount=function(){return e("filter")(t.FlightScheduleOptions,t.filterResults).length};t.showPopover=function(n){if(o.cancel(b),!n&&t.popover){t.popover=!1;return}t.popover||(t.urlLoading=!0);t.popover=!0;o(function(){$("body").on("click.share",function(n){$(n.target).closest(".share-popover").length||t.hidePopoverSlow()})},10);var r=[location.protocol,"//",location.host,location.pathname].join(""),i=["?o=",t.leg.origin.Code,"&d=",t.leg.destination.Code,"&dt=",t.dateType.type==="d"?0:1,"&date=",e("date")(t.dateType.type==="d"?t.departureDay:t.monthChoice.date,"yyyy-MM-dd")].join(""),u={LongUrl:r+i};if(v[i]){t.url=v[i];t.urlLoading=!1;return}f.POST(p.getTinyUrl,JSON.stringify(u)).then(function(n){n.data&&n.data.Success&&n.data.TinyUrl?(t.url=n.data.TinyUrl.TinyUrl,t.urlLoading=!1,v[i]=n.data.TinyUrl.TinyUrl):t.urlLoading=!1},function(){t.urlLoading=!1})};t.hidePopoverSlow=function(){b=o(function(){t.popover=!1;$("body").off("click.share")},1e3)};t.getFlightLegs=function(n){for(var t=[],i=0;i<n.FlightSegments.length;i++)t=t.concat(n.FlightSegments[i].Legs);return t};t.getOriginDestination=function(){return t.leg.origin&&t.leg.destination?[t.leg.origin.DisplayName,a("FlightScheduleSearch.to"),t.leg.destination.DisplayName].join(" "):" "};t.switchOriginDestination=function(){if(t.modalData.leg.origin&&t.modalData.leg.destination){var n=t.modalData.leg.origin;t.modalData.leg.origin=t.modalData.leg.destination;t.modalData.leg.destination=null;t.modalData.leg.destination=n}};t.getDisplayDate=function(){return t.dateType.type==="d"?e("date")(t.departureDay,"longDate"):e("date")(t.monthChoice.date,"MMMM yyyy")};t.getDate=function(n,t){var i=t==="o"?n.FlightSegments[0]:n.FlightSegments[n.FlightSegments.length-1],r=t==="o"?i.Legs[0]:i.Legs[i.Legs.length-1];return moment(t==="o"?r.DepartureDateTime:r.ArrivalDateTime).format("YYYY-MM-DDTHH:mm:ssZZ")};t.isNextDay=function(n,t){var i=s.msToDate(n),r=s.msToDate(t);return!s.isSameDay(i,r)};t.isTripOvernight=function(n){var i=n.FlightSegments[0].Legs[0].DepartureDateTime,r=n.FlightSegments[n.FlightSegments.length-1].Legs[n.FlightSegments[n.FlightSegments.length-1].Legs.length-1].ArrivalDateTime;return t.isNextDay(i,r)};t.numDaysDifference=function(n,t){var i=s.msToDate(n),r=s.msToDate(t);return s.numDaysDifference(i,r)};t.getDurationDelta=function(n,t){return moment(t).diff(n,"minutes")};t.getDuration=function(n){var t=Math.floor(n/60),i=n%60;return[t,a("FlightScheduleResults.hr")," ",i,a("FlightScheduleResults.min")].join("")};t.getLayover=function(n,i,r){var u=t.getFlightLegs(n);return r?"":t.getDuration(t.getDurationDelta(t.msToDate(u[i].ArrivalDateTime),t.msToDate(u[i+1].DepartureDateTime)))};t.getStops=function(n){var t=y(n);return t===1?a("FlightScheduleResults.nonstop"):t===2?"1 "+a("FlightScheduleResults.stop"):--t+" "+a("FlightScheduleResults.stops")};t.getMonthAvailability=function(n){if(!n.ValidDates||!n.ValidDates.length)return"";var t=moment(n.ValidDates[0],"M/D/YYYY"),i=moment(n.ValidDates[n.ValidDates.length-1],"M/D/YYYY");return!t.isValid()||!i.isValid()?"":n.ValidDates.length>1?e("date")(t.toDate(),"MMM. d-")+i.date():e("date")(t.toDate(),"MMM. d")};t.getWeekdayAvailability=function(n){return n.DaysOfOperation?[n.DaysOfOperation.Sunday?a("FlightScheduleResults.sunday"):"-",n.DaysOfOperation.Monday?a("FlightScheduleResults.monday"):"-",n.DaysOfOperation.Tuesday?a("FlightScheduleResults.tuesday"):"-",n.DaysOfOperation.Wednesday?a("FlightScheduleResults.wednesday"):"-",n.DaysOfOperation.Thursday?a("FlightScheduleResults.thursday"):"-",n.DaysOfOperation.Friday?a("FlightScheduleResults.friday"):"-",n.DaysOfOperation.Saturday?a("FlightScheduleResults.saturday"):"-"].join(" "):""};t.setFilter=function(n){t.flightFilter=n};t.getCurrentSort=function(n){switch(t.currentSort){case"depart":return t.getDate(n,"o");case"stops":return y(n.FlightSegments);case"arrive":return t.getDate(n,"d");case"duration":return parseInt(n.JourneyTime,10);default:var i=n.FlightNumber.indexOf("*")===0?"1":"0",r=moment(t.getDate(n,"o")).format("HH:mm:ssZZ"),u=y(n.FlightSegments);return i+u+r}};t.filterResults=function(n){return t.flightFilter==="ha"?!n.IsCodeShare:!0};t.getTerminal=function(n){return n?a("FlightScheduleResults.terminal")+" "+n:""};t.msToDate=s.msToDate;t.moment=moment;t.$watch("url",function(){o(function(){$('[ng-model="url"]').select()},100)})}])}(angular),function(n){"use strict";var t;try{t=n.module("haGiftCardModule")}catch(i){t=n.module("haGiftCardModule",[])}t.controller("giftCardCustomizeController",["$scope","haGlobals","haModal","$window",function(t,i,r,u){t.languageCode=u.languageCode;t.Error="";t.personalMessages=[];t.currencySymbols={USD:"$",AUD:"$",NZD:"$",CNY:"¥",KRW:"₩",JPY:"¥",TWD:"NT$"};t.assignDesignIndexes=function(n){t.designIndexes=[];for(var i=0;i<n.length;i++)t.designIndexes.push(n[i].DesignIndex)};i("giftCardVM",function(i){t.GiftCardVM=i;t.GiftCardVM.CardOrders=i.CardOrders||[{CardID:1,Design:i.Designs[0].Name,DesignIndex:0,Amount:50,To:"",From:"",RecipientEmail:"",PersonalMessage:""}];t.assignDesignIndexes(t.GiftCardVM.CardOrders);t.GiftCardVM.SelectedCardID&&setTimeout(function(){n.element("#GiftCard"+t.GiftCardVM.SelectedCardID).ready(function(){$("html,body").animate({scrollTop:$("#GiftCard"+t.GiftCardVM.SelectedCardID).offset().top},1e3)})},1e3);t.currencyCode=t.GiftCardVM.CurrencyCode||"USD"});t.addCard=function(){var n=t.GiftCardVM.CardOrders.length+1;t.GiftCardVM.CardOrders.length<10&&t.GiftCardVM.CardOrders.push({CardID:n,Design:t.GiftCardVM.Designs[0].Name,DesignIndex:0,Amount:50,To:"",From:"",RecipientEmail:"",PersonalMessage:""});t.assignDesignIndexes(t.GiftCardVM.CardOrders)};t.removeCard=function(n){t.GiftCardVM.CardOrders.splice(n,1);t.assignDesignIndexes(t.GiftCardVM.CardOrders)};t.openFAQModal=function(){console.log("open faq modal");r({id:"FAQ",backdrop:"true",template:n.element(".showFAQ")})};t.openTermsModal=function(){r({id:"Terms",backdrop:"true",template:n.element(".showTerms")})};t.getHelpContent=function(){r("",{id:"gift-card-help",backdrop:"true",template:n.element(".getHelpContent")})}}]);t.controller("giftCardPaymentController",["$scope","$rootScope","haGlobals","haModal","$window","$timeout","haPaymentTypesService",function(t,i,r,u,f,e,o){t.GiftCardPayment={EmailAddress:"",IsGiftCardPayment:"",ProductDetails:""};t.languageCode=f.languageCode;t.submitting=!1;r("giftCardPaymentJson",function(n){t.GiftCardPayment=n;t.currencyCode=t.GiftCardPayment.CurrencyCode||"USD";t.GiftCardPayment.IsGiftCardPayment=!0;t.haPaymentTypes=o;t.haPaymentTypes.setPaymentTypes({data:n.PaymentOptionVM});t.haPaymentTypes.paymentMethod="creditDebit"});t.getHelpContent=function(){u("",{id:"gift-card-help",backdrop:"true",template:n.element(".getHelpContent")})};t.showPrivacyPolicy=function(){u("",{id:"privacy-policy",backdrop:"true",template:n.element(".showPrivacyPolicy")})};t.showTerms=function(){u("",{id:"terms-and-conditions",backdrop:"true",template:n.element(".showTerms")})};t.showGiftCardPreview=function(n){t.orderPreview=t.GiftCardPayment.ProductDetails.CardDetails[n];u({id:"giftCardPreview",backdrop:"true",templateUrl:"/giftCardPreview.html",scope:t})};t.onSubmitForm=function(){return userdata.load_data("user_data"),t.submitting=!0,!0};t.CDESubmit=function(){i.$broadcast("CDESubmit")};t.$on("CDEPaymentSubmitted",function(){t.submitting=!0});t.$on("CDEPaymentSubmitError",function(){t.submitting=!1;e(function(){$("html, body").animate({scrollTop:$("#formIFrame").offset().top-50},"fast")},100)})}]);t.controller("GiftCardConfirmationController",["$scope","haGlobals","haModal",function(t,i,r){t.Error="";i("giftCardJson",function(n){t.giftConfirmVM=n});i("errorMessage",function(n){n!==""&&(t.Error=n)});t.getHelpContent=function(){r("",{id:"gift-card-help",backdrop:"true",template:n.element(".getHelpContent")})}}])}(angular),function(n){"use strict";var t=n.module("haContactUsTopicsModule",[]);t.controller("ContactUsTopicsController",["$scope","haGlobals","haUtils",function(n,t,i){var u=[],r=!1;n.isEN=i.isEN();t(["topics","faqs","jsonTopicInfo"],function(t,i,f){if(n.topics=t,n.QuestionsIntroText=i&&i.length?i[0].QuestionsIntroText:"",u=i&&i.length?i[0].FaqsList:"",n.faqs=i&&i.length?i[0].FaqsList:"",n.topics){for(var o,s,e=0;e<n.topics.length;e++)if(n.topics[e].Title===f.topic){o=n.topics[e];break}if(typeof o!="undefined"){for(e=0;e<o.SubTopics.length;e++)if(o.SubTopics[e].Title===f.subTopic){s=o.SubTopics[e];break}n.topic=o;typeof s!="undefined"&&(n.subTopic=s,r=!0)}}});n.awardChanged=function(t){if(n.awardQuantityArray=[],t.Min!==undefined&&t.Min!==t.Max&&t.Increment!==0){for(var i=t.Min;i<t.Max;i=i+t.Increment)n.awardQuantityArray.push(i.toString());n.awardQuantityArray.push(t.Max.toString())}else n.awardQuantityArray=["1","2","3","4","5","6","7","8","9","10"]};n.$watch("topic",function(t){t&&(n.faqs=n.topic.FaqsList&&n.topic.FaqsList.length>0?n.topic.FaqsList:u);r&&(r=!1)});n.$watch("autoSelectFirstTopic",function(t){t&&n.topics&&(n.topic=n.topics[0])})}])}(angular);module=angular.module("haMyReceiptsModule",["haUtilsModule","haGlobalsModule","haFeatureFlagsModule","haCurrencyModule"]);module.controller("MyReceiptsController",["$scope","haGlobals","haModal","haHttpService",function(n,t,i,r){var f,u;n.Error="";n.activeTab="ticketsAndFees";n.dateRangeConfig={start:"[name=_startDate]",end:"[name=_endDate]",depart_cal_title:"",return_cal_title:"",namespace:"inflight",viewing:moment().startOf("month").subtract(1,"months"),range_start:moment().startOf("day").subtract(9,"months"),range_end:moment().startOf("day"),onRender:function(n){n.addClass("double-wide")}};n.tripType=2;n.legs=[];n.model={startDate:"",endDate:""};f={getReceipts:"/MyReceipts/GetRecieptList",getMyReceiptDetails:"/MyReceipts/GetReceiptDetails",GetMSRDetails:"/MyReceipts/GetMSRDetails"};$(".ha-page-help").hide();n.getRecieptList=function(){n.loading=!0;r.POST(f.getReceipts).then(function(t){t.data&&t.data.Success?(n.RecieptList=t.data.eReceiptsVM,n.error=!1,n.loading=!1):(n.error=!0,n.loading=!1)},function(){n.error=!0;n.loading=!1})};n.ConvertToValidDate=function(n){var t=/-?\d+/.exec(n);return new Date(parseInt(t[0]))};n.moment=moment;n.SplitTicketNumber=function(n){return n.indexOf("-")>=0?n.split("-")[0]:n};n.submitMyReceiptsForm=function(t){t.preventDefault();n.loadingFindReceipt=!0;n.error=!1;var u=$("#MyReceiptsForm").serialize(),i={},r=!1,f=u.split("&");return f.forEach(function(n){n=n.split("=");n[1]===""&&(r=!0);i[n[0]]=decodeURIComponent(n[1]||"")}),i=JSON.parse(JSON.stringify(i)),r===!0?(n.loadingFindReceipt=!1,$("html, body").animate({scrollTop:0},"slow")):n.getReciept(i,"","",!1),!1};u="";n.getReciept=function(t,i,e,o){var s=f.getMyReceiptDetails;u=t===""?{ticketOrMSRNumber:i,lastName:e,enc:0,isExchangedTicket:o}:t;r.POST(s,u).then(function(t){t.data&&t.data.Success?(n.IsMSRdetails=!1,n.IsTicketDetailAvailable=!1,n.RecieptDetails=t.data.eReceiptsDetailViewModel,n.flightToBeExchangedEncoded=n.RecieptDetails.FlightToBeExchanged,n.IsEmdOrdersEnabled=n.RecieptDetails.IsEmdOrdersEnabled,n.IsFindMyCreditFeatureEnabled=n.RecieptDetails.IsFindMyCreditFeatureEnabled,t.data.eReceiptsDetailViewModel.FlighDetailsList==null?n.IsMSRdetails=!0:n.IsTicketDetailAvailable=!0,t.data.eReceiptsDetailViewModel.MSRlist==null&&(n.IsMSRdetails=!1),n.IsMSRdetails||n.IsTicketDetailAvailable?(n.error=!1,window.location.href=t.data.RedirectURL):(n.error=!0,$("html, body").animate({scrollTop:0},"slow")),n.loadingFindReceipt=!1):(n.error=!0,n.loadingFindReceipt=!1,$("html, body").animate({scrollTop:0},"slow"))},function(){n.error=!0;n.loading=!1;$("html, body").animate({scrollTop:0},"slow")})};n.manageQuantity=function(n){return parseInt(n,10)};t(["HACombinedReceipts","HACombinedReceiptsList"],function(t,i){n.CombinedReceipts=t;n.CombinedReceiptsList=i});n.getRecieptList();n.HasMainCabinBasicBooking=function(){if(!n.CombinedReceiptsList)return!1;for(var t=0;t<n.CombinedReceiptsList.length;t++)if(n.CombinedReceiptsList[t].IsMainCabinBasicBooking)return!0;return!1}}]);module.controller("MyReceiptsDetailController",["$scope","haGlobals","haModal","haHttpService","haDateUtils","haSitecoreStrings","$window",function(n,t,i,r,u,f,e){var o,s;n.Error="";n.ReceiptEncryptedTicketNumber=e.EncrytpedTicketnumberJson;n.ReceiptEncryptedLastName=e.EncrytpedLastNameJson;n.EncryptedFlag=e.encryptedFlagJson;n.IsTravelerMSRAvail=!1;o={getReceiptDetails:"/MyReceipts/GetReceipt",getMSRDetails:"/MyReceipts/GetMSRDetails"};t("myReceiptsJson",function(){});n.ShowMSR=function(t){if(n.RecieptMSRDetails=n.RecieptDetails.MSRlist[t],n.IsMSRdetails=!1,n.IsTicketDetailAvailable=!1,n.RecieptMSRDetails.MSRnumber!==""&&n.RecieptMSRDetails.LastName!==""){var i={ticketOrMSRNumber:n.RecieptMSRDetails.MSRnumber,lastName:n.RecieptMSRDetails.LastName};o.GetMSRDetails="/MyReceipts/GetMSRDetails";n.loading=!0;n.IsTicketDetailAvailable=!1;r.POST(o.GetMSRDetails,i).then(function(t){t.data&&t.data.Success?(n.loading=!1,n.IsMSRdetails=!0,n.MSRDetails=t.data.eReceiptsDetailViewModel.MSRlist,n.IsEmdOrdersEnabled=t.data.eReceiptsDetailViewModel.IsEmdOrdersEnabled,n.IsFindMyCreditFeatureEnabled=t.data.eReceiptsDetailViewModel.IsFindMyCreditFeatureEnabled):(n.error=!0,n.loading=!1)},function(){n.error=!0;n.loading=!1})}};n.isContainChar=function(n,t){return n.indexOf(t)>-1?!0:!1};n.getConjTickets=function(n){for(var i=n.split("-"),t=i[0],u=t.substring(0,t.length-2),r=1;r<i.length;r++)t+=", "+u+i[r];return t};$(".ha-page-help").hide();n.IsNumber=function(n){return!isNaN(n)&&n!==null&&n!=="undefined"};n.conjInfo=function(t,i,r){return t+i+n.getConjTickets(r)};n.manageQuantity=function(n){return parseInt(n,10)};n.msToDate=u.msToDate;n.moment=moment;s="";n.getRecieptDetails=function(t,i,u,e){t!==""&&i!==""&&u!==""&&(s={ticketOrMSRNumber:t,lastName:i,enc:u,isExchangedTicket:e},o.getReceiptDetails="/MyReceipts/GetReceiptDetails");n.loading=!0;r.POST(o.getReceiptDetails,s).then(function(t){var r,i;if(t.data&&t.data.Success){if(n.IsTravelerMSRAvail=!1,n.IsMSRdetails=!1,n.IsTicketDetailAvailable=!1,n.RecieptDetails=t.data.eReceiptsDetailViewModel,n.flightToBeExchangedEncoded=n.RecieptDetails.FlightToBeExchanged,n.IsEmdOrdersEnabled=n.RecieptDetails.IsEmdOrdersEnabled,n.IsFindMyCreditFeatureEnabled=n.RecieptDetails.IsFindMyCreditFeatureEnabled,t.data.eReceiptsDetailViewModel.FlighDetailsList==null)n.IsMSRdetails=!0,n.MSRDetails=t.data.eReceiptsDetailViewModel.MSRlist;else for(n.IsTicketDetailAvailable=!0,n.conjInfo="<b>"+f("MyReceiptsDetails.conjunctiveticketinfo")+"<\/b><br/>"+f("MyReceiptsDetails.eticketinfo")+n.getConjTickets(n.RecieptDetails.ETicketNumber),i=0;i<n.RecieptDetails.FlighDetailsList.length;i++)n.RecieptDetails.FlighDetailsList[i].DepartureDateTime&&(r=moment(n.RecieptDetails.FlighDetailsList[i].DepartureDateTime).toDate(),n.RecieptDetails.FlighDetailsList[i].DepartureDateObject=r),n.RecieptDetails.FlighDetailsList[i].ArrivalDateTime&&(r=moment(n.RecieptDetails.FlighDetailsList[i].ArrivalDateTime).toDate(),n.RecieptDetails.FlighDetailsList[i].ArrivalDateObject=r);if(t.data.eReceiptsDetailViewModel.MSRlist!=null)for(n.RecieptMSRDetails=t.data.eReceiptsDetailViewModel.MSRlist,i=0;i<n.RecieptDetails.MSRlist.length;i++)n.RecieptDetails.MSRlist[i].IsMsrAvailable&&(n.IsTravelerMSRAvail=n.RecieptDetails.MSRlist[i].IsMsrAvailable);n.error=!1;n.loading=!1}else n.error=!0,n.loading=!1},function(){n.error=!0;n.loading=!1})};n.ReceiptEncryptedTicketNumber!=null&&n.ReceiptEncryptedLastName!=null&&n.EncryptedFlag?n.getRecieptDetails(n.ReceiptEncryptedTicketNumber,n.ReceiptEncryptedLastName,n.EncryptedFlag,!1):n.getRecieptDetails("","","",!1);n.SplitTicketNumber=function(n){return n.indexOf("-")>=0?n.split("-")[0]:n}}]),function(n){"use strict";var t;try{t=n.module("haTripSummaryModule")}catch(i){t=n.module("haTripSummaryModule",[])}t.controller("haTripSummaryCtrl",["$scope","haHttpService","$window","haGlobals","$filter","$rootScope",function(n,t,i,r,u,f){function e(t){var a=location.href,e,o,u,i,c,l;for(n.summaryModel=t,n.summaryModel.ETCOResponseModel=n.ETCOResponseModel,n.summaryModel.allSegments={},n.summaryModel.totalMiles=0,n.summaryModel.grandTotal=0,n.summaryModel.totalSaved=0,i=0;i<n.summaryModel.AvailGridTrips.length;i++)for(e=0;e<n.summaryModel.AvailGridTrips[i].Segments.length;e++)n.summaryModel.allSegments[n.summaryModel.AvailGridTrips[i].Segments[e].SegmentID]=n.summaryModel.AvailGridTrips[i].Segments[e];for(i=0;i<n.summaryModel.Passengers.length;i++){var r=n.summaryModel.Passengers[i],s=0,h=0;for(o=0;o<n.summaryModel.FareDetails.length;o++)u=n.summaryModel.FareDetails[o],r.FareType===u.FareType&&r.IsCompanion===u.IsCompanion&&(r.fare=u,s=n.summaryModel.SelectedHotel!==null?0:u.TotalAmount*100,/book\/flightresults/i.test(a)?(angular.forEach(r.Seats,function(n){h+=n.SeatAmount}),r.fare.BaseFareAmount=(r.fare.TotalAmount*100-(r.fare.TaxAmount*100+h*100))/100):angular.forEach(r.Seats,function(n){s+=n.SeatAmount*100}),r.Subtotal=s/100,n.summaryModel.grandTotal+=r.Subtotal,n.summaryModel.totalMiles+=r.fare.BaseFareMiles,n.summaryModel.totalSaved+=u.DiscountedAmount);f.$language==="ko-kr"&&(r.taxesOpen=!0)}if(n.summaryModel.MilesPurchaseDetails&&n.summaryModel.MilesPurchaseDetails.PurchaseAmount&&(n.summaryModel.grandTotal+=n.summaryModel.MilesPurchaseDetails.PurchaseAmount),n.summaryModel.SelectedHotel!==null)for(n.summaryModel.grandTotal=n.summaryModel.SelectedHotel.GrandTotalWithoutEC,n.summaryModel.totalSaved+=n.summaryModel.SelectedHotel.PackageSavings,i=0;i<n.summaryModel.Passengers.length;i++)c=n.summaryModel.Passengers[i],angular.forEach(c.Seats,function(t){(+t.Type==1||+t.Type==2||t.IsUpgrade)&&(n.IsSeatAssignmentError||(n.summaryModel.grandTotal+=t.SeatAmount))});n.enableTCR&&n.summaryModel.ETCOResponseModel&&n.summaryModel.ETCOResponseModel.Amount&&(n.summaryModel.grandTotal-=n.summaryModel.ETCOResponseModel.Amount,n.summaryModel.totalSaved+=n.summaryModel.ETCOResponseModel.Amount);n.TripSummary!=null&&(n.TripSummary.TripInsurance!=null&&(n.TripSummary.TripInsurance.IsTripInsuranceSelected||n.TripSummary.IsTripInsuranceConfirmed)&&!n.IsTripInsurancePurchaseError&&(n.summaryModel.grandTotal+=parseFloat(n.TripSummary.TripInsurance.InsuranceCost)),n.TripSummary.SelectedLeiGreeting!=null&&n.TripSummary.SelectedLeiGreeting.isEligible&&(n.summaryModel.grandTotal+=parseFloat(n.TripSummary.SelectedLeiGreeting.totalCost)),n.TripSummary.IsAirportShuttleSelected&&n.TripSummary.SelectedShuttleDetails!=null&&n.TripSummary.SelectedShuttleDetails.isEligible&&(n.summaryModel.grandTotal+=parseFloat(n.TripSummary.SelectedShuttleDetails.totalPrice)),n.IsAirportShuttlePurchaseError&&(n.summaryModel.grandTotal-=parseFloat(n.TripSummary.SelectedShuttleDetails.totalPrice)),n.IsLeigreetingsPurchaseError&&(n.summaryModel.grandTotal-=parseFloat(n.TripSummary.SelectedLeiGreeting.totalCost)));n.summaryModel.grandTotal<0&&(l=0-n.summaryModel.grandTotal,n.summaryModel.grandTotal=0,n.summaryModel.totalSaved-=l)}n.$on("ancillariesOffered",function(n,t){var i=location.href;/book\/payment/i.test(i)&&(t.leiGreeting&&document.body.dispatchEvent(new CustomEvent("LeiGreetingOffered")),t.tripInsurance&&document.body.dispatchEvent(new CustomEvent("TripInsuranceOffered")))});n.enableChildFare=n.$switch("FlightResult:enablechildfarelabels");n.UserInsuranceAmount=0;n.TripSummary.TripInsurance=n.TripSummary.TripInsurance||{};n.TripSummary.TripInsurance.IsTripInsuranceSelected=i.tripInsuranceAdded===1?!0:null;n.$emit("ancillariesOffered",{leiGreeting:n.TripSummary.SelectedLeiGreeting===null,tripInsurance:!!n.TripSummary.TripInsurance&&!i.tripInsuranceAdded});r(["enableTCR","ETCOResponseModel"],function(t,i){n.enableTCR=t;n.ETCOResponseModel=i});n.$watch("PassengerTripSummary",function(n){n&&e(n)});n.$on("ancelaryStateChange",function(){n.PassengerTripSummary&&e(n.PassengerTripSummary)});n.getCabinString=function(t){var i=t.toLowerCase();return n.summaryModel.IsRefundableFare&&(i="refundable"+i),"PassengerTripSummary."+i+"text"}}])}(angular),function(n){"use strict";var t;try{t=n.module("promoDetailsModule")}catch(i){t=n.module("promoDetailsModule",[])}t.controller("promoDetailsCtrl",["$scope","haHttpService","$window","$rootScope",function(n,t,i,r){console.log("promo details ctrl loaded");t.POST("/MyAccount/MemberDiscounts/GetPromotionDetail",{promoCode:n.promoCode}).then(function(t){n.promoData=t.data},function(n){console.log(n,"err")});n.applyPromo=function(t){var i=angular.element("#flightResultsStickProgressBar").scope();i!=null?i.applyPromo(t):r.$broadcast("ExpertBookingApplyPromo",t);n.$modalCancel()};n.RedirectToLoginPage=function(n){i.location.href=n!==null&&n.data!==null&&n.data.RedirectURL!==null?n.data.RedirectURL:i.location.href};n.$on("responseError:UNAUTHORIZED",function(t,i){n.RedirectToLoginPage(i)});n.$on("responseError:FORBIDDEN",function(t,i){n.RedirectToLoginPage(i)})}])}(angular),function(n){"use strict";var t;t=n.module("haTrueUpModule",["haMemberDobModule"]);t.controller("haTrueUpCtrl",["$log","$scope","$rootScope","haUtils","haModal","haGlobals","haHttpService","$window","haGeoDataSvc","haSitecoreStrings","haFeatureFlags",function(t,i,r,u,f,e,o,s,h,c,l){function v(n){function f(n,i,r){return n?n.match(i)?(t.debug("validating",n,"TRUE"),n):(t.debug("validating",n,"FALSE"),r):r}var s=n.AccountDetail.EmailAddress,e,u,o;n.AccountDetail.EmailAddress=f(s,r.$regex.email,"");e=n.AccountDetail.UserName;n.AccountDetail.UserName=f(e,r.$regex.username,"");u=n.MemberAddress;u.Address1=f(u.Address1,r.$regex.addressLine,"");u.Address2=f(u.Address2,r.$regex.addressLine,"");u.Address3=f(u.Address3,r.$regex.addressLine,"");o=h.getPostalCodeRegex(i.VM.MemberAddress.CountryKey);i.VM.MemberAddress.ZipCode=f(i.VM.MemberAddress.ZipCode,o,undefined)}u.attachViewModelToScopeAsVM(i,"TrueUpViewModel").then(function(){e("countryData",function(n){i.countries=h.setCountryData(n)});i.VM.disableUsername=i.VM.AccountDetail.UserName&&i.VM.AccountDetail.UserName.length;v(i.VM);i.usernamePrefilled=!1;i.VM.AccountDetail.UserName!=null&&i.VM.AccountDetail.UserName.length>0&&(i.usernamePrefilled=!0);i.VM.MemberAddress=i.VM.MemberAddress||{};i.MemberPersonalInfo={};i.MemberPersonalInfo=i.VM.MemberPersonalInfo;i.MemberPersonalInfo.DOBMonthDropDown.shift();i.MemberPersonalInfo.DOBYearDropDown.shift();i.MemberPersonalInfo.GenderDropDown.shift();i.$broadcast("VMReady")});var a=function(r){t.error("haTrueUpCtrl",r);i.error=r.data;n.element("html,body").animate({scrollTop:0},"fast");i.submitting=!1};n.extend(i,{hasPostalCode:h.hasPostalCode});i.showPrivacyPolicy=function(){f("/Shared/Modal/GetModalContent?fieldName=ViewPrivacyPolicy&itemId=HMRegistration",{id:"registration-privacy",backdrop:"true"})};i.showTerms=function(){f("/Shared/Modal/GetModalContent?fieldName=ViewTermsFullText&itemId=HMRegistration",{id:"registration-privacy",backdrop:"true"})};i.showIndividualFields=function(){var n=l.get("NonIndividualMemberTypes");return i.VM&&(i.VM.MemberType==null||n==null||n.indexOf(i.VM.MemberType)<0)};i.submitForm=function(){i.submitting=!0;var u={AccountDetail:n.copy(i.VM.AccountDetail),MemberPersonalInfo:{DateOfBirth:i.MemberPersonalInfo.SelectedDOB,Gender:i.MemberPersonalInfo.Gender},GuardianInfo:n.copy(i.VM.GuardianInfo),MemberAddress:n.copy(i.VM.MemberAddress),PhoneDetailList:{PhoneDetails:n.copy(i.VM.PhoneDetailList.PhoneDetails)},SecurityQuestions:{SecurityQuestionAnswers:n.copy(i.VM.SecurityQuestions.SecurityQuestionAnswers)}},r=i.VM.MemberAddress;u.AccountDetail.ZipCode=r.ZipCode;u.AccountDetail.PostalCode=r.ZipCode;u.AccountDetail.PostalCodeKey=r.PostalCodeKey;u.MemberAddress.IsoCode=r.Country&&r.Country.IsoCode||null;u.MemberAddress.CountryKey=r.Country&&r.Country.Key||0;u.MemberAddress.Country=r.Country&&r.Country.DisplayName||null;u.MemberAddress.StateKey=r.State&&r.State.Key||0;u.MemberAddress.State=r.State&&r.State.DisplayName||null;u.MemberAddress.CityKey=r.City&&r.City.Key||0;u.MemberAddress.City=r.City&&(r.City.Name||r.City.DisplayName)||r.CityName;o.POST("/MyAccount/Login/UserProfileTrueUp",u).then(function(n){if(t.debug(n.data),n.data.RedirectURL!=null&&(s.location=n.data.RedirectURL),n.data.IsSuccess!==!0)return a(n);i.error=!1},a)}}])}(angular),function(n){"use strict";var t=n.module("haBarclaysModule",["ngSanitize"]);t.controller("barclaysController",["$scope","$rootScope","haModal","haHttpService","haSitecoreStrings",function(n,t,i,r,u){function p(t){var i,r;t.data&&(i=$(t.data).find("#CCItemEnum").text(),(i==="2"||i==="3")&&(n.preApprovedForCC=!0,n.CCApprovedWithFormData=!0),n.CCItemEnum=i,r=$(t.data).children(),$("#barclaysOfferContain").html(r),n.$root.$broadcast("haStickyResize"))}$("#barclaysModalTemplate").length>0&&!$("#barclaysModal").length&&i("barclaysModalTemplate",{id:"barclaysModal",backdrop:"true",scope:n});$("#preApprovedModalTemplate").length>0&&i("preApprovedModalTemplate",{id:"preApprovedModal",backdrop:"true",modalLock:!0,scope:n});var y=!1,o="PaymentInfo.BillingAddress.Address1",s="PaymentInfo.BillingAddress.Country",h="PaymentInfo.BillingAddress.City",f="PaymentInfo.BillingAddress.State_EN",e="PaymentInfo.BillingAddress.State_EN_Text",c="PaymentInfo.BillingAddress.ZipCode",l="PaymentInfo.CCInfo.FirstName",a="PaymentInfo.CCInfo.LastName",v=0;u.get("ReviewAndPay").then(function(t){n.scContent=t});n.$watch(function(){return window.showAlternateCCOffer},function(t){t&&(n.showAlternateCCOffer=t,n.$root.$broadcast("haStickyResize"))});n.isHMCardHolder=window.acctIsBCUSCardHolder||!1;n.preApprovedForCC=!1;n.CCApprovedWithFormData=!1;n.CCItemEnum=$("#CCItemEnum").text();(n.CCItemEnum==="2"||n.CCItemEnum==="3")&&(n.preApprovedForCC=!0);n.fieldBlurred=function(){var t,i;if(!y&&!n.$root.isMobile&&n.paymentform[l].$modelValue&&n.paymentform[a].$modelValue&&n.paymentform[s].$modelValue&&n.paymentform[o].$modelValue&&n.paymentform[h].$modelValue&&n.paymentform[c].$modelValue){if(n.paymentform[f]&&n.paymentform[f].$modelValue)t=n.paymentform[f].$modelValue;else if(n.paymentform[e]&&n.paymentform[e].$modelValue)t=n.paymentform[e].$modelValue;else return;y=!0;i={Address:{Address:n.paymentform[o].$modelValue,City:n.paymentform[h].$modelValue,State:t,Country:n.paymentform[s].$modelValue,ZipCode:n.paymentform[c].$modelValue},CreditCard:{FirstName:n.paymentform[l].$modelValue,LastName:n.paymentform[a].$modelValue},IsBarclaysPreApprovalPostforNonLoggedInUserDone:!0};r.POST("/book/creditcard/creditpreapprovalcheckfornotloggedinuser",JSON.stringify(i)).then(p)}};n.$on("BarclaysCreditpreApprovalCheck",function(n,t){y=!0;var i={Address:{Address:t.Address1,City:t.City,State:t.State,Country:t.Country,ZipCode:t.ZipCode},CreditCard:{FirstName:t.FirstName,LastName:t.LastName},IsBarclaysPreApprovalPostforNonLoggedInUserDone:!0};r.POST("/book/creditcard/creditpreapprovalcheckfornotloggedinuser",JSON.stringify(i)).then(p)});n.requestData=function(i,r){if(v=n.preApprovedForCC?1:2,r==="scope"&&(r=n.CCItemEnum),t.isLoggedIn&&(r==="2"||r==="3")&&!n.CCApprovedWithFormData)n.applyNow(!1,i,r);else{n.itemEnum=r;var u=document.getElementById("formIFrame");u.contentWindow.postMessage("barclaysRequest",iframeOrigin)}};n.$on("BarclaysApplyNow",function(t,i){var u="/book/creditcard/acceptoffer?IsFullApp=true&fn="+i.FirstName+"&ln="+i.LastName+"&co="+i.Country+"&a1="+i.Address1+"&cy="+i.City+"&st="+i.State+"&zp="+i.ZipCode+"&oe="+n.itemEnum;n.error=!1;r.GET(u).then(function(t){var i,r;t.data&&t.data.Success?(i=t.data.postURL,v>0&&(v===1?r=n.scContent.preapprovalbannerctalink:v===2&&(r=n.scContent.fullapplicationbannerctalink),i+="&referrerid="+r),window.location.href=i):n.error=!0},function(){n.error=!0})});n.applyNow=function(t,i,u){var p="",w="",b="",k="",d="",g="",y="/book/creditcard/acceptoffer?IsFullApp="+t,v;t&&(n.paymentform[f]&&n.paymentform[f].$modelValue?v=n.paymentform[f].$modelValue:n.paymentform[e]&&n.paymentform[e].$modelValue&&(v=n.paymentform[e].$modelValue),typeof n.paymentform[l]!="undefined"&&(p=n.paymentform[l].$modelValue),typeof n.paymentform[a]!="undefined"&&(w=n.paymentform[a].$modelValue),typeof n.paymentform[s]!="undefined"&&(b=n.paymentform[s].$modelValue),typeof n.paymentform[o]!="undefined"&&(k=n.paymentform[o].$modelValue),typeof n.paymentform[h]!="undefined"&&(d=n.paymentform[h].$modelValue),typeof n.paymentform[c]!="undefined"&&(g=n.paymentform[c].$modelValue),typeof v=="undefined"&&(v=""),y+="&fn="+p+"&ln="+w+"&co="+b+"&a1="+k+"&cy="+d+"&st="+v+"&zp="+g);y+="&oe="+u;n.error=!1;r.GET(y).then(function(t){t.data&&t.data.Success?window.location.href=t.data.postURL:n.error=!0},function(){n.error=!0})};n.acceptOffer=function(){r.GET("/book/creditcard/acceptpreapprovaloffer");n.$modalClose()};n.decline=function(){r.GET("/book/creditcard/declineoffer");n.$modalClose()};n.closeModal=function(){r.GET("/book/creditcard/closemodal");n.$modalClose()}}])}(angular),function(n){"use strict";var t=n.module("haNitpModule",[]);t.controller("nitpServiceOfferController",["$scope","haGlobals","$window","$location","haCitiesSvc","haHttpService","$timeout","haModal","$filter",function(t,i,r,u,f,e,o,s,h){t.nitpFormData={};t.nitpFormData.homeAirport="";t.nitpFormData.destinationAirport="";t.nitpVM={OfferDetails:null,DefaultOfferDetails:null,AccountNumber:""};t.errorMessage="";t.hasErrorMessage=!1;f.getNitpOrigins().then(function(n){t.originCities=n});t.selectTab=function(i){t.errorMessage="";t.hasErrorMessage=!1;n.forEach(t.nitpVM.OfferDetails,function(n){n.NIPassID===i?(t.nitpVM.OfferDetails[t.nitpVM.OfferDetails.indexOf(n)].IsSelected=!0,t.nitpFormData.plan=n):t.nitpVM.OfferDetails[t.nitpVM.OfferDetails.indexOf(n)].IsSelected=!1})};t.getHelpContent=function(){s("",{id:"nitp-selectoffer-help",backdrop:"true",template:n.element(".getHelpContent")})};i("jsonofferDetailsVM",function(n){t.nitpVM.OfferDetails=n.AvailableOffers;t.nitpVM.DisplayOffers=n.DisplayOffers;t.nitpVM.AccountNumber=n.AccountNumber});t.submit=function(){var i,o=!0,u=!1,f,s;n.forEach(t.nitpVM.DisplayOffers,function(n){n.IsSelected&&o&&(i=n,o=!1)});f=!1;i!=null&&i.NIPassID==="4"&&t.nitpFormData.homeAirport&&t.nitpFormData.destinationAirport?n.forEach(t.nitpVM.OfferDetails,function(n){if(i.NIPassID===n.NIPassID&&(n.Origin===t.nitpFormData.homeAirport&&n.Dest===t.nitpFormData.destinationAirport||n.Origin===t.nitpFormData.destinationAirport&&n.Dest===t.nitpFormData.homeAirport))if(f=!0,n.IsEligible&&!n.IsAvailable)t.errorMessage=r.nitpErrorMsg,u=!0;else if(!n.IsEligible){if(n.NextEligibleDate!=="01/01/0001"){var e=h("date")(new Date(n.NextEligibleDate),"MMM dd yyyy");t.errorMessage=r.nitpPurchasedMsg+"  <b>"+e+"<\/b>."}else t.errorMessage=r.nitpErrorMsg;u=!0}}):i!=null&&+i.NIPassID!=4?(f=!0,i.IsEligible||i.IsAvailable?i.IsEligible||(window.offer.NextEligibleDate!=="01/01/0001"?(s=h("date")(new Date(offer.NextEligibleDate),"MMM dd yyyy"),t.errorMessage=r.nitpPurchasedMsg+"  <b>"+s+"<\/b>."):t.errorMessage=r.nitpErrorMsg):(t.errorMessage=r.nitpErrorMsg,u=!0)):(t.errorMessage=r.nitpErrorMsg,u=!0);f||(t.errorMessage=r.nitpErrorMsg,u=!0);u?(t.hasErrorMessage=!0,n.element("html,body").animate({scrollTop:100},"fast")):e.POST("/Program/NITPPurchase/PurchaseSelectedNIOffer",{offerID:i.NIPassID,orig:t.nitpFormData.homeAirport,dest:t.nitpFormData.destinationAirport}).then(function(n){n.data.IsSuccess&&(r.location=n.data.RedirectURL)})};t.$watch("nitpFormData.homeAirport",function(n){n&&f.getNitpDestinations(n).then(function(n){t.destinationCities=n})})}]);t.controller("nitpLandingController",["$scope","haGlobals","$window","$location","haCitiesSvc","haHttpService",function(n,t,i,r,u,f){var e=function(n){console.error(n)};n.showExtraFeatures=!1;n.IsEligible=!1;f.POST("/Program/NITPPurchase/GetNIOfferDetails").then(function(t){t.data.IsSuccess?$.extend(n,t.data):e(t)},e);n.selectNIOffer=function(n){f.POST("/Program/NITPPurchase/SetSelectedNIOffer",{offerID:n}).then(function(n){n.data.RedirectURL!=null&&(i.location=n.data.RedirectURL)})}}]);t.controller("nitpPaymentController",["$scope","$rootScope","haGlobals","$window","$location","haCitiesSvc","haHttpService","haModal","$timeout","$filter",function(t,i,r,u,f,e,o,s,h,c){t.errorMessage="";t.nitpVM={OfferDetails:null};t.submitting=!1;t.getHelpContent=function(){s("",{id:"nitp-payment-help",backdrop:"true",template:n.element(".getHelpContent")})};t.submit=function(n){if(t.IsPaymentProcessing)return!1;if(t.IsPaymentProcessing=!0,$("#PaymentInterstitial-modal").length===0){var i=$("#PaymentInterstitial").html();s({id:"PaymentInterstitial-modal",backdrop:"true",template:i,modalLock:!0});t.interstitialDynamicResize()}n.preventDefault();t.form=$("#nitppaymentform");h(function(){t.processPayment()},0)};t.isNitpPurchaseValid=function(i){var r=!1;return n.forEach(i.data.AvailableOffers,function(n){if(n.NIPassID===t.nitpVM.OfferDetails.NIPassID&&!n.IsEligible){if(n.NextEligibleDate!=="01/01/0001"){var i=c("date")(new Date(n.NextEligibleDate),"MMM dd yyyy");t.errorMessage=u.nitpPurchasedMsg+"  <b>"+i+"<\/b>."}else t.errorMessage=u.nitpErrorMsg;r=!0;t.isDuplicatePurchase=!0}}),r};t.interstitialDynamicResize=function(){$(".ha-modal#PaymentInterstitial-modal .modalContainer").css({width:$(window).width(),height:$(window).height(),"padding-top":$(window).height()*.2})};t.showTerms=function(){s("",{id:"terms-and-conditions",backdrop:"true",template:n.element(".showTerms")})};t.processPayment=function(){userdata.load_data("user_data");var n=$(t.form).serialize();o.POST("/Program/NITPPurchase/Payment",n,{headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(function(n){n.data.IsSuccess?u.location=n.data.RedirectURL:(t.IsPaymentProcessing=!1,n.data.ServiceErrors!=null&&(t.errorMessage=n.data.ServiceErrors[0]),n.data.RedirectURL!=null&&n.data.RedirectURL.indexOf("programs/nitp/confirmation")<=-1&&(u.location=n.data.RedirectURL),t.$emit("closeModal"),$("body, html").animate({scrollTop:300},"slow"))})};r("nitpPaymentJson",function(n){t.nitpVM.OfferDetails=n.OfferDetail});t.haPaymentTypes={paymentMethod:"creditDebit"};t.CDESubmit=function(){t.form=$("#nitppaymentform");o.POST("/Program/NITPPurchase/GetNIOfferDetails").then(function(n){var r=t.isNitpPurchaseValid(n);r===!1?i.$broadcast("CDESubmit"):(t.$emit("closeModal"),$("body, html").animate({scrollTop:300},"slow"))})};t.$on("CDEPaymentSubmitted",function(){var n=$("#PaymentInterstitial").html();s({id:"PaymentInterstitial-modal",backdrop:"true",template:n,modalLock:!0});t.interstitialDynamicResize()});t.$on("CDEPaymentSubmitError",function(){t.$emit("closeModal");h(function(){$("html, body").animate({scrollTop:$("#formIFrame").offset().top-50},"fast")},100)})}]);t.controller("nitpConfirmController",["$scope","haGlobals","$window","$location","haCitiesSvc","haHttpService","haModal",function(t,i,r,u,f,e,o){t.nitpVM={OfferDetails:null,OrderID:""};i("nitpConfirmJson",function(n){t.nitpVM.OfferDetails=n.OfferDetail;t.nitpVM.OrderID=n.OrderID;t.nitpVM.RequiredSavePayment=n.RequiredSavePayment;t.nitpVM.CCMessage=n.CCMessage;t.nitpVM.CCSuccess=n.CCSuccess});t.getHelpContent=function(){o("",{id:"nitp-Confirmation-help",backdrop:"true",template:n.element(".getHelpContent")})};t.showTerms=function(){o("",{id:"terms-and-conditions",backdrop:"true",template:n.element(".showTerms")})};t.showFAQ=function(){o("",{id:"nitp-faq",backdrop:"true",template:n.element(".showFAQ")})}}])}(angular),function(n){"use strict";var t=n.module("haMyDashboardModule",["ui.router"]);/^\/my-account\/?$/i.test(location.pathname)&&t.config(["$stateProvider","$urlRouterProvider",function(n,t){n.state("changerequest",{url:"/changerequest",templateProvider:["haConfig",function(n){return n.getTemplateUrlWithInclude("ha-mydashboard-changerequest.html")}]}).state("contactsalesrep",{url:"/contactsalesrep",templateProvider:["haConfig",function(n){return n.getTemplateUrlWithInclude("ha-mydashboard-salesrepcontact.html")}]}).state("changeaccount",{url:"/changeaccount",templateProvider:["haConfig",function(n){return n.getTemplateUrlWithInclude("ha-mydashboard-changeaccount.html")}]});t.otherwise("/dashboard")}]).run(["$rootScope",function(n){n.$on("$stateChangeSuccess",function(){$("html, body").animate({scrollTop:$("[ui-view]").offset().top},200)})}]);t.controller("haMyDashboardCtrl",["$scope","$http","$timeout","$q","$state","$filter","$window","$log","haMyAccountAPI","$rootScope",function(t,i,r,u,f,e,o,s,h,c){var l,p,w;t.$on("$stateChangeSuccess",function(n,i){setTimeout(function(){document.body.dispatchEvent(new CustomEvent("MyDashBoard"))});var r=c.isLoggedIn&&c.corpAccTypes.indexOf(c.user.accountType)>-1;r||i.name!=="changeaccount"&&i.name!=="contactsalesrep"&&i.name!=="changerequest"||(o.location.href="/my-account");i.name!=="contactsalesrep"||t.salesRepContact?i.name!=="changerequest"||t.changeRequest?i.name!=="changeaccount"||t.corpWebAccountUpdate||(t.loading=!0,h.getcorpwebaccountupdate().then(function(n){t.corpWebAccountUpdate=n.data;t.changeAcctModel={};t.paymentModel={};t.changeAcctModel.DateOfChangeRequest=e("date")(new Date,"shortDate");t.changeAcctModel.FromEmail=t.corpWebAccountUpdate.FromEmail;t.changeAcctModel.CorporateAccountNumber=t.corpWebAccountUpdate.CorporateAccountNumber;t.changeAcctModel.AccountName=t.corpWebAccountUpdate.AccountName;t.loading=!1},function(){s.error("There was an error while retreiving /myaccount/mydashboardform/getcorpwebaccountupdate")})):(t.loading=!0,h.getchangerequestform().then(function(n){t.changeRequest=n.data;t.loading=!1},function(){s.error("There was an error while retreiving /myaccount/mydashboardform/getchangerequestform")})):(t.loading=!0,t.showSalesRepForm=!1,h.getcontactsalesrepform().then(function(n){t.salesRepContact=n.data;t.loading=!1;t.showSalesRepForm=!0},function(){s.error("There was an error while retreiving /myaccount/mydashboardform/getcontactsalesrepform")}))});t.AddHyphenString=function(n){return n.length==7?n.replace(/(\d{3})(\d{4})/,"$1-$2"):n};setTimeout(function(){document.body.dispatchEvent(new CustomEvent("MyDashBoard"))});var v=window.location.href,a=0,y=v;a=v.indexOf("?");a===-1&&(a=v.indexOf("#"));a!==-1&&(y=v.substring(0,a)+"/");t.URLHome=y;t.changeRequestSubmitted=t.changeRequestError=t.salesRepContactSubmitted=t.salesRepContactError=!1;l=function(){$("body, html").animate({scrollTop:500},"slow")};t.changeRequestModel={};t.$watch("changeRequestModel.DepartTravelDate",function(n){n>t.changeRequestModel.ReturnTravelDate&&(t.changeRequestModel.ReturnTravelDate=undefined)});t.$watch("changeRequestModel.ReturnTravelDate",function(n){n<t.changeRequestModel.DepartTravelDate&&(t.changeRequestModel.DepartTravelDate=undefined)});t.submitChangeRequest=function(n){var r=new FormData,f=document.querySelector('input[name="FirstFileAttachment"]').files[0],e=document.querySelector('input[name="SecondFileAttachment"]').files[0],o=document.querySelector('input[name="ThirdFileAttachment"]').files[0],s=document.querySelector('input[name="FourthFileAttachment"]').files[0],h=document.querySelector('input[name="FifthFileAttachment"]').files[0],u,c;f&&(n.FirstFileAttachment=f);e&&(n.SecondFileAttachment=e);o&&(n.ThirdFileAttachment=o);s&&(n.FourthFileAttachment=s);h&&(n.FifthFileAttachment=h);for(u in n)r.append(u,n[u]);c={headers:{"Content-Type":undefined}};console.log(r);t.loading=!0;i.post("/myaccount/mydashboardform/UpdateChangeRequest",r,c).then(function(n){n.data.IsFileSizeError||n.data.IsFileTypeError?(t.fileAttachmentNum=n.data.fileAttachmentNum,t.isFileSizeError=n.data.IsFileSizeError,t.isFileTypeError=n.data.IsFileTypeError):n&&n.data.Success?(t.changeRequestSubmitted=!0,t.changeRequestModel={},l()):(t.changeRequestError=!0,l())},function(){t.changeRequestError=!0;l()})["finally"](function(){t.loading=!1})};t.submitSalesRepContact=function(n){t.loading=!0;i.post("/myaccount/mydashboardform/sendcontactsalesrepformemail",JSON.stringify(n)).then(function(n){n&&n.data.Success?(t.salesRepContactSubmitted=!0,t.salesRepModel={},l()):(t.salesRepContactError=!0,l())},function(){t.salesRepContactError=!0;l()})["finally"](function(){t.loading=!1})};t.submitChangeCorpAccountRequest=function(n){var u=new FormData,f=document.querySelector('input[name="FirstFileAttachment"]').files[0],e=document.querySelector('input[name="SecondFileAttachment"]').files[0],s=document.querySelector('input[name="ThirdFileAttachment"]').files[0],r,h;if(f&&(n.FirstFileAttachment=f),e&&(n.SecondFileAttachment=e),s&&(n.ThirdFileAttachment=s),Object.keys(n).length===4){o.alert(t.corpWebAccountUpdate.corpWebAccountUpdateSitecoreVM.AlertNoFieldChanged);l();return}if((!(Object.keys(n).length>5)||o.confirm(t.corpWebAccountUpdate.corpWebAccountUpdateSitecoreVM.AlertMoreThanOneFieldChanges))&&(!(Object.keys(t.paymentModel).length>0)||o.confirm(t.corpWebAccountUpdate.corpWebAccountUpdateSitecoreVM.AlertFormOfPaymentFieldsChanged))){for(r in n)u.append(r,n[r]);t.loading=!0;h={headers:{"Content-Type":undefined}};i.post("/myaccount/mydashboardform/updatecorpwebaccount",u,h).then(function(n){n&&n.data.Success?(t.changeCorpAcctSubmitted=!0,t.changeAcctModel={}):(t.changeCorpAccountError=!0,l())},function(){t.changeCorpAccountError=!0;l()})["finally"](function(){t.loading=!1})}};t.selectedAvatar={};t.$on("$closeCustomDropdown",function(){t.selectedAvatar&&i.post("/myaccount/mydashboard/saveprofileavatar",JSON.stringify({AvatarId:t.selectedAvatar.ID,AvatarUrl:t.selectedAvatar.ProfileImageSrc}))});t.ccYears=function(n,t){while(n--)t[n]=n+(new Date).getFullYear();return t}(11,[]);t.$on("$selectedAvatarURL",function(n,i){i&&(t.selectedAvatar=i)});p=n.element("#barclaysModalTemplate").length>0;w=n.element("#newUserCCOfferTemplate").length>0;!p&&w&&c.$language==="en"&&haModal("",{id:"newuserccoffer",backdrop:"true",modalLock:!1,scope:t,template:n.element("#newUserCCOfferTemplate")})}])}(angular),function(n){"use strict";var t;t=n.module("haAffiliateModule",[]);t.controller("haAffiliateCtrl",["$log","$scope","$rootScope","haHttpService","$window",function(n,t,i,r,u){t.VM={};t.VM.affiliatePromoCode="";t.VM.isErrorResponse=!1;t.VM.errorMessage="";var f=function(t){n.error("haAffiliateCtrl",t)};t.submitForm=function(){t.VM.isErrorResponse=!1;t.VM.errorMessage="";r.POST("/Program/Affiliate/ValidateAffiliate",{promoCode:t.VM.affiliatePromoCode}).then(function(i){n.debug(i.data);i.data.IsSuccess&&i.data.RedirectURL!=null?(i.data.RedirectURL=i.data.RedirectURL,u.location=i.data.RedirectURL):(t.VM.isErrorResponse=!0,t.VM.errorMessage=i.data.ServiceErrors!=null?i.data.ServiceErrors[0]:"Error While Processing Request",f(i))},f)}}])}(angular),function(n){"use strict";var t=n.module("haPaxModule",["ui.router","duScroll","ngSanitize","haGeoDataModule"]);location.pathname.toLowerCase().indexOf("/book/pax")>-1&&t.config(["$stateProvider","$urlRouterProvider",function(n,t){t.otherwise(function(n){var i=n.get("haGlobals"),r=n.get("$rootScope"),t=n.get("$state");i(["PaxVM"],function(n){n.IsLoggedIn?n.IsCorporate?t.go("passenger.corporate.x",{id:1,replace:!0}):t.go("passenger.x",{id:1}):t.go("passenger.x",{id:1})})});var i=["$rootScope","$scope","$state",function(n,t){window.digitalDataLoaded.then(function(){setTimeout(function(){document.body.dispatchEvent(new CustomEvent("PassengerPage",{detail:{pageName:window.digitalData.page.pageInfo.name}}))})});t.$on("$stateChangeStart",function(i,r,u,f,e){var s=parseInt(e.id,10),o=parseInt(u.id,10),h;(f.name==="passenger.x"&&s&&o&&s>o||f.name==="passenger.contact")&&(setTimeout(function(){document.body.dispatchEvent(new CustomEvent("PassengerPage",{detail:{pageName:window.digitalData.page.pageInfo.name}}))}),h={pageName:window.digitalData.page.pageInfo.name+":passenger:"+o,pageURL:[location.origin,location.pathname,location.search,"#/passenger/"+o].join("")},window.digitalDataLoaded.then(function(){setTimeout(function(){document.body.dispatchEvent(new CustomEvent("PassengerPage",{detail:h}))})}),t.prevTraveler());f.name==="passenger.x"&&s&&o&&s<o&&t.nextTraveler();r.name!=="passenger.contact"&&f.name!=="passenger.contact"&&r.name!=="passenger.corporate.x"&&i.preventDefault();r.name==="passenger.x"&&f.name==="passenger.contact"&&(t.resetErrors(),n.$broadcast("$modalCancel"))})}];n.state("passenger",{abstract:!0,url:"/passenger",controller:i,template:"<div ui-view><\/div>"}).state("passenger.x",{url:"/{id:int}",templateProvider:["haConfig",function(n){return n.getTemplateUrlWithInclude("Book/Pax/ha-pax.html")}]}).state("passenger.corporate",{url:"^/corporate",controller:"PaxCtrl",template:"<div ui-view><\/div>"}).state("passenger.corporate.x",{url:"/{id:int}",controller:"haCorporateTravelersCtrl",templateProvider:["haConfig",function(n){return n.getTemplateUrlWithInclude("my-account/ha-corporate-travelers.html")}]}).state("passenger.contact",{url:"^/contact",templateProvider:["haConfig",function(n){return n.getTemplateUrlWithInclude("Book/Pax/ha-pax-contact.html")}]})}]).run(["$rootScope","$stateParams","$state",function(n,t,i){n.$state=i;n.$stateParams=t}]);t.controller("PaxCtrl",["$scope","$rootScope","$stateParams","$state","haHttpService","$document","$timeout","haGlobals","haModal","haUtils","haConfig","haPassengersService","haGeoDataSvc","haPaxService","$window","haInterstitialAPI",function(t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w){function ft(n){$(".dynamicAlertContainer").find(".alert-content-secondary").html(n);$("body, html").animate({scrollTop:0},"slow")}function d(n){return t.selectedTravelers.get().filter(function(t){return n.test(t.Type)}).length}function b(n){if(n!=="jsError")switch(n.ErrorCodeHandle){case"SessionTimeOut":window.location.href="/book/error?ErrorType=SessionTimeOut";break;default:if(n.ErrorCodeHandle!==undefined)window.location.href=n.RedirectURL;else return!1}else window.location.href="/book/error?ErrorType=Technical&ErrorCode=js%20xhr"}function tt(){var n;if(t.errordescription="",t.errorCategory="",n=t.Passengers.filter(function(n){return n.IsSelectedPax&&(!n.DOBYear||!n.DOBMonth||!n.DOBDay)}),n.length>0)return t.isPageError=!0,t.errortype="error",t.errorCategory="missinginfo",t.errordescription=$scs("PassengerInfo.CompanionMissingFieldErrorMessageText"),$("body, html").animate({scrollTop:0},"slow"),!1;var r=d(/Adult/),u=parseInt(t.TripSummary.AdultCount,10),f=d(/Child|Infant/),i=parseInt(t.TripSummary.ChildCount,10);return(t.selectedTravelers.get().length!==t.totalPaxCount?(t.isPageError=!0,t.errortype="error",t.errorCategory="travelermismatch",t.errordescription=$scs("PassengerInfo.travelerinformationmismatchmessage")):r>u||i>0&&i>f?(t.isPageError=!0,t.errortype="error",t.errorCategory="travelermismatch",t.errordescription=$scs("PassengerInfo.selectchildpassengertext")):t.isPageError=!1,t.isPageError)?($("body, html").animate({scrollTop:0},"slow"),!1):(t.isPageError=!1,!0)}function g(n,i){(n.DuplicateEnrollEmail===null||n.DuplicateEnrollEmail.Status==="SUCCESS"||n.DuplicateEnrollEmail.Status==="")&&n.IsValidHMNumber?(t.ServiceErrorMessage="",t.IsServiceErrors=!1,t.duplicateEmailError=t.ageLimitError=!1):n.DuplicateEnrollEmail.Status==="AGELIMIT"?(t.ServiceErrorMessage=$scs("PassengerInfo.PassengerInfo.agelimitemailstatuserror"),t.IsServiceErrors=!0,t.ageLimitError=!0,i&&$("body, html").animate({scrollTop:0},"slow")):n.DuplicateEnrollEmail.Status==="DUPLICATE"&&(t.ServiceErrorMessage=$scs("PassengerInfo.duplicateemailstatuserror"),t.IsServiceErrors=!0,t.duplicateEmailError=!0,i&&$("body, html").animate({scrollTop:0},"slow"))}function et(){i.isMobile||$(".ha-modal#InterstitialAirAvailability-modal .modalContainer").css({width:$(window).width(),height:$(window).height(),"padding-top":$(window).height()*.2})}function nt(n){n.isHAMember!=="0"&&n.HMNumber?n.isHAMember==="1"&&(n.EmailID=""):n.HMNumber=""}function ot(){t.UpdatePhoneDetailsValidation=t.PaxContactInfo;t.PhoneDetails=t.UpdatePhoneDetailsValidation.PhoneDetailsVM.PhoneDetails;t.PhoneDetails.length&&t.PhoneDetails.forEach(function(n){n.Type=Number(n.Type)?["Home","Work","Mobile"].indexOf(n.Type)+1:n.Type});t.PhoneDetails[0]=t.PhoneDetails[0]||{CountryCode:window.defaultPhoneCountryCode,Number:"",Type:1};t.PhoneDetails[1]=t.PhoneDetails[1]||{CountryCode:window.defaultPhoneCountryCode,Number:"",Type:1};t.PhoneDetails[2]=t.PhoneDetails[2]||{CountryCode:window.defaultPhoneCountryCode,Number:"",Type:1}}function st(){w.getAirAvailability().success(function(n){h({id:"InterstitialAirAvailability-modal",backdrop:"true",template:n,modalLock:!0});et();ht()})}function ht(){h(l.getTemplateUrl("ha-iframe-breakout-modal.html"),{modalClass:"ha-content-modal",id:"iframe-breakout-modal",scope:t,modalLock:!0});t.breakOutUrl=p.self.location.href}c.inIframe()&&st();t.genders=[{name:i.$scs("PassengerInfo.malelabel"),value:"M"},{name:i.$scs("PassengerInfo.femalelabel"),value:"F"}];t.phoneTypes=[{name:i.$scs("PassengerInfo.HomeText"),value:1},{name:i.$scs("PassengerInfo.WorkText"),value:2},{name:i.$scs("PassengerInfo.MobileText"),value:3}];i.isBooking=!0;t.months=window.PaxVM.DOBMonthDropDown?window.PaxVM.DOBMonthDropDown.map(function(n){return{name:n.Name,value:n.Value}}):[{name:"January",value:"1"},{name:"February",value:"2"},{name:"March",value:"3"},{name:"April",value:"4"},{name:"May",value:"5"},{name:"June",value:"6"},{name:"July",value:"7"},{name:"August",value:"8"},{name:"September",value:"9"},{name:"October",value:"10"},{name:"November",value:"11"},{name:"December",value:"12"}];t.months.length>12&&t.months.shift();t.days=function(n,t){while(n--)t[n]=(n+1).toString();return t}(31,[]);t.years=function(n,t){while(n--)t[n]=(n+(new Date).getFullYear()-100).toString();return t}(101,[]).reverse();t.IsAffiliateBooking=window.PaxVM.IsAffiliateBooking;t.$pax=a;t.Passengers=t.$pax.passengers=[];t.selectedTravelers=y.selectedTravelers();t.tempTraveler=[];t.grandTotal=0;t.isPageError=!1;t.ContactInfo="";t.paxRules=[];t.showInfantHelp=!1;t.Country=[];t.CountryFlag=!1;t.DupeEmailFlag="";t.IsServiceErrors=!1;t.IsInValidHMNumber=!1;t.ServiceErrorMessage="";t.errordescription="";t.PhoneReqired=!1;t.IsInfantMaxError=!1;t.IsInfantAdultError=!1;t.IsEditingError=!1;t.isDisableName=!1;t.isLoggedinEtco=!1;t.taxDetails=!1;t.isInfantEnabled=!1;t.enablePassengerTripSummary=!0;t.enableTCR=p.enableTCR;t.travelCoordinator=!1;s(["PaxVM","defaultPhoneCountryCode","ETCOResponseModel","countryData"],function(r,u,f,e){$.extend(t,r);t.countries=v.setCountryData(e);ot(t.PhoneDetails);t.countryCodeDropDown=t.UpdatePhoneDetailsValidation.PhoneDetailsVM.CountryCodeDropDown;i.phoneCount=t.PaxContactInfo.PhoneDetailsVM.PhoneDetails.reduce(function(n,t){return Number(!!t.Number)+n},0)||1;t.tcInfo=t.PaxContactInfo.TravelCoordinatorInfo;t.tcInfo===null||t.tcInfo.TravelCoordinatorPhoneDetails!==null&&t.tcInfo.TravelCoordinatorPhoneDetails.Number?(t.travelCoordinator=!0,t.tcInfo.TravelCoordinatorPhoneDetails.Type=["Home","Work","Mobile"].indexOf(t.tcInfo.TravelCoordinatorPhoneDetails.Type)):t.tcInfo.TravelCoordinatorPhoneDetails={CountryCode:u,Number:"",Type:1};f&&f.Passengers&&f.Passengers.length===1&&!f.IsGAFTravelCredit&&(t.isDisableName=!0,t.isLoggedinEtco=!0,n.extend(t.Passengers[0],f.Passengers[0]))});t.countryPhoneDropdown=v.getPhoneCountryCodes();t.phoneRegexByCC=function(n){var t=v.lookupCountryByCode(n);return t!==null?v.getPhoneNumberRegex(t.Key):/.*/};t.TripSummary.SelectedShuttleDetails=null;t.TripSummary.IsAirportShuttleSelected=!1;t.TripSummary.TotalPremiumSeatAmount=0;t.TripSummary.UnselectedExtraComfortSeatsDowngradeAmount=0;t.PricingType=t.TripSummary.PricingType;t.currency=t.TripSummary.currency;t.totalPaxCount=parseInt(t.TripSummary.PaxCount,10);t.IsAllPaxUpdated=!0;for(var it=parseInt(t.TripSummary.AdultCount,10)||0,rt=parseInt(t.TripSummary.ChildCount,10)||0,ut=parseInt(t.TripSummary.InfantCount,10)||0,k=0;k<it;k++)t.$pax.add({type:"Adult"});for(k=0;k<rt;k++)t.$pax.add({type:"Child"});for(k=0;k<ut;k++)t.$pax.add({type:"Infant"});t.setNextForm=function(){var i=n.element("ol.pax li.active form, #contactInfoForm");i.length&&(t.currentForm=i.scope()[i.attr("name")],t.currentForm.$setPristine(),o(function(){i.find("input").first().focus().select()},1200))};t.nextTraveler=function(){var i=r.id-1,n=t.Passengers[i],f;if(t.currentForm.$invalid){o(function(){t.currentForm.$validate(t.currentForm)},0);return}t.IsServiceErrors=t.IsInValidHMNumber=t.DuplicateInfoError=!1;t.ServiceErrorMessage="";!0||t.currentForm.$dirty?(nt(n),n.saving=!0,t.$pax.addeditpax(n).success(function(f){var e,s;if(!b(f,"haPassengersAPI-addeditpax")){if(t.showInfantHelp=f.Passengers?f.Passengers.some(function(n){return n.PassengerType==="Infant"}):!1,f.ErrorMessage){t.IsServiceErrors=!0;t.ServiceErrorMessage=f.ErrorMessage;n.saving=!1;$("body, html").animate({scrollTop:0},"fast");return}if(f.DoBCheckMessagesList.length>0?(t.paxRules=f.DoBCheckMessagesList,t.AllowBooking=f.AllowBooking,t.showInfantHelp=!0,$("body, html").animate({scrollTop:0},"fast")):(t.paxRules=[],t.AllowBooking=!0,t.showInfantHelp=!1),f.DuplicatFirstAndLastNameError){t.DuplicateInfoError=!0;n.saving=!1;$("body, html").animate({scrollTop:0},"fast");return}if(n.DuplicateEnrollEmail=f.Passengers[i].DuplicateEnrollEmail,n.IsValidHMNumber=f.Passengers[i].IsValidHMNumber,!n.IsValidHMNumber){t.IsInValidHMNumber=!0;n.saving=!1;$("body, html").animate({scrollTop:0},"fast");return}if(t.Country=f.InternationalCountryListForMessage,t.Country.length>0&&(t.CountryFlag=!0),g(n,!0),t.duplicateEmailError||t.ageLimitError){n.saving=n.saveSuccessDelayActive=!1;return}n.Type=f.Passengers[i].Type;t.selectedTravelers.get().length===i?t.selectedTravelers.get().push(n):t.selectedTravelers.get()[i]=n;f.PassengerTripSummary&&(t.PassengerTripSummary=f.PassengerTripSummary);n.saveSuccessDelayActive=!0;e=r.id+1;r.id<t.Passengers.length?(s={pageName:window.digitalData.page.pageInfo.name+":passenger:"+e,pageURL:[location.origin,location.pathname,location.search,"#/passenger/"+e].join("")},window.digitalDataLoaded.then(function(){setTimeout(function(){document.body.dispatchEvent(new CustomEvent("PassengerPage",{detail:s}))})}),u.go("passenger.x",{id:e},{notify:!1})):(s={pageName:window.digitalData.page.pageInfo.name+":passenger:contact",pageURL:[location.origin,location.pathname,location.search,"#/passenger/contact"].join("")},window.digitalDataLoaded.then(function(){setTimeout(function(){document.body.dispatchEvent(new CustomEvent("PassengerPage",{detail:s}))})}),u.go("passenger.contact"));o(function(){$("body, html").animate({scrollTop:0},"fast").promise().done(function(){c.safeApply(t,function(){r.id<=t.Passengers.length&&(t.setNextForm(e),t.currentPaxClass="pax"+r.id)})})},500)}})):(f=r.id+1,r.id<t.Passengers.length?u.go("passenger.x",{id:f},{notify:!1}):u.go("passenger.contact"),$("body, html").animate({scrollTop:0},"fast").promise().done(function(){var n=r.id;c.safeApply(t,function(){r.id<=t.Passengers.length&&(t.setNextForm(n),t.currentPaxClass="pax"+n)})}))};t.prevTraveler=function(){var n=r.id?r.id-2:t.Passengers.length-1,i=t.Passengers[n];i.saveSuccessDelayActive=i.saving=!1;u.go("passenger.x",{id:n+1},{notify:!1});$("body, html").animate({scrollTop:0},"fast").promise().done(function(){c.safeApply(t,function(){t.setNextForm(n+1)})})};t.resetErrors=function(){o(function(){t.addEditState=""},500);t.IsServiceErrors=t.showInfantHelp=t.IsInValidHMNumber=t.DuplicateInfoError=t.IsEditingError=t.duplicateEmailError=t.ageLimitError=!1;t.ServiceErrorMessage=""};t.formSubmitted=function(){u.is("passenger.x")&&(t.IsLoggedIn?t.continueToContactInfo(!0):t.nextTraveler())};t.isMainCabinBasicSelected=t.PassengerTripSummary.AvailGridTrips.filter(function(n){return n.CabinName==="MAINCABINBASIC"}).length>0;t.continueToContactInfo=function(){if(t.IsProcessing)return!1;if(t.IsProcessing=!0,!tt()){t.IsProcessing=!1;return}t.$pax.addPaxToPNR(t.selectedTravelers.get()).success(function(n){if(b(n,"haPassengersAPI-addPaxToPNR")){t.IsProcessing=!1;return}t.showInfantHelp=!1;n.ErrorMessage!==null?(t.IsServiceErrors=!0,t.ServiceErrorMessage=n.ErrorMessage,$("body, html").animate({scrollTop:0},"slow")):n.DuplicatFirstAndLastNameError!==null&&n.DuplicatFirstAndLastNameError!==undefined?(t.DuplicateInfoError=!0,$("body, html").animate({scrollTop:0},"slow")):(t.showInfantHelp=t.selectedTravelers.get()?t.selectedTravelers.get().some(function(n){return n.PassengerType==="Infant"}):!1,n.DoBCheckMessagesList.length>0&&(t.paxRules=n.DoBCheckMessagesList,t.AllowBooking=n.AllowBooking,t.showInfantHelp=!0,$("body, html").animate({scrollTop:0},"fast")),t.IsAllPaxUpdated=!0,t.Passengers=n.Passengers,t.AllowBooking=n.AllowBooking,t.InternationalCountryListForMessage=n.InternationalCountryListForMessage,t.DoBCheckMessagesList=n.DoBCheckMessagesList,t.InitializeSelected(),u.go("passenger.contact"));n.PassengerTripSummary&&(t.PassengerTripSummary=n.PassengerTripSummary);t.IsProcessing=!1}).error(function(n){t.IsProcessing=!1;b("jsError","haPassengersAPI-addPaxToPNR");t.IsServiceErrors=!0;t.ServiceErrorMessage=n})};t.fauxContinueToContact=function(){o(function(){n.element("button.done").trigger("click")})};t.InitializeSelected=function(){var i,r;t.IsAllPaxUpdated&&(t.Passengers.forEach(function(n){n.DOBYear&&n.DOBYear!=="0001"||(n.IsIncomplete=!0,n.DOBDay="",n.DOBMonth="",n.DOBYear="");n.DOBDay&&n.DOBMonth&&n.DOBYear&&n.FirstName&&n.LastName&&n.Gender||(n.IsIncomplete=!0);n.DOBDay||n.DOBMonth||n.DOBYear||n.FirstName||n.LastName||n.Gender||(n.IsIncomplete=!1)}),i=t.Passengers.filter(function(n){return n.IsSelectedPax}),t.selectedTravelers.set(i),r=t.IsLoggedIn&&(t.ForcePrimaryTraveller||t.PreselectPrimaryTraveller),t.selectedTravelers.get().length<t.totalPaxCount&&r&&n.forEach(t.Passengers,function(n){n.isUser&&(n.IsSelectedPax=!0,t.selectedTravelers.get().push(n))}),t.paxRules=!!t.DoBCheckMessagesList&&t.DoBCheckMessagesList.length?t.DoBCheckMessagesList:undefined,t.showInfantHelp=!t.DoBCheckMessagesList||t.DoBCheckMessagesList.length,t.Country=t.InternationalCountryListForMessage,t.CountryFlag=!!t.Country.length,t.selectedTravelers.get().length===t.totalPaxCount&&($(".contact-info").addClass("current"),$("body, html").animate({scrollTop:0},"slow"),t.PaxContactInfo!==null&&t.PaxContactInfo.phone2number!==null&&(t.showphone2=!0)))};t.InitializeSelected();t.contactInfoSubmit=function(n,i){if($(n.target).is(".continue")&&t.currentForm.$validate(t.currentForm),!t.currentForm.$valid)return!1;if(t.paxRules&&t.paxRules.length>0&&!i)return t.showUMModal(),!1;if(window.sessionStorage.removeItem("haMinor"),a.isAdultInFlight(t.selectedTravelers.get(),t.TripSummary.DepartDate)||window.sessionStorage.setItem("haMinor",!0),tt()){var r=d(/Infant/);r>2?t.IsInfantMaxError=!0:r>0&&d(/Adult/)===0?t.IsInfantAdultError=!0:(t.isPageError=!1,t.IsInfantMaxError=!1,t.IsInfantAdultError=!1)}t.isPageError||(t.ContactInfo=t.PaxContactInfo,t.$pax.updatecontactinfo(t.ContactInfo).success(function(n){if(b(n,"haPassengersAPI-updatecontactinfo")||!n.IsSuccess){t.isPageError=!0;o(function(){ft(n.ErrorMessage)},800);return}window.location.href=t.IsHoldBooking||n.SkipItinPage?"/Book/inflightoptions/index":"/Book/itinerary/index"}).error(function(n){b(n,"haPassengersAPI-updatecontactinfo");t.IsServiceErrors=!0;t.ServiceErrorMessage=n}))};t.customSubmit=function(){return t.addEditState?t.addEditState==="edit"?t.doneEditTraveler():t.doneAddTraveler():t.formSubmitted()};t.doneEditTraveler=function(){t.IsServiceErrors=t.showInfantHelp=t.IsInValidHMNumber=t.DuplicateInfoError=t.IsEditingError=t.duplicateEmailError=t.ageLimitError=!1;t.ServiceErrorMessage="";nt(t.modifyTraveler);t.IsLoggedIn?(t.modifyTraveler.MethodRequestor=p.pageURL.indexOf("passenger")!==-1?"passenger":"contactinfo",t.$pax.editLoggedInPax(t.modifyTraveler).success(function(n){var u,r,f;if(!b(n,"haPassengersAPI-editLoggedInPax")){if(n.ErrorMessage){t.IsServiceErrors=!0;t.ServiceErrorMessage=n.ErrorMessage;return}if(n.DoBCheckMessagesList.length>0?(t.paxRules=n.DoBCheckMessagesList,t.AllowBooking=n.AllowBooking,t.showInfantHelp=!0,$("body, html").animate({scrollTop:0},"fast")):(t.paxRules=[],t.AllowBooking=!0),n.DuplicatFirstAndLastNameError!==null&&n.DuplicatFirstAndLastNameError!==undefined){t.DuplicateInfoError=!0;return}if(u=n.Passengers.map(function(n){return n.TravelerAssociationID===t.modifyTraveler.TravelerAssociationID}).indexOf(!0),r=n.Passengers[u],t.modifyTraveler.IsValidHMNumber=t.IsValidHMNumber=r.IsValidHMNumber,t.IsInValidHMNumber=!t.modifyTraveler.IsValidHMNumber,t.modifyTraveler.DuplicateEnrollEmail=r.DuplicateEnrollEmail,g(t.modifyTraveler,!1),!t.modifyTraveler.IsValidHMNumber||t.duplicateEmailError||t.ageLimitError){t.IsInValidHMNumber=!0;return}t.modifyTraveler.DuplicateEnrollEmail.Status!=="SUCCESS"&&t.modifyTraveler.DuplicateEnrollEmail.Status!==""||t.IsInValidHMNumber?t.IsEditingError=!0:(i.$broadcast("closeModal"),o(function(){t.addEditState=""},500));t.modifyTraveler.Type=r.Type;t.modifyTraveler.Type!=="Infant"&&(t.modifyTraveler.GuardianID=null,t.modifyTraveler.GuardianName=null);t.Passengers[u]=t.modifyTraveler;window.PaxVM.Passengers=t.Passengers;t.modifyTraveler.IsSelectedPax&&(f=t.selectedTravelers.get().map(function(n){return n.TravelerAssociationID===t.modifyTraveler.TravelerAssociationID}).indexOf(!0),t.selectedTravelers.get()[f]=t.modifyTraveler)}}).error(function(n){b("jsError","haPassengersAPI-editLoggedInPax");t.IsServiceErrors=!0;t.ServiceErrorMessage=n})):t.$pax.addeditpax(t.modifyTraveler).success(function(n){if(!b(n,"haPassengersAPI-editLoggedInPax")){if(t.showInfantHelp=n.Passengers?n.Passengers.some(function(n){return n.PassengerType==="Infant"}):!1,n.ErrorMessage){t.IsServiceErrors=!0;t.ServiceErrorMessage=n.ErrorMessage;return}if(n.DoBCheckMessagesList.length>0?(t.paxRules=n.DoBCheckMessagesList,t.AllowBooking=n.AllowBooking,t.showInfantHelp=!0,$("body, html").animate({scrollTop:0},"fast")):(t.paxRules=[],t.AllowBooking=!0),n.DuplicatFirstAndLastNameError!==null&&n.DuplicatFirstAndLastNameError!==undefined){t.formValid==="editpax"?t.DuplicateInfoError=!0:(t.DuplicateInfoError=!0,t.AllowBooking=!1,$("body, html").animate({scrollTop:0},"slow"));return}var u=n.Passengers.map(function(n){return n.TravelerAssociationID===t.modifyTraveler.TravelerAssociationID}).indexOf(!0),r=n.Passengers[u];if(t.modifyTraveler.IsValidHMNumber=t.IsValidHMNumber=r.IsValidHMNumber,t.IsInValidHMNumber=!t.modifyTraveler.IsValidHMNumber,t.modifyTraveler.DuplicateEnrollEmail=r.DuplicateEnrollEmail,!t.modifyTraveler.IsValidHMNumber){t.IsEditingError=!0;return}if(g(t.modifyTraveler,!1),!t.modifyTraveler.IsValidHMNumber||t.duplicateEmailError||t.ageLimitError){t.IsInValidHMNumber=!0;return}t.modifyTraveler.DuplicateEnrollEmail=r.DuplicateEnrollEmail;t.modifyTraveler.DuplicateEnrollEmail.Status!=="SUCCESS"&&t.modifyTraveler.DuplicateEnrollEmail.Status!==""||t.IsInValidHMNumber?t.IsEditingError=!0:(i.$broadcast("closeModal"),o(function(){t.addEditState=""},500));t.IsEditingError||(t.modifyTraveler.Type=r.Type,t.modifyTraveler.Type!=="Infant"&&(t.modifyTraveler.GuardianID=null,t.modifyTraveler.GuardianName=null),t.Passengers[u]=t.modifyTraveler,t.selectedTravelers.get()[u]=t.modifyTraveler);n.PassengerTripSummary&&(t.PassengerTripSummary=n.PassengerTripSummary)}}).error(function(n){b("jsError","haPassengersAPI-addeditpax");t.IsServiceErrors=!0;t.ServiceErrorMessage=n})};t.doneAddTraveler=function(){t.IsServiceErrors=t.showInfantHelp=t.IsInValidHMNumber=t.DuplicateInfoError=t.IsEditingError=t.duplicateEmailError=t.ageLimitError=!1;t.ServiceErrorMessage="";t.createSaveForFutureBookingCookie();nt(t.modifyTraveler);t.$pax.addExtraLoggedTravellerInfo(t.modifyTraveler).success(function(n){if(!b(n,"haPassengersAPI-addExtraLoggedTravellerInfo"))if(n.ErrorMessage)t.IsServiceErrors=!0,t.ServiceErrorMessage=n.ErrorMessage;else if(n.DuplicatFirstAndLastNameError!==null&&n.DuplicatFirstAndLastNameError!==undefined)t.DuplicateInfoError=!0;else{if(t.modifyTraveler=n,t.modifyTraveler.IsValidHMNumber=t.IsValidHMNumber=n.IsValidHMNumber,t.IsInValidHMNumber=!t.modifyTraveler.IsValidHMNumber,t.modifyTraveler.DuplicateEnrollEmail=n.DuplicateEnrollEmail,g(t.modifyTraveler,!1),!t.modifyTraveler.IsValidHMNumber||t.duplicateEmailError||t.ageLimitError){t.IsInValidHMNumber=!0;return}(t.modifyTraveler.DuplicateEnrollEmail.Status==="SUCCESS"||!t.modifyTraveler.DuplicateEnrollEmail.Status)&&t.modifyTraveler.IsValidHMNumber&&(t.selectTraveler(t.modifyTraveler),t.Passengers.push(t.modifyTraveler),i.$broadcast("closeModal"),o(function(){t.addEditState=""},500));n.IsValidHMNumber||(t.IsInValidHMNumber=!0)}}).error(function(n){b("jsError","haPassengersAPI-addExtraLoggedTravellerInfo");t.IsServiceErrors=!0;t.ServiceErrorMessage=n})};t.editPax=function(i,r){return t.formValid="",t.ServiceErrorMessage="",t.isPageError=t.DuplicateInfoError=t.IsInValidHMNumber=t.IsServiceErrors=!1,t.addEditState="edit",t.modifyTraveler=n.copy(i),t.modifyTraveler.DuplicateEnrollEmail="",t.modifyTraveler.indexpos=r,t.modifyTraveler.isHAMember=t.modifyTraveler.HMNumber?"1":"0",t.traveler=t.modifyTraveler,t.traveler.saveSuccessDelayActive=t.traveler.saving=!1,h(l.getTemplateUrl("book/pax/ha-pax-edit.html"),{id:"addedit-pax",scope:t,backdrop:"false",extendScope:{enableTCR:t.enableTCR,addEditState:t.addEditState}}),!0};t.addPax=function(n){n&&n.preventDefault();t.formValid="";t.ServiceErrorMessage="";t.isPageError=t.DuplicateInfoError=t.IsInValidHMNumber=t.IsServiceErrors=!1;t.addEditState="add";t.traveler={HMNumber:"",isHAMember:"0",AvatarImage:t.DefaultAvatarUrl,SaveForFutureBooking:t.getSaveForFutureBookingValueFromCookie(),SeatPreference:"1"};t.modifyTraveler=t.traveler;h(l.getTemplateUrl("book/pax/ha-pax-edit.html"),{id:"addedit-pax",scope:t,backdrop:"false",extendScope:{addEditState:t.addEditState}})};t.selectTraveler=function(n){if(t.ForcePrimaryTraveller&&n.isUser)return!1;if(n.IsSelectedPax=!n.IsSelectedPax,n.IsSelectedPax)t.selectedTravelers.get().push(n);else{var i=t.selectedTravelers.get().indexOf(n);t.selectedTravelers.get().splice(i,1)}t.IsProcessing=!1};t.addPhone=function(){t.phoneCount++;o(function(){$('select[name="PhoneType'+(t.phoneCount-1)+'"]').focus()})};t.deletePhone=function(){t.phoneCount--;o(function(){$('select[name="PhoneType'+(t.phoneCount-1)+'"]').focus()})};t.showPaxHelp=function(){h(l.getTemplateUrl("ha-pax-info-help-modal.html"),{id:"pax-help"})};t.showUMModal=function(){h(l.getTemplateUrl("book/pax/ha-pax-um-modal.html"),{id:"pax-um-modal",scope:t,backdrop:"false"})};t.getGuardian=function(n){return t.selectedTravelers.get().filter(function(t){return t.TravelerAssociationID===n.GuardianID}).map(function(n){return n.FirstName+" "+n.LastName})};t.toFullDate=function(n){var t=parseInt(n.DOBYear,10),i=parseInt(n.DOBMonth,10),r=parseInt(n.DOBDay,10);return isNaN(t)||isNaN(i)||isNaN(r)||t<1900?"":new Date(t,i-1,r)};t.ToggleTaxDetails=function(){t.taxDetails=!t.taxDetails};t.travelerSort=function(n){return n.isUser?"-1":"1"+n.LastName+n.FirstName};t.createSaveForFutureBookingCookie=function(){var n=new Date,i;n.setTime(n.getTime()+31536e6);i="expires="+n.toUTCString();document.cookie=HA.CookiesRequireSsl?["PermanentSaveCookie","=",t.modifyTraveler.SaveForFutureBooking,"; secure; ",i,"; path=/"].join(""):["PermanentSaveCookie","=",t.modifyTraveler.SaveForFutureBooking,"; ",i,"; path=/"].join("")};t.getSaveForFutureBookingValueFromCookie=function(){var t=!0,n=c.readCookie("PermanentSaveCookie");return n!==undefined&&(n=decodeURIComponent(n),t=JSON.parse(n)),t};t.showInfantTermsState=function(){o(function(){t.formValid==="assignguardians"&&(t.showInfantTerms=!0,o(function(){t.$apply()}))},0)};t.doneAcceptInfantTerms=function(){o(function(){t.formValid==="infantterms"&&t.$pax.associateinfants(t.infantTravelers).success(function(n){b(n,"haPassengersAPI-associateinfants")||(n==="true"?t.$emit("paxInfoDone"):(i.$broadcast("closeModal"),t.isPageError=!0,t.errortype="error",t.errordescription="There was error assigning the infants. Please try again."))}).error(function(n){b("jsError","haPassengersAPI-associateinfants");t.IsServiceErrors=!0;t.ServiceErrorMessage=n})},0)};t.doneAssignInfants=function(){o(function(){t.formValid==="assignInfants"&&(i.$broadcast("closeModal"),t.showInfantTermsModal())},0)};t.showAssignInfantsModal=function(){t.showInfantTerms=!1;h(l.getTemplateUrl("ha-pax-info-infant-assignment-modal.html"),{id:"pax-assign-infants"})};t.$on("IncludeReady",function(){var i=n.element("ol.pax li.active form, #contactInfoForm");i.length&&(t.currentForm=i.scope()[i.attr("name")],t.currentForm&&t.currentForm.$setPristine())});t.$on("$selectedAvatarURL",function(n,i){var e=t.traveler?t.traveler.indexpos:-1,o=e>-1?e:r.id-1,u,f;t.traveler?u=t.traveler:t.Passengers[o]&&(u=t.Passengers[o]);u&&(u.AvatarImage=i.ProfileImageSrc,t.currentForm||(f=$('form[name="passenger1form"]'),f.length&&f.scope()&&(t.currentForm=f.scope().passenger1form)),t.currentForm&&t.currentForm.avatarUrl&&t.currentForm.avatarUrl.$setViewValue(u.AvatarImage))});t.$watch("PhoneDetails[0].CountryCode",function(n,i){t.PhoneDetails[0].Number=!i||n===i?t.PhoneDetails[0].Number:""});t.$watch("PhoneDetails[1].CountryCode",function(n,i){t.PhoneDetails[1].Number=!i||n===i?t.PhoneDetails[1].Number:""});t.$watch("PhoneDetails[2].CountryCode",function(n,i){t.PhoneDetails[2].Number=!i||n===i?t.PhoneDetails[2].Number:""});t.$watch("PaxContactInfo.TravelCoordinatorInfo.TravelCoordinatorPhoneDetails.CountryCode",function(n,i){t.tcInfo.TravelCoordinatorPhoneDetails.Number=!i||n===i?t.tcInfo.TravelCoordinatorPhoneDetails.Number:""});t.$watch("phoneCount",function(n){t.PhoneDetails.forEach(function(t,i,r){r[i]=n<i+1?{CountryCode:window.defaultPhoneCountryCode,Number:"",Type:1}:r[i]})})}]);t.directive("haIncludeNotify",[function(){return{restrict:"A",link:function(n){n.$emit("IncludeReady")}}}])}(angular),function(n){"use strict";var t=n.module("haStoriesModule",[]);t.directive("haPullQuote",function(){return{template:'<div class="pull-quote"><span class="top-quote">&ldquo;<\/span><p ng-transclude><\/p><span class="bottom-quote">&rdquo;<\/span><\/div>',transclude:!0,restrict:"A",scope:{},link:function(n,t){if($(".right-rail")){n.id=$(t).index()+1;var i=function(t){var s="pull-quote"+n.id,r=this,i,o;r.markerIdString="pull-quote-marker"+n.id;$(t).attr("id",s).addClass("added-item");var u=$(t).offset().top,f=$(".right-rail").children().last(),e=$(f).outerHeight()+$(f).offset().top,h='<span class="marker" id="'+r.markerIdString+'"><\/span>';$(h).insertBefore(t);$(t).remove();$(".right-rail").append(t);u>e&&(i=u-e,o=i<20?20:i,$(t).css({marginTop:o}))};n.$root.isMobile||(n.pullQuote=new i(t),n.$on("repositionSidebarElements",function(i,r){var e=$("#"+n.pullQuote.markerIdString).offset().top,s=$(t).prev(),o=s.offset().top+$(t).prev().outerHeight(),u,f;e>r.top&&(s.hasClass("blocker")?(u=e-(r.top+r.height),f=u<20?20:u,$(t).css({marginTop:f})):o>r.top+r.height?o>e?$(t).css({marginTop:20}):(u=e-o,f=u<20?20:u,$(t).css({marginTop:f})):(u=e-(r.top+r.height),f=u<20?20:u,$(t).css({marginTop:f})))}))}}}});t.directive("haPageWidthImage",["$rootScope",function(n){return{restrict:"A",link:function(t,i){var u,r;if($(".article-body")&&(u=function(t){var i=this;i.id=$(t).index()+1;i.blockerIdString="blocker"+i.id;i.firstOverlappedIndex=-1;i.firstOverlappedIndexSet=!1;this.enlarge=function(){var l=$(".container").outerWidth(),a=$(".container").offset(),v=$(".article-body").children("p:first-child").offset(),r=$(t).offset(),f=$(".right-rail").children().last(),h=$(f).outerHeight(!0)+$(f).offset().top,u,e,o;if($(t).children("img:first-child").css({left:-(v.left-a.left),width:l,display:"block"}),u=$(t).children("img:first-child").height(),$(t).height(u),e=0,i.firstOverlappedIndexSet||(i.firstOverlappedIndexSet=!0,h>r.top&&$(".right-rail").children().each(function(n){var t=$(this).offset().top,u=$(this).outerHeight(!0);if(t+u>r.top)return i.firstOverlappedIndex=n,n===0&&(e=t+u-r.top),!1})),e>0&&$(t).css({marginTop:e}),o='<div id="'+i.blockerIdString+'" class="blocker">&nbsp;<\/div>',i.firstOverlappedIndex>-1)if(i.firstOverlappedIndex===0)$("#"+i.blockerIdString).is("*")||$(".right-rail").children().eq(0).after(o),$("#"+i.blockerIdString).css({height:u});else{var c=$(".right-rail").children().eq(i.firstOverlappedIndex-1),y=$(c).outerHeight()+$(c).offset().top,s=r.top-y;$("#"+i.blockerIdString).is("*")||$(".right-rail").children().eq(i.firstOverlappedIndex-1).after(o);s>0&&$("#"+i.blockerIdString).css({height:u,marginTop:s})}else{var f=$(".right-rail").children().last(),h=$(f).outerHeight()+$(f).offset().top,s=r.top-h;$("#"+i.blockerIdString).is("*")||$(".right-rail").append(o);s>0&&$("#"+i.blockerIdString).css({height:u,marginTop:s})}n.$broadcast("repositionSidebarElements",{top:r.top,height:u})}},!t.$root.isMobile)){t.pageWidthImage=new u(i);t.pageWidthImage.enlarge();t.enlargeTimeout=0;r=$(window).width();$(window).on("resize orientationchange",function(){clearTimeout(t.enlargeTimeout);t.enlargeTimeout=setTimeout(function(){$(window).width()!==r&&(r=$(window).width(),t.pageWidthImage.enlarge())},50)})}}}}]);t.directive("haAside",["$compile","haModal",function(n,t){return{restrict:"A",scope:{readMoreText:"@",heading:"@"},link:function(i,r){var e=$(r).index()+1,o=$(r).html(),u=$(r).children("p").text(),s=u.substring(0,Math.min(u.length,240)),h='<a class="bodycopy-sans-5 textlink" ng-click="openModal()">'+i.readMoreText+"<\/a>",c=n(h)(i),l="<h5>"+i.heading+"<\/h5><p>"+s+"... <\/p>",f;$(r).html(l);$(r).children("p").append(c);$(r).show();f='<div class="modal-template"><div class="modal-header containerFullBleed"><div class="container"><div class="row"><div class="col"><h2>'+i.heading+'<\/h2><\/div><\/div><\/div><\/div><div class="modal-main containerFullBleed padded-main"><div class="container"><div class="row"><div class="col">'+o+"<br><\/div><\/div><\/div><\/div><\/div>";i.openModal=function(){t("",{id:"ha-aside-"+e,backdrop:"true",template:f})}}}}])}(angular),function(n){"use strict";var t=n.module("haEventsCalendarModule",[]);t.controller("EventsCalendarController",["$scope","$document","$timeout","haSitecoreStrings","haDateUtils","$filter","haGlobals","$log","$location","$locale",function(n,t,i,r,u,f,e,o,s,h){function tt(){for(var i=[],t=0;t<n.model.islands.length;t++)n.model.islands[t].checked&&i.push(n.model.islands[t].displayName);return i.join(",")}function v(){var i,t;if(y())return"all";for(i=[],t=0;t<n.model.islands.length;t++)n.model.islands[t].checked&&i.push(t);return i.join(",")}function y(){for(var t=0;t<n.model.islands.length;t++)if(!n.model.islands[t].checked)return!1;return!0}function l(t){for(var i=0;i<n.model.islands.length;i++)n.model.islands[i].checked=t;n.model.allIslands=t}function p(n){if(n){var t=new Date(n),i=f("date")(t,"yyyy-MM-dd");return encodeURIComponent(i)}}function it(t,i){var f,r;return n.model.departDate&&n.model.returnDate?(f=moment(n.model.departDate).toDate(),r=moment(n.model.returnDate).toDate(),r.setDate(r.getDate()+1),u.isBetween(f,t,i)||u.isBetween(r,t,i)||u.isBefore(f,t)&&u.isAfter(r,i)):n.model.departDate?(f=moment(n.model.departDate).toDate(),u.isAfter(f,t)||u.isAfter(i,f)||u.isSameDay(f,t)||u.isSameDay(f,i)):n.model.returnDate?(r=moment(n.model.returnDate).toDate(),r.setDate(r.getDate()+1),u.isAfter(r,t)||u.isSameDay(r,t)||u.isSameDay(r,i)):!0}function nt(n){var i=moment(n).toDate(),t;return isNaN(i.getFullYear())?(t=n.match(/[\d]+/),t=Number(t[0]),new Date(t)):i}function g(){i(function(){n.model.calendarOpen=[!1]},500)}function rt(){t.off("click.closeCalendar");t.on("click.closeCalendar",function(i){var r=$(i.target);r.closest(".originDestinationWrap0").length||(t.off("click.closeCalendar"),n.model.currentDateChoice="",g(),n.$digest())})}var c,b,a,k,d,w;if(n.range_datepicker_config={calendars:2,start:'[name="FromDate"]',end:'[name="ToDate"]',range_start:moment().startOf("day"),range_end:moment().startOf("day").add(330,"days"),double_wide:!0},n.msToDate=u.msToDate,n.model={departDate:"",returnDate:"",calendarOpen:[!1],currentDateChoice:"",islands:[],islandDisplayNames:{},islandIds:[],allIslands:!0},n.strings={},r.get("CALENDAR_EVENTS_LABELS").then(function(t){n.strings=t}),n.tripType=2,e("HACalendarIslands",function(t){if(t&&t.Islands)for(var i=0;i<t.Islands.length;i++)n.model.islands.push({id:t.Islands[i].Id,displayName:t.Islands[i].DisplayName,checked:!0}),n.model.islandDisplayNames[t.Islands[i].Id]=t.Islands[i].DisplayName,n.model.islandIds.push(t.Islands[i].Id)}),e("HACalendarEvents",function(t){var e,i;for(n.model.HAEvents=t,e=0;e<n.model.HAEvents.length;e++)if(n.model.HAEvents[e]){i=n.model.HAEvents[e];i.IslandIndex=n.model.islandIds.indexOf(i.Island);i.IslandDisplayName||(i.IslandDisplayName=n.model.islandDisplayNames[i.Island]);var r=nt(i.EventStartDate),u=nt(i.EventEndDate),o="";r||(r=u);u||(u=r);isNaN(r.getTime())||isNaN(u.getTime())||(o=r.getDate()===u.getDate()?f("localDate")(r,$language):f("localDate")(r,$language)+" - "+f("localDate")(u,$language),i.EventStartDateObject=r,i.EventEndDateObject=u,i.EventDateRangeString=o)}n.model.HAEvents.sort(function(n,t){var i=new Date(n.EventEndDateObject),r=new Date(t.EventEndDateObject);return i<r?-1:r<i?1:0})}),n.searchIsActive=!1,n.pgInfo={currentPage:1,maxSize:10,pageNumber:1},c=s.search(),n.searchIsActive=!1,c.islands||c.startDate||c.endDate){if(n.searchIsActive=!0,c.islands&&c.islands!=="all"){for(l(!1),b=c.islands.split(","),a=0;a<b.length;a++)n.model.islands[Number(b[a])].checked=!0;n.model.allIslands=!1}else c.islands&&c.islands==="all"&&l(!0);c.startDate&&(k=moment(c.startDate).toDate(),isNaN(k.getTime())||(n.model.departDate=k));c.endDate&&(d=moment(c.endDate).toDate(),isNaN(d.getTime())||(n.model.returnDate=d))}n.$watch(v,function(){n.model.allIslands=y();n.searchIsActive&&s.search("islands",v())});n.$watch(function(n){return n.model.allIslands},function(t){t?(l(!0),n.searchIsActive&&s.search("islands","all")):y()&&(l(!1),n.searchIsActive&&s.search("islands",""))});n.togglesearchform=function(t){t.preventDefault();n.searchformvisible=!n.searchformvisible};n.searchEvents=function(t){t&&t.preventDefault();n.searchIsActive=!0;var i={islands:v()};n.model.departDate&&(i.startDate=p(n.model.departDate));n.model.returnDate&&(i.endDate=p(n.model.returnDate));$("#eventSearchSubmit").blur();s.search(i);n.searchformvisible=!1};n.searchIsland=function(t){var r={},i;if(n.model.departDate="",n.model.returnDate="",n.searchIsActive=!0,typeof t=="string")if(t==="all")l(!0),r.islands="all";else{for(i=0;i<n.model.islands.length;i++)n.model.islands[i].checked=t===n.model.islands[i].id?!0:!1;r.islands=v()}else{for(i=0;i<n.model.islands.length;i++)n.model.islands[i].checked=Number(t)===i?!0:!1;r.islands=t}s.search(r)};n.showHighlightedEvents=function(){n.searchIsActive=!1};n.eventSearchRangeString=function(){var e=tt(),t,r,i,u;if(e.length===0)return n.strings["please check at least one island"];if(n.model.departDate&&n.model.returnDate){var t=new Date(n.model.departDate),i=new Date(n.model.returnDate),r=f("localDate")(t,$language),u=f("localDate")(i,$language);return n.strings.events+": "+r+" - "+u}return n.model.departDate?(t=new Date(n.model.departDate),r=f("localDate")(t,$language),n.strings["events after"]+" "+r):n.model.returnDate?(i=new Date(n.model.returnDate),u=f("localDate")(i,$language),n.strings["events before"]+" "+u):y()?n.strings["all events"]:n.strings["events on"]+": "+e};n.eventSearchPredicate=function(t){return n.model.islands[t.IslandIndex].checked&&it(t.EventStartDateObject,t.EventEndDateObject)};n.dateStringToMonthAbbrev=function(n){var t=moment(n).toDate(),i=t.getMonth();return h.DATETIME_FORMATS.SHORTMONTH[i]};n.$on("dateInputFocused",function(t,i){n.model.currentDateChoice=i;n.model.calendarOpen=[!0];rt()});n.$on("setDate",function(t,i){n.model[n.model.currentDateChoice]=i||"";n.model.currentDateChoice==="departDate"&&n.model.returnDate&&i>n.model.returnDate?n.model.returnDate=undefined:n.model.currentDateChoice==="returnDate"&&n.model.departDate&&i<n.model.departDate&&(n.model.departDate=undefined);n.$digest()});n.$watch(function(n){if(n.model)return n.model.departDate},function(){n.model.departDate&&!n.model.returnDate?n.model.currentDateChoice="returnDate":n.model.returnDate&&n.model.departDate&&g();n.searchIsActive&&s.search("startDate",p(n.model.departDate))});n.$watch(function(n){if(n.model)return n.model.returnDate},function(){n.model.returnDate&&!n.model.departDate?n.model.currentDateChoice="departDate":n.model.returnDate&&n.model.departDate&&g();n.searchIsActive&&s.search("endDate",p(n.model.returnDate))});n.getCalendarHeading=function(t){return t!=="returnDate"?n.strings["start date"]:n.strings["end date"]};w=new Date;n.getIsUnavailable=function(n){if(u.isBefore(n,w)&&!u.isSameDay(n,w)||u.isAfter331(n,w))return!0}}])}(angular),function(n){"use strict";var t;try{t=n.module("haPaxModule")}catch(i){t=n.module("haPaxModule",["ui.router","duScroll","ngSanitize","haGeoDataModule"])}t.controller("TravelerCtrl",["$scope","$interval","haSitecoreStrings",function(n,t,i){n.traveler.SaveForFutureBooking=!0;n.seatPreferences=[];i.get("SEATPREFERENCE_DROPDOWN").then(function(t){n.seatPreferences=t});n.$watch("traveler.isHAMember",function(t){t==="0"?n.traveler.HMNumber=null:t==="1"&&(n.traveler.EmailID=null)});n.$watch("traveler.SaveForFutureBooking",function(t){n.traveler.SaveForFutureBooking=t});n.$on("$defaultAvatarURL",function(t,i){var r=n.traveler;r.AvatarImage=i.ProfileImageSrc});var r;n.traveler.IsIncomplete&&(r=t(function(){$("[name=passengerEditForm]").length&&($("[name=passengerEditForm]").addClass("submitted"),t.cancel(r))},100))}])}(angular),function(n){"use strict";var t=n.module("haCorporateTravelersModule",["ui.router","haTravelersAPI"]);/my-account\/guests/i.test(location.pathname)&&t.config(["$stateProvider","$urlRouterProvider",function(n,t){t.otherwise("/corporate/1");var i=[function(){}];n.state("passenger",{abstract:!0,url:"",controller:i,template:'<div ui-view class="row"><\/div>'}).state("passenger.corporate",{url:"^/corporate",template:'<div ui-view  class="col"><\/div>'}).state("passenger.corporate.x",{url:"/{id:int}",templateProvider:["haConfig",function(n){return n.getTemplateUrlWithInclude("my-account/ha-corporate-travelers.html")}]})}]).run(["$rootScope","$state",function(n,t){n.$state=t}]);t.controller("haCorporateTravelersCtrl",["$scope","$rootScope","$stateParams","$state","$filter","filterFilter","SavedTravelersService","haModal","haTravelersAPI","haGlobals","haPaxService",function(t,i,r,u,f,e,o,s,h,c,l){function a(r){var u=r?r.AvatarID||r.AvatarId||1:1,f=r&&(r.HMAccountNo||r.HMNumber)?"Yes":"No";r=$.extend({},r,{HasHMNumber:f});i.UpdateTraveler=n.copy(r);t.currentTraveler=r;s("/MyAccount/TravelersList/TravelerAddEdit?AvatarID="+u,{id:"add-edit-traveler",backdrop:"false"})}function v(n,t){var r,i;return n&&t&&(r=n.IsSelectedPax,t.DateOfBirth&&(i=t.DateOfBirth.split("/"),i.length===3&&(t.DOBMonth=i[0],t.DOBDay=i[1],t.DOBYear=i[2])),$.extend(n,t),n.IsSelectedPax=r),n}t.selectedTravelers=l.selectedTravelers();t.passengerLimit=7;t.pax={};t.search={query:""};t.booking=$(".my-account.ha-manage-travelers").length===0;i.isBooking=t.booking;t.pgInfo={currentPage:1,pageNumber:20,maxSize:10};i.isMobile&&(t.pgInfo.pageNumber=1e3);t.changePageCount=function(){var n=e(t.travelers,t.search.query),i=f("slice")(n);t.totalrecords=i.length};c(["PaxVM"],function(n){n&&(t.pax=n,t.passengerLimit=t.pax.PassengerTripSummary.Passengers.length)});i.ShowProfileImageDropdown=window.jsonTravelerListsModel?window.jsonTravelerListsModel.ShowProfileImageDropdown:!1;t.travelers=t.booking?t.pax.Passengers:window.jsonTravelerListsModel.TravelersList;n.forEach(t.travelers,function(n){n.AvatarID=n.AvatarID||n.AvatarId});t.totalrecords=t.travelers.length;t.limit=20;t.toggleStyle=function(){t.booking=!t.booking};t.addNewTraveler=function(n){n.preventDefault();a()};t.removeSavedTraveler=function(n){t.currentTraveler=n;h.TravelerDelete(n.TravelerID).success(function(r){r.IsSuccess?(t.$emit("closeModal"),i.$broadcast("TravelerDeleted",{response:r,travelerID:n.TravelerID})):t.errorMessage=r.Message}).error(function(n,t){t===403&&i.$broadcast("SessionError")})};t.removeTravelerFromAside=function(n){var i=t.selectedTravelers.get().indexOf(n);t.selectedTravelers.get().splice(i,1);n.IsSelectedPax=!1};t.generatePagination=function(){return[]};t.toggleTraveler=function(n){if(n.IsSelectedPax)t.selectedTravelers.get().push(n);else{var i=t.selectedTravelers.get().indexOf(n);t.selectedTravelers.get().splice(i,1)}};t.editTraveler=function(n){a(n)};t.viewTravelerDetails=function(n){n.detailsvisible=!n.detailsvisible};t.viewTravelersList=function(){t.passengersvisible=!t.passengersvisible};t.$on("TravelerModified",function(n,i){var r=t.travelers.filter(function(n){return n.$$hashKey===t.currentTraveler.$$hashKey})[0];r=v(r,i.response.Data)});t.$on("TravelerDeleted",function(){t.travelers.splice(t.travelers.indexOf(t.currentTraveler),1);t.changePageCount()});t.$on("TravelerAdded",function(n,i){i.response.IsSuccess&&(i.response.Data.IsSelectedPax=!0,i.response.Data.AvatarID=i.response.Data.AvatarID||i.response.Data.AvatarId,t.toggleTraveler(i.response.Data),t.travelers.push(i.response.Data),t.changePageCount(),t.successmessage=i.response.Message,t.shownewtraveleralert=!0,t.alertType=i.response.IsWarnAndContinue?"warning":"success")})}]).factory("SavedTravelersService",["$http",function(n){return{getPassengers:function(t){return n.get("/my-account/travelers/"+t)}}}]).filter("slice",[function(){return function(n,t,i,r){return t?n||[]:(n||[]).slice(i,r)}}]).directive("highlight",[function(){return{restrict:"A",scope:{highlight:"="},link:function(n,t){function i(n){var i,r,u;n?(i=RegExp("("+n+")","gi"),r=t.text().match(i),r?(u=t.text().replace(i,'<span class="highlight">$1<\/span>'),t.html(u)):t.html("<span>"+t.text()+"<\/span>")):t.html("<span>"+t.text()+"<\/span>")}n.$watch("highlight",function(n){i(n)})}}}])}(angular),function(n){"use strict";var t=n.module("haHomepageStoriesAndEventsModule",[]);t.controller("HomepageStoriesAndEventsController",["$scope","$locale","haDateUtils",function(n,t,i){n.dateStringToMonthAbbrev=function(n){var i=moment(n).toDate(),r=i.getMonth();return t.DATETIME_FORMATS.SHORTMONTH[r]};n.msToDate=i.msToDate}])}(angular),function(n){"use strict";var t=n.module("haVerticalSeatmapPreviewModule",[]);t.controller("verticalSeatmapPreviewCtrl",["$scope","haVerticalSeatmapService","$timeout","$log","$rootScope",function(n,t,i,r){function u(i){if(t.disallowAdvanceSeatSelection(n.svc.legs[i],n.$switch("InFlightOptionsInfo:EnableFAARestriction"),"ppg"))return t.setFAARestriction(n.svc.legs[n.svc.activeLegIndex]);n.svc.legs[i].IsCodeShare||(n.svc.legs[i].error=null,n.svc.legs[i].promise||(n.svc.legs[i].promise=n.svc.getAvailableSeatsForLeg(i)),n.svc.legs[i].promise.then(function(){n.svc.loadSvgSeatmapForLeg(i).then(function(){var r=$("#svgSeatmap"+i).find("svg"),t;if(!r.attr("scaled")){t=1;switch(n.svc.legs[i].EquipmentName){case"Airbus 330":t=.65;break;case"Boeing 767":t=.7;break;case"Boeing 717":t=.8;break;case"ATR 42 Turboprop":t=.9}r.attr({height:r.attr("height")*t,scaled:!0})}(n.enableTCR||n.isRefundable)&&(n.svc.disableSeatUpgrades=!0);n.svc.legs[i].resolved=!0;n.$broadcast("renderSeatmapAtIndex",i);n.$emit("haStickyResize")},f)},f))}function f(t){n.svc.legs[n.svc.activeLegIndex].resolved=!0;n.svc.legs[n.svc.activeLegIndex].error=t;r.error(t)}if(n.svc=t,n.vm={showDetails:!1},n.previewSegments&&n.SignifiedMarket&&n.disableSeatUpgrades!==undefined)n.svc.initPreviewSegments(n.previewSegments,n.SignifiedMarket,n.disableSeatUpgrades);else{n.svc.handleError('"previewSegments", "disableSeatUpgrades" & "SignifiedMarket" expected to be in scope but are missing.');return}n.$watch("svc.pageLoading",function(){n.svc.pageLoading===!1&&(n.svc.activeLegIndex=0,n.svc.legs&&n.svc.legs.length&&n.svc.legs[n.svc.activeLegIndex]?(u(n.svc.activeLegIndex),n.svc.legs[n.svc.activeLegIndex].IsCodeShare&&n.svc.getNextLeg()):n.svc.handleError("Missing leg data for flight "+$stateParams.flightId))});n.$watch("svc.activeLegIndex",function(n){u(n)})}])}(angular),function(n){"use strict";var t=n.module("haInFlightReceiptsModule",["ui.router"]);location.pathname.toLowerCase().indexOf("manage/my-receipts/in-flight")>-1&&t.config(["$stateProvider",function(n){n.state("index",{url:"/:transactionId"})}]);t.controller("InFlightReceiptsController",["$scope","haGlobals","$timeout","$state","$stateParams",function(t,i,r,u,f){function o(n){for(var i=0,r=t.flights.length;i<r;i++)if(t.flights[i].transId===n)return t.flights[i]}t.loading=!0;var e=!1;$(".ha-page-help").hide();i("results",function(i){t.flights=i.Flights||[];n.forEach(t.flights,function(n){n.FlightDateObj=new Date(n.FlightDate);n.transId=n.Transactions[0].TransactionNumber});t.loading=!1});t.$on("$stateChangeSuccess",function(){t.loading=!1;t.transactionId=f.transactionId;f.transactionId&&(t.flightReceipt=o(f.transactionId));e&&(e=!1,r(function(){window.print()},100))});t.viewReceiptThenPrint=function(n){e=!0;u.go("index",{transactionId:n})}}])}(angular),function(n){"use strict";var t;try{t=n.module("haUpgradeModalModule")}catch(i){t=n.module("haUpgradeModalModule",[])}t.controller("haUpgradeModalController",["$scope","haCitiesSvc","haUpgradeService","$rootScope",function(n,t,i,r){function u(n){var t=n.FlightNumber.split(" "),i;return t=t[t.length-1],i=moment(n.DepartureDate).format("DDMMM").toUpperCase(),""+t+"/"+i+"/"+n.DepartureCityCode+"/"+n.ArrivalCityCode}function f(){var i={Pnr:n.trip.ReservationCode},f=n.platinum_pax,r=[],t;return angular.forEach(n.trip.allLegs,function(t){if(t.selected&&t.platinum_pax){var e={UniqueFlightId:u(t),SequenceId:t.SegmentNumber},i=[];n.isPlatinumUpgraded(t)||i.push({PaxNameNumber:f.TravellerNameNumber});t.optional_pax&&i.push({PaxNameNumber:t.optional_pax});e.PaxUpgradeCostDetails=i;r.push(e)}}),i.SegmentUpgradeDetails=r,t=n.trip.Travellers.map(function(n){return{FirstName:n.FirstName,LastName:n.LastName,NameNumberId:n.TravellerNameNumber}}),t[0]&&n.trip.Travellers[0]&&(t[0].HmNumber=n.trip.Travellers[0].HMNumber||n.trip.Travellers[0].HmNumber),i.Passengers=t,i}n.cities=t;n.parent_view==="dashboard"?(n.platinum_pax=n.trip.PAXList.filter(function(n){return n.IsLoggedinPassenger})[0],n.companions=n.trip.PAXList.filter(function(n){return!n.IsLoggedinPassenger}),n.trip.Travellers=n.trip.PAXList):n.parent_view==="itinerary"&&(n.platinum_pax=n.VM.Travellers.filter(function(n){return n.IsLoggedinPassenger})[0],n.companions=n.VM.Travellers.filter(function(n){return!n.IsLoggedinPassenger}));n.toDate=function(n){return new Date(n)};n.isUpgradeRqReady=function(){var i=n.trip.allLegs.filter(function(n){return n.IsOnlineUpgradeEligible}).filter(function(n){return n.selected}),t;return i.length<1?!1:(t=!1,angular.forEach(i,function(i){t||(i.platinum_pax?n.isPlatinumUpgraded(i)&&(i.optional_pax===undefined||i.optional_pax==="")&&(t=!0):t=!0)}),t)?!1:!0};n.resetPlatinum_pax=function(t){t.selected?n.platinum_pax.isUpgraded&&(t.platinum_pax=n.isPlatinumUpgraded(t)):(t.platinum_pax=!1,t.optional_pax="")};n.resetOptional_pax=function(n){n.platinum_pax||(n.optional_pax="")};n.resetAll=function(){angular.forEach(n.trip.allLegs,function(t){t.selected=!1;n.resetPlatinum_pax(t)})};n.isPlatinumUpgraded=function(t){return t.OnlineUpgradePassengers.length>0?(n.platinum_pax.isUpgraded=!0,t.OnlineUpgradePassengers[0].UpgradedPassengers.indexOf(n.platinum_pax.FirstName+" "+(!n.platinum_pax.MiddleName?"":n.platinum_pax.MiddleName.trim()+" ")+n.platinum_pax.LastName)>-1):!1};n.getUpgradedCompanions=function(t){var i=[];return t.OnlineUpgradePassengers.length>0&&angular.forEach(n.companions,function(n){t.OnlineUpgradePassengers[0].UpgradedPassengers.indexOf(n.FirstName+" "+(!n.MiddleName?"":n.MiddleName.trim()+" ")+n.LastName)>-1&&i.push(n)}),t.upgradedCompanions=i,t.upgradedCompanions};n.getNonUpgradedCompanions=function(t){var i=[];return angular.forEach(n.companions,function(n){(t.OnlineUpgradePassengers.length===0||t.OnlineUpgradePassengers[0].UpgradedPassengers.indexOf(n.FirstName+" "+(!n.MiddleName?"":n.MiddleName.trim()+" ")+n.LastName)<0)&&i.push(n)}),t.nonUpgradedCompanions=i,t.nonUpgradedCompanions};n.isNoFurtherUpgradable=function(t){return n.isPlatinumUpgraded(t)&&(n.companions.length===0||n.getUpgradedCompanions(t).length>0)?!0:!1};n.submitRequest=function(){if(!n.isUpgradeRqReady())return!1;n.submitting=!0;var t=f();i.submitUpgradeRequest(t).then(function(t){t.data.IsSuccess?(n.upgradeSuccess=!0,r.$broadcast("OnlineUpgradeRqSuccess",n.trip)):n.upgradeError=!0;n.submitting=!1},function(){n.upgradeError=!0;n.submitting=!1})}}])}(angular),function(n){"use strict";var t="FLIGHT_STATUS_NATIVE_APP_HIDE_BANNER",r=60,i;i=n.module("haNativeUpsellBannerModule",["ngCookies"]);i.controller("haFlightStatusNativeUpsellController",["$scope","$cookies","haGlobals",function(n,i,u){function e(){u("flightStatusCookieExpirationDays",function(n){f=!n||isNaN(n)?r:n});n.bannerHidden=!!i.get(t)}var f;n.hideBanner=function(){n.bannerHidden=!0;var r=new Date;r.setDate(r.getDate()+f);i.put(t,!0,{expires:r})};e()}])}(angular)