1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="90db3520-e7ab-432f-a84e-1e042950b9b0",e._sentryDebugIdIdentifier="sentry-dbid-90db3520-e7ab-432f-a84e-1e042950b9b0")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2671],{464:(e,t,r)=>{"use strict";r.d(t,{H9:()=>i,ae:()=>n,y2:()=>a});let n=e=>e?new Date(e).toLocaleDateString("en-GB",{weekday:"long",day:"2-digit",month:"long",year:"numeric"}):null,a=e=>{if(!e)return null;let t=new Date(e),r=t.getUTCHours(),n=t.getUTCMinutes().toString().padStart(2,"0");return"".concat(r%12||12,".").concat(n).concat(r>=12?"pm":"am")},i=e=>{if(!e)return null;let t=new Date(e),r=t.getDate(),n=t.toLocaleDateString("en-GB",{month:"long"}),a=t.getFullYear();return"".concat(r," ").concat(n," ").concat(a)}},8301:(e,t,r)=>{"use strict";r.d(t,{w:()=>i});var n=r(12115);let a=e=>{let t=window.matchMedia("(prefers-reduced-motion: reduce)").matches;e.focus({preventScroll:!0}),e.scrollIntoView({behavior:t?"auto":"smooth",block:"center"})},i=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=(0,n.useCallback)(()=>{var r;let n=Object.keys(e)[0];if(!n)return;let i=null!=(r=document.getElementById(n))?r:document.querySelector('[name="'.concat(n,'"]'));if("Postcode"===n)return void setTimeout(()=>{let e=document.getElementById("PostcodeSearch");e&&a(e)},0);if("SelectAddressDropdown"===n)return void setTimeout(()=>{let e=document.getElementById("SelectAddressDropdown");e&&a(e)},0);if(t(n),!i)return;if(i.id.includes("manualAddress")){let e=i.id.replace("manualAddress",""),t=document.getElementById("".concat(e,"FindAddressButton")),r=document.getElementById("".concat(e,"SelectAddressDropdown"));return t?void a(t):void a(r)}let l=i;if("FIELDSET"===i.tagName){let e=i.querySelector('input[type="radio"][name="'.concat(n,'"]'));if(e)l=e;else{let e=i.querySelector("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])");e&&(l=e)}}"hidden"===i.getAttribute("type")&&(l=document.querySelectorAll(".field-validation-error")[0]),a(l)},[e,t]);return(0,n.useEffect)(()=>{Object.keys(e).length>0&&!r&&i()},[e,r,i]),{focusFirstError:i}}},36356:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(95155);r(12115);var a=r(54577),i=r.n(a),l=r(42658);let o=r.n(l)().bind(i()),s=e=>{let{ref:t,cols:r,rows:a,maxLength:i,minLength:l,readOnly:s,visible:d=!0,...u}=e;return d&&(0,n.jsxs)("div",{className:o("c-textarea"),children:[u.label&&(0,n.jsxs)("label",{htmlFor:u.id,className:u.disabled?" disabled":"",children:[u.label,u.required&&(0,n.jsx)("span",{className:"required-indicator",children:"*"})]}),u.helptext&&(0,n.jsx)("p",{className:"helptext",id:"helptext-".concat(u.id),children:u.helptext}),(0,n.jsx)("textarea",{ref:t,className:u.error?"error":u.classname,id:u.id,name:u.name,value:u.value,required:u.required,disabled:u.disabled,cols:r,rows:a,maxLength:i,minLength:l,readOnly:s,"aria-invalid":!!u.error,"aria-describedby":(u.error?"errorId".concat(u.name):"")+(u.helptext?" helptext-".concat(u.id):""),onChange:u.onChange,onBlur:u.onBlur}),u.error&&(0,n.jsx)("p",{className:"field-validation-error",id:"errorId".concat(u.name),children:u.error.message?u.error.message:"".concat(u.label," is required")})]})}},54577:e=>{e.exports={"c-textarea":"Textarea_c-textarea__Sdoup"}},70081:e=>{e.exports={"c-discount-code":"DiscountCode_c-discount-code__TwIe6","c-discount-code__input-group":"DiscountCode_c-discount-code__input-group__TaQ5l","c-discount-code__input":"DiscountCode_c-discount-code__input__YAmRZ","c-discount-code__applied":"DiscountCode_c-discount-code__applied__8aWQA","c-discount-code__remove":"DiscountCode_c-discount-code__remove__ctMa_"}},92671:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>es});var n=r(95155),a=r(12115),i=r(22544),l=r(13611),o=r(91550),s=r(21680),d=r(80165),u=r(20063),c=r(5336),m=r(60756),p=r(76326),g=r(74408),h=r(58474);let v=e=>{var t;let{updateData:r,getData:l,FORMID:o,getValues:s,eventStatus:d,privacyText:u}=e,{register:c,setValue:v,watch:f,formState:{errors:y}}=(0,i.xW)(),b={register:c,setValue:v,errors:y,updateData:r,getData:l},S=[{id:"EmailOptIn",name:"EmailOptIn",value:"EmailOptIn",label:(0,h.lu)("EmailOptIn")},{id:"TelephoneOptIn",name:"TelephoneOptIn",value:"TelephoneOptIn",label:(0,h.lu)("TelephoneOptIn")},{id:"SMSOptIn",name:"SMSOptIn",value:"SMSOptIn",label:(0,h.lu)("SMSOptIn")}],x=(0,a.useMemo)(()=>[{id:"TypeOfPlaceCharity",name:"TypeOfPlace",value:"charity",label:"I would like a charity place with Guide Dogs"},{id:"TypeOfPlaceBallot",name:"TypeOfPlace",value:"ballot",label:"I have a ballot place"}],[]),P=(0,a.useMemo)(()=>"ballot"===d?x.filter(e=>"ballot"===e.value):x,[d,x]);return(0,a.useEffect)(()=>
1{if(1===P.length){let e=P[0];v("TypeOfPlace",e.value,{shouldValidate:!0}),r({TypeOfPlace:e.value})}},[P]),(0,n.jsxs)("div",{children:[(0,n.jsx)(p.A,{options:P,id:"TypeOfPlace",label:(0,h.lu)("TypeOfPlace"),selected:null==(t=l())?void 0:t.TypeOfPlace,...c("TypeOfPlace"),error:y.TypeOfPlace,required:!0,onChange:e=>{let t=e.target.value;v("TypeOfPlace",t,{shouldValidate:!0}),r({TypeOfPlace:t})}}),(0,n.jsx)(m.A.Title,{...b}),(0,n.jsx)(m.A.FirstName,{...b}),(0,n.jsx)(m.A.LastName,{...b}),(0,n.jsx)(m.A.DateOfBirth,{...b}),(0,n.jsx)(m.A.PostcodeField,{...b,FORMID:o,fieldId:"PostcodeSearch"}),(0,n.jsx)(m.A.Email,{...b}),(0,n.jsx)(m.A.MobileNumber,{...b,required:!0}),(0,n.jsx)(m.A.PhoneNumber,{...b}),u&&(0,n.jsx)("div",{className:"form-rich-text-group",children:u.map((e,t)=>(0,n.jsx)(g.A,{html:e},t))}),(0,n.jsx)(m.A.ContactOptions,{...b,options:S})]})};var f=r(36356),y=r(16519),b=r(69697),S=r(19057),x=r(68904),P=r(63877);let _=e=>{var t,r,a,l,o,s,d,u;let{props:c,updateData:m,getData:g,getValues:v,eventName:_,postRaceCelebrations:C,fundraisingTargetPlan:j,expectedFinishTime:I}=e,{register:E,setValue:T,watch:w,formState:{errors:A}}=(0,i.xW)(),D=P.p.CHALLENGE_EVENTS_STANDARD,F=w("TypeOfPlace"),N=w("TShirtOrVest"),R=w("PostRaceCelebration"),O=w("PostRaceCelebrationSupporters"),M=w("MatchedFunding"),V=w("LovedOne"),L=e=>t=>{let r=t.target.value;T(e,r,{shouldValidate:!0}),m({[e]:r})};return(0,n.jsxs)("div",{children:[(0,n.jsx)(f.A,{id:"WhatInspiredYou",label:(0,h.lu)("WhatInspiredYou",D,{eventName:_||""}),required:!0,...E("WhatInspiredYou"),error:A.WhatInspiredYou,onBlur:L("WhatInspiredYou"),onChange:L("WhatInspiredYou")}),(0,n.jsx)(p.A,{options:[{id:"MascotSuitYes",name:"MascotSuit",value:"yes",label:"Yes"},{id:"MascotSuitNo",name:"MascotSuit",value:"no",label:"No"}],id:"MascotSuit",label:(0,h.lu)("MascotSuit"),selected:null==(t=g())?void 0:t.MascotSuit,...E("MascotSuit"),error:A.MascotSuit,required:!0,onChange:L("MascotSuit")}),(0,n.jsx)(y.A,{id:"FundraisePledge",helptext:"charity"===F?"(Please note the fundraising target for this event is \xa3".concat(c.form_content.fundraising_target,".)"):void 0,value:(null==(r=g())?void 0:r.FundraisePledge)||"",required:"charity"===F,minValue:1,label:(0,h.lu)("FundraisePledge"),...E("FundraisePledge"),error:null==A?void 0:A.FundraisePledge,onChange:L("FundraisePledge"),onBlur:L("FundraisePledge")}),j&&"charity"===F&&(0,n.jsx)(f.A,{id:"FundraisingTargetPlan",label:(0,h.lu)("FundraisingTargetPlan"),required:!0,...E("FundraisingTargetPlan"),error:A.FundraisingTargetPlan,onBlur:L("FundraisingTargetPlan"),onChange:L("FundraisingTargetPlan")}),(0,n.jsx)(p.A,{options:[{id:"GuinnessWorldRecordYes",name:"GuinnessWorldRecord",value:"yes",label:"Yes"},{id:"GuinnessWorldRecordNo",name:"GuinnessWorldRecord",value:"no",label:"No"}],id:"GuinnessWorldRecord",label:(0,h.lu)("GuinnessWorldRecord"),selected:null==(a=g())?void 0:a.GuinnessWorldRecord,...E("GuinnessWorldRecord"),error:A.GuinnessWorldRecord,required:!0,onChange:L("GuinnessWorldRecord")}),(0,n.jsx)(p.A,{options:[{id:"TShirtOrVestYes",name:"TShirtOrVest",value:"t-shirt",label:"T-shirt"},{id:"TShirtOrVestNo",name:"TShirtOrVest",value:"vest",label:"Vest"},{id:"TShirtOrVestNeither",name:"TShirtOrVest",value:"neither",label:"I don't need a T-shirt or vest"}],id:"TShirtOrVest",label:(0,h.lu)("TShirtOrVest"),selected:null==(l=g())?void 0:l.TShirtOrVest,...E("TShirtOrVest"),error:A.TShirtOrVest,required:!0,onChange:L("TShirtOrVest")}),c.sizes_guide&&(0,n.jsxs)("p",{children:["Please refer to our"," ",(0,n.jsx)("a",{href:c.sizes_guide,target:"_blank",children:"size guide"})," ","to help choose the correct size for you."]}),N&&"vest"===N&&(0,n.jsx)(p.A,{options:[{id:"VestFitFemale",name:"VestFit",value:"female",label:"Female"},{id:"VestFitMale",name:"VestFit",value:"male",label:"Male"}],id:"VestFit",label:(0,h.lu)("VestFit"),selected:null==(o=g())?void 0:o.VestFit,...E("VestFit"),error:A.VestFit,required:!0,onChange:L("VestFit")}),N&&"neither"!==N&&(0,n.jsx)(b.A,{addDefault:!0,addDefaultText:"Please select...",options:[{label:"Small",value:"S"},{label:"Medium",value:"M"},{label:"Large",value:"L"},{label:"X-Large",value:"XL"},{label:"XX-Large",value:"XXL"}],id:"TShirtSize",label:(0,h.lu)("TShirtSize"),required:!0,...E("TShirtSize"),error:A.TShirtSize,onBlur:L("TShirtSize"),onChange:L("TShirtSize")}),(0,n.jsx)(b.A,{addDefault:!0,addDefaultText:"Please select...",options:[{label:"Social media",value:"EVSM"},{label:"Events team email",value:"EVEM"},{label:"Guide Dogs website",value:"EVWB"},{label:"I sponsor a puppy",value:"EVSP"},{label:"Local Guide Dogs centre or representative",value:"EVLR"},{label:"I am a Guide Dogs Volunteer",value:"EVGV"},{label:"I am a guide dog owner",value:"EVGO"}],id:"PromptedToJoin",label:(0,h.lu)("PromptedToJoin"),required:!0,...E("PromptedToJoin"),error:A.PromptedToJoin,onBlur:L("PromptedToJoin"),onChange:L("PromptedToJoin")}),(0,n.jsx)(b.A,{addDefault:!0,addDefaultText:"Please select...",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}],id:"MatchedFunding",label:(0,h.lu)("MatchedFunding"),required:!0,...E("MatchedFunding"),error:A.MatchedFunding,onBlur:L("MatchedFunding"),onChange:L("MatchedFunding")}),M&&"yes"===M&&(0,n.jsx)(x.A,{type:"text",id:"EmployerName",label:(0,h.lu)("EmployerName"),required:!0,...E("EmployerName"),error:A.EmployerName,onBlur:L("EmployerName")}),(0,n.jsx)(p.A,{options:[{id:"LovedOneYes",name:"LovedOne",value:"yes",label:"Yes"},{id:"LovedOneNo",name:"LovedOne",value:"no",label:"No"}],id:"LovedOne",label:(0,h.lu)("LovedOne"),selected:null==(s=g())?void 0:s.LovedOne,...E("LovedOne"),error:A.LovedOne,required:!0,onChange:L("LovedOne")}),V&&"yes"===V&&(0,n.jsx)(x.A,{type:"text",id:"LovedOneName",label:(0,h.lu)("LovedOneName"),required:!0,...E("LovedOneName"),error:A.LovedOneName,onBlur:L("LovedOneName")}),(0,n.jsx)(p.A,{options:[{id:"SightedGuideYes",name:"SightedGuide",value:"yes",label:"Yes"},{id:"SightedGuideNo",name:"SightedGuide",value:"no",label:"No"}],id:"SightedGuide",label:(0,h.lu)("SightedGuide"),selected:null==(d=g())?void 0:d.SightedGuide,...E("SightedGuide"),error:A.SightedGuide,required:!0,onChange:L("SightedGuide")}),I&&(0,n.jsx)(x.A,{type:"text",id:"ExpectedFinishTime",label:(0,h.lu)("ExpectedFinishTime"),required:!1,...E("ExpectedFinishTime"),error:A.ExpectedFinishTime,onBlur:L("ExpectedFinishTime")}
1),C&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h2",{children:"Post-race celebrations"}),(0,n.jsx)(p.A,{options:[{id:"PostRaceCelebrationYes",name:"PostRaceCelebration",value:"yes",label:"Yes"},{id:"PostRaceCelebrationNo",name:"PostRaceCelebration",value:"no",label:"No"}],id:"PostRaceCelebration",label:(0,h.lu)("PostRaceCelebration"),selected:null==(u=g())?void 0:u.PostRaceCelebration,...E("PostRaceCelebration"),error:A.PostRaceCelebration,required:!0,onChange:L("PostRaceCelebration")}),R&&"yes"===R&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b.A,{addDefault:!0,addDefaultText:"Please select...",options:[{label:"0",value:"0"},{label:"1",value:"1"},{label:"2",value:"2"}],id:"PostRaceCelebrationSupporters",label:(0,h.lu)("PostRaceCelebrationSupporters"),required:!0,...E("PostRaceCelebrationSupporters"),error:A.PostRaceCelebrationSupporters,onBlur:L("PostRaceCelebrationSupporters"),onChange:L("PostRaceCelebrationSupporters")}),O&&"0"!==O&&(0,n.jsx)(x.A,{type:"text",id:"SupporterNames",label:(0,h.lu)("SupporterNames"),required:!0,...E("SupporterNames"),error:A.SupporterNames,onBlur:L("SupporterNames")}),(0,n.jsx)(x.A,{type:"text",id:"PostRaceCelebrationDietary",label:(0,h.lu)("PostRaceCelebrationDietary"),required:!0,...E("PostRaceCelebrationDietary"),error:A.PostRaceCelebrationDietary,onBlur:L("PostRaceCelebrationDietary")})]})]}),c.fundraising_agreement_page&&(0,n.jsx)("p",{children:(0,n.jsx)("a",{href:c.fundraising_agreement_page,target:"_blank",children:"View fundraising agreement"})}),(0,n.jsx)(S.default,{id:"Declaration",label:(0,h.lu)("Declaration"),required:!0,...E("Declaration"),onChange:e=>{T("Declaration",e.target.checked,{shouldValidate:!0})},isChecked:!!v("Declaration"),error:A.Declaration})]})};var C=r(12890),j=r(15239),I=r(25910),E=r(34927),T=r(96911),w=r(70081),A=r.n(w),D=r(89827),F=r(42658),N=r.n(F),R=r(87849);let O=N().bind(A()),M=e=>{let{updateData:t,handleApplyDiscountCode:r,handleRemoveDiscount:l,status:o,isApplying:s}=e,{register:d,setValue:u,watch:c,setFocus:m,formState:{errors:p}}=(0,i.xW)(),g=c("DiscountCode"),v="string"==typeof g?g.trim().length>0:!!g,f=(0,a.useRef)(null),y=(0,a.useRef)(o),b=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=y.current;"success"===o&&b.current&&b.current.focus({preventScroll:!0}),("error"===o||"success"!==o&&"success"===e)&&m("DiscountCode"),y.current=o},[o]),(0,n.jsx)("div",{className:O("c-discount-code"),children:"success"===o?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"label",ref:b,tabIndex:-1,children:"Discount applied"}),(0,n.jsxs)("div",{className:O("c-discount-code__applied"),children:[g," ",(0,n.jsx)("button",{className:O("c-discount-code__remove"),onClick:e=>l(e),ref:f,"aria-label":"Remove discount code",children:(0,n.jsx)(R.A,{iconType:"close"})})]})]}):(0,n.jsxs)("div",{className:O("c-discount-code__input-group"),children:[(0,n.jsx)("div",{className:O("c-discount-code__input"),children:(0,n.jsx)(x.A,{type:"text",id:"DiscountCode",label:(0,h.lu)("DiscountCode"),required:!1,...d("DiscountCode"),error:v?p.DiscountCode||("error"===o?{message:"Invalid code"}:void 0):void 0,onBlur:e=>{u("DiscountCode",e.target.value,{shouldValidate:!1})}})}),(0,n.jsx)(D.A,{label:"Apply",hideArrow:!0,onClick:r,disabled:!g||s,loading:s})]})})};var V=r(30926);let L=(0,V.createServerReference)("7f38dae96201b9b79c69e04ef8c4d88a419557766b",V.callServer,void 0,V.findSourceMapURL,"applyDiscountCode"),k=(0,V.createServerReference)("7f5d2fa4b2c8f87683f100ed5a1bdde1a3aa935896",V.callServer,void 0,V.findSourceMapURL,"removeDiscountCode");var G=r(58174);let q=e=>{var t;let{props:r,updateData:l,getData:o,amount:s,setAmount:d,setClientSecret:u,setPaymentIntentId:c,paymentIntentId:m,paymentIntentData:p,FORMID:g,eventName:h,paymentMethodCollapsed:v,setPaymentMethodCollapsed:f}=e,[y,b]=(0,a.useState)(null),[S,x]=(0,a.useState)(""),[P,_]=(0,a.useState)(!1),{createPaymentIntent:w}=(0,I.r)(),{setValue:A,register:D,watch:F,formState:{errors:N,isSubmitting:R}}=(0,i.xW)();(0,a.useEffect)(()=>{D("StripePaymentStatus"),D("StripePaymentIntentId"),D("PaymentMethod"),D("FinalAmount")},[D]),(0,a.useEffect)(()=>
1{if(A("PaymentMethod",S),l({PaymentMethod:S}),"paypal"===S){let e={timestamp:Date.now(),payload:o()};localStorage.setItem("".concat(G.Gw,":").concat(o().StripePaymentIntentId),JSON.stringify(e))}},[o,S,A,l]),(0,a.useEffect)(()=>{A("FinalAmount",s),l({FinalAmount:s})},[s]);let{confirmPayment:O,isProcessing:V,stripeError:q}=(0,T.A)({formName:"Challenge Events Standard",onPaymentSuccess:e=>{A("StripePaymentStatus","succeeded"),A("StripePaymentIntentId",e.id),null==l||l({StripePaymentStatus:"succeeded",StripePaymentIntentId:e.id})},onPaymentError:e=>{console.error("Payment error:",e)}});(0,a.useEffect)(()=>(window.confirmStripePayment=O,()=>{delete window.confirmStripePayment}),[O]);let B=F("DiscountCode");(0,a.useEffect)(()=>{"error"!==y||B||b(null)},[B]);let W=async e=>{if(e.preventDefault(),!B)return;_(!0);let t=await L(r.page_path,r.page_uid,r.form_content._metadata.uid,B,m),n=null==t?void 0:t.status,a=null==t?void 0:t.requiresPayment;"success"===n||"error"===n?b(n):b(null),"number"==typeof(null==t?void 0:t.amount)&&d(t.amount.toFixed(2)),"success"===n&&l({DiscountCode:B}),!1===a&&(c(""),l({StripePaymentIntentId:"",StripeClientSecret:""})),_(!1)},Y=async e=>{e.preventDefault();let t=await k(r.page_path,r.page_uid,r.form_content._metadata.uid,m);if((null==t?void 0:t.status)==="success"){if(b(null),d(t.amount.toFixed(2)),A("DiscountCode",""),l({DiscountCode:""}),t.createNewPaymentIntent){var n;let e=await w(p,"form");if(!e)throw Error("Failed to create payment intent");u(e.clientSecret),c(e.paymentIntentId),d(((null!=(n=e.amount)?n:0)/100).toFixed(2)),l({StripePaymentIntentId:e.paymentIntentId,StripeClientSecret:e.clientSecret})}}else console.error("Failed to remove discount code")};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("p",{className:"xl",children:["\xa3",s]}),(0,n.jsx)(M,{updateData:l,handleApplyDiscountCode:W,handleRemoveDiscount:Y,status:y,isApplying:P}),m&&(0,n.jsxs)("div",{className:"stripe-payment-step",children:[(0,n.jsx)("p",{children:(0,n.jsx)("strong",{children:"Following submission, please wait for the Guide Dogs 'Thank you page' to confirm your payment has been successful."})}),(0,n.jsx)("p",{children:"Your payment information is secure and encrypted."}),(0,n.jsxs)("fieldset",{children:[v?(0,n.jsx)("legend",{children:(0,n.jsx)("h3",{children:"Select payment method:"})}):(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("legend",{className:"payment-summary",children:[(0,n.jsx)("h3",{children:"Payment summary"}),(0,n.jsxs)("p",{children:["\xa3",s," will be ","paypal"===S?"paid via PayPal":"charged to your card"]})]})}),(0,n.jsx)(C.He,{options:{fields:{billingDetails:{address:"if_required"}}},onChange:e=>{var t;(null==(t=e.value)?void 0:t.type)&&(f(e.collapsed),x(e.value.type))},onLoadError:E.w})]}),(0,n.jsxs)("div",{className:"accepted-payments",children:[(0,n.jsx)("p",{children:"We accept:"}),(0,n.jsxs)("div",{children:[(0,n.jsx)(j.default,{src:"/images/Card-VisaDebitColour.svg",alt:"Visa Debit",loading:"lazy",width:"48",height:"48"}),(0,n.jsx)(j.default,{src:"/images/Card-VisaColour.svg",alt:"Visa",loading:"lazy",width:"48",height:"48"}),(0,n.jsx)(j.default,{src:"/images/Card-VisaElectronColour.svg",alt:"Visa Electron",loading:"lazy",width:"48",height:"48"}),(0,n.jsx)(j.default,{src:"/images/Card-MaestroColour.svg",alt:"Maestro",loading:"lazy",width:"48",height:"48"}),(0,n.jsx)(j.default,{src:"/images/Card-MastercardColour.svg",alt:"Mastercard",loading:"lazy",width:"48",height:"48"}),(0,n.jsx)(j.default,{src:"/images/Card-AmericanExpressColour.svg",alt:"American Express",loading:"lazy",width:"48",height:"48"})]}),(0,n.jsx)("p",{children:"Plus Apple Pay and Google Pay (when available on your device)"})]}),(V||R)&&(0,n.jsx)("div",{children:(0,n.jsx)("p",{children:"Processing your payment..."})}),(null==N?void 0:N.stripeError)&&(0,n.jsx)("div",{className:"field-validation-error",children:null==(t=N.stripeError.message)?void 0:t.toString()})]})]})},B=e=>{let{props:t,updateData:r,getData:l,FORMID:o,amount:s,setAmount:d,eventName:u,paymentMethodCollapsed:c,setPaymentMethodCollapsed:m}=e,{getValues:p,setError:g}=(0,i.xW)(),[h,v]=(0,a.useState)(""),[f,y]=(0,a.useState)(""),[b,S]=(0,a.useState)(null),{createPaymentIntent:x,isProcessing:P}=(0,I.r)(),_="production",C=(0,a.useRef)(!1),j=(0,a.useRef)(!1),T=(0,a.useCallback)(()=>{let e=p(),r="GUIDE DOGS* PROD EVENT";return{currency:"gbp",page_path:t.page_path,page_uid:t.page_uid,event_name:u,form_uid:t.form_content._metadata.uid,statementDescriptor:r,metadata:{webId:e.WebID,sessionId:e.SessionId,formId:e.FormId,statementDescriptor:r,productType:"Events",environment:_}}},[p,_,t,u]),w=(0,a.useCallback)(async()=>
1{if(j.current||C.current)return void console.log("Skipping payment intent initialisation - already initialised or in progress");let e=l(),t=null==e?void 0:e.StripePaymentIntentId,n=null==e?void 0:e.StripeClientSecret,a=null==e?void 0:e.FinalAmount;if(t&&n){console.log("Reusing existing payment intent from session storage:",t),y(t),v(n),a&&d(a),S(T()),j.current=!0;return}C.current=!0;try{var i;let e=T();S(e),console.log("Creating new payment intent...",e);let t=await x(e,"form");if(!t)throw Error("Failed to create payment intent");let n=((null!=(i=t.amount)?i:0)/100).toFixed(2);v(t.clientSecret),y(t.paymentIntentId),d(n),r({StripePaymentIntentId:t.paymentIntentId,StripeClientSecret:t.clientSecret,FinalAmount:n}),j.current=!0,console.log("Payment intent created successfully:",t.paymentIntentId)}catch(e){console.error("Error creating payment intent:",e),g("root.serverError",{type:"server",message:e.message||"Failed to initialise payment. Please refresh the page and try again."})}finally{C.current=!1}},[T,x,r,g,l,d]);return(0,a.useEffect)(()=>{w()},[]),(0,n.jsxs)("div",{children:[!h&&P&&(0,n.jsx)("div",{children:(0,n.jsx)("p",{children:"Initialising payment form..."})}),!h&&!P&&!C.current&&(0,n.jsx)("div",{className:"field-validation-error",children:(0,n.jsx)("p",{children:"Failed to initialise payment form. Please refresh the page and try again."})}),h&&(0,n.jsx)(E.A,{clientSecret:h,children:(0,n.jsx)(q,{props:t,updateData:r,getData:l,amount:s,setAmount:d,setClientSecret:v,paymentIntentId:f,setPaymentIntentId:y,paymentIntentData:b,FORMID:o,eventName:u,paymentMethodCollapsed:c,setPaymentMethodCollapsed:m})})]})},W=function(e,t,r,a,i,l,o,s,d){let u=arguments.length>9&&void 0!==arguments[9]&&arguments[9],c=arguments.length>10?arguments[10]:void 0,m=arguments.length>11?arguments[11]:void 0,p=(arguments.length>12&&arguments[12],arguments.length>13&&arguments[13],arguments.length>14&&arguments[14],arguments.length>15?arguments[15]:void 0),g=arguments.length>16?arguments[16]:void 0,h=arguments.length>17?arguments[17]:void 0,f=arguments.length>18?arguments[18]:void 0,y=arguments.length>19?arguments[19]:void 0,b=arguments.length>20?arguments[20]:void 0,S=arguments.length>21?arguments[21]:void 0,x=arguments.length>22?arguments[22]:void 0,P=arguments.length>23?arguments[23]:void 0,C=arguments.length>24?arguments[24]:void 0,j=[{step:1,name:"1. Personal Details",title:"1. Personal Details",fields:["TypeOfPlace","Title","FirstName","LastName","DateOfBirth","PostcodeSearch","manualAddress","SelectAddressDropdown","Email","MobileNumber","PhoneNumber","AddressLine1","AddressLine2","AddressLine3","Town","County","Country","Postcode"],component:(0,n.jsx)(v,{props:e,updateData:t,getData:r,FORMID:a,isSubmitting:u,getValues:c,eventStatus:b,privacyText:S}),renderComplete:()=>{let e=r()||{},t="string"==typeof e.Title?e.Title:"",n="string"==typeof e.FirstName?e.FirstName:"",a="string"==typeof e.LastName?e.LastName:"",i="string"==typeof e.Email?e.Email:"",l="".concat(t," ").concat(n," ").concat(a).trim();return"".concat(l," - ").concat(i)},labels:{next:"Next: Registration information",edit:"Edit personal details"}},{step:2,name:"2. Registration information",title:"2. Registration information",fields:(()=>{r();let e=[];return x&&(e.push("PostRaceCelebration"),e.push("PostRaceCelebrationSupporters"),e.push("PostRaceCelebrationDietary")),x&&e.push("SupporterNames"),P&&e.push("FundraisingTargetPlan"),C&&e.push("ExpectedFinishTime"),["WhatInspiredYou","MascotSuit","GuinnessWorldRecord","TShirtOrVest","VestFit","TShirtSize","PromptedToJoin","MatchedFunding","EmployerName","LovedOne","LovedOneName","SightedGuide","Declaration","FundraisePledge",...e]})(),component:(0,n.jsx)(_,{props:e,updateData:t,getData:r,isSubmitting:u,getValues:c,eventStatus:b,eventName:h,postRaceCelebrations:x,fundraisingTargetPlan:P,expectedFinishTime:C}),renderComplete:()=>"Further registration details complete.",labels:m?{next:"Next: To payment",edit:"Edit registration information"}:{submit:"Reserve place"}}];m&&j.push({step:3,name:"3. Payment information",title:"3. Payment information",fields:[],component:(0,n.jsx)(B,{props:e,updateData:t,getData:r,FORMID:a,amount:p,setAmount:g,eventName:h,paymentMethodCollapsed:f,setPaymentMethodCollapsed:y}),renderComplete:()=>"step 3 - done",labels:{submit:"0.00"===p?"Reserve place":"Submit payment"}
1,isSubmitting:u,hideSubmit:f&&"0.00"!==p});let I=m?4:3;return j.push({step:I,name:"".concat(I,". Thank You"),title:"".concat(I,". Thank You"),fields:[],component:(0,n.jsx)("div",{}),renderComplete:()=>"Complete",labels:{}}),j};var Y=r(464),z=r(97561),U=r(20140),J=r(22622),X=r(8301),H=r(74879);let Q=(0,V.createServerReference)("7fbd11dd01e08be57fb14f9bae4104c5288957eddf",V.callServer,void 0,V.findSourceMapURL,"getFinalEventFee");var Z=r(27122),K=r(55525),$=r(69764),ee=r(8424);let et=(0,V.createServerReference)("7fb2f3e846a144e346ade70d853a1997ed560fb545",V.callServer,void 0,V.findSourceMapURL,"submitPaymentForm");var er=r(27487),en=r(4913),ea=r(42893),ei=r(16731),el=r(32746),eo=r(32409);let es=e=>{var t,r;let{form_content:m,page_path:p,page_uid:h}=e,v=(0,u.useRouter)(),f=(0,u.useSearchParams)(),y=P.p.CHALLENGE_EVENTS_STANDARD,[b,S]=(0,a.useState)(!1),[x,_]=(0,a.useState)(""),C=new ei.A,[j,I]=(0,a.useState)(1),[E,T]=(0,a.useState)(!1),[w,A]=(0,a.useState)(null==m?void 0:m.include_payment_step),[D,F]=(0,a.useState)(null),{updateData:N,getData:R,clearData:O}=(0,c.F)(y),[M,V]=(0,a.useState)(""),L=(0,a.useRef)(null),k=(0,a.useRef)(!1),[q,B]=(0,a.useState)(!1),[es,ed]=(0,a.useState)(""),[eu,ec]=(0,a.useState)(!1),[em,ep]=(0,a.useState)(!0),eg=(0,a.useRef)(!1),eh=(0,a.useRef)(!1),ev=(0,a.useRef)(!1),ef=null==m?void 0:m.event_status,ey=null==m?void 0:m.event_name,eb=null==m?void 0:m.event_location,eS=(0,Y.ae)(null==m?void 0:m.event_date),ex=(0,Y.y2)(null==m?void 0:m.event_date),eP=null==m?void 0:m.form_texts_privacy.map(e=>e.rich_text),e_=null==m?void 0:m.registration_fee,eC=null==m?void 0:m.post_race_celebrations,ej=null==m?void 0:m.fundraising_target,eI=null==m?void 0:m.fundraising_target_plan,eE=null==m?void 0:m.expected_finish_time,eT=null==m?void 0:m.include_payment_step,ew=null==m?void 0:m.event_source,eA=null==m?void 0:m.minimum_age,eD=null==m?void 0:m.event_date,[eF,eN]=(0,a.useState)(()=>"true"===new URLSearchParams(window.location.search).get("isPayPal")&&!ev.current&&(console.log("\uD83D\uDD04 PayPal return detected synchronously during state initialization"),!0));(0,a.useEffect)(()=>{eF&&B(!0)},[eF]);let eR=(0,i.mN)({mode:"onBlur",resolver:(0,l.t)(K.lV),defaultValues:R()}),{register:eO,handleSubmit:eM,trigger:eV,getValues:eL,setFocus:ek,setError:eG,setValue:eq,watch:eB,formState:{errors:eW}}=eR,{ensureFormDataAvailable:eY}=(0,eo.A)(eR),ez=eB("TypeOfPlace"),eU=eB("DiscountCode"),{focusFirstError:eJ}=(0,X.w)(eW,ek,E);(0,a.useEffect)(()=>{let e=R();if(null==e?void 0:e.SessionId)V(e.SessionId),eq("sessionId",e.SessionId);else{let e=(0,H.A)();V(e),eq("sessionId",e),N({sessionId:e})}C.isSupported()||(S(!0),_(C.getBrowserName()),Z.wd("Browser not supported",{tags:{unsupportedBrowser:window.navigator.userAgent,formName:"ChallengeEventsStandard"}}))},[]);let eX=(0,a.useCallback)(async e=>{let t=Array.isArray(e)?e:[e],r=await eV(t);return r||eJ(),r},[eV,eJ]);(0,a.useEffect)(()=>{A(0!==Number(e_)&&ez!==G.gM&&eT)},[m,ez]);let eH=(e,t)=>{var r;return(null==e||null==(r=e.email_fields)?void 0:r.find(e=>e.type===t))||null};(0,a.useEffect)(()=>{var e;if(!m)return;let t=null;ez===G.gM?t=eH(m,G.gM):ez===G.cj&&(es&&0===Number(es)||!eT)?t=eH(m,G.FJ):ez===G.cj&&(t=eH(m,G.cj));let r=null!=(e=null==t?void 0:t.email_id)?e:null;F(r),eq("EmailId",r)},[ez,m,es,eq]),(0,a.useEffect)(()=>{(async()=>{ec((await Q(p,h,e.form_content._metadata.uid,ez,eU)).requiresPayment)})()},[ez,eU]);let eQ=async()=>{try{let e;if(T(!0),eu){let t=window.confirmStripePayment;if(!t)throw Z.Cp(new er.U("Challenge Events form payment processing failed"),{tags:{errorType:"ComponentSubmissionError"},extra:{confirmStripePayment:t,errorText:"Payment system not initialized"}}),Error("Payment system not initialized. Please refresh the page and try again.");if(!(e=await t()).success){console.error("Payment confirmation failed"),eg.current=!1,T(!1),eG("root.serverError",{type:"error",message:"There was an error confirming your payment. Please try again."});return}}let t=eL();await e$({...t,PaymentIntentId:null==e?void 0:e.paymentIntentId},!1)}catch(e){console.error("Error during form submission:",e),eG("root.serverError",{type:"error",message:e instanceof Error?e.message:"An unexpected error occurred. Please try again."}),eg.current=!1,T(!1)}},eZ=(0,a.useCallback)((e,t)=>{let r=!!e.PaymentIntentId;return{FirstName:e.FirstName,LastName:e.LastName,Location:eb,EventDate:eS,EventTime:ex,TypeOfPlace:e.TypeOfPlace,PaymentReference:r?t:"Not applicable",Email:e.Email,WebId:t,SourceCode:e.PromptedToJoin}},[]),eK=(0,a.useCallback)(t=>{var r;if(null==(r=e.form_content)?void 0:r.email_fields)return e.form_content.email_fields.map(e=>{let r=e0(t),n=[];for(let t of e.dot_digital_field_name){let e=r(t);n.push({name:t,value:e})}return{...e,personalizationValues:n}})},[es]),e$=(0,a.useCallback)(async function(t){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{let r=eK(t).filter(e=>e.email_id===t.EmailId);t.PagePath=p,t.PageUid=h,t.EventName=ey,t.FormUid=e.form_content._metadata.uid;let n={description:"Events - {webId} - ".concat(t.PromptedToJoin),websiteReferenceId:"{webId}"},a=await (0,ea.L)(()=>et(t,r,n));if(a&&a.ok){let e=a.webId,r=eZ(t,e);sessionStorage.setItem("thankYou_".concat(e),JSON.stringify({value:r,timestamp:Date.now()}));let n=(0,ee.w)(r);document.getElementById("gtm_transaction")||document.head.appendChild(n),k.current=!0,B(!1),eh.current=!0,O(),"paypal"===t.PaymentMethod&&localStorage.removeItem("".concat(G.Gw,":").concat(t.StripePaymentIntentId)),(null==a?void 0:a.redirectTo)&&setTimeout(()=>{v.push(a.redirectTo)},100)}else Z.Cp(new er.U("Challenge events form submission failed"),{fingerprint:["ComponentSubmissionError",null==a?void 0:a.status],tags:{errorType:"ComponentSubmissionError",submissionStatus:null==a?void 0:a.status,azureRef:null==a?void 0:a.azureRef},extra:{submissionResult:a}}),(null==a?void 0:a.serverErrors)!==void 0?eG("root.serverError",{type:a.status,message:a.serverErrors}):v.push("/500"),B(!1),eN(!1),I(3),L.current=null}catch(e){Z.Cp(new er.U("Challenge events form submission failed"),{fingerprint:["ComponentSubmissionError",String(e)],tags:{errorType:"ComponentSubmissionError"},extra:{originalError:e}}),console.error("".concat(r?"Payment processing":"Form submission"," failed:"),e),eG("root.serverError",{type:"error",message:e instanceof Error?e.message:"An unexpected error occurred. Please try again."}),B(!1),eN(!1),I(3),L.current=null}},[O,eZ,v,eG,es,D,eK]);(0,a.useEffect)(()=>{let e=f.get("payment_completed"),t=f.get("payment_intent");
1if(t&&"true"===e){if(ev.current)return void console.log("âï¸ Payment already processed, skipping");if(L.current!==t){if(k.current){console.log("âï¸ Skipping payment processing:",{reason:k.current?"Already processed":L.current===t?"Already processing this payment":"Unknown reason"}),B(!1);return}B(!0),L.current=t,(async()=>{try{console.log("\uD83D\uDE80 Starting PayPal payment processing...");let e=await eY(t);if(!e){console.error("â No form data available for payment processing"),eG("root.serverError",{type:"error",message:"We have encountered an error. Please contact our Supporter Experience team on freephone 0800 688 8405, Monday to Friday 9.00am to 5.00pm, or email [email protected] and quote payment reference number ".concat(t," in relation to your transaction.")}),I(3),eN(!1),B(!1),L.current=null;return}console.log("\uD83D\uDD0D Verifying payment with Stripe...");let r=await fetch(G.uM,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentIntentId:t})});if(!r.ok){let t=await r.text();console.error("Payment verification failed:",r.status,t),Z.Cp(new er.U("Challenge Events form payment processing failed"),{tags:{errorType:"ComponentSubmissionError"},extra:{errorText:t}}),I(3),B(!1),eN(!1),eG("root.serverError",{type:"error",message:"Payment not succeeded. Please try again."}),localStorage.removeItem("".concat(G.Gw,":").concat(e.StripePaymentIntentId)),L.current=null,ev.current=!0;return}let n=await r.json();await e$({...e,PaymentIntentId:null==n?void 0:n.id},!0),window.history.replaceState({},document.title,window.location.pathname),L.current=null,ev.current=!0}catch(t){console.error("â Error processing payment completion:",t),window.history.replaceState({},document.title,window.location.pathname),L.current=null;let e=t instanceof Error?t.message:"An error occurred while completing your payment";eG("NotCompleted",{message:e},{shouldFocus:!0}),Z.Cp(new er.U("Challenge Events form payment processing failed"),{tags:{errorType:"ComponentSubmissionError"},extra:{errorText:e}}),I(3),B(!1),eN(!1)}})()}}},[f,e$,eG,eY]);let e0=e=>t=>{switch(t.toLowerCase()){case"amount":return e.FinalAmount;case"reference":return"{webId}";case"firstname":return e.FirstName||"";default:let r=Object.keys(e).find(e=>e.toLowerCase()===t.toLowerCase());return r&&e[r]||""}},e1=(0,a.useCallback)(async e=>{if(!eg.current&&R().sessionId){eg.current=!0,T(!0),eh.current=!1;try{await eM(eQ)(e)}finally{eh.current||(eg.current=!1,T(!1))}}},[eM,eQ]),e2=W(e,N,R,y,eO,eq,eW,eB,ek,E,eL,w,p,h,e_,es,ed,ey,em,ep,ef,eP,eC,eI,eE),e4=(0,a.useMemo)(()=>w?e2.filter(e=>4!==e.step):e2.filter(e=>3!==e.step),[e2.length,w,es,E,em]),e5=(0,a.useMemo)(()=>e2.map(e=>({name:e.name,position:e.step})),[e2.length]);return(0,n.jsxs)("div",{children:[(0,n.jsx)(el.A,{open:b,browser:x}),ef===G.gM&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z.A,{text:m.alert_pods.ballot_only[0].text,link:m.alert_pods.ballot_only[0].cta_link,blueBg:!0}),(0,n.jsx)(U.A,{variant:"clear"})]}),"closed"===ef&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z.A,{text:m.alert_pods.closed[0].text,link:m.alert_pods.closed[0].cta_link,blueBg:!0}),(0,n.jsx)(U.A,{variant:"clear"})]}),"cancelled"===ef&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z.A,{text:m.alert_pods.cancelled[0].text,link:m.alert_pods.cancelled[0].cta_link,blueBg:!0}),(0,n.jsx)(U.A,{variant:"clear"})]}),"closed"!==ef&&"cancelled"!==ef&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h2",{children:"Event details"}),eS&&(0,n.jsxs)("h3",{children:["When: ",eS]}),eb&&(0,n.jsxs)("h3",{children:["Where: ",eb]}),"charityAndBallot"===ef&&(0,n.jsxs)("h3",{children:["Charity registration fee: \xa3",null==m?void 0:m.registration_fee]}),(null==m?void 0:m.rich_text_signup_conditions)&&(0,n.jsx)(g.A,{html:m.rich_text_signup_conditions}),(q||eF)&&(0,n.jsx)($.A,{}),(0,n.jsx)(i.Op,{...eR,children:(0,n.jsxs)("form",{noValidate:!0,id:"challenge-events-form",children:[(0,n.jsx)("input",{type:"hidden",id:"sessionId",name:"sessionId",value:M}),(0,n.jsx)("input",{type:"hidden",id:"EventSource",value:ew,...eO("EventSource")}),(0,n.jsx)("input",{type:"hidden",id:"cmsPostRaceCelebrations",value:eC,...eO("cmsPostRaceCelebrations")}),(0,n.jsx)("input",{type:"hidden",id:"cmsFundraisingTarget",value:ej,...eO("cmsFundraisingTarget")}),(0,n.jsx)("input",{type:"hidden",id:"cmsFundraisingTargetPlan",value:eI,...eO("cmsFundraisingTargetPlan")}),(0,n.jsx)("input",{type:"hidden",id:"cmsExpectedFinishTime",value:eE,...eO("cmsExpectedFinishTime")}
1),(0,n.jsx)("input",{type:"hidden",id:"cmsMinimumAge",value:eA,...eO("cmsMinimumAge")}),(0,n.jsx)("input",{type:"hidden",id:"cmsEventDate",value:eD,...eO("cmsEventDate")}),(0,n.jsx)(d.A,{register:eO,emailId:D||null,thankYouPage:e.thank_you_page,formId:y,eventId:m.event_id}),(0,n.jsx)(s.A,{id:(0,J._)(null==m?void 0:m.event_name),name:"".concat(null==m?void 0:m.event_name," Progress"),nextPosition:j,steps:e5}),(0,n.jsx)(o.A,{formId:y,stepId:null==m?void 0:m.event_name,step:j,setStep:I,steps:e4,validator:eX,onSubmit:e1,titleTag:"h2"}),(0,n.jsx)(en.A,{messages:null==eW||null==(r=eW.root)||null==(t=r.serverError)?void 0:t.message})]})})]})]})}},97561:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var n=r(95155);r(12115);var a=r(14250),i=r.n(a),l=r(42658),o=r.n(l),s=r(87036),d=r(89827);let u=o().bind(i()),c=e=>{let{text:t,link:r,blueBg:a,blueNoCTA:i,$:l}=e;return t&&""!==t?(0,n.jsx)("div",{className:u("c-promo-pod",{"c-promo-pod--blue":a||i}),...l,children:(0,n.jsxs)("div",{className:u("c-promo-pod__wrapper"),children:[(0,n.jsx)("p",{className:u("c-promo-pod__text"),children:(0,s.p)(t)}),!i&&r&&r.text&&(0,n.jsx)("p",{className:u("c-promo-pod__link"),children:(0,n.jsx)(d.A,{href:r.href,inverted:a,label:r.text,target:null==r?void 0:r.target,rel:null==r?void 0:r.rel})})]})}):null}}}]);
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.