1function initHeader(){$(".popup-with-move-anim").magnificPopup({type:"inline",fixedContentPos:!1,fixedBgPos:!0,overflowY:"auto",closeBtnInside:!0,preloader:!1,midClick:!0,removalDelay:300,mainClass:"my-mfp-zoom-in"});let n=$("#header"),o=$("body");var e=n.outerHeight();o.addClass("sticky-parent"),o.css("padding-top",e+"px"),$(window).on("scroll resize",function(){var e=$(this).scrollTop(),t=n.outerHeight();o.addClass("sticky-parent"),o.css("padding-top",t+"px"),t<=e?n.addClass("sticky"):n.removeClass("sticky")})}function hideAutocompleteDrop(){let e=jQuery(".pac-container");e.length&&jQuery(window).on("scroll resize",function(){e.hide()}),jQuery(".popup-content").on("scroll",function(){document.activeElement.blur()})}isInIframe()||(initHeader(),setTimeout(hideAutocompleteDrop,1e3)),Number.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},angular.module("frApp",["ngAnimate","ngSanitize","ui.router","ui.select","ui.date","angularPayments","tooltipster"]).filter("iif",function(){return function(e,t,n){return e?t:n}}).filter("cnumber",["$filter",function(e){let n=e("number");return function(e){let t=n(e,2);return t=t&&t.replace(/\.00$/g,"")}}]).filter("money",["$filter",function(e){let t=e("number");return function(e){return t(e,2)}}]).config(["$compileProvider","$locationProvider",function(e,t){e.debugInfoEnabled(!1),e.aHrefSanitizationTrustedUrlList(/^\s*(https?|mailto|javascript):/)}]),angular.module("frApp").controller("AddressDetailsCtrl",["$scope","$timeout","$state","$window","focus","scroll","$rootScope","checkoutDataStorage","googleAnalyticsCheckout","addressService","enhancedEcommerce","reCaptcha",function(n,o,t,a,i,r,s,c,u,l,d,p){if(n.initdata=a.checkoutData,!n.initdata.state.key||!n.initdata.userInfo)return void t.go("default");n.isLoaded=!1,n.inProcess=!1,n.addressSelect=!1,n.usePafLookup=a.usePafLookup,p.init(),n.countries=a.countries,n.UsStates=a.usStates,n.errors={},n.data={address:{country:a.checkoutData.checkoutBaseInfo.countryCode,phoneNumber:""}};n.inProcess||(n.inProcess=!0,c.trySetAddressDetails(a.checkoutData.state.key).then(function(e){if(e.success){if(e.model){if(e.model.billingAddressId)return a.checkoutData.checkoutBaseInfo.billingAddressId=e.model.billingAddressId,void m();e.model.billingAddress&&(angular.extend(n.data.address,e.model.billingAddress),n.data.address.country=e.model.billingAddress.country.countryCode)}n.isLoaded=!0}else n.isLoaded=!0,n.errors.server=e.error}).catch(function(){n.isLoaded=!0,n.errors.server="Some error occurred. Please, refresh the page."}).finally(function(){n.inProcess=!1}));let m=function(){n.inProcess=!0,d.SendCheckout(d.steps.Details,a.checkoutData.tippingMode&&!n.initdata.isVip);var e=a.checkoutData.checkoutBaseInfo.enableDonorMessage?"leave-message":"confirm";"confirm"==e?c.getConfirmationInfo(a.checkoutData).then(function(e){e.success&&(a.confirmationData=e.data)}).finally(function(){t.go("confirm")}):t.go(e)};if(a.checkoutData.state.key){s.$broadcast("fr-step",{step:1}),r(),u.SendEvent(u.eventAction.Details),n.GetAddressLine=function(e){return e&&!n.addressSelect?l.getFormattedAddressLine(null):l.getFormattedAddressLine(n.data.address)},n.setAddress=function(e){e=l.parseGoogleAddress(n.data.address.country,e);n.data.address=angular.copy(e),l.validateAddress(n.data.address,n.errors)||(n.editAddress(),o(function(){$("#popup-edit .error").siblings("input").trigger("focus")},20))},n.editAddress=function(){var e=angular.copy(n.data.address);s.$broadcast("addressPopup",e),n.triedToSaveAddress=!1},s.$on("saveAddress",function(e,t){n.triedToSaveAddress=!0,l.validateAddress(t,n.errors)?(l.clearAddressErrors(n.errors),s.$broadcast("addressPopupErrors",angular.copy(n.errors)),n.data.address=t,s.$broadcast("closeAddressPopup")):s.$broadcast("addressPopupErrors",angular.copy(n.errors))});let t=null,e=(n.countryChanged=function(e){l.emptyAddress(n.data.address),n.addressSelect=!1,t&&o.cancel(t),t=o(function(){i(".js-addr-input"),t=null},1e3)},function(e){var t=angular.copy(n.data);(t=angular.merge(n.data.address,t)).address=null,t.reCaptcha=e,c.saveAddressDetail
1s(a.checkoutData.state.key,t).then(function(e){if(e.success)m();else{if(e.errors)for(var t in e.errors){t=e.errors[t];"USState"===t.field?n.errors.UsState=t.message:n.errors[t.field]=t.message}e.error&&(n.errors.server=e.error)}}).finally(function(){n.inProcess=!1})});n.save=function(){(()=>{let e=!0;return n.errors={},l.validateAddress(n.data.address,n.errors)||(r(".ut-address-error"),e=!1),e})()?p.proceed(e):n.inProcess=!1},n.usePafLookup&&l.initPafData(function(e){let t=l.setPAFAddress(n.data.address,e);o(function(){n.addressSelect=!0,n.data.address=angular.copy(t),l.validateAddress(n.data.address,n.errors)||(n.editAddress(),o(function(){$("#popup-edit .error").siblings("input").trigger("focus")},20))},50)})}else t.go("default")}]),angular.module("frApp").controller("AddressPopupCtrl",["$scope","$rootScope","$window","$http","focus","validation",function(n,e,o,a,i,t){n.isShowingPopup=!1,n.errors={},n.addr={},n.UsStates=o.usStates,n.countries=o.countries,n.isMobile=o.isMobile,n.postcode="Postcode",n.countryChanged=function(e){r(e),n.addr.usState=null},e.$on("addressPopup",function(e,t){n.addr=t,r(n.addr.country),n.isShowingPopup=!0,n.UsStates||a.post("/checkout/get-us-states").then(function(e){n.UsStates=e.data}),o.isMobile||i("#popup-edit input:first")}),e.$on("addressPopupErrors",function(e,t){n.errors=t}),e.$on("closeAddressPopup",function(){n.isShowingPopup=!1}),n.toggleShowingPopup=function(){n.isShowingPopup=!n.isShowingPopup},n.saveAddress=function(){e.$broadcast("saveAddress",n.addr)},n.onKeyUp=function(e){27===e.keyCode&&(n.isShowingPopup=!1)};var r=function(e){n.postcode=t.getPostCodeLabel(e)}}]),angular.module("frApp").controller("BillingAddressPopupCtrl",["$scope","$rootScope","$window","focus","validation",function(n,e,o,a,t){n.isMobile=o.isMobile,n.isShowing=!1,n.errors={},n.billInfo={},n.postcode="Postcode",n.UsStates=o.usStates,n.countries=o.countries,n.allowEnterUserTitle=o.checkoutData.checkoutBaseInfo.allowEnterUserTitle;function i(){n.isShowing=!1}function r(e){n.postcode=t.getPostCodeLabel(e)}n.countryChanged=function(e){r(e),n.billInfo.usState=null},n.toggleShowingPopup=function(){n.isShowing=!n.isShowing},e.$on("closeBillingAddressPopup",i),n.onKeyUp=function(e){27===e.keyCode&&i()},n.onPopupClick=function(e){"billing-address-popup"===e.target.id&&e.eventPhase===Event.AT_TARGET&&i()},e.$on("openBillingAddressPopup",function(e,t){n.billInfo=t,r(n.billInfo.country),n.isShowing=!0,o.isMobile||a("#billing-address-popup input:first")}),e.$on("billingAddressPopupErrors",function(e,t){n.errors=t}),n.changeBillingAddress=function(){e.$broadcast("changeBillingAddress",n.billInfo)}}]),angular.module("frApp").controller("BreadCrumbsCtrl",["$scope","$rootScope",function(n,e){n.currentStep=-1,e.$on("fr-step",function(e,t){n.currentStep=t.step}),e.$on("is-free",function(e,t){n.isFree=t.isFree})}]),angular.module("frApp").controller("ConfirmCtrl",["$scope","$window","$rootScope","$state","cnumberFilter","scroll","checkoutDataStorage","googleAnalyticsCheckout","enhancedEcommerce","reCaptcha",function(i,t,n,o,r,a,s,e,c,u){if(i.initdata=t.checkoutData,!i.initdata.state.key||!i.initdata.userInfo)return void o.go("default");if(s.isCheckoutFinished()&&o.go("process"),n.$broadcast("fr-step",{step:3}),n.$broadcast("get-matchFunding",{}),i.matchFundingAvailable=!1,i.matchFundingAmount=0,i.$on("post-matchFunding",function(e,t){0<t&&(i.matchFundingAvailable=!0,i.matchFundingAmount=t)}),i.coverFee=void 0,i.$on("on-cover-fee-changed",function(e,t){i.coverFee=t.value}),a(),e.SendEvent(e.eventAction.Confirm),i.inProcess=!1,i.tipsInited=!1,i.Initing=!0,i.errors={},i.confirmStepTippingMode=i.initdata.tippingMode&&2==i.initdata.tipsStep,i.frequencies=s.frequencies,i.isGiftAid=!1,i.ukTaxpayer=!1,i.ownMoney=!1,i.notLottery=!1,i.customFields=i.initdata.customFields.confirmStep,i.initdata.marketingOptIns&&(i.marketingOptIns=i.initdata.isVip&&i.initdata.marketingOptIns.vip?i.initdata.marketingOptIns.vip:i.initdata.marketingOptIns.standard),i.showMarketingOptIns=!1,i.charityName=i.initdata.charityInfo.name,u.init(),i.isAnonymous=i.initdata.state.remainAnonymouse,i.initdata.customFields.signUpStep&&0<i.initdata.customFields.signUpStep.length)for(var l of i.initdata.customFields.signUpStep){var d=i.customFields.indexOf(l);t.newRegistered||-1!=d?t.newRegistered&&-1!=d&&i.customFields.splice(d,1):i.customFields.push(l)}t.newRegistered||!i.marketingOptIns||i.isAnonymous||(i.showMarketingOptIns=!0);function p(e){i.errors.server=e||"An error occurred. Please refresh the page and try again.",a(".js-error-container"),i.inProcess=!1}function m(){i.confirmationInfo.billingAddressId?(i.isGiftAid=i.confirmationInfo.giftAidAvailable,(e=>{for(var t of e)if(0==t.priceOption)return n.$broadcast("is-free",{isFree:!1});n.$broadcast("is-free",{isFree:!0})})(i.confirmationInfo.items),i.confirmStepTippingMode?s.getTips(i.initdata.state.key).then(function(e){e.success&&(i.tipsModel=e.data,i.tipsInited=!0)}).catch(function(){p()}).finally(function(){i.Initing=!1}
1):i.Initing=!1):o.go("address-details")}t.confirmationData?(i.confirmationInfo=t.confirmationData,t.confirmationData=null,i.initdata.donorCoverFeeEnabled=i.confirmationInfo.coverFeeAvailable,m()):s.getConfirmationInfo(i.initdata).then(function(e){e.success?(i.confirmationInfo=e.data,i.initdata.donorCoverFeeEnabled=i.confirmationInfo.coverFeeAvailable):(p(e.error),void 0===e.isAuthenticated||e.isAuthenticated||n.$broadcast("userInfo",{userInfo:null}))}).catch(function(){p()}).finally(function(){m()}),i.getFrequencyStr=function(e){switch(e){case i.frequencies.Monthly:return"every month";case i.frequencies.Yearly:return"every year";case i.frequencies.Quarterly:return"every quarter";default:return""}},i.getTotalsStr=function(){if(!i.confirmationInfo||!i.confirmationInfo.items)return"";let n={},o=(angular.forEach(i.confirmationInfo.items,function(e){var t=s.getFrequencyStr(e.frequency);n[t]?n[t].amount+=e.amount:n[t]={amount:e.amount,priceOption:e.priceOption}}),i.initdata.checkoutBaseInfo.isEventRegistrationCheckout),a="";return angular.forEach(n,function(e,t){(0<e.amount||1==e.priceOption)&&(0<a.length&&(a+=" + "),a+=i.initdata.currency.sign+r(e.amount)+(o?"":" "+t))}),a},i.onUkTaxpayer=function(){i.initdata.state.giftAidDonation=i.isGiftAid},i.onGiftAidOptions=function(){delete i.errors.giftaidoptions};i.continueFunc=function(e){i.inProcess||i.Initing||(()=>{i.errors={},!i.confirmationInfo.giftAidAvailable||!i.isGiftAid||i.ownMoney&&i.notLottery&&i.ukTaxpayer||(i.errors.giftaidoptions="You must confirm all statements in order for your donation to be eligible for Gift Aid.",a(".js-giftaidoptions"));let e=!0;if(void 0===i.coverFee&&i.confirmationInfo.coverFeeAvailable&&(n.$broadcast("dont-see-fee-status-on-continue",{}),e=!1),0<i.customFields.length&&!i.validateCustomFileds())return!1;if(i.showMarketingOptIns&&!i.validateMarketingOptIns())return!1;for(var t in i.errors)if(i.errors[t])return!1;return e})()&&(i.inProcess=!0,i.initdata.state.giftAidDonation=i.isGiftAid,i.initdata.state.coverFee=i.coverFee,s.saveConfirmationState(i.initdata).then(function(e){var t;e.success?(i.confirmStepTippingMode?s.saveTips(i.initdata.state.key,{toStore:i.tipsModel.toStore}).then(function(){u.proceed(f)}):u.proceed(f),i.showMarketingOptIns&&(t=i.marketingOptIns.channels.reduce((e,t)=>(e[t.channelId]=t.isSelected,e),{}),i.marketingOptIns.usePostOptOut&&(t[3]=!i.marketingOptIns.postOptOut),s.saveMarketingOptIns(i.initdata,t))):(p(e.error),void 0===e.IsAuthenticated||e.IsAuthenticated||n.$broadcast("userInfo",{userInfo:null}))}).catch(function(){p()}))};let f=function(e){i.initdata.state.reCaptcha=e,s.getPaymentInfo(i.initdata).then(function(e){e.success?(t.paymentInfoData=e.data,c.SendCheckout(c.steps.Confirm,i.initdata.tippingMode&&!i.initdata.isVip),0<e.data.totalAmount?o.go("pay"):o.go("process")):p(e.error)}).catch(function(){p()})};i.backToFirstStep=function(){return o.go("default"),!1}}]),angular.module("frApp").controller("CustomFieldsCtrl",["$scope","$rootScope",function(n){n.customFieldTypes={TextSingleLine:0,TextMultiLine:1,Dropdown:2,Date:3,Checkbox:4,CheckboxMulti:5,TextBlock:6},n.customFieldScopes={PaymentField:0,UserField:1,PermissionStatement:2};var e=(new Date).getFullYear(),e=(e-100).toString()+":"+(e+25).toString();n.dateOptions={changeYear:!0,changeMonth:!0,dateFormat:"dd/mm/yy",firstDay:1,constrainInput:!0,yearRange:e},n.multicheckboxchecked=function(){var e=" "+this.cbitem.value+",";return this.$parent.$parent.item.userInput&&this.$parent.$parent.item.userInput.value&&-1!=this.$parent.$parent.item.userInput.value.indexOf(e)},n.filterFunction=function(e){return!n.$parent.$parent.initdata.state.remainAnonymouse||e.scope!=n.customFieldScopes.PermissionStatement&&(!e.charityId&&!e.companyId||e.scope!=n.customFieldScopes.UserField)};for(let e=0;e<n.$parent.$parent.customFields.length;e++){var o=n.$parent.$parent.customFields[e],t=o.userInput&&o.userInput.value&&0<o.userInput.value.length;if(o.type==n.customFieldTypes.Checkbox)t?"Yes"!=o.userInput.value&&"No"!=o.userInput.value&&(o.userInput.value="No"):o.userInput?o.userInput.value="No":o.userInput={value:"No"};else if(o.type==n.customFieldTypes.CheckboxMulti&&t){let t=o.userInput.value;var a=[];for(let e=0;e<o.customFieldItems.length;e++){var i=" "+o.customFieldItems[e].value+",";-1!=t.indexOf(i)&&(a.push(e),t=t.replace(i,""))}if(t.length&&0<t.length){o.userInput.value="";for(var r=0;r<a.length;r++)o.userInput.value+=" "+o.customFieldItems[a[r]].value+","}}}n.multicheckboxchange=function(){var e=" "+this.cbitem.value+",";this.$parent.$parent.item.requiredError=!1,null!=this.$parent.$parent.item.userIn
1put&&null!=this.$parent.$parent.item.userInput||(this.$parent.$parent.item.userInput={value:""}),-1!=this.$parent.$parent.item.userInput.value.indexOf(e)?this.$parent.$parent.item.userInput.value=this.$parent.$parent.item.userInput.value.replace(e,""):this.$parent.$parent.item.userInput.value+=e},n.onChangeDateValue=function(){this.$parent.item.requiredError=!1},n.onChangeValue=function(){this.item.requiredError=!1},n.$parent.$parent.validateCustomFileds=function(){let t=!0;if(n.$parent.customFields&&0<n.$parent.customFields.length)for(let e=0;e<n.$parent.customFields.length;e++)n.filterFunction(n.$parent.customFields[e])&&(n.$parent.$parent.initdata.state.remainAnonymouse?n.$parent.customFields[e].requiredError=!1:n.$parent.customFields[e].isRequired&&(!n.$parent.customFields[e].userInput||!n.$parent.customFields[e].userInput.value||n.$parent.customFields[e].type==n.customFieldTypes.Checkbox&&"No"==n.$parent.customFields[e].userInput.value?(t=!1,n.$parent.customFields[e].requiredError=!0):n.$parent.customFields[e].requiredError=!1));return t}}]),angular.module("frApp").controller("DemoPopupCtrl",["$scope","$state",function(e,t){e.opened=!0}]),angular.module("frApp").controller("DonationOptionsCtrl",["$scope","$window","$rootScope","$state","$location","scroll","checkoutDataStorage","googleAnalyticsCheckout","enhancedEcommerce","validation","iframe",function(r,s,a,c,u,l,d,p,m,f,e){if(a.$broadcast("fr-step",{step:0}),l(),p.SendEvent(p.eventAction.Donation),r.inProcess=!1,r.errors={},r.CtaButtonText="Next",d.isCheckoutFinished())c.go("process");else{r.initdata=s.checkoutData;let i=e(".js-hight-content-blok","#footer"),o=(r.preselectedAmount=null,r.selectStepTippingMode=r.initdata.tippingMode&&1==r.initdata.tipsStep,r.customFields=r.initdata.customFields.selectStep,r.isSingleOptionShown=!1,function(e){r.errors.server=e||"An error occurred. Please refresh the page and try again.",l(".js-error-container"),r.inProcess=!1});if(r.initdata.tippingMode){let e="";r.initdata.state.key?r.selectStepTippingMode&&(e=r.initdata.state.key):e=r.initdata.checkoutBaseInfo.id,e&&(r.inProcess=!0,d.getTips(e).then(function(e){e.success&&(r.tipsModel=e.data,r.tipsInited=r.selectStepTippingMode)}).catch(function(){o()}).finally(function(){r.inProcess=!1}))}r.$watch(function(){return r.initdata.checkoutOptions},function(){var e=r.getSelectedItem();a.$broadcast("selected-item-changed",e)},!0),r.$watch(function(){return r.tipsModel&&r.tipsModel.toStore?r.tipsModel.toStore.tipsAmount:void 0},function(){r.initdata.payingInExperiment&&r.processPayInThreshold()}),r.choose=function(){r.inProcess||this.item.isSelected||(delete r.errors.donationOption,r.resetSelectedStatus(),this.item.isSelected=!0,r.processPayInThreshold())},r.preselectFirstOption=function(){var e=r.getAvailableItems();r.isSingleOptionShown=e&&1===e.length,e&&(e[0].isSelected=!0)},r.preselectSingleOption=function(){var e=r.getAvailableItems();r.isSingleOptionShown=e&&1===e.length,r.isSingleOptionShown&&(e[0].isSelected=!0)},r.preselectDefaultOption=function(){var e=r.getAvailableItems().filter(function(e){return e.isDefault});e&&0<e.length&&(e[e.length-1].isSelected=!0,r.preselectedAmount=e[e.length-1].amount)},r.preselectOption=function(){r.resetSelectedStatus(),r.preselectDefaultOption(),r.getSelectedItem()||(r.initdata.isSingleAmount?r.preselectFirstOption():r.preselectSingleOption()),r.processPayInThreshold()},r.resetSelectedStatus=function(){var e=r.getSelectedItem();e&&(e.isSelected=!1)},r.resetVariableAmount=function(){return!r.inProcess&&(delete r.errors.donationOptionAmount,!0)},r.onChangeVarAmount=function(){r.resetVariableAmount(),this.item.amount=f.floatNumberFilter(this.item.amount),r.processPayInThreshold()},r.processPayInThreshold=function(){var e,t,n=r.getSelectedItem();n&&(e=r.initdata.checkoutBaseInfo.isFundraiserCheckout&&!r.initdata.isPayIn&&!n.isFixed&&4==n.paymentFrequency&&("Personal Page"==r.initdata.campaignInfo.category||"Team"==r.initdata.campaignInfo.category),r.initdata.payingInExperiment?(t=r.tipsModel&&r.tipsModel.toStore&&parseFloat(r.tipsModel.toStore.tipsAmount)||0,r.showPayInOptions=e&&0===t):r.showPayInOptions=e&&0<r.initdata.payInThreshold&&n.amount>r.initdata.payInThreshold,r.setCtaButtonText(r.showPayInOptions))},r.checkVipThreshold=function(){var e=r.getSelectedItem();return!!e&&0<r.initdata.vipThreshold&&e.amount>r.initdata.vipThreshold},r.setPayInSelectedOption=function(e){r.goToPayInFlow=e,r.setCtaButtonText(r.goToPayInFlow)},r.setCtaButtonText=function(e){r.CtaButtonText=e?"Pay in donations":"Next"},r.onAmountFocus=function(){var e;
1this.item.isSelected||((e=this.getSelectedItem())&&(e.isSelected=!1),this.item.isSelected=!0),this.item.showcurrencysign=!0},r.onChangeFrequency=function(){r.preselectedAmount=null,r.resetSelectedStatus(),r.preselectOption(),r.processPayInThreshold(),r.errors={}},r.frequencies=d.frequencies,r.getFrequencyStr=function(e){switch(e){case this.frequencies.Monthly:return"Monthly";case this.frequencies.Yearly:return"Yearly";case this.frequencies.Quarterly:return"Quarterly";case this.frequencies.Single:return"One-off";default:return""}},r.getSelectedItem=function(){var e=r.initdata.checkoutOptions.filter(function(e){return e.isSelected});return e&&0<e.length?e[0]:null},r.getAvailableItems=function(){var e=r.initdata.checkoutOptions.filter(function(e){return e.paymentFrequency===r.initdata.paymentFrequency});return e&&0<e.length?e:null},r.preselectOption();function h(e,t){let n={};r.initdata.tippingMode&&(n=r.tipsModel.usingTipsSetting.setting.typedValue);var o=r.initdata.checkoutOptions.filter(function(e){return t.paymentFrequency===e.paymentFrequency}).indexOf(t),o=(m.SendProducts([{name:r.initdata.campaignInfo.name,id:e.orderReference,price:t.amount,brand:r.initdata.charityInfo.name,category:r.initdata.campaignInfo.category,variant:r.getFrequencyStr(t.paymentFrequency),position:o,quantity:1}],r.initdata.currency.currencyCode,r.initdata.tippingMode,n),e),e=null===o.userInfo?"sign-up":"address-details";if(o.userInfo&&m.SendCheckout(m.steps.Login,r.initdata.tippingMode&&!r.initdata.isVip),o.newIntention){var a=location.search.replace("?","").split("&"),a=(a.push("key="+o.key),u.protocol()+"://"+location.host+location.pathname+"?"+a.join("&")+"#!/"+e);try{if(!document.cookie&&(document.cookie="testcookie",-1==document.cookie.indexOf("testcookie")))return void(p.SendIFrameCookieBlokedEvent(),i.redirect(a))}catch(e){console.log(e)}s.location=a}else s.checkoutData.userInfo=o.userInfo,c.go(e)}r.continue=function(){var e;if(!window.isPreviewMode&&!r.inProcess)if(r.showPayInOptions&&!1!==r.goToPayInFlow)r.inProcess=!0,e=r.getSelectedItem(),window.location="/checkout/payin/"+r.initdata.fundraiserInfo.id+"?amount="+e.amount;else if((()=>{if(r.initdata.userInfo&&2!==r.initdata.userInfo.role)return l(".js-error-donoronly"),!1;let e=!1;r.errors={};var t,n=r.getSelectedItem();if(n?n.isFixed||(f.isDecimal(n.amount)?d.checkAmountMin(n.amount)?d.checkAmountMax(n.amount)||(r.errors.donationOptionAmount="The maximum online donation amount is "+r.initdata.currency.sign+r.initdata.maxAmount+". If you would like to donate more than this, please call +44 (0) 20 3872 2090.",l(".js-donationAmount:visible"),e=!0):(r.errors.donationOptionAmount="The minimum donation is "+r.initdata.currency.sign+r.initdata.minAmount+". Please enter a higher amount.",l(".js-donationAmount:visible"),e=!0):(r.errors.donationOptionAmount="Please specify a correct amount",l(".js-donationAmount:visible"),e=!0)):(r.errors.donationOption="Please choose a donation option.",l(".js-donationOption"),e=!0),0<r.customFields.length&&!r.validateCustomFileds())return e||l(".js-customfields-container"),!1;for(t in r.errors)if(r.errors[t])return!1;return!0})()){r.inProcess=!0;let n=r.getSelectedItem();d.saveDonationOption(r.initdata,n,r.preselectedAmount,r.checkVipThreshold()).then(function(e){var t;a.$broadcast("userInfo",{userInfo:e.data.userInfo}),e.success?(r.initdata.isVip=r.checkVipThreshold(),r.initdata.tippingMode?(t={},r.checkVipThreshold()?t.toStore={tipsType:-1,tipsAmount:0}:(e.data.newIntention&&(t.usingTipsSetting=r.tipsModel.usingTipsSetting),r.selectStepTippingMode&&(t.toStore=r.tipsModel.toStore)),d.saveTips(e.data.key,t).then(function(){h(e.data,n)})):h(e.data,n)):(s.checkoutData.userInfo=e.data.userInfo,o(e.message),void 0===e.isAuthenticated||e.isAuthenticated||a.$broadcast("userInfo",{userInfo:null}))}).catch(function(){o()})}}}}]),angular.module("frApp").controller("ForgotCtrl",["$scope","$http","$timeout","$state","$window","focus","scroll","$rootScope","googleAnalyticsCheckout","enhancedEcommerce","validation",function(t,e,n,o,a,i,r,s,c,u,l){a.checkoutData.userInfo?o.go("default"):(s.$broadcast("fr-step",{step:1}),r(),c.SendEvent(c.eventAction.ForgotPassword),t.data={email:""},t.errors={email:""},t.inProcess=!1,t.clearError=function(){t.errors.email=null},t.validateEmail=function(){return t.errors.email=l.validateEmail(t.data.email)?"":"Please make sure the email address is valid and follows the format: {64 characters}
1@{67 characters}.",!t.errors.email},t.tryRestore=function(){t.inProcess||(t.validateEmail()?(t.inProcess=!0,e.post("/checkout/forgot-password",{email:t.data.email,key:a.checkoutData.state.key}).then(function(e){e.data.success?o.go("sent-successful"):t.errors.email=e.data.error}).catch(function(){t.errors.server="An error occurred. Please refresh the page and try again."}).finally(function(){r(".js-email-input"),i(".js-email-input"),t.inProcess=!1})):(r(".js-email-input"),i(".js-email-input")))},t.goToSignIn=function(){return o.go("sign-in"),!1},n(function(){i(".js-email-input")},100))}]),angular.module("frApp").controller("LeaveMessageCtrl",["$scope","$window","$rootScope","$state","scroll","checkoutDataStorage","googleAnalyticsCheckout","enhancedEcommerce",function(n,o,a,i,r,s,e,c){if(n.initdata=o.checkoutData,n.initdata.state.key&&n.initdata.userInfo)if(n.initdata.checkoutBaseInfo.billingAddressId)if(s.isCheckoutFinished())i.go("process");else if(n.initdata.checkoutBaseInfo.enableDonorMessage){a.$broadcast("fr-step",{step:2}),r(),e.SendEvent(e.eventAction.Message),n.inProcess=!1,n.errors={};let t=function(e){n.errors.server=e||"An error occurred. Please refresh the page and try again.",r(".js-error-container"),n.inProcess=!1};if(n.initdata.state.remainAnonymouse)n.initdata.state.hidePicture=!0,n.initdata.state.displayName="Anonymous";else if(!n.initdata.state.displayName){let e="";n.initdata.userInfo.firstName&&(e+=n.initdata.userInfo.firstName),n.initdata.userInfo.lastName&&(e+=" "+n.initdata.userInfo.lastName),n.initdata.state.displayName=e}n.continue=function(){n.inProcess||(n.inProcess=!0,s.saveCharityMessage(n.initdata,!0).then(function(e){e.success?s.getConfirmationInfo(n.initdata).then(function(e){e.success?(o.confirmationData=e.data,c.SendCheckout(c.steps.Message,n.initdata.tippingMode&&!n.initdata.isVip),i.go("confirm")):(t(e.error),void 0===e.isAuthenticated||e.isAuthenticated||a.$broadcast("userInfo",{userInfo:null}))}).catch(function(){t()}):(t(e.error),void 0===e.isAuthenticated||e.isAuthenticated||a.$broadcast("userInfo",{userInfo:null}))}).catch(function(){t()}))}}else i.go("confirm");else i.go("address-details");else i.go("default")}]),angular.module("frApp").controller("MarketingOptInsCtrl",["$scope",function(t){t.errors={},t.errors.marketingOptIns=!1,t.errors.marketingOptInsChannels=!1,t.userResponse=null,t.marketingOptIns=t.$parent.$parent.marketingOptIns,t.setMarketingOptIns=function(e){t.errors.marketingOptIns=!1,t.errors.marketingOptInsChannels=!1,(t.userResponse=e)||t.marketingOptIns.channels.forEach(e=>e.isSelected=!1)},t.onChannelChecked=function(){t.errors.marketingOptInsChannels=!1,t.userResponse=!0},t.$parent.$parent.validateMarketingOptIns=function(){let e=!0;return t.errors.marketingOptIns=!1,t.errors.marketingOptInsChannels=!1,t.$parent.marketingOptIns&&null==t.userResponse&&(t.errors.marketingOptIns=!0,e=!1),t.$parent.marketingOptIns&&t.userResponse&&(1===t.marketingOptIns.channels.length?t.marketingOptIns.channels[0].isSelected=!0:t.marketingOptIns.channels.every(e=>!e.isSelected)&&(t.errors.marketingOptInsChannels=!0,e=!1)),e}}]),angular.module("frApp").controller("MatchFundingInfoCtrl",["$scope","$window","$rootScope","checkoutDataStorage",function(o,a,n,i){function r(e){o.matchFundingAmount=o.donationAmount=e;var t,e=0;o.data.matchDonationUpAmountStr&&(e=o.data.matchDonationUpAmount),t=0<o.data.remainingAmount?o.data.remainingAmount>e&&0<e?e:o.data.remainingAmount:0,0<o.matchFundingAmount?o.matchFundingAmount>t&&(o.matchFundingAmount=t):0==o.matchFundingAmount&&(o.matchFundingAmount=e)}function s(){o.coinAmount=0,o.data=a.checkoutData.matchFundingModel.info,o.donationAmount=a.checkoutData.matchFundingModel.donationAmount,o.name=o.data.name,o.reached=o.data.reached,o.currencySign=o.data.currencySign,o.mFAvailable=o.data.availableAmountStr,o.mFRemaining=o.data.remainingAmountStr,o.mFExpiryDate=o.data.expiryDateStr,(o.matchFundingAmount=0)<o.donationAmount&&!o.reached&&r(o.donationAmount)}var e=$("#js-mtchf-popup");$(window).on("click",function(){e.is(":visible")&&o.close()}),o.close=function(){e.hide()}
1,e.on("keyup",function(e){27===e.keyCode&&o.close()}).find(".js-close-btn").on("click",o.close.close);s(),o.detailsPopup=function(){o.popupData={},o.popupData.reached=o.data.reached,e.show()},o.$on("selected-item-changed",function(e,t){r(t&&t.amount?t.amount:0)}),o.$on("userInfo",function(e,t){var n;t.mtchf&&(n=o.donationAmount,i.getMatchFunding().then(function(e){e.success&&(e.model.donationAmount=e.model.donationAmount||n,a.checkoutData.matchFundingModel=e.model,s())}))}),o.$on("get-matchFunding",function(e,t){0<o.matchFundingAmount?setTimeout(function(){n.$broadcast("post-matchFunding",o.matchFundingAmount)},100):0<o.donationAmount&&(r(o.donationAmount),setTimeout(function(){n.$broadcast("post-matchFunding",o.matchFundingAmount)},100))})}]),angular.module("frApp").controller("PayCtrl",["$scope","$window","$rootScope","$state","$timeout","scroll","checkoutDataStorage","googleAnalyticsCheckout","windowpopup","iframe","validation","addressService","paymentSvs","moneyFilter","reCaptcha",function(a,i,n,t,o,r,s,e,c,u,l,d,p,m,f){if(!i.checkoutData.state.key||!i.checkoutData.userInfo)return void t.go("default");if(s.isCheckoutFinished())return void t.go("process");function h(){if(a.isStripe){let e=null;a.paymentInfo.stripeInfo.stripeUserId&&(e={stripeAccount:a.paymentInfo.stripeInfo.stripeUserId}),a.stripe=Stripe(a.paymentInfo.stripeInfo.publicKey,e)}}function g(e){a.initdata.state.reCaptcha=e,s.getPaymentInfo(a.initdata).then(function(e){e.success?(a.paymentInfo=e.data,I=a.paymentInfo.cardPaymentSystem,k()):(S(e.error),void 0===e.isAuthenticated||e.isAuthenticated||n.$broadcast("userInfo",{userInfo:null}))}).catch(function(){S()}).finally(function(){a.Initing=!1})}function y(){i.isReCaptchaEnabled&&!i.isReCaptchaReady?setTimeout(y,200):f.proceed(g)}let v=u(".js-hight-content-blok","#footer"),I=void 0,S=(n.$broadcast("fr-step",{step:4}),r(),e.SendEvent(e.eventAction.PaymentMethod),a.inProcess=!1,a.Initing=!0,a.inProcessMessageDisplay=!1,a.errors={},a.initdata=i.checkoutData,a.frequencies=s.frequencies,a.getFrequencyStr=s.getFrequencyStr,a.Countries=i.countries,a.UsStates=i.usStates,a.isGuest=i.checkoutData.userInfo.isGuest,a.showRemeberCard=!i.checkoutData.userInfo.isGuest,a.isMobile=i.isMobile,a.stPan="",a.stMn="",a.stYr="",a.stSc="",f.init(),a.stPanCh=function(e){a.stPan=e.stPan},a.stMnCh=function(e){a.stMn=e.stMn,$("#stMn").val(e.stMn)},a.stYrCh=function(e){a.stYr=e.stYr,$("#stYr").val(e.stYr)},a.stScCh=function(e){a.stSc=e.stSc},a.threeD={},a.isMobileView=$(window).width()<=444,a.paymentSystem={SecureTrading:2,Stripe:4,PayPal:5,SmartDebit:6,ApplePayST:7,PayPalST:8,StripeConnect:14,StripeBacsDirectDebit:15,StripeBECSDirectDebit:16,StripeSEPADirectDebit:17,StripeApplePay:18,StripeGooglePay:19},a.dateOptions={changeYear:!0,changeMonth:!0,dateFormat:"dd/mm/yy",firstDay:1,constrainInput:!0,showOn:"both",buttonText:"Change Date",minDate:new Date(a.initdata.serverTimeStamp),maxDate:new Date(a.initdata.subscriptionDelayMaxDate)},a.smartDebitDateOptions={changeYear:!0,changeMonth:!0,dateFormat:"dd/mm/yy",firstDay:1,constrainInput:!0,showOn:"both",buttonText:"Change Date",minDate:new Date(a.initdata.smartDebitStartPaymentDelay),maxDate:new Date(a.initdata.subscriptionDelayMaxDate)},a.stripeDirectDebitMerchantName="Enthuse",a.tabChanged=function(){a.errors={},setTimeout(function(){v._recalibrate()},150)},a.OnUseANewCard=function(){I!=a.paymentInfo.cardPaymentSystem&&a.paymentInfo.cardPaymentSystem==a.paymentSystem.SecureTrading&&(I=a.paymentInfo.cardPaymentSystem,p.changePaymentSystem(a.initdata.state.key,a.paymentInfo.cardPaymentSystem)),o(function(){a.tabChanged()},100)},function(e){a.errors.server=e||"An error occurred. Please refresh the page and try again.",r(".js-error-container"),a.inProcess=!1}),k=(a.collapseOther=function(e){a.errors={},a.active=a.active==e?"":e,$(".accordion-row.active:first")&&r(".accordion-row.active:first")},n.$on("origin-asking-to-show-payment-tab",function(e,t,n){o(function(){var e=a.tabs.find(e=>e.paymenttype===n);void 0!==e&&(e.show=t),b()})}),a.getPayBtnText=function(){return a.initdata&&a.paymentInfo?"Pay "+a.getPayAmountText():"Pay"},a.getPayAmountText=function(){return a.initdata&&a.paymentInfo?a.initdata.currency.sign+""+m(a.paymentInfo.totalAmountToPay):""},function(){var e;a.paymentInfo.totalAmountToPay?a.paymentInfo.billingAddressId?(a.isStripe=a.paymentInfo.cardPaymentSystem==a.paymentSystem.Stripe||a.paymentInfo.cardPaymentSystem==a.paymentSystem.StripeConnect,h(),a.paymentInfo.smartDebitAvaiable&&a.tabs.push({displayName:"Direct Debit",paymenttype:"dd",arialabel:"Direct Debit",show:!0}),a.paymentInfo.stripeBacsDirectDebitAvaiable&&a.tabs.push({displayName:"Direct Debit",paymenttype:"stripebacsdd",arialabel:"Direct Debit",show:!0}),a.paymentInfo.stripeSepaDirectDebitAvaiable&&a.tabs.push({displayName:"Direct Debit",paymenttype:"stripesepadd",arialabel:"Direct Debit",show:!0}),a.paymentInfo.secureTradingApplePayAvailable&&i.ApplePaySession&&a.tabs.push({displayName:"Pay",paymenttype:"apple-pay",arialabel:"Apple Pay",show:!1}),a.paymentInfo.stripeApplePayAvailable&&i.ApplePaySession&&a.tabs.push({displayName:"Pay",paymenttype:"stripe-apple-pay",arialabel:"Apple Pay",show:!1}),a.paymentInfo.stripeGooglePayAvailable&&a.tabs.push({displayName:"Pay",paymenttype:"stripe-google-pay",arialabel:"Google Pay",show:!1}),a.paymentInfo.cardPaymentsAvaiable&&a.tabs.push({displayName:"Debit / credit card",paymenttype:"newcard",arialabel:"Debit / credit card",show:!0}),a.paymentInfo.paypalStAvaiable&&a.tabs.push({displayName:"",paymenttype:"pp",arialabel:"PayPal",show:!0}),a.paymentInfo.stripeGooglePayAvailable||a.paymentInfo.secureTradingApplePayAvailable&&i.ApplePaySession||b(),e=parseFloat(a.paymentInfo.giftAidAmount),e=isNaN(e)?0:e,a.paymentInfo.charityWillReceive=Math.round(100*(a.paymentInfo.totalAmount+e))/100):t.go("address-detail
1s"):t.go("process")}),b=function(){a.showTabs=1<a.tabs.filter(function(e){return e.show}).length,!(0<a.tabs.length)||a.showTabs&&a.isMobile||(a.active=a.tabs.filter(function(e){return e.show})[0].paymenttype)};a.tabs=[],a.destroySlider=function(){},a.refreshSlider=function(){};i.paymentInfoData?(a.paymentInfo=i.paymentInfoData,I=a.paymentInfo.cardPaymentSystem,i.paymentInfoData=null,k(),a.Initing=!1):setTimeout(y,200),a.makeApplePayPayment=function(){var e;a.Initing||a.inProcess||(a.inProcess=!0,e=p.getApplePayUrl(a.initdata.state.key),window.location=e)},a.makePayPalPayment=function(){var e,t;a.inProcess||a.Initing||(I=a.paymentSystem.PayPalST,a.inProcess=!0,a.inProcessMessageDisplay=!0,r(),e=i.isInIframe(),t=p.getPayPalUrl(a.initdata.state.key,e,a.paymentInfo),e?c(t,"Payment",null,null,!0,function(){o(function(){a.inProcess&&(a.inProcess=!1,a.inProcessMessageDisplay=!1)},300)}):i.location=t)},a.makeStripePayment=function(){a.inProcess||a.Initing||(I=a.paymentSystem.Stripe,a.inProcess=!0,a.inProcessMessageDisplay=!0,r(),a.stripe.createPaymentMethod({type:"card",card:a.card,billing_details:a.getStripeBillingDetails()}).then(a.processStripeSource))},a.processStripeSource=function(e){e.error?(document.getElementById("card-errors").textContent=e.error.message,r("#card-errors"),a.inProcessMessageDisplay=!1,a.inProcess=!1):p.makeStripePayment(a.initdata.state.key,a.paymentInfo,e.paymentMethod.id,e.paymentMethod.card.three_d_secure_usage.supported,e.paymentMethod.card.country).then(function(e){e.success?e.data&&e.data.requiresAction?a.stripe.handleCardAction(e.data.paymentIntentClientSecret).then(function(e){e.error?(a.inProcessMessageDisplay=!1,S(e.error.message)):p.confirmStripePayment(a.initdata.state.key,e.paymentIntent.id).then(function(e){e.success?a.paymentSuccess():(a.inProcessMessageDisplay=!1,S(e.message))})}):a.paymentSuccess():(a.inProcessMessageDisplay=!1,S(e.message),void 0===e.isAuthenticated||e.isAuthenticated||n.$broadcast("userInfo",{userInfo:null}))}).catch(function(){a.inProcessMessageDisplay=!1,S()})},a.paymentSuccess=function(){t.go("process")},a.logPaymentError=function(e,t){var n=a.initdata.state.key;p.logPaymentError(n,e,t,I)},a.processSecureTradingPayment=function(){a.inProcessMessageDisplay=!0,p.processSecureTradingPayment(a.initdata.state.key).then(function(e){i.checkoutData.state.step=s.getProcessedStatus(),a.paymentSuccess()}).catch(function(){a.inProcessMessageDisplay=!1,S()})},a.paymentError=function(e){a.inProcessMessageDisplay=!1,S(e.error),void 0===data.isAuthenticated||data.isAuthenticated||n.$broadcast("userInfo",{userInfo:null})},i.goToProcessingStep=a.paymentSuccess,i.paymentError=a.paymentError,a.editBillingInfo=function(){var e=angular.copy(a.paymentInfo.billingInfo);n.$broadcast("openBillingAddressPopup",e)},a.checkBillingInfo=function(e){var t,n={},o="The entry must begin and end with a letter, and may only contain letters, spaces, full stops(.), hyphens(-) and apostrophes(').";for(t in l.isEmpty(e.firstName)?n.FirstName="First name can't be blank.":n.FirstName=l.validateUserName(e.firstName)?"":o,l.isEmpty(e.lastName)?n.LastName="Last name can't be blank.":n.LastName=l.validateUserName(e.lastName)?"":o,!i.checkoutData.checkoutBaseInfo.allowEnterUserTitle||l.isEmpty(e.title)||l.validateTitle(e.title)?n.Title="":n.Title="Accepted characters are lower and upper case letters, 0-9, spaces and the following special characters . ' - / ( )",n.HouseName=l.isEmpty(e.houseName)?"Your house number or name is required":"",n.Address1=l.isEmpty(e.address1)?"Address can't be blank":"",n.Town=l.isEmpty(e.town)?"Town/City can't be blank":"",n.Country=l.isEmpty(e.country)?"Country can't be blank":"",n.Postcode="",l.isPostcodeNotEmptyOrAllowed(e.country,e.postcode)?n.Postcode=l.validatePostcode(e.country,e.postcode)?"":"Please enter a valid "+l.getPostCodeLabel(e.country).toLowerCase()+".":n.Postcode=l.getPostCodeLabel(e.country).toLowerCase()+" can't be blank","US"===e.country?l.isEmpty(e.usState)?n.UsState="State can't be blank":(e=>{var t,n=new RegExp("^"+e.trim().toLowerCase()+"$","i");for(t in a.UsStates)if(a.UsStates[t].name.match(n)||a.UsStates[t].code.match(n))return!0;return!1})(e.usState)?n.UsState="":n.UsState="Please enter a valid state.":n.UsState="",n)if(n[t])return n;return null},a.validateBillingInfo=function(){var e=a.checkBillingInfo(a.paymentInfo.billingInfo);return n.$broadcast("billingAddressPopupErrors",e),e?(angular.extend(a.errors,{BillingInfo:e}),!1):!(a.errors.BillingInfo=null)},a.validateSmartDebit=function(){a.errors={};var e,t={};let n=a.validateBillingInfo();for(e in t.SmartDebitEmail=l.isEmpty(a.paymentInfo.smartDebit.email)?"Please enter your email address.":"",t.SmartDebitAccountName=l.isEmpty(a.paymentInfo.smartDebit.accountName)?"Please enter the name of the account holder.":"",t.SmartDebitSortCode=l.isEmpty(a.paymentInfo.smartDebit.sortCode)?"Please enter your sort code.":"",t.SmartDebitAccountNumber=l.isEmpty(a.paymentInfo.smartDebit.accountNumber)?"Please enter your account number.":"",t)if(t[e]){n=!1,angular.extend(a.errors,t);break}return n},a.onChangeAccountNumber=function(){a.paymentInfo.smartDebit.accountNumber=l.numberFilter(a.paymentInfo.smartDebit.accountNumber)},n.$on("changeBillingAddress",function(e,t){a.paymentInfo.billingInfo=t,a.validateBillingInfo()&&s.saveBillingAddress(a.initdata.state.key,t).then(function(e){e.success?n.$broadcast("closeBillingAddressPopup"):(n.$broadcast("billingAddressPopupErrors",e.errors),angular.extend(a.errors,{BillingInfo:e.errors}))}).catch(function(){a.inProcessMessageDisplay=!1,S()})}),n.$on("stripe-info",function(e,t){a.stripe=t.stripe,a.card=t.card}),n.$on("stripe-sepa-info",function(e,t){a.iban=t.iban}),n.$on("stripe-sepa-iban-change",function(e,t){a.stripeIbanError=t.errorMessage,a.$apply()}),a.billingAddressLine=function(){return a.paymentInfo?d.getAddressLine(a.paymentInfo.billingInfo):""},a.makeSmartDebitPayment=function(){a.inProcess||a.Initing||!a.validateSmartDebit()||(I=a.paymentSystem.SmartDebit,a.inProcess=!0,a.inProcessMessageDisplay=!0,r(),p.makeSmartDebitPayment(a.initdata.state.key,a.paymentInfo).then(function(e){e.success?a.paymentSuccess():(a.inProcess=!1,a.inProcessMessageDisplay=!1,e.error&&(S(e.error),void 0===e.isAuthenticated||e.isAuthenticated||n.$broadcast("userInfo",{userInfo:null})),e.errors&&(a.errors.ddErrors=e.errors,r(".js-error-container")))}).catch(function(){a.inProcessMessageDisplay=!1,S()}))}
1,a.stripeBascDetailsBackToForm=function(){a.stripeBascDetailsConfirmation=!1},a.makeStripeBacsDebitPayment=function(){a.inProcess||a.Initing||!a.validateStripeBascDebit()||(a.stripeBascDetailsConfirmation?(I=a.paymentSystem.StripeBacsDirectDebit,a.inProcess=!0,a.inProcessMessageDisplay=!0,r(),p.makeStripeBacsSetupIntent(a.initdata.state.key,a.paymentInfo).then(function(e){e.success?a.stripe.confirmBacsDebitSetup(e.data.setupIntentResultClientSecret,{payment_method:{billing_details:a.getStripeBillingDetails(),bacs_debit:{account_number:a.paymentInfo.stripeBacsDebit.accountNumber,sort_code:a.paymentInfo.stripeBacsDebit.sortCode.replaceAll("-","")}}}).then(function(e){e.error?(a.inProcess=!1,a.inProcessMessageDisplay=!1,S(e.error.message),a.stripeBascDetailsBackToForm()):p.makeStripeDirectDebitPayment(a.initdata.state.key,a.paymentInfo,e.setupIntent.id).then(function(e){e.success?a.paymentSuccess():(a.inProcessMessageDisplay=!1,S(e.message),void 0===e.isAuthenticated||e.isAuthenticated||n.$broadcast("userInfo",{userInfo:null}))})}):(a.inProcess=!1,a.inProcessMessageDisplay=!1,S(e.message),a.stripeBascDetailsBackToForm())})):a.stripeBascDetailsConfirmation=!0)},a.makeStripeSepaDebitPayment=function(){a.inProcess||a.Initing||!a.validateStripeSepaDebit()||(I=a.paymentSystem.StripeSEPADirectDebit,a.inProcess=!0,a.inProcessMessageDisplay=!0,r(),p.makeStripeSepaSetupIntent(a.initdata.state.key,a.paymentInfo).then(function(e){e.success?a.stripe.confirmSepaDebitSetup(e.data.setupIntentResultClientSecret,{payment_method:{billing_details:a.getStripeBillingDetails(),sepa_debit:a.iban}}).then(function(e){e.error?(a.inProcess=!1,a.inProcessMessageDisplay=!1,S(e.error.message)):p.makeStripeDirectDebitPayment(a.initdata.state.key,a.paymentInfo,e.setupIntent.id).then(function(e){e.success?a.paymentSuccess():(a.inProcessMessageDisplay=!1,S(e.message),void 0===e.isAuthenticated||e.isAuthenticated||n.$broadcast("userInfo",{userInfo:null}))})}):(a.inProcess=!1,a.inProcessMessageDisplay=!1,S(e.message))}))},a.getStripeBillingDetails=function(){return{address:{city:a.paymentInfo.billingInfo.town,country:a.paymentInfo.billingInfo.country,line1:a.paymentInfo.billingInfo.address1,line2:a.paymentInfo.billingInfo.address2,postal_code:a.paymentInfo.billingInfo.postcode,state:"US"==a.paymentInfo.billingInfo.country?a.paymentInfo.billingInfo.usState:null},email:a.paymentInfo.userEmail,name:(a.paymentInfo.billingInfo.title+" "+a.paymentInfo.billingInfo.firstName+" "+a.paymentInfo.billingInfo.lastName).trim()}},a.validateStripeBascDebit=function(){a.errors={};var e,t={};let n=a.validateBillingInfo();for(e in t.StripeBacsDebitEmail="",l.isEmpty(a.paymentInfo.stripeBacsDebit.email)?t.StripeBacsDebitEmail="Please enter your email address.":l.validateEmail(a.paymentInfo.stripeBacsDebit.email)||(t.StripeBacsDebitEmail="Please enter correct email address."),t.StripeBacsDebitAccountName=l.isEmpty(a.paymentInfo.stripeBacsDebit.accountName)?"Please enter the name of the account holder.":"",t.StripeBacsDebitSortCode=l.isEmpty(a.paymentInfo.stripeBacsDebit.sortCode)?"Please enter your sort code.":"",t.StripeBacsDebitAccountNumber=l.isEmpty(a.paymentInfo.stripeBacsDebit.accountNumber)?"Please enter your account number.":"",t.StripeBacsDebitAgree=a.paymentInfo.stripeBacsDebit.agree?"":"Please confirm that you are authorised to set up this direct debit",t)if(t[e]){n=!1,angular.extend(a.errors,t);break}return n},a.validateStripeSepaDebit=function(){a.errors={};var e,t={};let n=a.validateBillingInfo();for(e in t.StripeSepaDebitEmail="",l.isEmpty(a.paymentInfo.userEmail)?t.StripeSepaDebitEmail="Please enter your email address.":l.validateEmail(a.paymentInfo.userEmail)||(t.StripeSepaDebitEmail="Please enter correct email address."),a.stripeIbanError&&(n=!1),t)if(t[e]){n=!1,angular.extend(a.errors,t);break}return n},a.onChangeStripeBacsDebitAccountNumber=function(){a.paymentInfo.stripeBacsDebit.accountNumber=l.numberFilter(a.paymentInfo.stripeBacsDebit.accountNumber)},a.onChangeStripeBacsDebitSortCode=function(){a.paymentInfo.stripeBacsDebit.sortCode=l.sortCodeFilter(a.paymentInfo.stripeBacsDebit.sortCode)}}]),angular.module("frApp").controller("ProcessCtrl",["$scope","$
1window","$rootScope","$state","scroll","checkoutDataStorage","googleAnalyticsCheckout","enhancedEcommerce",function(o,a,i,r,t,s,e,c){i.$broadcast("fr-step",{step:4}),t(),e.SendEvent(e.eventAction.Payment),o.initdata=a.checkoutData,o.inProcess=!0,o.errors={},o.failedMessage="";function u(e){o.errors.server=e||"An error occurred. Please refresh the page and try again.",t(".js-error-container"),o.inProcess=!1}o.goToPay=function(){return r.go("pay"),!1},s.getProcessingInfo(o.initdata.state.key).then(function(e){if(e.success)if(2==e.data.state)e.data.failureReason?(o.inProcess=!1,o.errors.failed=e.data.failureReason):0!=e.data.totalAmount?r.go("pay"):r.go("confirm");else{for(var t=[],n=0;n<e.data.items.length;n++)t.push({name:o.initdata.campaignInfo.name,id:e.data.orderRef,price:e.data.items[n].amount,brand:e.data.charityName,category:o.initdata.campaignInfo.category,variant:s.getFrequencyStr(e.data.items[n].paymentFrequency),quantity:0<e.data.items[n].qty?e.data.items[n].qty:1});c.SendCheckout(c.steps.Pay,o.initdata.tippingMode&&!o.initdata.isVip),c.SendTransaction(e.data.orderRef,e.data.totalAmount,e.data.giftAidAmount,e.data.tipsAmount,t,o.initdata.currency.currencyCode,o.initdata.tippingMode),e.needSetPassword?r.go("set-password"):s.getThankYouInfo(o.initdata).then(function(e){e.success?(a.thankYouInfo=e,r.go("thank-you")):(u(e.error),void 0===e.isAuthenticated||e.isAuthenticated||i.$broadcast("userInfo",{userInfo:null}))}).catch(function(){u()})}else u()}).catch(function(){u()})}]),angular.module("frApp").controller("PurchaseOptionsCtrl",["$scope","$window","$rootScope","$state","cnumberFilter","scroll","$location","checkoutDataStorage","googleAnalyticsCheckout","enhancedEcommerce","validation","iframe",function(s,c,u,l,a,i,d,p,m,f,n,e){u.$broadcast("fr-step",{step:0}),i(),m.SendEvent(m.eventAction.Donation),s.inProcess=!1,s.errors={},s.initdata=c.checkoutData,s.customFields=s.initdata.customFields.selectStep,s.frequencies=p.frequencies,s.getFrequencyStr=p.getPurchaseFrequencyStr;function h(e){s.errors.server=e||"An error occurred. Please refresh the page and try again.",i(".js-error-container"),s.inProcess=!1}function o(){s.errors.donationOptionAmount=null,s.errors.donationOption=null}function t(){if(s.initdata.userInfo&&2!=s.initdata.userInfo.role)return i(".js-error-donoronly"),0;let e=!1;if(s.errors={},0!=s.initdata.checkoutOptions.filter(function(e){return!e.isFixed&&e.qty&&Number.isInteger(e.qty)&&0<e.qty&&(1===e.priceOption||!n.isDecimal(e.amount)||e.amount<=0)}).length)return s.errors.donationOption="Please enter an amount.",i(".js-error-container"),0;var t,o=y();if(o&&0!=o.length){var a=s.initdata.checkoutOptions.filter(function(e){return!e.isFixed&&e.qty&&Number.isInteger(e.qty)&&0<e.qty});let n=!0;if(angular.forEach(a,function(e){var t=e.amount*e.qty;e.error=!p.checkAmountMin(t),n=n&&!e.error}),!n)return s.errors.donationOptionAmount="The minimum payment amount is "+s.initdata.currency.sign+s.initdata.minAmount+". Please enter a higher amount.",i(".js-error-container"),0;let t=0;angular.forEach(o,function(e){t+=e.amount*e.qty}),p.checkAmountMax(t)||(s.errors.donationOptionAmount="The maximum online payment amount is "+s.initdata.currency.sign+s.initdata.maxAmount+". If you would like to make a larger payment, please call +44 (0) 20 3872 2090.",i(".js-error-container"),e=!0)}else s.errors.donationOption="Please make a selection.",i(".js-error-container"),e=!0;if(0<s.customFields.length&&!s.validateCustomFileds())return e||i(".js-customfields-container"),0;for(t in s.errors)if(s.errors[t])return;return 1}let g=e(".js-hight-content-blok","#footer"),y=(p.isCheckoutFinished()&&l.go("process"),s.getPleaseSelectTitle=function(){return s.initdata.checkoutBaseInfo.isEventRegistrationCheckout?"a ticket":(1==s.initdata.checkoutOptions.length?"how many":"your")+" items"},s.getTotalsStr=function(){var e=y();if(!e||0==e.length)return"";let n={},o=(angular.forEach(e,function(e){var t=p.getFrequencyStr(e.paymentFrequency),e=e.amount*e.qty;n[t]?n[t].amount+=e:n[t]={amount:e}}),"");return angular.forEach(n,function(e,t){0<e.amount&&(0<o.length&&(o+="
1+ "),o+=s.initdata.currency.sign+a(e.amount)+" "+t)}),o},s.onChangeQty=function(){var e;o(),this.item.qty?(this.item.qty=parseInt(this.item.qty.replace(/\D/g,"")),e=this.item.stockLimit?this.item.stockLimit-this.item.soldQty:this.item.qty+1,this.item.qty>e&&(this.item.qty=e)):this.item.qty=0},s.changeQty=function(e){var t;s.inProcess||(o(),e=this.item.qty+e,t=this.item.stockLimit?this.item.stockLimit-this.item.soldQty:e+1,e<0)||t<e||(this.item.qty=e)},s.onChangeAmount=function(){var e;o(),this.item.error=!1,this.item.amount=n.floatNumberFilter(this.item.amount),this.item.amount&&0==this.item.qty&&(e=this.item.stockLimit?this.item.stockLimit-this.item.soldQty:this.item.qty+1,this.item.qty<e)&&(this.item.qty=1)},function(){return s.initdata.checkoutOptions.filter(function(e){return e.qty&&Number.isInteger(e.qty)&&0<e.qty&&(1===e.priceOption||n.isDecimal(e.amount))})});s.getTiketType=function(){switch(this.item.ticketType){case 0:return"Single";case 1:return 0===this.item.teamSize?"Team | Unlim members":"Team | "+this.item.teamSize+" members";case 2:return"Free"}},s.getRemaining=function(){var e=this.item.stockLimit-this.item.soldQty;return this.item.stockLimit?(this.item.stockLimit,e<=0?"Sold Out":this.item.stockLimit&&e<=15?"Only "+a(e)+" remaining":a(e)+" remaining"):"Unlimited"},s.choose=function(){if(!this.item.stockLimit||0<this.item.stockLimit-this.item.soldQty){for(var e of s.initdata.checkoutOptions)e.qty=0;this.item.qty=1}},s.remainlLessThen=function(e){return e=e||1,this.item.stockLimit&&this.item.stockLimit-this.item.soldQty<e},s.continue=function(){if(!window.isPreviewMode&&!s.inProcess&&t()){s.inProcess=!0;let r=y();p.savePurchaseOptions(s.initdata,r).then(function(e){if(u.$broadcast("userInfo",{userInfo:e.data.userInfo}),e.success){var t,n=[];for(t of r){var o=s.initdata.checkoutOptions.indexOf(t);n.push({name:s.initdata.campaignInfo.name,id:e.data.orderReference,price:t.amount,brand:s.initdata.charityInfo.name,category:s.initdata.campaignInfo.category,variant:s.getFrequencyStr(t.paymentFrequency),position:o,quantity:t.qty})}f.SendProducts(n,s.initdata.currency.currencyCode,!1,null);var a=null===e.data.userInfo?"sign-up":"address-details";if(e.data.userInfo&&f.SendCheckout(f.steps.Login,s.initdata.tippingMode,!0,f.steps.Details),e.data.newIntention){var i=location.search.replace("?","").split("&"),i=(i.push("key="+e.data.key),d.protocol()+"://"+location.host+location.pathname+"?"+i.join("&")+"#!/"+a);try{if(!document.cookie&&(document.cookie="testcookie",-1==document.cookie.indexOf("testcookie")))return m.SendIFrameCookieBlokedEvent(),void g.redirect(i)}catch(e){console.log(e)}c.location=i}else c.checkoutData.userInfo=e.data.userInfo,l.go(a)}else c.checkoutData.userInfo=e.data.userInfo,h(e.message)}).catch(function(){h()})}}}]),angular.module("frApp").controller("SentSuccessfulCtrl",["$scope","$state","$rootScope","scroll",function(e,t,n,o){n.$broadcast("fr-step",{step:1}),o(),e.goToSignIn=function(){return t.go("sign-in"),!1}}]),angular.module("frApp").controller("SetPasswordCtrl",["$scope","$window","$rootScope","$state","scroll","focus","checkoutDataStorage","googleAnalyticsCheckout","enhancedEcommerce","validation","reCaptcha",function(t,n,e,o,a,i,r,s,c,u,l){e.$broadcast("fr-step",{step:5}),a(),i(".js-pwd-field"),s.SendEvent(s.eventAction.SetPassword),t.inProcess=!1,t.errors={},t.passval=null,t.initdata=n.checkoutData,t.charityName=t.initdata.charityInfo.name,t.showPassword=!1,l.init();function d(e){t.errors.server=e||"An error occurred. Please refresh the page and try again.",a(".js-error-container"),t.inProcess=!1}t.onChangePassword=function(){t.errors.Password=null},t.continue=function(){t.inProcess||(t.errors={},(u.isEmpty(t.passval)?(t.errors.Password="Please specify a password.",i(".js-pwd-field"),1):u.validatePassword(t.passval)?t.errors.Password=null:(t.errors.Password="Password must contain from 8 to 25 characters, at least one lowercase letter, one uppercase letter, one numeric digit, and one special character.",i(".js-pwd-field"),1))?s.SendEvent(s.eventAction.SetPasswordFailed):(t.inProcess=!0,r.setPassword(t.initdata.state.key,t.passval).then(function(e){e.success?(t.initdata.userEmail=e.userEmail,l.proceed(p)):(s.SendEvent(s.eventAction.SetPasswordFailed),d(e.error))}).catch(function(){d()})))},t.skip=function(){o.go("thank-you")};var p=function(e){t.inProcess=!0;e={email:t.initdata.userEmail,password:t.passval,reCaptcha:e};r.signIn(t.initdata.state.key,e).then(function(e){c.SendCheckout(c.steps.Password,t.initdata.tippingMode&&!t.initdata.isVip),r.getThankYouInfo(n.checkoutData).then(function(e){e.success?n.thankYouInfo=e:d(e.error)}).finally(function(){o.go("thank-you")})}).catch(function(){t.inProcess=!1,d()})}}]),angular.module("frApp").controller("SignInCtrl",["$scope","$timeout","$state","$window","focus","scroll","$rootScope","checkoutDataStorage","googleAnalyticsCheckout","enhancedEcommerce","windowpopup","reCaptcha","validation","oAuthService",function(t,n,o,e,a,i,r,s,c,u,l,d,p,m){var f=m.getCookie();if(t.initdata=e.checkoutData,(!t.initdata.state.key||t.initdata.userInfo)&&!f)return void o.go("default");r.$broadcast("fr-step",{step:1}),i(),c.SendEvent(c.eventAction.Details),c.SendEvent(c.eventAction.SignIn),t.inProcess=!1,t.showPassword=!1,d.init();function h(e){s.setIntentionUserId(t.initdata.state.key).then(function(e){e.success&&(t.initdata.userInfo=e.userInfo,r.$broadcast("userInfo",{userInfo:e.userInfo,mtchf:!0}),y())}).catch(function(){t.inProcess=!1,g()})}let g=function(e){t.errors.server=e||"An error occurred. Please refresh the page and try again.",i(".js-error-container"),t.inProcess=!1},y=(t.goToForgotPassword=function(){return o.go("forgot-password"),!1},t.goToSignUp=function(){var e=t.data&&t.data.email?t.data.email:null;return o.go("sign-up",{userEmail:e}),!1},function(){t.inProcess=!0,u.SendCheckout(u.steps.Login,t.initdata.tippingMode&&!t.initdata.isVip),e.newRegistered=!1,o.go("address-detail
1s")}),v=(t.errors={},t.data={email:"",password:""},t.emailChanged=function(){t.errors.email=null},t.validateEmail=function(){return t.errors.email=p.validateEmail(t.data.email)?"":"Please make sure the email address is valid and follows the format: {64 characters}@{67 characters}.",!t.errors.email},t.trySignIn=function(){t.inProcess||(t.errors={},t.validateEmail()?(t.errors.password=t.data.password?null:"Please enter your password.",t.errors.password?a(".js-sign-in-pwd"):(t.inProcess=!0,d.proceed(v))):a(".js-email-input"))},function(e){t.inProcess=!0;e={email:t.data.email,password:t.data.password,reCaptcha:e};s.signIn(t.initdata.state.key,e).then(function(e){e.success?(c.SendSignInEvent("Success","email"),h(e.userInfo)):(c.SendSignInEvent("Failed","email"),g(e.error),t.inProcess=!1)}).catch(function(){t.inProcess=!1,g()})});t.connectFB=function(){window.location!==window.parent.location?l(e.facebookUrl,"FB",640,350,!0):m.signInFB(t.companyId)},t.connectTW=function(){l(e.twitterUrl,"TW",640,320,!0)},t.connectGoogle=function(){l(e.googleUrl,"Google",640,450,!0)},e.facebookCallback=function(t){if(t.needSignUp)n(function(){g("Your Facebook account is not linked with Enthuse. Please log in using your email address and password.")},50),c.SendSignInEvent("Failed",t.type);else if(t.message)n(function(){g(t.message)},50),c.SendSignInEvent("Failed",t.type);else if(t.authorized){let e=t.userInfo;c.SendSignInEvent("Success",t.type),n(function(){h(e)},50)}},e.authResult=function(e){e.success?(c.SendSignInEvent("Success",e.type),h(e.userInfo)):(c.SendSignInEvent("Failed",e.type),g(e.error))},m.useCookie(f),n(function(){a(".js-email-input")},100)}]),angular.module("frApp").controller("SignUpCtrl",["$scope","$timeout","$state","$window","focus","scroll","$rootScope","checkoutDataStorage","googleAnalyticsCheckout","validation","addressService","enhancedEcommerce","windowpopup","reCaptcha","oAuthService",function(o,a,t,n,i,r,s,c,u,l,d,p,e,m,f){o.inProcess=!1,o.inProcessFb=!1,o.isSignUpMode=!1,o.addressSelect=!1,o.usePafLookup=n.usePafLookup,o.initdata=n.checkoutData,m.init(),o.allowEnterUserTitle=o.initdata.checkoutBaseInfo.allowEnterUserTitle,o.allowEnterPhoneNumber=o.initdata.checkoutBaseInfo.allowEnterPhoneNumber;function h(){o.inProcess=!0,p.SendCheckout(p.steps.Details,o.initdata.tippingMode&&!o.initdata.isVip);var e=o.initdata.checkoutBaseInfo.enableDonorMessage?"leave-message":"confirm";"confirm"==e?c.getConfirmationInfo(o.initdata).then(function(e){e.success&&(n.confirmationData=e.data)}).finally(function(){t.go("confirm")}):t.go(e)}o.goToSignIn=function(){return t.go("sign-in"),!1};var g=f.getCookie();if((!o.initdata.state.key||o.initdata.userInfo)&&!g)return void t.go("default");o.customFields=o.initdata.customFields.signUpStep,o.initdata.marketingOptIns&&(o.marketingOptIns=o.initdata.isVip&&o.initdata.marketingOptIns.vip?o.initdata.marketingOptIns.vip:o.initdata.marketingOptIns.standard),o.showMarketingOptIns=!1,o.charityName=o.initdata.charityInfo.name,s.$broadcast("fr-step",{step:1}),r(),u.SendEvent(u.eventAction.Details),u.SendEvent(u.eventAction.SignUp),o.isMobile=n.isMobile,o.countries=n.countries,o.UsStates=n.usStates,o.agree=!1,o.postcode="",o.isAnonymous=o.initdata.state.remainAnonymouse,o.errors={},o.data={isGuest:!0,Email:"",FirstName:"",LastName:"",FacebookId:null,GoogleId:null,TwitterId:null,Title:"",address:{country:o.initdata.checkoutBaseInfo.countryCode,phoneNumber:""}};function y(e){c.setIntentionUserId(o.initdata.state.key).then(function(e){e.success&&(o.initdata.userInfo=angular.copy(e.userInfo),s.$broadcast("userInfo",{userInfo:e.userInfo,mtchf:!0}),h())}).catch(function(){o.inProcess=!1})}function v(){o.isSignUpMode=!0,o.errors.Email="",o.marketingOptIns&&!o.isAnonymous&&(o.showMarketingOptIns=!0),o.isMobile?i("#title-select"):o.$broadcast("SetTitleFocus"),r(".js-title-label")}function I(e){var t=angular.copy(o.data);(t=angular.merge(o.data.address,t)).address=null,t.reCaptcha=e,c.signUp(o.initdata.state.key,t).then(function(e){if(e.success&&(o.initdata.checkoutBaseInfo.billingAddressId=e.billingAddressId,c.setIntentionUserId(o.initdata.state.key).then(function(e){e.success&&(o.initdata.userInfo=e.userInfo,s.$broadcast("userInfo",{userInfo:e.userInfo,mtchf:!0}),n.newRegistered=!0,c.saveCustomFields(o.initdata.state.key,o.customFields),o.showMarketingOptIns&&(e=o.marketingOptIns.channels.reduce((e,t)=>
1(e[t.channelId]=t.isSelected,e),{}),o.marketingOptIns.usePostOptOut&&(e[3]=!o.marketingOptIns.postOptOut),c.saveMarketingOptIns(o.initdata,e)),h())}).catch(function(){o.inProcess=!1})),e.errors)for(var t in e.errors){t=e.errors[t];"USState"===t.field?o.errors.UsState=t.message:o.errors[t.field]=t.message}}).finally(function(){o.inProcess=!1})}let S={password:"",Email:"",FirstName:"",LastName:"",Title:""},k=(o.GetAddressLine=function(e){return e&&!o.addressSelect?d.getFormattedAddressLine(null):d.getFormattedAddressLine(o.data.address)},o.setAddress=function(e){e=d.parseGoogleAddress(o.data.address.country,e);o.data.address=angular.copy(e),d.validateAddress(o.data.address,o.errors)||(o.editAddress(),a(function(){$("#popup-edit .error").siblings("input").trigger("focus")},20))},o.editAddress=function(){var e=angular.copy(o.data.address);s.$broadcast("addressPopup",e),o.triedToSaveAddress=!1},o.agreeChanged=function(){o.errors.agree=null,i(".js-next-button")},s.$on("saveAddress",function(e,t){o.triedToSaveAddress=!0,d.validateAddress(t,o.errors)?(d.clearAddressErrors(o.errors),s.$broadcast("addressPopupErrors",angular.copy(o.errors)),o.data.address=t,s.$broadcast("closeAddressPopup")):s.$broadcast("addressPopupErrors",angular.copy(o.errors))}),null),b=(o.countryChanged=function(e){d.emptyAddress(o.data.address),o.addressSelect=!1,k&&a.cancel(k),k=a(function(){i(".js-addr-input"),k=null},1e3)},n.authResult=function(e){var t;e.success?(u.SendSignInEvent("Success",e.type),y(e.userInfo)):e.googleId?(t=e,o.data.Email=t.googleEmail,o.data.GoogleId=t.googleId,o.data.userPictureUrl=t.googlePictureUrl,v()):e.twitterId?(t=e,o.data.TwitterId=t.twitterId,o.data.userPictureUrl=t.pictureUrl,t.email&&(o.data.Email=t.email),v()):(o.errors.server=e.error,r(".js-error-container"))},o.connectFB=function(){window.location!==window.parent.location?e(n.facebookUrl,"FB",640,350,!0):f.signUpFB(o.companyId)},o.connectTW=function(){e(n.twitterUrl,"TW",640,320,!0)},o.connectGoogle=function(){e(n.googleUrl,"Google",640,450,!0)},n.facebookCallback=function(n){if(n.needSignUp){let t=angular.copy(n.fbData);void a(function(){var e;e=t,o.data.FirstName=e.firstName,o.data.LastName=e.lastName,o.data.Email=e.email,o.data.FacebookId=e.facebookId,v(),o.data.userPictureUrl=t.PhotoUrl},50)}else if(n.message)a(function(){o.errors.server=n.message,r(".js-error-container")},50);else if(n.authorized){let e=n.userInfo;u.SendSignInEvent("Success",n.type),a(function(){y(e)},50)}},o.save=function(){b()?m.proceed(I):(o.inProcess=!1,o.inProcessFb=!1)},function(){let e=!0,t=!0;for(var n in o.errors={},o.validateName("FirstName"),o.validateName("LastName"),o.validateTitle("Title"),o.errors)o.errors[n]&&(t&&(r(".js-firstname-label"),t=!1),e=!1);return d.validateAddress(o.data.address,o.errors)||(t&&(r(".ut-address-error"),t=!1),e=!1),0<o.customFields.length&&!o.validateCustomFileds()&&(t&&(r(".js-customfields-container"),t=!1),e=!1),o.showMarketingOptIns&&!o.validateMarketingOptIns()&&(e=!1),o.agree||(o.errors.agree=!0,t&&(r(".js-agree-error"),i("#agree-check")),e=!1),e});o.clearEmailError=function(){o.errors.Email=null},o.validateAndSave=function(e){var t=e&&13===e.keyCode;return!(o.inProcess||!t&&e)&&(e&&(e.preventDefault(),e.stopPropagation()),o.inProcess=!0,o.errors={},S.Email=o.data.Email,l.validateEmail(o.data.Email)?(o.errors.Email="",void c.checkEemail(o.data.Email).then(function(e){if(o.isSignUpMode&&(e.success||e.isExisting&&o.data.isGuest))return o.save(),!1;if(e.success)v();else{if(e.isExisting&&!o.initdata.checkoutBaseInfo.isEventRegistrationCheckout)return v(),o.inProcess=!1;o.errors.Email=e.error,i(".js-email-input"),r(".js-email-area")}o.inProcess=!1})):(o.errors.Email="Please make sure the email address is valid and follows the format: {64 characters}@{67 characters}.",r(".js-email-area"),o.inProcess=!1))},o.validateName=function(e){S[e]===o.data[e]&&!l.isEmpty(o.data[e])&&l.validateUserName(o.data[e])||(S[e]=o.data[e],l.isEmpty(o.data[e])?o.errors[e]="Field is required.":o.errors[e]=l.validateUserName(o.data[e])?"":"The entry must begin and end with a letter, and may only contain letters, space
1s, full stops(.), hyphens(-) and apostrophes(').")},o.validateTitle=function(e){if(!o.allowEnterUserTitle)return!0;S[e]===o.data[e]&&(!l.isEmpty(o.data[e])&&l.validateTitle(o.data[e])||l.isEmpty(o.data[e]))||(S[e]=o.data[e],l.validateTitle(o.data[e])?o.errors[e]="":o.errors[e]="Accepted characters are lower and upper case letters, 0-9, spaces and the following special characters . ' - / ( )")},a(function(){i(".js-email-input")},500),o.usePafLookup&&d.initPafData(function(e){let t=d.setPAFAddress(o.data.address,e);a(function(){o.addressSelect=!0,o.data.address=angular.copy(t),d.validateAddress(o.data.address,o.errors)||(o.editAddress(),a(function(){$("#popup-edit .error").siblings("input").trigger("focus")},20))},50)}),g&&f.useCookie(g)}]),angular.module("frApp").controller("ThankYouCtrl",["$scope","$window","$rootScope","$state","$location","scroll","checkoutDataStorage","googleAnalyticsCheckout","iframe","$timeout","windowpopup",function(t,n,e,o,a,i,r,s,c,u,l){function d(){!1!==t.canFillCustomFields||!0===t.initdata.checkoutBaseInfo.isEventRegistrationCheckout&&!1===n.checkoutData.donationOnly||null!==t.marketingOptInInfo||(y=u(function(){"/thank-you"===a.path()&&t.redirect()},3e4))}function p(){return null!=t.info&&t.info.returnUrl&&""!=t.info.returnUrl}function m(){!1===t.canFillCustomFields&&(!p()||n.isIframe&&t.info.isOverrideUrl)&&(y&&u.cancel(y),t.showThankYouMessage=!1,t.showDoneButton=!1)}function f(e){t.errors.server=e||"An error occurred. Please refresh the page and try again.",i(".js-error-container"),t.inProcess=!1}function h(){try{t.info.donationItems.forEach(function(e){var t=r.getThankYouFrequencyStr(e.paymentFrequency);s.SendEventWithLabel(s.eventAction.Success,e.netAmount,t)})}catch(e){console.error(e),s.SendEvent(s.eventAction.Success)}}var g=c(".js-hight-content-blok","#footer"),y=null;e.$broadcast("fr-step",{step:5}),e.$broadcast("userInfo",{userInfo:null}),i(),t.toggled=!1,t.showThankYouMessage=!1,t.showDoneButton=!0,t.inProcess=!1,t.Initing=!0,t.errors={},t.initdata=n.checkoutData,t.customFields=t.initdata.customFields.successStep,t.info=null,t.canFillCustomFields=t.initdata.canFillCustomFields,t.frequencies=r.frequencies,t.getFrequencyStr=r.getFrequencyStr,t.marketingOptIn={response:!1};t.showMore=function(){t.toggled=!t.toggled,setTimeout(g._recalibrate,150)},n.thankYouInfo?(t.info=n.thankYouInfo.data,t.shareInfo=n.thankYouInfo.shareInfo,t.marketingOptInInfo=n.thankYouInfo.marketingOptInInfo,n.thankYouInfo=null,t.Initing=!1,h(),d(),m()):r.getThankYouInfo(t.initdata).then(function(e){e.success?(t.info=e.data,t.shareInfo=e.shareInfo,t.marketingOptInInfo=e.marketingOptInInfo,t.info.state<0?(n.checkoutData.state.step=t.info.state,o.go("default")):(h(),d(),m(),t.Initing=!1)):(f(e.error),t.Initing=!1)}).catch(function(e){404!==e.status&&401!==e.status||o.go("default"),f(),t.Initing=!1}),t.getBankStatementStr=function(){return t.info?"Enthuse.com":""},t.shareFb=function(){u.cancel(y),l("https://www.facebook.com/share.php?display=popup&u="+encodeURIComponent(t.shareInfo.shareUrl),"FB",640,450)},t.shareTwitter=function(){u.cancel(y);var e={url:t.shareInfo.shareUrl,text:t.shareInfo.message},e="https://twitter.com/intent/tweet?"+$.param(e);l(e,"TW",640,450)},t.saveMarketingOptIn=function(){var e={};e[0]=t.marketingOptIn.response,r.saveCompanyMarketingOptIns(t.initdata.state.key,e).then(function(e){!1===e?.success&&f(e.error)}).catch(function(e){f(e)})},t.continue=function(){if(!t.inProcess&&!t.Initing){if(y&&u.cancel(y),!0===t.canFillCustomFields)return t.validateCustomFileds()?(t.inProcess=!0,void r.saveThankYouInfo(t.initdata).then(function(e){e.success?t.redirect():f(e.error)}).catch(function(){f()})):void i(".js-customfields-container");t.redirect()}},t.redirect=function(){p()?n.crossDomainMessageLibrary.isPresentExternal?g.redirect(t.info.returnUrl):window.location.href=t.info.returnUrl:(t.showDoneButton=!1,t.showThankYouMessage=!0)}}]),angular.module("frApp").controller("UserInfoCtrl",["$state","$scope","$http","$window","$rootScope",function(n,o,a,i,r){o.userInfo=i.checkoutData.userInfo,r.$on("userInfo",function(e,t){o.userInfo=t.userInfo}),r.$on("auth-cookie-has-expired",function(e,t){location.reload()}),o.LogOut=function(){let e="/checkout/sign-out/";i.loggedIn=!1;var t=i.location.hash.match("thank-you");t&&3===t.index||i.checkoutData.state&&i.checkoutData.state.key&&(e+=i.checkoutData.state.key),a.post(e).then(function(e){i.checkoutData.userInfo=null,r.$broadcast("userInfo",{userInfo:null,mtchf:!0}),e.data.redirectUrl?i.location=e.data.redirectUrl:n.go("default")})}}]),angular.module("frApp").directive("smartDebit",function(){return{restrict:"E",templateUrl:"/js/app/checkout/templates/payment-types/smart-debit.html"}}),angular.module("frApp").directive("autogrow",["$window",function(){return{link:function(e,t){e.autogrowFn=function(){t[0].style.overflowY="hidden",t[0].style.height="auto",t[0].style.height=t[0].scrollHeight+"px"},$(t[0]).on("input",e.autogrowFn),$(t[0]).on("focus",e.autogrowFn),e.autogrowFn()}}}]),angular.module("frApp").config(["$stateProvider","$urlRouterProvider",function(e,t){t.otherwise("/"),e.state({name:"default",url:"/",templateUrl:0==window.checkoutData.checkoutBaseInfo.checkoutType?"/js/app/checkout/templates/donation-options.html":"/js/app/checkout/templates/purchase-options.html",controller:0==window.checkoutData.checkoutBaseInfo.checkoutType?"DonationOptionsCtrl":"PurchaseOptionsCtrl"}),e.state({name:"donation-options",url:"/donation",templateUrl:"/js/app/checkout/templates/donation-options.html",controller:"DonationOptionsCtrl"}),e.state({name:"purchase-options",url:"/purchase",templateUrl:"/js/app/checkout/templates/purchase-options.html",controller:"PurchaseOptionsCtrl"}),e.state({name:"sign-up",url:"/sign-up",params:{userEmail:null,proceedAsGuest:null},templateUrl:"/js/app/checkout/templates/signup.html",controller:"SignUpCtrl"}
1),e.state({name:"address-details",url:"/address-details",params:{userEmail:null,proceedAsGuest:null},templateUrl:"/js/app/checkout/templates/address-details.html",controller:"AddressDetailsCtrl"}),e.state({name:"sign-in",url:"/login",templateUrl:"/js/app/checkout/templates/sign-in.html",controller:"SignInCtrl"}),e.state({name:"forgot-password",url:"/forgot-password",templateUrl:"/js/app/checkout/templates/forgot-password.html",controller:"ForgotCtrl"}),e.state({name:"sent-successful",url:"/sent-successful",templateUrl:"/js/app/checkout/templates/sent-successful.html",controller:"SentSuccessfulCtrl"}),e.state({name:"leave-message",url:"/leave-message",templateUrl:"/js/app/checkout/templates/leave-message.html",controller:"LeaveMessageCtrl"}),e.state({name:"confirm",url:"/confirm",templateUrl:"/js/app/checkout/templates/confirm.html",controller:"ConfirmCtrl"}),e.state({name:"pay",url:"/pay",templateUrl:function(){return 444<$(window).width()?"/js/app/checkout/templates/pay.html":"/js/app/checkout/templates/pay-mobile.html"},controller:"PayCtrl"}),e.state({name:"process",url:"/process",templateUrl:"/js/app/checkout/templates/process.html",controller:"ProcessCtrl"}),e.state({name:"set-password",url:"/set-password",templateUrl:"/js/app/checkout/templates/set-password.html",controller:"SetPasswordCtrl"}),e.state({name:"thank-you",url:"/thank-you",templateUrl:!0===window.checkoutData.checkoutBaseInfo.isEventRegistrationCheckout&&!1===window.checkoutData.donationOnly?"/js/app/checkout/templates/ticket-purchase-complete.html":"/js/app/checkout/templates/thank-you.html",controller:"ThankYouCtrl"})}]),angular.module("frApp").factory("checkoutDataStorage",["$http","$window","$q",function(i,n,r){return{httpConfig:{timeout:5e5},checkAmountMin:function(e){return e>=n.checkoutData.minAmount},checkAmountMax:function(e){return e<=n.checkoutData.maxAmount},frequencies:{Quarterly:1,Yearly:3,Single:4,Monthly:6},CheckoutStep:{Select:0,Details:1,Message:2,Confirm:3,Pay:4},IntentionState:{Selected:-4,LeaveMessage:-2,Confirmed:0,Failed:2,Processed:3,PartiallyProcessed:4,Processing:5},getPurchaseFrequencyStr:function(e){switch(e){case this.frequencies.Monthly:return"Monthly â ongoing";case this.frequencies.Yearly:return"Yearly â ongoing";case this.frequencies.Quarterly:return"Quarterly â ongoing";default:this.frequencies.Single;return""}},getThankYouFrequencyStr:function(e){switch(e){case this.frequencies.Monthly:return"First Monthly";case this.frequencies.Yearly:return"First Yearly";case this.frequencies.Quarterly:return"First Quarterly";case this.frequencies.Single:return"Single";default:return""}},getFrequencyStr:function(e){switch(e){case this.frequencies.Monthly:return"Monthly";case this.frequencies.Yearly:return"Yearly";case this.frequencies.Quarterly:return"Quarterly";default:this.frequencies.Single;return""}},saveDonationOption:function(e,t,n,o){let a=r.defer();t={checkoutId:e.checkoutBaseInfo.id,charityId:e.checkoutBaseInfo.charityId,companyId:e.checkoutBaseInfo.companyId,key:e.state.key,hideDonationAmount:e.state.hideDonationAmount,remainAnonymouse:e.state.remainAnonymouse,option:t,customFields:e.customFields.selectStep,fundraiserInfo:e.fundraiserInfo,isPayIn:e.isPayIn,isVip:o,tippingMode:e.tippingMode,preselectedAmountValue:n};return i.post("/checkoutstate/donationoption/save",t,this.httpConfig).then(function(e){a.resolve(e.data)}).catch(function(){a.reject("")}),a.promise},savePurchaseOptions:function(e,t){let n=r.defer();t={checkoutId:e.checkoutBaseInfo.id,charityId:e.checkoutBaseInfo.charityId,companyId:e.checkoutBaseInfo.companyId,key:e.state.key,hideDonationAmount:e.state.hideDonationAmount,options:t,customFields:e.customFields.selectStep,fundraiserInfo:e.fundraiserInfo};return i.post("/checkoutstate/purchaseoptions/save",t,this.httpConfig).then(function(e){n.resolve(e.data)}).catch(function(){n.reject("")}),n.promise},saveCharityMessage:function(e){let t=r.defer();return i.post("/checkoutstate/charitymessage/save",e.state,this.httpConfig).then(function(e){t.resolve(e.data)}).catch(function(){t.reject("")}),t.promise},getConfirmationInfo:function(e){let t=r.defer();e="/checkoutstate/confirm/get/"+e.state.key;return i.get(e,{},this.httpConfig).then(function(e){window.checkoutData.coverFeeModel=e.data.data.coverFeeViewModel,t.resolve(e.data)}).catch(function(){t.reject("")}),t.promise},saveConfirmationState:function(e){let t=r.defer();e={key:e.state.key,coverFee:e.state.coverFee,giftAidDonation:e.state.giftAidDonation,customFields:e.customFields.confirmStep,charityId:e.charityInfo.id,tippingMode:e.state.t
1ippingMode,donorCoverFeeEnabled:e.donorCoverFeeEnabled};return i.post("/checkoutstate/confirm/save",e,this.httpConfig).then(function(e){t.resolve(e.data)}).catch(function(){t.reject("")}),t.promise},getCountries:function(){let t=r.defer();return n.countries?t.resolve(n.countries):i.post("/checkout/get-countries").then(function(e){n.countries=e.data,t.resolve(e.data)}).catch(function(){t.reject("")}),t.promise},getPaymentInfo:function(e){let t=r.defer();var n="/checkoutstate/pay/get/"+e.state.key,e={charityId:e.charityInfo.id,reCaptcha:e.state.reCaptcha};return i.post(n,e,this.httpConfig).then(function(e){t.resolve(e.data)}).catch(function(){t.reject("")}),t.promise},getTips:function(e){let t=r.defer();return i.get("/tips/get/"+e).then(function(e){t.resolve(e.data)}).catch(function(){t.reject("")}),t.promise},saveTips:function(e,t){let n=r.defer();return i.post("/tips/save/"+e,t,this.httpConfig).then(function(e){n.resolve(e)}).catch(function(){n.reject("")}),n.promise},getMatchFunding:function(){let t=r.defer();var e="/checkoutstate/getMatchFunding/"+(n.checkoutData.state.key||"");return i.post(e,{fundraiserInfo:n.checkoutData.fundraiserInfo,checkoutBaseInfo:n.checkoutData.checkoutBaseInfo},this.httpConfig).then(function(e){t.resolve(e.data)}).catch(function(){t.reject("")}),t.promise},getProcessingInfo:function(e){let t=r.defer();return i.post("/checkoutstate/pay/process/"+e,{},this.httpConfig).then(function(e){t.resolve(e.data)}).catch(function(){t.reject("")}),t.promise},setPassword:function(e,t){let n=r.defer();return i.post("/checkoutstate/user/setpassword/"+e,{password:t},this.httpConfig).then(function(e){n.resolve(e.data)}).catch(function(){n.reject("")}),n.promise},getThankYouInfo:function(e){let t=r.defer();e="/checkoutstate/thankyou/get/"+e.state.key;return i.post(e,{},this.httpConfig).then(function(e){t.resolve(e.data)}).catch(function(e){t.reject(e)}),t.promise},saveCustomFields:function(e,t){let n=r.defer();return i.post("/checkoutstate/customefields/save/"+e,t,this.httpConfig).then(function(e){n.resolve(e.data)}).catch(function(e){n.reject("")}),n.promise},saveCompanyMarketingOptIns:function(e,t){let n=r.defer();return i.post("/checkoutstate/corp-marketing-opt-in/save/"+e,{channels:t},this.httpConfig).then(function(e){n.resolve(e.data)}).catch(function(e){n.reject("")}),n.promise},saveMarketingOptIns:function(e,t){let n=r.defer();e="/checkoutstate/marketing-opt-ins/save/"+e.checkoutBaseInfo.charityId;return i.post(e,{channels:t},this.httpConfig).then(function(e){n.resolve(e.data)}).catch(function(e){n.reject("")}),n.promise},saveThankYouInfo:function(e){let t=r.defer();var n="/checkoutstate/thankyou/save/"+e.state.key;return i.post(n,e.customFields.successStep,this.httpConfig).then(function(e){t.resolve(e.data)}).catch(function(){t.reject("")}),t.promise},afterPopupClosed:function(t,n){setTimeout(function e(){t&&!t.closed?setTimeout(e,800):n()},800)},saveBillingAddress:function(e,t){let n=r.defer();return i.post("/checkout/save-billing-address/"+e,t,this.httpConfig).then(function(e){n.resolve(e.data)}).catch(function(){n.reject("")}),n.promise},signIn:function(e,t){let n=r.defer();return i.post("/checkout/sign-in?key="+e,t,this.httpConfig).then(function(e){n.resolve(e.data)}).catch(function(){n.reject(ex)}),n.promise},signUp:function(e,t){let n=r.defer();return i.post("/checkout/sign-up?key="+e,t,this.httpConfig).then(function(e){n.resolve(e.data)}).catch(function(){n.reject(ex)}),n.promise},setIntentionUserId:function(e){let t=r.defer();return i.post("/checkout/set-intention-user-id/"+e).then(function(e){t.resolve(e.data)}).catch(function(){t.reject(ex)}),t.promise},checkEemail:function(e){let t=r.defer();return i.post("/checkout/check-email",{email:e}).then(function(e){t.resolve(e.data)}).catch(function(){t.reject(ex)}),t.promise},trySetAddressDetails:function(e){let t=r.defer();return i.post("/checkout/try-set-address-details?key="+e,null).then(function(e){t.resolve(e.data)}).catch(function(){t.reject(ex)}),t.promise},saveAddressDetails:function(e,t){let n=r.defer();
1return i.post("/checkout/save-address-details?key="+e,t).then(function(e){n.resolve(e.data)}).catch(function(){n.reject(ex)}),n.promise},isCheckoutFinished:function(){return n.checkoutData&&n.checkoutData.state&&n.checkoutData.state.step>=this.getProcessedStatus()},getProcessedStatus:function(){return 1}}}]),angular.module("frApp").controller("ExpireSoonCtrl",["$scope","$window","$interval","$timeout","$http","$q","$rootScope",function(n,e,t,o,a,i,r){String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return this.indexOf(e,t=t||0)===t}),n.remailTimeToShow=n.remainTimeToLogOut=15,n.lastSyncTime=0,n.syncInterval=6e4;{let e=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){return this.addEventListener("load",function(){var e;this.responseURL&&this.responseURL.startsWith(window.location.origin)&&!this.responseURL.endsWith(".html")&&((e=this.getResponseHeader("expiresUtc"))?(e=Math.floor(new Date(e).getTime()))>n.expiresUtc&&(n.expiresUtc=e,n.logOutSoonRun()):n.cancelTimer())}),e.apply(this,arguments)}}n.timer=null,n.interval=null,n.expiresUtc=e.expiresUtc?Math.floor(new Date(window.expiresUtc).getTime()):0,e.expiresUtc=null,n.runInterval=function(){var e;n.timer&&(1<n.remailTimeToShow?(e=(new Date).getTime(),e=(n.expiresUtc-e)/1e3/60,2<Math.abs(Math.round(e)-n.remailTimeToShow)&&(n.cancelInterval(),n.logOutSoonRun()),--n.remailTimeToShow):n.cancelInterval())},n.checkInterval=t(function(){var e=(new Date).getTime();e-n.lastSyncTime>n.syncInterval&&(n.lastSyncTime=(new Date).getTime(),e>n.expiresUtc&&0!==n.expiresUtc&&n.isLogedIn().then(function(e){n.hasBeenLogedOut=!e,e||(n.show(),n.cancelInterval(),t.cancel(n.checkInterval),n.checkInterval=null)}),n.expiresUtc)&&(e=(n.expiresUtc-e)/1e3/60,3<Math.abs(Math.round(e)-n.remailTimeToShow))&&n.remailTimeToShow!==n.remainTimeToLogOut&&(n.cancelInterval(),n.logOutSoonRun())},n.syncInterval),n.logOutSoonRun=function(){n.cancelTimer(),n.hasBeenLogedOut=!1,n.timeNow=Math.floor((new Date).getTime());var e=n.expiresUtc-n.timeNow-60*n.remainTimeToLogOut*1e3;n.timer=o(function(){n.remailTimeToShow=n.remainTimeToLogOut,n.show(),n.logedOutRun(),n.interval=t(function(){n.runInterval()},n.syncInterval)},e)},n.logedOutRun=function(){n.timer=o(function(){n.isLogedIn().then(function(e){n.hasBeenLogedOut=!e,e||n.show()})},60*n.remainTimeToLogOut*1e3+5e3)},n.cancelInterval=function(){t.cancel(n.interval),n.interval=null},n.cancelTimer=function(){n.timer&&(o.cancel(n.timer),n.hasBeenLogedOut||s.hide()),n.timer=null,n.remailTimeToShow=n.remainTimeToLogOut};let s=$("#js-expire-popup");n.close=function(){s.hide(),n.hasBeenLogedOut&&(n.hasBeenLogedOut=!1,r.$broadcast("auth-cookie-has-expired",{}))},n.show=function(){$("#js-mtchf-popup").is(":visible")&&$("#js-mtchf-popup").hide(),s.show()},n.remainLogedIn=function(){n.isLogedIn().then(function(){n.isLogedIn()})},n.isLogedIn=function(){let t=i.defer();return a.post("/login/is-loged-in").then(function(e){t.resolve(e.data.isAuthenticated)}),t.promise},s.on("keyup",function(e){27===e.keyCode&&n.close()}).find(".js-close-btn").on("click",n.close),n.$on("userInfo",function(e,t){t.userInfo?n.isLogedIn():n.cancelTimer()}),n.expiresUtc&&n.logOutSoonRun()}]),angular.module("frApp").factory("scroll",["$timeout","$rootScope","iframe",function(t,e,n){return function(o){let a=0,i=0,r=n(".js-hight-content-blok","#footer");var e;o&&(e=$(".step-panel:visible"))&&(a=e.position().top,i=e.outerHeight()),t(function(){let e=0,t=0;var n;o?0<(n=$(o)).length&&(t=500,e=n.offset().top-a-i-10,r.scroll(e)):r.pageChange(),window.isIframe&&!window.crossDomainMessageLibrary.enableScrollInIframe||$("html,body").animate({scrollTop:e},t)},200)}}]),angular.module("frApp").factory("enhancedEcommerce",["$window","$q",function(s,e){return{steps:{Select:{Number:1,Name:"Select"},Details:{Number:2,Name:"Details"},Message:{Number:3,Name:"Message"},Confirm:{Number:4,Name:"Confirm"},Pay:{Number:5,Name:"Pay"},Login:{Number:6,Name:"Login"},Password:{Number:7,Name:"Password"}},SendProducts:function(t,n,o,a){try{if(s.useTagManager){let e=0;for(var i=0;i<t.length;i++)e+=t[i].price*t[i].quantity;var r={event:"checkout",ecommerce:{currencyCode:n,checkout:{actionField:{step:this.steps.Select.Number,option:this.steps.Select.Name},products:t}},useTipping:o,totalAmount:e};try{if(a&&o){let t="",n="";for(let e=0;e<a.selectedTips.length;e++)t+=a.selectedTips[e].title+";",a.selectedTips[e].type==a.defaultTipsType&&(n=a.selectedTips[e].title);r.tippingOrder=a.tipOrderAsc?"ascending":"descending",r.tipTypes=t,r.defaultTipsType=n}}catch(e){console.log(e)}dataLayer.push(r)}}catch(e){console.log(e)}},SendCheckout:function(e,t){try{s.useTagManager&&dataLayer.push({event:"checkout",ecommerce:{checkout:{actionField:{step:e.Number,option:e.Name}}},useTipping:t})}catch(e){console.log(e)}},SendTransaction:function(e,t,n,o,a,i,r){try{s.useTagManager&&dataLayer.push({event:"purchaseComplited",ecommerce:{currencyCode:i,purchase:{actionField:{id:e,revenue:t+n,tax:n,shipping:o||0},products:a},useTipping:r}}
1)}catch(e){console.log(e)}}}}]),angular.module("frApp").factory("iframe",[function(){return function(e,t){let o=window.isPreviewMode?40:0,a={isInIframe:void 0,container:e,footer:t,height:function(){return $(a.container).outerHeight(!0)+$(a.footer).outerHeight(!0)},pageChange:function(){try{if(isInIframe){let e=a.height(),t=void 0;var n={attributes:!0,childList:!0,subtree:!0};new MutationObserver(()=>{a.height()!=e&&(e=a.height(),t&&clearTimeout(t),t=setTimeout(function(){a._recalibrate()},50))}).observe(document,n),parent.postMessage(["scroll"],"*"),parent.postMessage(["height",a.height()+o],"*")}}catch(e){console.log(e)}},_recalibrate:function(){try{isInIframe&&parent.postMessage(["height",a.height()+o],"*")}catch(e){console.log(e)}},scroll:function(e){try{isInIframe&&parent.postMessage(["scroll",e],"*")}catch(e){console.log(e)}},redirect:function(e){try{isInIframe&&parent.postMessage(["redirectUrl",e],"*")}catch(e){console.log(e)}}};return a}}]),angular.module("frApp").factory("googleAnalyticsCheckout",["$window",function(o){return{eventAction:{Donation:"Donation",Details:"Details",ForgotPassword:"ForgotPassword",SignIn:"SignIn",SignInFailed:"SignInFailed",SignUp:"SignUp",Message:"Message",Confirm:"Confirm",PaymentMethod:"PaymentMethod",Payment:"Payment",SetPassword:"SetPassword",SetPasswordFailed:"SetPasswordFailed",Failed:"Failed",Success:"Success",IFrameCookieBloked:"IFrameCookieBloked"},SendPageView:function(){this.Send({hitType:"pageView",eventCategory:null,eventAction:null,eventValue:null})},SendEvent:function(e,t){e={hitType:"event",eventCategory:o.agEventCategory,eventAction:e,eventValue:t};this.Send(e)},SendEventWithLabel:function(e,t,n){e={hitType:"event",eventCategory:o.agEventCategory,eventAction:e,eventLabel:n,eventValue:t};this.Send(e)},SendSignInEvent:function(e,t){e={hitType:"event",eventCategory:this.eventAction.SignIn,eventAction:e,eventLabel:t=t||""};this.Send(e)},SendIFrameCookieBlokedEvent:function(){try{var e={hitType:"event",eventCategory:this.eventAction.IFrameCookieBloked,eventAction:this.eventAction.IFrameCookieBloked,eventLabel:null};window.sendGoogleTargetEvent("cc",e)}catch(e){console.log(e)}},Send:function(e){try{if(o.googleTracker){window.sendGoogleTargetEvent("cc",e);try{!window.googleClientTrackingId||Object.hasOwn(e,"eventAction")&&"SetPasswordFailed"==e.eventAction||Object.hasOwn(e,"eventCategory")&&"Login"==e.eventCategory||window.sendGoogleTargetEvent("ch",e)}catch(e){console.log("clients event failed: "+e)}}else console.log("No googleTracker")}catch(e){console.log(e)}}}}]),angular.module("frApp").factory("paymentSvs",["$http","$q",function(o,r){return{httpConfig:{timeout:5e5},getPayPalUrl:function(e,t,n){var o={};return o.ispopup=t,o.stPayPal=!0,t="/checkoutstate/securetrading/paypal/",t+=e+"?"+$.param(o)},getApplePayUrl:function(e){return"/applepay/"+e},makeSmartDebitPayment:function(e,t){var n=r.defer(),t=t.smartDebit;return this.post("/checkoutstate/pay/smartdebit/"+e,t,n),n.promise},makeStripePayment:function(e,t,n,o,a){var i=r.defer(),e={key:e,startDate:t.startDate,paymentMethodId:n,threeDSecureSupported:o,stripeConnectedAccountId:t.stripeConnectedAccountId,cardCountryCode:a};return this.post("/checkoutstate/pay/stripe",e,i),i.promise},makeStripeBacsSetupIntent:function(e,t){var n=r.defer(),e={key:e,stripeConnectedAccountId:t.stripeConnectedAccountId};return this.post("/checkoutstate/pay/stripe-bacs-setup",e,n),n.promise},makeStripeDirectDebitPayment:function(e,t,n){var o=r.defer(),e={key:e,startDate:t.startDate,setupIntentId:n,stripeConnectedAccountId:t.stripeConnectedAccountId};return this.post("/checkoutstate/pay/stripe-direct-debit",e,o),o.promise},makeStripeSepaSetupIntent:function(e,t){var n=r.defer(),e={key:e,stripeConnectedAccountId:t.stripeConnectedAccountId};return this.post("/checkoutstate/pay/stripe-sepa-setup",e,n),n.promise},confirmStripePayment:function(e,t){var n=r.defer();return this.post("/checkoutstate/pay/stripe/confirm/",{key:e,paymentIntentId:t},n),n.promise},changePaymentSystem:function(e,t){let n=r.defer();return o.post("/checkoutstate/pay/changePaymentSystem/"+e,t,this.httpConfig).then(function(e){n.resolve(e.data)}).catch(function(){n.reject("")}),n.promise},attachPaymentMethod:function(e,t){var n=r.defer();return this.post("/checkoutstate/pay/attach-payment-method",{key:e,paymentMethodId:t},n),n.promise},createGPayPaymentIntent:function(e){var t=r.defer();return this.post("/checkoutstate/pay/googlepay-payment-intent",{key:e},t),t.promise},post:function(e,t,n){o.post(e,t,this.httpConfig).then(function(e){n.resolve(e.data)}).catch(function(){n.reject("")})},logPaymentError:function(e,t,n,o){var n=JSON.stringify(n),a=r.defer();return this.post("/checkoutstate/securetrading/failed/"+e,{failedAction:t,data:n,chosenPaymentSystem:o},a),a.promise},processSecureTradingPayment:function(e){var t=r.defer();return this.post("/checkoutstate/securetrading/success/"+e,{},t),t.promise}}}]),angular.module("frApp").directive("applePay",["$window","$rootScope",function(e,o){return{restrict:"E",transclude:!0,templateUrl:"/js/app/common/checkout/templates/payment-types/apple-pay.html",link:function(t){function n(e){o.$broadcast("origin-asking-to-show-payment-tab",e,"apple-pay"),t.paymentInfo.applePayCanBeUsed=e}try{e.ApplePaySession&&t.paymentInfo.secureTradingApplePayAvailable&&n(window.isIframe||ApplePaySession.canMakePayments())}catch(e){n(!1)}}}}]),angular.module("frApp").directive("slideit",["$timeout",function(e){return{restrict:"A",scope:{onRefresh:"=click",onDestroy:"=destrsl"},link:function(e,t,n){new Swiper(t,{direction:"horizontal",slidesPerView:1,observer:!0,observeParents:!0,navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"}})}}}]),angular.module("frApp").directive("googlePay",["$window","$rootScope","paymentSvs",function(e,c,u){return{restrict:"E",templateUrl:"/js/app/common/checkout/templates/payment-types/google-pay.html",link:function(n){let o="js-stripeConnect-gpay-error",a="payment-request-button-gpay",i=Stripe(n.paymentInfo.googlePayModel.apiKey);function r(e){document.getElementById(o).style.display="block",document.getElementById(o).textContent=e}function s(e){i.confirmCardPayment(n.paymentInfo.googlePayModel.clientKey,{payment_method:e.paymentMethod.id},{handleActions:!1}).then(function(t){document.getElementById(o).style.display="none",document.getElementById(o).textContent="",t.error?(r(t.error.message),e.complete("fail")):(e.complete("success"),"requires_action"===t.paymentIntent.status?i.confirmCardPayment(n.paymentInfo.googlePayModel.clientKey).then(function(e){e.error?r(t.error.message):n.paymentSuccess()}):n.paymentSuccess())})}{var e=i.paymentRequest({country:n.paymentInfo.googlePayModel.countryCode,currency:n.paymentInfo.googlePayModel.currencyCode,total:{label:n.paymentInfo.googlePayModel.total.label,amount:n.paymentInfo.googlePayModel.total.amountInCents}
1,requestPayerName:n.paymentInfo.googlePayModel.collectPayersName,requestPayerEmail:n.paymentInfo.googlePayModel.collectPayersEmail,disableWallets:["applePay"]});e.canMakePayment().then(function(e){e?(c.$broadcast("origin-asking-to-show-payment-tab",!0,"stripe-google-pay"),t.mount("#"+a)):(c.$broadcast("origin-asking-to-show-payment-tab",!1,"stripe-google-pay"),document.getElementById(a).style.display="none",r("Browser does not support GooglePay"))});let t=i.elements().create("paymentRequestButton",{paymentRequest:e});e.on("paymentmethod",function(t){u.createGPayPaymentIntent(n.paymentInfo.googlePayModel.donationKey).then(function(e){e.success?(n.paymentInfo.googlePayModel.clientKey=e.clientKey,e.isSinglePayment?s(t):u.attachPaymentMethod(n.paymentInfo.googlePayModel.donationKey,t.paymentMethod.id).then(function(e){e.success?s(t):(t.complete("fail"),r(e.error))}).catch(function(){t.complete("fail"),r(data.error)})):(t.complete("fail"),r(e.error))}).catch(function(){t.complete("fail"),r(payIntentData.error)})})}}}}]),angular.module("frApp").directive("newCard",[function(){return{restrict:"E",transclude:!0,templateUrl:"/js/app/common/checkout/templates/payment-types/new-card.html",link:function(){}}}]),angular.module("frApp").directive("payPal",function(){return{restrict:"E",templateUrl:"/js/app/common/checkout/templates/payment-types/pay-pal.html"}}),angular.module("frApp").directive("reviewAddress",[function(){var a=1;return{restrict:"E",transclude:!0,templateUrl:"/js/app/common/checkout/templates/payment-types/review-address.html",link:function(e,t,n){var o="address-field-"+a++;t.find("input").attr("id",o),t.find("label").attr("for",o)}}}]),angular.module("frApp").directive("secureTrading",["$timeout","$window","$rootScope",function(o,e,t){return{restrict:"E",transclude:!0,templateUrl:"/js/app/common/checkout/templates/payment-types/secure-trading.html",link:function(n){!function e(){var t;n.Initing?o(e,100):n.paymentInfo.cardPaymentSystem==n.paymentSystem.SecureTrading&&((t=document.createElement("script")).onload=function(){var e=(t=getComputedStyle(document.body)).getPropertyValue("--body-text-color")||"grey",t=t.getPropertyValue("--error-color")||"#e85858";(t=SecureTrading({jwt:n.paymentInfo.sTjwtCode,livestatus:n.paymentInfo.jsLiveStatus,panIcon:!0,submitOnSuccess:!1,translations:{Pay:n.getPayBtnText(),Processing:"Processing"},styles:{"font-size-body":"10px","line-height-body":1.5,"color-input":e,"border-color-input":"#adacac","color-error":t,"border-radius-input":"4px","background-color-input":"#fff","border-size-input":"1px","font-size-input":"16px","line-height-input":"22px","space-inset-input":"17px 15px 15px","space-outset-input":0,"outline-input":"none","color-label":e,"font-size-label":"16px","font-size-message":"14px","background-color-input-error":"#fff","position-top-icon":"14px"}})).on("paymentCompleted",e=>{n.processSecureTradingPayment()}),t.on("paymentFailed",e=>{n.logPaymentError("paymentFailed",e)}),t.on("paymentCanceled",e=>{n.logPaymentError("paymentCanceled",e)}),t.Components()},t.src="https://cdn.eu.trustpayments.com/js/latest/st.js",document.getElementsByTagName("head")[0].appendChild(t))}()}}}]),angular.module("frApp").directive("stripeApplePay",["$window","$rootScope",function(e,o){return{restrict:"E",transclude:!0,templateUrl:"/js/app/common/checkout/templates/payment-types/stripe-apple-pay.html",link:function(t){function n(e){o.$broadcast("origin-asking-to-show-payment-tab",e,"stripe-apple-pay"),t.paymentInfo.applePayCanBeUsed=e}try{e.ApplePaySession&&t.paymentInfo.stripeApplePayAvailable&&n(window.isIframe||ApplePaySession.canMakePayments())}catch(e){n(!1)}}}}]),angular.module("frApp").directive("stripeBacsDebit",function(){return{restrict:"E",templateUrl:"/js/app/common/checkout/templates/payment-types/stripe-bacs-debit.html"}}),angular.module("frApp").directive("stripe",["$timeout","$rootScope",function(a,i){return{restrict:"E",transclude:!0,templateUrl:"/js/app/common/checkout/templates/payment-types/stripe.html",link:function(n){function o(){var e,t;n.Initing?a(o,100):n.isStripe&&(e=n.stripe.elements(),t={base:{color:n.paymentInfo.bodyTextColour,lineHeight:"20px",fontFamily:'"cera", Arial, Helvetica, sans-serif',fontSmoothing:"antialiased",height:"20px",fontSize:"16px","::placeholder":{color:"#aab7c4"}},invalid:{color:"#32325d"}},n.card=e.create("cardNumber",{style:t}),n.card.mount("#card-element"),n.card.addEventListener("change",function(e){var t=document.getElementById("card-errors");e.error?t.textContent=e.error.message:t.textContent="",n.setSecurityCodeText(e.brand)},!1),n.cardExpiry=e.create("cardExpiry",{style:t}),n.cardExpiry.mount("#cardExpiry-element"),n.cardExpiry.addEventListener("change",function(e){var t=document.getElementById("cardExpiry-errors");e.error?t.textContent=e.error.message:t.textContent=""},!1),n.cardCvc=e.create("cardCvc",{style:t}),n.cardCvc.mount("#cardCvc-element"),n.cardCvc.addEventListener("change",function(e){var t=document.getElementById("cardCvc-errors");e.error?t.textContent=e.error.message:t.textContent=""}
1,!1),i.$broadcast("stripe-info",{stripe:n.stripe,card:n.card}))}let t=document.getElementById("secureCode-description");n.brandAmex=!1;n.setSecurityCodeText=function(e){"amex"===e?n.brandAmex||(t.textContent="The four digit code displayed on the front of your card above the 16 digit card number.",n.brandAmex=!0):n.brandAmex&&(t.textContent="The last three digits shown on the back of your credit card.",n.brandAmex=!1)},a(o)}}}]),angular.module("frApp").directive("stripeSepaDebit",["$timeout","$rootScope",function(a,i){return{restrict:"E",transclude:!0,templateUrl:"/js/app/common/checkout/templates/payment-types/stripe-sepa-debit.html",link:function(n){function o(){var e,t;n.Initing?a(o,100):n.isStripe&&(e={style:{base:{color:n.paymentInfo.bodyTextColour,lineHeight:"20px",fontFamily:'"cera", Arial, Helvetica, sans-serif',fontSmoothing:"antialiased",height:"20px",fontSize:"16px","::placeholder":{color:"#aab7c4"}},invalid:{color:"#32325d"}},supportedCountries:["SEPA"]},t=n.stripe.elements(),n.iban=t.create("iban",e),n.iban.mount("#stripe-sepa-element"),n.iban.on("change",function(e){e.error?i.$broadcast("stripe-sepa-iban-change",{errorMessage:e.error.message}):i.$broadcast("stripe-sepa-iban-change",{errorMessage:""})}),i.$broadcast("stripe-sepa-info",{iban:n.iban}))}a(o)}}}]),angular.module("frApp").directive("uiSelectOpenOnFocus",["$timeout",function(i){return{require:"uiSelect",restrict:"A",link:function(e,t,n,o){var a=!0;angular.element(o.focusser).on("focus",function(){a&&o.activate()}),e.$on("uis:activate",function(){a=!1}),e.$on("uis:close",function(){a=!1,i(function(){a=!0},250)})}}}]),angular.module("frApp").directive("googleplace",function(){return{require:"ngModel",link:function(t,o,e,n){let a=t.data.address.country;var i={types:["geocode"],componentRestrictions:{country:a=void 0===a?"GB":a}};let r=new google.maps.places.Autocomplete(o[0],i),s=null,c=!1;o[0].addEventListener("input",function(e){c||(e.stopImmediatePropagation(),clearTimeout(s),o[0].value.length<3)||(s=setTimeout(function(){c=!0,o[0].dispatchEvent(new Event("input",{bubbles:!0})),c=!1,window.appInsights&&window.appInsights.trackEvent({name:"GooglePlacesPredictionRequested",properties:{host:window.location.hostname,page:window.location.pathname}})},500))},!0);i=e.gpUpdate;let u=i&&"function"==typeof t[i]?t[i]:null;i=e.gpCountry;let l="";i&&t.$watch(i,function(e){e&&l!==e&&"string"==typeof e&&(r.setComponentRestrictions({country:e}),l=e)}),google.maps.event.addListener(r,"place_changed",function(){var e;u&&(e=r.getPlace(),u(e)),t.$apply(function(){n.$setViewValue(o.val())}),window.appInsights&&window.appInsights.trackEvent({name:"GooglePlacesSelected",properties:{host:window.location.hostname,page:window.location.pathname}})});{var d=o[0];let n=d.addEventListener||d.attachEvent;function p(e,t){if("keydown"===e){let n=t;t=function(e){var t=0<$(".pac-item-selected").length;13===e.which&&t&&e.preventDefault(),n.apply(d,[e])}}n.apply(d,[e,t])}d.addEventListener?d.addEventListener=p:d.attachEvent&&(d.attachEvent=p)}}}}),angular.module("frApp").directive("showPassword",function(){return function(e,t,n){e.$watch(n.showPassword,function(e){e?t.attr("type","text"):t.attr("type","password")})}}),angular.module("frApp").directive("compile",["$compile",function(a){return function(t,n,o){t.$watch(function(e){return e.$eval(o.compile)},function(e){n.html((e=void 0===e?"":e)+" "+n.html()),a(n.contents())(t)})}}]),angular.module("frApp").factory("oAuthService",["$window","$http",function(e,t){return{useCookie:function(e){e&&(document.cookie="popup-transfer-data=; Path=/; Domain="+location.host+"; Expires=Thu, 01 Jan 1970 00:00:01 GMT; SameSite=None; Secure",e=JSON.parse(decodeURIComponent(e)))&&window[e.callbackFunc](JSON.parse(e.data))},getCookie:function(){if(document.cookie){var e=document.cookie.split(";").find(e=>e.startsWith(" popup-transfer-data"));if(e){e=e.split("=");if(e)return e[1]}}return null},signInFB:function(e){e={SocialMedia:1,RequestOriginUrl:window.location.href,CompanyId:e};t.post("/oauth-facebook-login",e).then(function(e){e.data.success&&(window.location=e.data.url)})},signUpFB:function(e){e={SocialMedia:1,RequestOriginUrl:window.location.href,CompanyId:e};t.post("/oauth-facebook-signup",e).then(function(e){e.data.success&&(window.location=e.data.url)})},processOAuth:function(){var e=this.getCookie();e&&this.useCookie(e)}}}]),angular.module("frApp").factory("focus",["$timeout","$window",function(e,t){return function(n){t.isMobile||e(function(){var t=$(n).trigger("focus");if(t.is("input"))try{var e=2*(t.val()||"").length;t[0].setSelectionRange(e,e)}catch(e){t.val(t.val())}},150)}}]),angular.module("frApp").factory("validation",[function(){return{testEmailRegEx:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,testEmailLenRegEx:/^.{1,64}@.{5,67}$/,ukPostcodeRegEx:/^(([A-Za-z]{1,2}[0-9]{1,2})|([A-Za-z]{1,2}[0-9][A-Za-z]))[0-9][A-Za-z]{2}$/i,caPostcodeRegEx:/^([a-zA-Z][0-9][a-zA-Z] [0-9][a-zA-Z][0-9])|([a-zA-Z][0-9][a-zA-Z][0-9][a-zA-Z][0-9])$/,usPostcodeRegEx:/^[0-9]{5}$/,userNameNotAllowedCharsRegEx:/[\d@#$%^&*()_+=\[\]{}|\\:;\"",<>?\/~`!\x00-\x1F\x7F-\x9F]/,titleRegEx:/^([A-Za-z0-9 .'()\-/]+)?$/,isPostcodeNotEmptyOrAllowed:function(e,t){switch(e){case"CA":case"GB":case"US":return!this.isEmpty(t);default:return!0}},validatePostcode:function(e,t){switch(e){case"CA":return this.caPostcodeRegEx.test(t);case"GB":return this.ukPostcodeRegEx.test(t.replace(/\s/g,""));case"US":return this.usPostcodeRegEx.test(t);default:return!0}},getPostCodeLabel:function(e){return"US"===e?"Zip Code":"IE"===e?"Eircode":"Postcode"},floatNumberFilter:function(e){return(e+"").replace(/[^\d\.]/g,"").replace(/\./,"x").replace(/\./g,"").replace(/x/,".").replace(/^0+/,"0").replace(/^(0*)([1-9]{1,})/g,"$2").replace(/(\d*\.\d{2})(\d+)/g,"$1")},numberFilter:function(e){return(e+"").replace(/[^\d]/g,"")},sortCodeFilter:function(e){return(e+"").replace(/[^\d-]/g,"")},isDecimal:function(e){return!isNaN(e)&&/^\d*(\.\d{1,2})?$/.test(e)},validateEmail:function(e){return e&&e.match(this.testEmailRegEx
1)&&e.match(this.testEmailLenRegEx)},isEmpty:function(e){return(e||"").match(/^[\s\t]*$/)},validatePassword:function(e){return 8<=e.length&&e.length<=25&&/[\d]+/gi.test(e)&&/[a-z]+/g.test(e)&&/[A-Z]+/g.test(e)&&/[^a-zA-Z\d]+/gi.test(e)},validateUserName:function(e){var t,n;return!(this.isEmpty(e)||(e=e.trim(),this.userNameNotAllowedCharsRegEx.test(e))||(t=e.charAt(0),e=e.charAt(e.length-1),(n=/[\s.\-']/).test(t))||n.test(e))},validateTitle:function(e){return!!this.isEmpty(e)||this.titleRegEx.test(e)}}}]),angular.module("frApp").factory("reCaptcha",["$window",function(t){return{grecaptchaObj:null,callback:null,isInited:!1,reCaptchaReset:function(){grecaptcha.reset(this.grecaptchaObj)},reCaptchaSubmit:function(e){this.reCaptchaReset(),this.callback(e)},initReCaptcha:function(){t.isReCaptchaReady?this.grecaptchaObj=grecaptcha.render("g-recaptcha",{sitekey:t.googleSiteKey,size:"invisible",isolated:!0,callback:this._reCaptchaSubmitCallback,"expired-callback":this._reCaptchaResetCallback}):setTimeout(this._initCallback,200)},init:function(){this.isInited||(this.isInited=!0,this._reCaptchaResetCallback=this.reCaptchaReset.bind(this),this._reCaptchaSubmitCallback=this.reCaptchaSubmit.bind(this),this._initCallback=this.initReCaptcha.bind(this),t.isReCaptchaEnabled&&!this.grecaptchaObj&&this.initReCaptcha())},proceed:function(e){this.callback=e,t.isReCaptchaEnabled&&t.isReCaptchaReady&&this.grecaptchaObj?grecaptcha.execute(this.grecaptchaObj):this.callback()}}}]),angular.module("frApp").factory("addressService",["$window","validation",function(i,r){let e;return{clearAddressErrors:function(e){e.HouseName="",e.Address1="",e.Address2="",e.Town="",e.Postcode="",e.UsState=""},emptyAddress:function(e){e.houseName="",e.address1="",e.address2="",e.town="",e.postcode="",e.usState=""},parseGoogleAddress:function(e,t){var n,o={houseName:"",address1:"",address2:"",town:"",postcode:"",usState:"",country:e};for(n in t.address_components){var a=t.address_components[n];a.types.length&&("street_number"===a.types[0]&&(o.houseName=a.long_name),"route"===a.types[0]&&(o.address1=a.long_name),"administrative_area_level_2"===a.types[0]&&(o.address2=a.long_name),"sublocality_level_1"!==a.types[0]&&"postal_town"!==a.types[0]&&"locality"!==a.types[0]||(o.town=a.long_name),"US"===o.country&&"administrative_area_level_1"===a.types[0]&&(o.usState=a.short_name),"postal_code"===a.types[0])&&(o.postcode=a.short_name)}return o},getAddressLine:function(e){var t;return e?(t=[],e.houseName&&t.push(e.houseName),e.address1&&t.push(e.address1),e.address2&&t.push(e.address2),e.town&&t.push(e.town),"US"===e.country&&e.usState&&t.push(e.usState),e.postcode&&t.push(e.postcode),t.push(e.country),t.join(", ")):""},getFormattedAddressLine:function(e){var t,n;return e?(t=[],n=e.postcode?e.postcode+" ":"",e.houseName&&t.push(e.houseName),(e.address1||e.address2)&&t.push((e.address1+" "+e.address2).trim()),e.town&&t.push(e.town),"US"===e.country&&e.usState&&t.push(e.usState),t.push(e.country),n+t.join(", ")):""},initPafData:function(o){e?e.attach({search:"js-paf-addr-input"},{onResultSelected:function(e,t,n){o&&o(n)}}):e=new clickToAddress({accessToken:i.pafas,dom:{search:"js-paf-addr-input"},domMode:"class",gfxMode:1,defaultCountry:"gbr",getIpLocation:!1,countrySelector:!1,countryMatchWith:"iso_2",placeholders:!0,showLogo:!1,historyTools:!1,texts:{default_placeholder:"Start typing your address"},onResultSelected:function(e,t,n){o&&o(n)},onError:function(e,t){console.log(t)}})},setPAFAddress:function(e,t){this.emptyAddress(e),this.setUndefinedToEmptyString(t);this.emptyAddress(e),t.sub_building_name?e.houseName=t.sub_building_name:t.building_name?e.houseName=t.building_name:t.building_number&&(e.houseName=t.building_number),t.company_name&&(e.houseName?(n=t.company_name+", "+e.houseName).length<=50?e.houseName=n:(n=e.houseName.length+2,e.houseName=t.company_name.substring(0,50-n)+", "+e.houseName):e.houseName=t.company_name.length<=50?t.company_name:t.company_name.substring(0,50));var n=(t.street_prefix+" "+t.street_name+" "+t.street_suffix).trim(),o=(n?e.address1=n:(a=t.post_office_box_number?" PO Box "+t.post_office_box_number+" ":"",o=t.building_name&&(t.building_number||a)?t.building_name+", ":t.building_number,e.address1=(o+t.building_number+a).trim()),(t.dependent_street_prefix+" "+t.dependent_street_name+" "+t.dependent_street_suffix
1).trim()),a=n&&o?o+", "+n:o+n;return e.address1||(e.address1=a&&t.dependent_locality?a+", "+t.dependent_locality:a+t.dependent_locality),e.address2||(t.line_2?e.address2=t.line_2:t.province_name?e.address2=t.province_name:e.address2=a&&t.dependent_locality?a+", "+t.dependent_locality:a+t.dependent_locality),e.town=t.locality,e.country=t.country.iso_3166_1_alpha_2,e.postcode=t.postal_code.toUpperCase(),e},validateAddress:function(e,t){var n,o={},a=" is required.";for(n in o.HouseName=r.isEmpty(e.houseName)?"Your house number"+a:"",o.Address1=r.isEmpty(e.address1)?"Your address"+a:"",o.Town=r.isEmpty(e.town)?"Your town"+a:"",o.Country=r.isEmpty(e.country)?"Your country"+a:"",o.Postcode="",r.isPostcodeNotEmptyOrAllowed(e.country,e.postcode)?o.Postcode=r.validatePostcode(e.country,e.postcode)?"":"Please enter a valid "+r.getPostCodeLabel(e.country).toLowerCase()+".":o.Postcode="Your "+r.getPostCodeLabel(e.country).toLowerCase()+a,"US"===e.country?r.isEmpty(e.usState)?o.UsState="State "+a:(e=>{var t,n=new RegExp("^"+e.trim().toLowerCase()+"$","i");for(t in i.usStates)if(i.usStates[t].name.match(n)||i.usStates[t].code.match(n))return!0;return!1})(e.usState)?o.UsState="":o.UsState="Please enter a valid state.":o.UsState="",angular.extend(t,o),o)if(o[n])return!1;return!0},changeCallingPrefix:function(e){switch(e){case"AU":return"+66";case"CA":return"+1";case"IE":return"+353";case"GB":return"+44";case"US":return"+1";default:return""}},setUndefinedToEmptyString:function(e){e.building_name=e.building_name||"",e.building_number=e.building_number||"",e.street_prefix=e.street_prefix||"",e.street_name=e.street_name||"",e.street_suffix=e.street_suffix||"",e.dependent_street_prefix=e.dependent_street_prefix||"",e.dependent_street_name=e.dependent_street_name||"",e.dependent_street_suffix=e.dependent_street_suffix||"",e.dependent_locality=e.dependent_locality||"",e.locality=e.locality||"",e.country.iso_3166_1_alpha_2=e.country.iso_3166_1_alpha_2||"",e.postal_code=e.postal_code||""}}}]),Date.prototype.addHours=function(e){return this.setTime(this.getTime()+60*e*60*1e3),this},angular.module("frApp").factory("windowpopup",["$window",function(h){return function(e,t,n,o,a,i){var r,s,c={toolbar:"no",location:"no",directories:"no",status:"no",menubar:"no",scrollbars:"yes",resizable:"yes",copyhistory:"no"},n=(n&&o&&(r=screen.width/2-n/2,s=screen.height/2-o/2,c.width=n,c.height=o,c.top=s,c.left=r),$.map(c,function(e,t){return t+"="+e}).join(", ")),u=h.open(e,t,n),l=0<window.navigator.userAgent.indexOf("MSIE ")||0<window.navigator.userAgent.indexOf("Trident/")||0<window.navigator.userAgent.indexOf("Edge/"),d=i&&"function"==typeof i,p="popup-transfer-data",m=setInterval(function(){var e;l?a?f(p)&&(e=JSON.parse(atob(f(p))),new Date(e.time).getTime()>(new Date).addHours(-.5).getTime()?(window[e.callbackFunc](e.data),d&&i()):clearInterval(m),clearInterval(m),document.cookie=p+"=; path=/; domain="+window.location.host+"; expires="+new Date(-1)):clearInterval(m):d?u.closed&&(clearInterval(m),i()):clearInterval(m)},1e3);function f(e){e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0}return u}}]),angular.module("frApp").component("tipping",{templateUrl:"/js/app/common/components/tipping/tipping.html",bindings:{tipsModel:"<",tipsWraperAllowed:"<",changeEvent:"<",isAvailableForStep:"<"},controller:"TippingComponentCtrl"}),angular.module("frApp").controller("TippingComponentCtrl",["$scope","validation","moneyFilter",function(o,e,a){function t(){o.setDefaultTip(),o.onChangeTips()}o.componentInited=!1,Number.prototype.between=function(e,t){return!(!e&&!t)&&(!e||e<=this)&&(!t||this<=t)},o.recalculateTotalToPay=function(){var e=parseFloat(o.$ctrl.tipsModel.toStore.tipsAmount),e=isNaN(e)?0:e;o.totalToPay=o.$ctrl.tipsModel.checkoutDataValues.donationAmount+e},o.getTipsStr=function(e){var t=o.$ctrl.tipsModel.checkoutDataValues.donationAmount;switch(e.type){case-1:return"Other";case 0:return o.$ctrl.tipsModel.tipsCheckoutSetting.giftZeroPercentCustomTitle;default:return o.formatTipsSelectItem(t,e.percentage)}},o.formatTipsSelectItem=function(e,t){let n=t+"%";return e&&0<e&&(n+=" ("+o.$ctrl.tipsModel.checkoutDataValues.currency+a(o.calculate(e,t))+")"),n},o.calculate=function(e,t){return Math.round(e*t)/100},o.onChangeCustomTipAmount=function(){o.$ctrl.tipsModel.toStore.tipsAmount=e.floatNumberFilter(o.$ctrl.tipsModel.toStore.tipsAmount),o.recalculateTotalToPay()},o.getDefaultOtherAmount=function(){var e,t=o.$ctrl.tipsModel.checkoutDataValues.donationAmount;let n;for(e of o.$ctrl.tipsModel.tipsCheckoutSetting.tipTypes)if(-1===e.type&&(n=e),e.range&&t.between(e.range.from,e.range.to))return e.range.defaultOtherAmount;return n?.range.defaultOtherAmount},o.onChangeTips=function(){var e;-1===o.$ctrl.tipsModel.toStore.tipsType?(o.$ctrl.tipsModel.toStore.tipsAmount=o.getDefaultOtherAmount(),focus(".js-tips-custom-amount")):(e=o.getPercentageFromTipType(o.$ctrl.tipsModel.toStore.tipsType),o.$ctrl.tipsModel.toStore.tipsAmount=o.calculate(o.$ctrl.tipsModel.checkoutDataValues.donationAmount,e)),o.recalculateTotalToPay()},o.getPercentageFromTipType=function(t){return o.$ctrl.tipsModel.tipsCheckoutSetting.tipTypes.find(function(e){return e.type==t}).percentage},o.$watch(function(){return o.$ctrl.tipsWraperAllowed},function(){if(o.$ctrl.tipsWraperAllowed){o.$ctrl.tipsModel.tipsCheckoutSetting.tipsDescriptionText=o.$ctrl.tipsModel.tipsCheckoutSetting.tipsDescriptionText.replace("{CharityName}",o.$ctrl.tipsModel.checkoutDataValues.charityName),o.$ctrl.tipsModel.tipsCheckoutSetting.tipsHeaderText=o.$ctrl.tipsModel.tipsCheckoutSetting.tipsHeaderText.replace("{CharityName}",o.$ctrl.tipsModel.checkoutDataValues.charityName),o.$ctrl.tipsModel.tipsCheckoutSetting.tipsTooltipText=o.$ctrl.tipsModel.tipsCheckoutSetting.tipsTooltipText.replace("{CharityName}",o.$ctrl.tipsModel.checkoutDataValues.charityName),o.$ctrl.tipsModel.tipsCheckoutSetting.otherAmountLabel=o.$ctrl.tipsModel.tipsCheckoutSetting.otherAmountLabel.replace("{CharityName}",o.$ctrl.tipsModel.checkoutDataValues.charityName);{let e="{CompanyName}",t="";o.$ctrl.tipsModel.checkoutDataValues.companyName&&(t=o.$ctrl.tipsModel.checkoutDataValues.companyName),o.$ctrl.tipsModel.tipsCheckoutSetting.tipsDescriptionText=o.$ctrl.tipsModel.tipsCheckoutSetting.tipsDescriptionText.replace(e,t).replace(" "," "),o.$ctrl.tipsModel.tipsCheckoutSetting.tipsHeaderText=o.$ctrl.tipsModel.tipsCheckoutSetting.tipsHeaderText.replace(e,t).replace(" "," "),o.$ctrl.tipsModel.tipsCheckoutSetting.tipsTooltipText=o.$ctrl.tipsModel.tipsCheckoutSetting.tipsTooltipText.replace(e,t).replace(" "," "),o.$ctrl.tipsModel.tipsCheckoutSetting.otherAmountLabel=o.$ctrl.tipsModel.tipsCheckoutSetting.otherAmountLabel.replace(e,t).replace(" "," ")}t(),o.componentInited=!0}}
1),o.$watch(function(){return o.$ctrl.changeEvent},function(){void 0!==o.$ctrl.changeEvent&&t()}),o.$watch(function(){return o.$ctrl?.tipsModel},function(){void 0!==o.$ctrl.tipsModel&&o.runCustomTipsCode()}),o.setDefaultTip=function(){if(o.$ctrl.tipsModel.toStore.tipsType=o.$ctrl.tipsModel.tipsCheckoutSetting.defaultTipsType,o.$ctrl.tipsModel.tipsCheckoutSetting.setDefaultTipsBasedOnDonationAmount){var e,t=o.$ctrl.tipsModel.checkoutDataValues.donationAmount;for(e of o.$ctrl.tipsModel.tipsCheckoutSetting.tipTypes)if(e.range&&t.between(e.range.from,e.range.to))return void(o.$ctrl.tipsModel.toStore.tipsType=e.type)}},o.runCustomTipsCode=function(){try{window.tipsModel=o.$ctrl.tipsModel.tipsCheckoutSetting}catch{}var e;o.$ctrl.isAvailableForStep&&o.$ctrl.tipsModel.tipsCheckoutSetting.applyCustomJavaScript&&o.$ctrl.tipsModel.tipsCheckoutSetting.customJavaScriptCode&&((e=document.createElement("script")).innerHTML=o.$ctrl.tipsModel.tipsCheckoutSetting.customJavaScriptCode,document.getElementById("custom-tips-js-code-holder").appendChild(e))}}]),angular.module("frApp").component("selectTipping",{template:'<tipping change-event="changeEvent" tips-wraper-allowed="tipsWraperAllowed" tips-model="$ctrl.tipsModel" is-available-for-step="$ctrl.isAvailableForStep"></tipping>',bindings:{tipsModel:"<",tipsInited:"<",isAvailableForStep:"<"},controller:["$scope",function(t){t.tipsWraperAllowed=!1;let n=0,o=0;function a(e){!t.$ctrl.tipsInited&&0<e?o=e:t.$ctrl.tipsInited&&(n!=e||0<e&&0==n)&&(t.$ctrl.tipsModel.checkoutDataValues.donationAmount=n=e,t.tipsWraperAllowed=!0,t.changeEvent=!t.changeEvent)}t.$watch(function(){return t.$ctrl.tipsInited},function(){var e;t.$ctrl.tipsInited&&(e=o||n||t.$ctrl.tipsModel.checkoutDataValues.donationAmount,o=o&&0,a(e))}),t.$on("selected-item-changed",function(e,t){a(+(t&&t.amount?t.amount:0))})}]}),angular.module("frApp").component("confirmTipping",{template:'<tipping change-event="changeEvent" tips-wraper-allowed="$ctrl.tipsInited" tips-model="$ctrl.tipsModel"></tipping>',bindings:{tipsModel:"<",tipsInited:"<"}}),angular.module("frApp").component("donorPaysFees",{templateUrl:"/js/app/common/components/donor-pays-fees/donor-pays-fees.html",bindings:{coverFeeModel:"<",giftAid:"<",inProcess:"<",initing:"<"},controller:"DonorPaysFeesComponentCtrl"}),angular.module("frApp").controller("DonorPaysFeesComponentCtrl",["$scope","$rootScope","scroll","$window",function(o,e,n,t){function a(){return o.$ctrl.coverFeeModel&&o.$ctrl.coverFeeModel.coverFeeAvailable&&!o.$ctrl.initing}function i(e){let t=e.replace("{CharityName}",o.$ctrl.coverFeeModel.checkoutDataValues.charityName);var e="{CompanyName}",n="";return o.$ctrl.coverFeeModel.checkoutDataValues.companyName?n=o.$ctrl.coverFeeModel.checkoutDataValues.companyName:t.includes(e+" ")?e+=" ":t.includes(" "+e)&&(e=" "+e),(t=t.replace(e,n)).replace("{FeeSum}",o.$ctrl.coverFeeModel.checkoutDataValues.currency+"{{feeAmount | cnumber}}")}o.coverFee=void 0,o.coverFeeError=!1,o.$watch(function(){return o.$ctrl.giftAid},function(){a()&&o.giftAidChanged(o.$ctrl.giftAid)}),o.$watch(function(){return o.$ctrl.initing},function(){a()&&(o.giftAidChanged(o.$ctrl.giftAid),o.text=i(o.$ctrl.coverFeeModel.payFeeCheckoutSetting.customDonorPayFeesText),o.yesText=i(o.$ctrl.coverFeeModel.payFeeCheckoutSetting.yesOptionText),o.noText=i(o.$ctrl.coverFeeModel.payFeeCheckoutSetting.noOptionText),o.$ctrl.coverFeeModel.payFeeCheckoutSetting.showYesNoOption||(o.coverFee=o.$ctrl.coverFeeModel.payFeeCheckoutSetting.defaultCheckBoxState,o.onFeeChanged()))}),o.onFeeChanged=function(){o.coverFeeError=void 0===o.coverFee,e.$broadcast("on-cover-fee-changed",{value:o.coverFee})},o.$on("dont-see-fee-status-on-continue",function(e,t){void 0===o.coverFee?(o.coverFeeError=!0,n(".js-cover-fee-error")):o.onFeeChanged()}),o.giftAidChanged=function(e){o.feeAmount=e?o.$ctrl.coverFeeModel.checkoutDataValues.estimatedFeeIncludedGiftAid:o.$ctrl.coverFeeModel.checkoutDataValues.estimatedFee}}]),angular.module("frApp").component("tooltip",{templateUrl:"/js/app/common/components/tooltip/tooltip.html",bindings:{message:"<",messageContainer:"@"}});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.