1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[483],{483:(e,a,s)=>{s.r(a),s.d(a,{default:()=>j});var t=s(7876),n=s(4232),o=s(3036),l=s(9099),i=s(8579),r=s(593),d=s(1993),c=s(6401);s(8780);var m=s(1787);function u(e){let[a,s]=(0,n.useState)(null),[o,l]=(0,n.useState)(null),[r,d]=(0,n.useState)(null),[c,m]=(0,n.useState)(null),[u,p]=(0,n.useState)(null),g=e?.optHotelId,h=e?.GuestlineApi||!1,f=h?.glApiUrl||!1,y=h?.glApiPass||!1,b=h?.glApiOperator||!1,x=h?.glApiInterface||!1,v=0,j=async()=>{let e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:f,pass:y,operator:b,interface:x,site:g})},a=await fetch("/api/guestline/login",e),t=await a.json();200!=a.status?console.log("%cRezLynx API: Login fails:","color:red",t):(console.log("%cRezLynx API: Login data: ","color:green",t),s(t.SessionID))},N=async s=>{let t={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({SessionID:a,CRSRef:s})},n=await fetch("/api/guestline/booking-search",t),o=await n.json();v++,p(""),200!=n.status?(console.log("%cRezLynx API: BookingSearch fails:","color:red",o),console.log("booking Search No: "+v),v<10?setTimeout(function(){N(s)},1e3):(console.log("%cRezLynx API: BookingSEarch timeout, nothing found","color:red"),p("Sorry, we couldn't find your Room booking."),e.setState({...e.state,loading:!1}))):(console.log("%cRezLynx API: Booking data: ","color:green",o),d(o))},w=async e=>{let a=Array.isArray(e?.Reservation)?e?.Reservation[0]:e?.Reservation,s={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ProfileUniqueId:a?.Contact?.ProfileRef||!1,Surname:a?.Contact?.Surname||!1,url:f,pass:y,operator:b,interface:x,site:g})},t=await fetch("/api/guestline/get-profile",s),n=await t.json();200!=t.status?console.log("%cRezLynx API: GetProfileSummary fails: ","color:green",n):(console.log("%cRezLynx API: Profile data: ","color:green",n),m(n))};return(0,n.useEffect)(()=>
1{l(e.BookingID),console.log("%cGuestline transaction ID received: ","color:green",e.BookingID)},[]),(0,n.useEffect)(()=>{a||j()},[o]),(0,n.useEffect)(()=>{a&&!r&&(e.setState({...e.state,loading:!0}),N(o))},[a]),(0,n.useEffect)(()=>{r&&!c&&w(r)},[r]),(0,n.useEffect)(()=>{if(r){let a=Array.isArray(r.Reservation)?r.Reservation[0].Arrival:r.Reservation.Arrival,s=new Date(a);console.log("%c State Data:","color:green",a,e.state),e.setState({...e.state,Date:s,slotDate:(0,i.A)(s,"yyyy-MM-dd"),slotDateFormated:(0,i.A)(s,"do MMMM Y"),minDate:s,minActiveDate:new Date(s.getFullYear(),s.getMonth(),s.getDate())})}},[r]),(0,n.useEffect)(()=>{if(c&&2==e.state.step&&!e.BookingData.lastname&&!e.BookingData.emailAddress){let a={};c.Forename&&(a.firstname=c.Forename),c.Surname&&(a.lastname=c.Surname),c.EMailAddress&&(a.emailAddress=c.EMailAddress),c.TelephoneNo&&(a.telephoneNumber=c.TelephoneNo),console.log(a),console.log("%c Bridge -> Booking Data:","color:green",e.BookingData),e.setBookingData({...e.BookingData,...a})}},[e.state.step,c]),(0,t.jsx)("div",{children:u&&(0,t.jsxs)("p",{className:"alert alert-warning text-center",children:[u,(0,t.jsx)("button",{href:"",className:"btn btn-outline-dusk m-10",onClick:()=>{e.setState({...e.state,loading:!0}),N(o)},children:"Try again"})]})})}var p=s(8230),g=s.n(p),h=s(9814),f=s(5487);function y(e){let a=e?.state?.calendarMessages||[],s=e?.state?.slotDate||null,n=a.find(e=>e.dates.find(e=>{if(!e.to)return e.from===s;{let a=e.from<=s,t=!e.to||e.to>=s;return a&&t}}));return n&&s&&(0,t.jsx)("aside",{className:"zonalevents-calendar-notes mt-10 text-center",children:(0,t.jsxs)("div",{className:"inview",children:[(0,t.jsx)("hr",{}),(0,t.jsx)("div",{className:"m-10",dangerouslySetInnerHTML:{__html:n.message}}),(0,t.jsx)("hr",{})]})})}function b(e){let a=e.location||!1;return(console.log(a),!a||a.loyalty)?null:(0,t.jsx)("p",{style:{color:"red",fontSize:"0.85em"},children:'"Treats" are not currently available at this pub. Please look out for exciting news soon.'})}function x(e){let a,{settings:s}=(0,o.M)(),p=e.settings,x=s?.acf.optGeneral.optGtm||!1,v=s?.acf.optGeneral.optPixel||!1,j=s?.acf.optGeneral.optBrand||!1,N=s?.general.title||!1,w=(0,n.useRef)(),k=((0,n.useRef)(),(0,n.useRef)()),I=(0,n.useRef)(),D=(0,n.useRef)(),M=(0,n.useRef)(),T=(0,l.useRouter)(),_=p.restApi+"/zonal/v1",S=p.restApi+"/atreemo/v1",A="heartwood-secret-phrase-hard2guess",P=["2022-02-03","2022-02-10","2022-02-17","2022-02-24","2022-03-03","2022-03-10","2022-03-17","2022-03-24"],z=p.excludedOccasions,[O,E]=(0,n.useState)(null),[C,q]=(0,n.useState)(null),B=(0,n.useId)(),{utm_source:L,utm_medium:F,utm_campaign:$,utm_term:R,utm_content:U,promocode:H,editable:G}=T.query,Y=void 0!==G,{transaction_id:W,hotel_id:J,layout:V}=T.query,X=C??p.defaultLocation,[Z,K]=(0,n.useState)(null),[Q,ee]=(0,n.use
1State)(null),ea=2*Math.ceil((new Date().getHours()+2)/2),es=ea<10?"0"+ea+":00":ea+":00",[et,en]=(0,n.useState)(),eo=!!p.booking_date,[el,ei]=(0,n.useState)(null),[er,ed]=(0,n.useState)(()=>({bookingReference:null,siteId:p.defaultLocation||0,occasionId:"",menuIds:"",areaId:"",upsellIds:[],adults:0,children:0,date:"",time:"",firstname:"",lastname:"",emailAddress:"",telephoneNumber:"",consent:{email:!1,sms:!1}})),[ec,em]=(0,n.useState)(()=>{let e=new Date;return console.log(e.getFullYear(),e.getMonth(),e.getDate()),{step:1,status:"book",loading:!0,appMessage:null,appMessageButtons:!1,showDateDropdown:!1,restID:!1,restUrl:!1,restName:"",restPhone:"",restEmail:"",restAtreemoId:!1,restBookingType:p.restBookingType||"standard",restOccasionId:!1,restOccasionName:!1,restOccasionShow:"events"==p.restBookingType,restMenuName:!1,restMenuShow:!0,restAreaId:!1,restAreaName:!1,restAreaShow:!0,restUpsellShow:!0,restSessions:!1,restTimes:null,restOccasions:null,restMenus:null,restAreas:null,restUpsells:null,defaultSizeRange:12,minPartySize:!1,maxPartySize:!1,minDate:e,minActiveDate:new Date(e.getFullYear(),e.getMonth(),e.getDate()),maxDate:null,calendarMessages:null,DateMode:"single",Date:"",slotDate:null,slotDateFormated:null,Time:0,suggestedTime:null,slotType:"enquiry",availableTimeslots:0,menuId:null,pixelEventPrefix:"events"==p.restBookingType?"Enquiry:":"Book table:",usePromocodes:!1,promocode:null}});function eu(){let e=w.current,a=e.closest(".booking-wrapper");a&&(e=a),console.log("scrolling to: "+e.offsetTop),e&&(0,h.VG)(window,{behavior:"smooth",top:e.offsetTop-180})}function ep(e){if(void 0===e)return!1;let a=e.value;if("radio"==e.getAttribute("type")){let a=e.getAttribute("name"),s=0,t=w.current?.querySelectorAll('[name="'+a+'"]');return!t||((t.forEach(function(e){e.checked&&s++}),s)?(e.closest(".form-group").classList.remove("input-error"),!0):(e.closest(".form-group").classList.add("input-error"),!1))}return a&&0!=a&&"null"!=a?"email"!=e.getAttribute("type")||/^(([^<>()\[\]\\.,;:\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,}))$/.test(a)?(e.closest(".form-group").classList.remove("input-error"),!0):(e.closest(".form-group").classList.add("input-error"),!1):(e.closest(".form-group").classList.add("input-error"),!1)}function eg(e){if(!w.current)return!1;let a=w.current?.querySelector("#zonalevents_page_"+e),s=a?.querySelectorAll("[required]"),t=0;return!function(e){if(!w.current)return;let a=w.current?.querySelector("#zonalevents_page_"+e),s=a?.querySelectorAll(".input-error");s&&s.forEach(e=>{e.classList.remove("input-error")})}(e),s&&s.forEach(function(e){!ep(e)&&t++}),"1"!=e||ec.Time||(t++,w.current.querySelector("#zonalevents_booking_time").closest(".form-group").classList.add("input-error")),!t}function eh(){var e,a=new Date(ec.slotDate).getTime(),s=0,t=new Date,n=new Date,o=ec.Time.time.split(":");t.setHours(18,0),n.setHours(o[0],o[1]);for(var l=0;l<P.length;l++){var i=new Date(P[l]).getTime()-72e6,r=new Date(P[l]).getTime()+72e6;a>i&&a<r&&s++}return e=ec.usePromocodes&&ec.promocode&&"apresski"==ec.promocode.toLowerCase()&&a&&s&&er.adults>1&&n>=t,console.log(n,t,n>=t),console.log(a,er.adults,ec.usePromocodes,ec.promocode,s,e),e}(0,n.useEffect)(()=>{if(J&&p?.locationOptions?.length){let e=p.locationOptions.find(e=>e.hotelid===J);e?.zonalId&&q(e.zonalId)}},[J,p?.locationOptions]);let ef=e=>{if(console.log("going to step: "+e),void 0===e)return!1;em(a=>({...a,step:e})),ec.promocode&&2==e&&eh()&&em(e=>({...e,loading:!0,appMessage:'<strong style="text-transform:uppercase;">'+ec.promocode+"</strong> promotion has been applied to your booking"})),!ec.promocode&&2==e&&function(){for(var e,a=new Date(ec.slotDate).getTime(),s=0,t=0;t<P.length;t++){var n=new Date(P[t]).getTime()-72e6,o=new Date(P[t]).getTime()+72e6;a>n&&a<o&&s++}return e=ec.usePromocodes&&a&&s&&er.adults>1,console.log(a,er.adults,ec.usePromocodes,s,e),e}()&&em(e=>({...e,loading:!0,appMessage:"We host Apr\xe8s ski evenings from 6pm on Thursdays in our cosy tent. <br>Please call "+ec.restPhone+" to book so we can seat you accordingly."}
1)),console.log("scrolling to: "+e),eu(),"function"==typeof fbq&&2==e&&(console.log(ec.pixelEventPrefix+" Progress"),fbq("trackSingleCustom",v,ec.pixelEventPrefix+" Progress"))};function ey(e){if(el&&el.id==e.id)return!1;console.log("setRestaurantInfo fired!",e);let a=p.booking_date||e.mindate||null,s={restID:e.id,restUrl:e.url,restName:e.name,restPhone:e.phone,restEmail:e.email,restAtreemoId:e.atreemoid,restOccasionId:e.occasionid,menuId:e.menuid,restAreaId:e.areaid,restMenuShow:1==e.menushow,restAreaShow:1==e.areashow,restUpsellShow:1==e.upsellshow,usePromocodes:1==e.usePromocodes,restMenus:!1,restAreas:!1,restUpsells:!1,loading:!1,restOccasions:null,restOccasionName:!1,restAreaName:!1,restMenuName:!1,restTimes:null,Time:0,Date:"",maxDate:e.maxdate?new Date(e.maxdate):null,calendarMessages:e.calendarMessages};a&&!p.booking_date&&(0,r.nb)(new Date(a).getTime())&&(a=new Date);let t={date:a?new Date(a):new Date,partysize:p.booking_partysize||2,time:p.booking_time||es,areaId:eo&&p.booking_areaId?p.booking_areaId:e.areaid,menuIds:eo&&p.booking_menuIds?p.booking_menuIds:e.menuid};if(en(t),s.minDate=a?new Date(a):t.date,s.minActiveDate=a?new Date(a):t.date,s.Date=t.date,s.slotDate=(0,i.A)(new Date(t.date),"yyyy-MM-dd"),s.slotDateFormated=(0,i.A)(new Date(t?.date),"do MMMM y"),s.suggestedTime=t.time,"book"==ec.status){let e;s.step=1,console.log("clearBookingForm method fired"),ed(e=>({...e,adults:0})),e={Date:new Date,Time:0,slotDate:null,slotDateFormated:null,slotType:"enquiry",restTimes:null,loading:!1,appMessage:null,appMessageButtons:!1},et?.date&&(e.Date=et.date,e.slotDate=(0,i.A)(new Date(et.date),"yyyy-MM-dd"),e.slotDateFormated=(0,i.A)(new Date(et?.date),"do MMMM y")),em(a=>({...a,...e}))}em(e=>({...e,...s})),ed(a=>({...a,siteId:e.zonalId,adults:0})),"function"==typeof fbq&&1==ec.step&&(console.log(ec.pixelEventPrefix+" Location change: "+ec.restName),fbq("trackSingleCustom",v,ec.pixelEventPrefix+" Location change",{value:ec.restName})),W&&e.glapiurl&&e.glapipass&&e.glapioperator&&e.glapiinterface&&(console.log("%cRezLynx API: Location details:","color:green",e),E({glApiUrl:e.glapiurl,glApiPass:e.glapipass,glApiOperator:e.glapioperator,glApiInterface:e.glapiinterface})),K(e.enquiryInfo),ee(e.confirmationInfo),ei(e)}async function eb(){if(!(er.siteId&&ec.Date&&A))return!1;console.log("> getOccasions method fired..."),em(e=>({...e,loading:!0,appMessage:null}));let e=new URLSearchParams;e.append("siteId",er.siteId),e.append("date_mode",ec.DateMode),e.append("booking_date",(0,i.A)(new Date(ec.Date),"yyyy-MM-dd")),e.append("api_secret",A);let a=await fetch(_+"/occasions",{method:"POST",body:e});if(!a.ok)throw em(e=>({...e,loading:!1})),Error("Failed to fetch data");let s=await a.json();if(console.log(s),200==s.StatusCode&&s.data.occasions)if("events"==ec.restBookingType){let e=s.data.occasions.filter(function(e){return e.id.toString()!=ec.restOccasionId.toString()});z&&(e=e.filter(function(e){return -1==z.indexOf(e.id.toString())})),em(a=>({...a,restOccasions:e,loading:!1})),ed(e=>({...e,occasionId:""}))}else{console.log("Standard booking occasion update..."),ec.restOccasionId&&ed(e=>({...e,occasionId:ec.restOccasionId}));let e="";s.data.occasions&&s.data.occasions.forEach(function(a){ec.restOccasionId==a.id&&(console.log("getOccasions: "+a.name),e=a.name)}),em(a=>({...a,restOccasions:s.data.occasions,restOccasionName:e,loading:!1}))}else em(e=>({...e,loading:!0,appMessage:"No available Occasions found"}))}async function ex(){if(!(er.siteId&&er.occasionId&&A))return!1;console.log("> getRestrictions method fired..."),em(e=>({...e,loading:!0,appMessage:null}));let e=new URLSearchParams;e.append("siteId",er.siteId),e.append("occasionId",er.occasionId),e.append("api_secret",A);let a=await fetch(_+"/restrictions",{method:"POST",body:e});if(!a.ok)throw em(e=>({...e,loading:!1})),Error("Failed to fetch data");let s=await a.json();console.log(s),200==s.StatusCode&&s.data.minCovers&&s.data.maxCovers?(em(e=>({...e,minPartySize:s.data.minCovers,maxPartySize:s.data.maxCovers,loading:!1})),et?.partysize&&ed(e=>({...e,adults:Math.max(et.partysize,s.data.minCovers)}))):em(e=>
1({...e,loading:!0,appMessage:"No available Restrictions found"}))}async function ev(){if(!(er.siteId&&er.occasionId&&ec.slotDate&&er.adults&&A))return!1;console.log("> getAreas method fired...");let e=new URLSearchParams;e.append("siteId",er.siteId),e.append("occasionId",er.occasionId),e.append("dates",ec.slotDate),e.append("adults",er.adults),e.append("api_secret",A);let a=await fetch(_+"/areas",{method:"POST",body:e});if(!a.ok)throw em(e=>({...e,loading:!1})),Error("Failed to fetch data");let s=await a.json();if(console.log(er.siteId,er.occasionId,er.adults,ec.slotDate),console.log(s),200==s.StatusCode&&s.data.areas){let e=s.data.areas.filter(function(e){return e.available});console.log(e),em(a=>({...a,restAreas:e,restAreaName:!1,loading:!1})),et?.areaId&&ed(e=>({...e,areaId:et.areaId}))}else em(e=>({...e,loading:!0,appMessage:"No available Areas found"}))}async function ej(){if(!(er.siteId&&er.occasionId&&ec.Date&&er.adults&&er.areaId&&A))return!1;console.log("> getSlots method fired..."),em(e=>({...e,loading:!0,availableTimeslots:0,appMessage:null,Time:0}));let e=new URLSearchParams;e.append("rest_code",er.siteId),e.append("occasionId",er.occasionId),e.append("date_mode",ec.DateMode),e.append("booking_date",(0,i.A)(new Date(ec.Date),"yyyy-MM-dd")),e.append("party_size",er.adults),e.append("area_id",er.areaId),e.append("api_secret",A);let a=await fetch(_+"/slots",{method:"POST",body:e,next:{revalidate:10}});if(!a.ok)throw em(e=>({...e,loading:!1})),Error("Failed to fetch data");let s=await a.json();if(console.log(s),200==s.StatusCode){let e=0,a=[],t=null;if(s.data.dates.length>0&&s.data.dates.forEach(function(s){let n=[{name:"Breakfast",times:[]},{name:"Lunch",times:[]},{name:"Dinner",times:[]}];s.times.length>0&&(e++,s.times.forEach(function(e){let a={time:e.time.split(":").length>2?e.time.substr(0,5):e.time,available:e.availabilities[0].available,canEnquire:e.availabilities[0].canEnquire,isClosed:e.availabilities[0].isClosed};e.time<"11:30"&&n[0].times.push(a),e.time>"11:29"&&e.time<"17:00"&&n[1].times.push(a),e.time>"16:59"&&n[2].times.push(a),eo&&a.time==et.time&&(t=a)}),a.push({date:s.date.split("T")[0],sessions:n}),console.log(a))}),e>0){let s={restTimes:a,Time:0,availableTimeslots:e,loading:!1};if(t&&!t.isClosed&&(t.available||t.canEnquire)){let e="events"!=ec.restBookingType&&(t.isClosed||t.available||!t.canEnquire)?"booking":"enquiry";s.Time=t,s.slotType=e}em(e=>({...e,...s}))}else console.log("NO timeslots available"),em(e=>({...e,loading:!0,appMessage:'If you cannot find the availability you are looking for, please contact us by <a href="mailto:'+ec.restEmail+'" style="word-break: break-word;">'+ec.restEmail+"</a>."})),"function"==typeof ga&&(ga("send","event","create_booking","date_session_not_available","error"),ga("brasserie.send","event","create_booking","date_session_not_available","error")),"function"==typeof fbq&&(console.log(ec.pixelEventPrefix+" Abandoned cart"),fbq("trackSingleCustom",v,ec.pixelEventPrefix+" Abandoned cart"))}else em(e=>({...e,loading:!0,appMessage:"No slots available. Please select a different date."}))}async function eN(){if(!(er.siteId&&er.occasionId&&ec.slotDate&&er.adults&&ec.Time.time&&A))return!1;console.log("> getMenus method fired..."),em(e=>({...e,loading:!0,appMessage:null}));let e=new URLSearchParams;e.append("siteId",er.siteId),e.append("occasionId",er.occasionId),e.append("adults",er.adults),e.append("dates",ec.slotDate),e.append("time",ec.Time.time),e.append("api_secret",A);let a=await fetch(_+"/menus",{method:"POST",body:e});if(!a.ok)throw em(e=>({...e,loading:!1})),Error("Failed to fetch data");let s=await a.json();if(console.log(s),200==s.StatusCode&&s.data.menus){let e=s.data.menus.filter(function(e){return e.available});console.log(e);let a=ec.menuId;console.log("defaultId found...",a),a||1!=e.length||(a=e[0].id),et?.menuIds?(console.log("custom bookign menuIds found..."),ed(e=>({...e,menuIds:et.menuIds}))):ed(e=>({...e,menuIds:a}));let t=!1;e&&e.forEach(function(e){er.menuIds==e.id&&(t=e.name)}),ew(e,t)}else em(e=>({...e,loading:!0,appMessage:"No available Menus found"}))}async function ew(e,a){if(!(er.siteId&&er.occasionId&&ec.slotDate&&er.adults&&ec.Time.time&&A))return!1;console.log("> getUpsells method fired..."),em(e=>({...e,loading:!0,appMessage:null}));let s=new URLSearchParams;s.append("siteId",er.siteId),s.append("occasionId",er.occasionId),s.append("adults",er.adults),s.append("dates",ec.slotDate),s.append("time",ec.Time.time),s.append("api_secret",A);let t=await fetch(_+"/upsells",{method:"POST",body:s});if(!t.ok)throw em(e=>({...e,loading:!1})),Error("Failed to fetch data");let n=await t.json();if(console.log(n),200==n.StatusCode&&n.data.upsells){let s;n.data.upsells.length&&(s=n.data.upsells.filter(function(e){return e.available}
1)),console.log(s),em(t=>({...t,restUpsells:s,restMenus:e,restMenuName:a,loading:!1})),console.log("Menus and Upsells has been updated...")}else em(s=>({...s,loading:!0,restMenus:e,restMenuName:a,appMessage:"No available Upsells found"}))}async function ek(){if(console.log("start Add Booking"),eg(2)){let e=[];console.log("validation OK"),"function"==typeof fbq&&(console.log(ec.pixelEventPrefix+" Create"),fbq("trackSingleCustom",v,ec.pixelEventPrefix+" Create")),em(e=>({...e,loading:!0,appMessage:null})),er.upsellIds&&er.upsellIds.length&&(er.upsellIds.forEach(function(a){e.push(a.id)}),e=e.join());let a=new URLSearchParams;a.append("siteId",er.siteId),a.append("occasionId",er.occasionId),a.append("menuIds",er.menuIds),a.append("areaId",er.areaId),a.append("upsellIds",e),a.append("date",ec.slotDate),a.append("time",ec.Time.time),a.append("adults",er.adults),a.append("children",er.children),a.append("firstname",er.firstname),a.append("lastname",er.lastname),a.append("emailAddress",er.emailAddress),a.append("telephoneNumber",er.telephoneNumber),a.append("EmailOptIn",er.consent.email),a.append("SmsOptIn",er.consent.sms),a.append("promocode",eh()?ec.promocode:null),a.append("api_secret",A);let s=await fetch(_+"/"+ec.slotType,{method:"POST",body:a,next:{revalidate:10}});if(!s.ok)throw em(e=>({...e,loading:!1})),Error("Failed to fetch data");let t=await s.json();if(console.log("ajax call success"),console.log(t),200==t.response.StatusCode){if(console.log("Booking confirmed"),ed(t.response.data),console.log(t.response.data),em(e=>({...e,status:"booked",step:3,loading:!1})),eu(),"function"==typeof ga&&(ga("send","event","create_booking","success_booking","covers",t.response.data.adults),ga("brasserie.send","event","create_booking","success_booking","covers",t.response.data.adults)),"function"==typeof fbq&&(console.log(ec.pixelEventPrefix+" PartySize Change: "+t.response.data.adults),fbq("trackSingleCustom",v,ec.pixelEventPrefix+" PartySize Change",{value:t.response.data.adults}),console.log(ec.pixelEventPrefix+" Success"),fbq("trackSingleCustom",v,ec.pixelEventPrefix+" Success")),window){console.log(j,N),window.dataLayer=window.dataLayer||[];let e=(0,r.Ri)("im_ref")||!1;if(window.dataLayer.push({event:"generate_lead",pub_location:N,form_type:"Book a table",reservation_id:t.response.data.bookingReference}),e){let a={event:"affiliate_booking",reservation_id:t.response.data.bookingReference,affiliate_id:e,pub_location:N};window.dataLayer.push(a)}if(e){let a={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({im_ref:e,bookingReference:t.response.data.bookingReference,emailAddress:t.response.data.emailAddress,promocode:ec.promocode||""})},s=await fetch("/api/impact/conversions",a);if(500==s.status)for(let e=0;e<3&&200!=(s=await fetch("/api/impact/conversions",a)).status;e++);await s.json()}}ec.restAtreemoId&&(console.log("Atreemo: start call"),await eI(t.response.data))}else em(e=>({...e,loading:!0,appMessage:t.response.data.message}))}else eu()}async function eI(e){let s=new URLSearchParams;s.append("firstname",er.firstname),s.append("surname",er.lastname),s.append("email",er.emailAddress),s.append("venueRef",ec.restAtreemoId),s.append("EmailOptIn",er.consent.email),s.append("SmsOptIn",er.consent.sms),s.append("MobilPhone",er.telephoneNumber),s.append("bookingId",e.bookingReference),s.append("bookingOccassion",eP),s.append("bookingArea",ez),s.append("bookingMenu",eO),s.append("bookingType","standard"==ec.restBookingType?"Booking":"Enquiry"),s.append("restName",ec.restName),s.append("bookingDate",ec.slotDate),s.append("bookingTime",ec.Time.time),s.append("api_secret",A),a=!!(0,r.Ri)(d.Bi)&&JSON.parse((0,r.Ri)(d.Bi)),console.log(L,a),a&&!L&&(console.log("utm_cookie fallback..."),L=a.utm_source||null,F=a.utm_medium||null,$=a.utm_campaign||null,R=a.utm_term||null,U=a.utm_content||null,H=a.promocode||null),L&&s.append("utmSource",L),F&&s.append("utmMedium",F),$&&s.append("utmCampaign",$),R&&s.append("utmTerm",R),U&&s.append("utmContent",U),H&&s.append("promocode",H),W&&s.append("transaction_id",W),p?.atreemoOrigin&&(console.log("Found custom SourceID: "+p.atreemoOrigin),s.append("origin",p.atreemoOrigin)),((0,r.Ri)("im_ref")||0)&&s.append("affiliate_booking",1);let t=await fetch(S+"/add",{method:"POST",body:s});if(!t.ok)throw em(e=>({...e,loading:!1})),Error("Failed to fetch data");let n=await t.json();200==n.code||201==n.code?console.log(n):console.log("Atreemo newsletter signup: something went wrong on ajax call")}let eD=e=>{ep(e.target)};(0,n.useEffect)(()=>{console.log(`siteId changed: ${er.siteId}`),W&&el?.roomsoccasionid&&(el.occasionid=el.roomsoccasionid,console.log("TEST",el.occasionid))},[er.siteId]),(0,n.useEffect)(()=>{console.log(`Date changed: ${ec.Date}`),ec.Date&&(ed(e=>({...e,adults:0,areaId:""})),em(e=>({...e,restOccasions:null,restOccasionName:!1,restAreas:null,restAreaName:!1,restMenus:null,restMenuName:!1,restUpsells:null,restTimes:null,Time:0})),"function"==typeof ga&&(ga("send","event","create_booking","pick_date","pick"),ga("brasserie.send","event","create_booking","pick_date","pick")))}
1,[ec.Date]),(0,n.useEffect)(()=>{ec.restOccasions||eb()},[ec.Date,ec.restOccasions]),(0,n.useEffect)(()=>{console.log(`restOccasionName changed: ${ec.restOccasionName}`),ec.restOccasionName&&er.occasionId&&(console.log("Update Restrictions..."),ex())},[ec.restOccasionName]),(0,n.useEffect)(()=>{console.log(`occasionId changed: ${er.occasionId}`),er.occasionId&&(ec.restOccasions&&ec.restOccasions.forEach(function(e){er.occasionId==e.id&&(console.log("BookingData.occasionId: "+e.name),em(a=>({...a,restOccasionName:e.name,restAreaName:!1,restAreas:null,restMenus:null,restMenuName:!1,restUpsells:null,restTimes:null,Time:0})))}),ed(e=>({...e,adults:0,areaId:""})))},[er.occasionId]),(0,n.useEffect)(()=>{console.log("Party size changed..."),er.adults&&("standard"==ec.restBookingType&&er.adults>ec.maxPartySize?em(e=>({...e,loading:!0,appMessageButtons:!1,appMessage:'Looking to book a large table or party, click here to <span style="display:block; margin-top:0.5rem;"><a class="btn btn-outline-dusk" href="/event-enquiry/?location='+ec.restID+"&date="+ec.slotDate+"&partysize="+er.adults+'&editable">enquire now</a></span>'})):ec.Date&&ec.minPartySize<=er.adults&&er.adults<=ec.maxPartySize&&(console.log("Reset: Menus, Areas, Upsells, AreaId"),em(e=>({...e,restAreas:null,restMenus:null,restMenuName:!1,restUpsells:null,restTimes:null,Time:0})),ed(e=>({...e,areaId:""}))),"function"==typeof ga&&(ga("send","event","create_booking","pick_partysize","pick"),ga("brasserie.send","event","create_booking","pick_partysize","pick")))},[er.adults]),(0,n.useEffect)(()=>{er.adults&&ec.Date&&ec.minPartySize<=er.adults&&er.adults<=ec.maxPartySize&&(console.log("Party size changed (second call)..."),console.log("updateAreas method fired"),em(e=>({...e,loading:!1,appMessageButtons:!1})),er.occasionId&&er.adults&&ec.Date&&ev())},[er.adults]),(0,n.useEffect)(()=>{let e=!1;er.areaId&&ec.restAreas&&(ec.restAreas.forEach(function(a){er.areaId==a.id&&(e=a.name)}),console.log(`areaId has changed: ${er.areaId}, ${e}`),em(a=>({...a,restAreaName:e,restMenus:null,restMenuName:!1,restUpsells:null,restTimes:null,Time:0})))},[er.areaId]),(0,n.useEffect)(()=>{console.log("restAreaName has changed: "+ec.restAreaName),ec.restAreaName&&er.areaId&&(console.log("Get time slots"),ej())},[ec.restAreaName]),(0,n.useEffect)(()=>{let e=w.current.querySelector(".time-dropdown").closest(".form-group"),a="We are currently accepting enquiries for this date and would love to help you plan your visit. Please get in touch using the form below, and a team member will get back to you shortly. Alternatively, feel free to call us directly on "+ec.restPhone+". We look forward to hearing from you!";ec.Time?(e.classList.remove("input-error"),"enquiry"==ec.slotType&&"standard"==ec.restBookingType||"booking"==ec.slotType&&!1==ec.Time.available?(console.log("Timeslot is of type: enquiry"),em(e=>({...e,loading:!0,appMessage:`<span style="display:block; margin-top:2rem;">${a}</span>`,appMessageButtons:!0}))):(console.log("Update Menus and Upsells..."),em(e=>({...e,restMenus:null,restMenuName:!1,restUpsells:null})),console.log("updateMenusUpsells method fired"),em(e=>({...e,loading:!1,appMessageButtons:!1,appMessage:null})),er.occasionId&&er.adults&&ec.Date&&ec.Time&&eN()),"function"==typeof ga&&(ga("send","event","create_booking","pick_timeslot"),ga("brasserie.send","event","create_booking","pick_timeslot"))):e.classList.add("input-error")},[ec.Time]),(0,n.useEffect)(()=>{er.menuIds&&ec.restMenus?(console.log(`menuIds has changed: ${er.menuIds}`),ec.restMenus.forEach(function(e){console.log("BookingData.menuIds: "+e.name),er.menuIds==e.id&&em(a=>({...a,restMenuName:e.name}))})):er.menuIds||(console.log("No menuIds found... resetting restMenuName"),em(e=>({...e,restMenuName:!1})))},[er.menuIds,ec.restMenus]);let eM=(0,n.useMemo)(()=>p.locationOptions?p.locationOptions.map(e=>({value:e,label:e.name})):[],[p.locationOptions]),eT=(0,n.useMemo)(()=>ec.restOccasions?ec.restOccasions.filter(e=>e.available).map(e=>({value:e.id,label:e.name})):[],[ec.restOccasions]),e_=(0,n.useMemo)(()=>{if(!ec.minPartySize||!ec.maxPartySize)return[];let e=[];for(let a=ec.minPartySize;a<=ec.maxPartySize;
1a++)e.push({value:a,label:a});return"standard"==ec.restBookingType&&ec.restOccasionId==er.occasionId&&e.push({value:ec.maxPartySize+1,label:ec.maxPartySize+1+" or more"}),e},[ec.minPartySize,ec.maxPartySize,ec.restBookingType,ec.restOccasionId,er.occasionId]),eS=(0,n.useMemo)(()=>ec.restAreas?ec.restAreas.filter(e=>e.available).map(e=>({value:e.id,label:e.name})):[],[ec.restAreas]),eA=(0,n.useMemo)(()=>ec.restMenus?ec.restMenus.filter(e=>e.available).map(e=>({value:e.id,label:e.name})):[],[ec.restMenus]),eP=(0,n.useMemo)(()=>{if(!ec.restOccasions||!er.occasionId)return!1;let e=ec.restOccasions.find(e=>e.id==er.occasionId);return e?.name||!1},[ec.restOccasions,er.occasionId]),ez=(0,n.useMemo)(()=>{if(!ec.restAreas||!er.areaId)return!1;let e=ec.restAreas.find(e=>e.id==er.areaId);return e?.name||!1},[ec.restAreas,er.areaId]),eO=(0,n.useMemo)(()=>{if(!ec.restMenus||!er.menuIds)return!1;let e=ec.restMenus.find(e=>e.id==er.menuIds);return e?.name||!1},[ec.restMenus,er.menuIds]);return(0,n.useEffect)(()=>{console.log(p.restBookingType+" widget loaded"),a=!!(0,r.Ri)(d.Bi)&&JSON.parse((0,r.Ri)(d.Bi)),"function"==typeof ga&&(console.log(x+" GA Start"),ga("create","UA-61208253-1","auto",{}),ga("send","pageview"),ga("create","UA-61485414-1","auto",{name:"brasserie",allowLinker:!0}),ga("brasserie.send","pageview")),"function"==typeof fbq&&(console.log(v+" FB Start"),fbq("trackSingleCustom",v,ec.pixelEventPrefix+" Start"));let e=w.current?.querySelectorAll("[required]");return document.querySelector(".zonalevents-ie-message").style.display="none",e&&e.forEach(function(e){e.addEventListener("change",eD)}),"function"==typeof ga&&(ga("send","event","widget","init","success"),ga("brasserie.send","event","widget","init","success")),()=>{let e=w.current?.querySelectorAll("[required]");e&&e.forEach(function(e){e.removeEventListener("change",eD)})}},[T]),(0,n.useEffect)(()=>{if(X&&p?.locationOptions?.length){let e=p.locationOptions.find(e=>e.zonalId===X);e&&ey(e)}else X||em(e=>({...e,loading:!1}))},[X,p?.locationOptions]),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"zonalevents-ie-message",children:[(0,t.jsx)("p",{children:"We are currently experiencing technical issues with displaying our table reservation functionality in your web browser. Please open this website using one of the following web browsers to complete your booking:"}),(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{children:"Microsoft Edge"}),(0,t.jsx)("li",{children:"Google Chrome"}),(0,t.jsx)("li",{children:"Firefox"})]}),(0,t.jsx)("p",{children:"Alternatively, please call the restaurant directly and we will be happy to assist you with completing your reservation. "})]}),(0,t.jsxs)("div",{ref:w,className:"zonalevents-widget v1",id:"zonalevents-app",children:[W&&O&&(0,t.jsx)(u,{BookingID:W,BookingData:er,setBookingData:ed,state:ec,setState:em,GuestlineApi:O,optHotelId:J}),(0,t.jsxs)("form",{id:"zonalevents-booking-form",name:"zonalevents-booking-form",action:"",method:"POST",className:"text-center text-lg-start",children:[(0,t.jsxs)("div",{className:`form-group ${1==ec.step&&!X?"":"d-none"}`,children:[(0,t.jsx)("label",{htmlFor:"zonalevents_location_select",className:"form-label text-center text-lg-start",children:"Location"}),(0,t.jsx)(f.Ay,{placeholder:"Please select",isSearchable:!1,options:eM,value:{value:el,label:ec.restName||"Please select"},onChange:(e,a)=>ey(e.value),className:"react-select-container",classNamePrefix:"react-select"})]}),!!p.booking_treats&&(0,t.jsx)(b,{location:p.locationOptions?.find(e=>e.id===ec.restID)}),(0,t.jsx)("div",{id:"header",className:er.siteId&&"booked"!=ec.status?"":"d-none",children:(0,t.jsxs)("div",{className:"inner",children:[(0,t.jsxs)("h3",{children:[ec.restName," ",(0,t.jsx)("br",{}),(0,t.jsx)("a",{href:`tel:${ec.restPhone}`,children:ec.restPhone})]}),ec.usePromocodes&&L&&(0,t.jsxs)("h4",{children:["Joining us on a Thursday evening for a spot of Apr\xe8s ski? ",(0,t.jsx)("br",{className:"d-none d-md-inline"}),"Call us directly on ",ec.restPhone," so we can allocate you a table"]}),(0,t.jsx)("div",{className:"events"==ec.restBookingType&&1==ec.step?"":"d-none",dangerouslySetInnerHTML:{__html:Z}})]})}),(0,t.jsxs)("div",{className:"widget-content",children:[(0,t.jsxs)("div",{ref:I,id:"zonalevents_page_1",className:`widget-page ${er.siteId&&1==ec.step?"":"d-none"}`,"data-role":"page",children:[(0,t.jsxs)("div",{className:"inner",children:[(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{htmlFor:"zonalevents_Date",className:"form-label text-center text-lg-start",children:"Date"}),(0,t.jsx)("input",{type:"text",className:`form-control ${eo&&p.booking_date&&!Y?"":"d-none"}`,value:ec.slotDateFormated,disabled:!0}),(0,t.jsxs)(m.A,{className:`dropdown ${eo&&p.booking_date&&!Y?"d-none":"date-dropdown"}`,onToggle:e=>em(e=>({...e,showDateDropdown:!e.showDateDropdown})),show:ec.showDateDropdown,children:[(0,t.jsxs)(m.A.Toggle,{className:"form-control dropdown-toggle",children:[ec.slotDateFormated||"Select Date",(0,t.jsx)("span",{className:"dropdown-indicator",children:(0,t.jsx)("svg",{height:"20",width:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})})})]}),(0,t.jsx)(m.A.Menu,{renderOnMount:!0,as:"div",className:"dropdown-menu",children:(0,t.jsx)("div",{className:"dropdown-menu-inner",children:(0,t.jsx)(c.Ay,{instanceId:B,className:"mx-auto",value:ec.Date,prevLabel:"Prev month",prev2Label:null,nextLabel:"Next month",next2Label:null,disabled:!0,onChange:(e,a)=>em(a=>({...a,Date:e,slotDate:(0,i.A)(new Date(e),"yyyy-MM-dd"),slotDateFormated:(0,i.A)(new Date(e),"do MMMM y"),showDateDropdown:!1})),minDate:ec.minDate,maxDate:ec.maxDate,activeStartDate:ec.minActiveDate,onActiveStartDateChange:({activeStartDate:e,value:a,view:s})=>{console.log("vv:",e,a,s),em(a=>({...a,minActiveDate:e})),console.log("state:",ec.minActiveDate)},formatLongDate:(e,a)=>(0,i.A)(new Date(a),"yyyy-MM-dd")})})})]}),(0,t.jsx)(y,{state:ec})]}),(0,t.jsxs)("div",{className:`form-group ${ec.restOccasionShow&&ec.Date?"":"d-none"}`,children:[(0,t.jsx)("label",{htmlFor:"zonalevents_occasionId",className:"form-label text-center text-lg-start",children:"Occasion"}),(0,t.jsx)(f.Ay,{isDisabled:!!eo&&!!p.booking_occasionId,placeholder:"Choose an occasion",isSearchable:!1,options:eT,value:{value:er.occasionId,label:eP||"Choose an occasion"},onChange:(e,a)=>ed(a=>({...a,occasionId:e.value})),className:"react-select-container",classNamePrefix:"react-select"}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{className:`form-group ${er.occasionId&&er.adults&&ec.Date?"":"d-none"}`,children:[(0,t.jsx)("label",{htmlFor:"zonalevents_AdultCovers",className:"form-label text-center text-lg-start",children:"Party Size"}),(0,t.jsx)(f.Ay,{isDisabled:!!eo&&!!p.booking_partysize&&!Y,placeholder:"How many guests?",isSearchable:!1,options:e_,value:{value:er.adults,label:er.adults},onChange:(e,a)=>ed(a=>({...a,adults:e.value})),className:"react-select-container",classNamePrefix:"react-select"}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{id:"area-wrapper",className:er.adults<=ec.maxPartySize&&er.occasionId?"":"d-none",children:[er.adults>0&&ec.restAreaShow&&ec.restAreas&&(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{htmlFor:"zonalevents_areaId",className:"form-label text-center text-lg-start",children:"Venue area"}),(0,t.jsx)(f.Ay,{isDisabled:!!eo&&!!p.booking_areaId,placeholder:"Choose area",isSearchable:!1,options:eS,value:{value:er.areaId,label:ez||"Choose area"},onChange:(e,a)=>ed(a=>({...a,areaId:e.value})),className:"react-select-container",classNamePrefix:"react-select"}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{className:`form-group ${ec.Date&&er.adults&&er.areaId&&ec.restTimes&&ec.availableTimeslots?"":"d-none"}`,children:[(0,t.jsx)("label",{htmlFor:"zonalevents_booking_time",className:"form-label text-center text-lg-start",children:"Time"}),(0,t.jsxs)("div",{ref:k,className:"dropdown time-dropdown",children:[(0,t.jsx)("input",{type:"text",className:`form-control ${et?.time&&p.booking_time&&!Y?"":"d-none"}`,value:ec.Time?ec.Time.time:"Choose Time",id:"zonalevents_booking_time",disabled:!0}),(0,t.jsxs)(m.A,{onToggle:()=>{let e=k.current.querySelector(".dropdown-menu"),a={top:e.closest(".form-group").offsetTop,left:e.closest(".form-group").offsetLeft},s=document.querySelector(".header");console.log(a,s?s.style.clientHeight:0)},onSelect:()=>console.log("menu itme selected"),className:eo&&p.booking_time&&!Y?"d-none":"time-dropdown",children:[(0,t.jsxs)(m.A.Toggle,{className:"form-control dropdown-toggle scroll-me-up",children:[ec.Time?ec.Time.time:"Choose Time","range"==ec.DateMode&&ec.Time?" on "+ec.slotDate:"",(0,t.jsx)("span",{className:"dropdown-indicator",children:(0,t.jsx)("svg",{height:"20",width:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})})})]}),(0,t.jsx)(m.A.Menu,{renderOnMount:!0,as:"div",className:"dropdown-menu",children:(0,t.jsxs)("div",{className:"dropdown-menu-inner",children:[ec.restTimes&&ec.restTimes.map((e,a)=>(0,t.jsxs)("div",{className:"time-session",children:[(0,t.jsx)("h4",{className:`time-session-label ${ec.restTimes.length>1?"":"d-none"}`,children:e.date}),e.sessions&&e.sessions.map((s,n)=>(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:`time-session-label ${s.times.length>1?"":"d-none"}`,children:s.name}),(0,t.jsx)("ul",{className:"time-list",children:s.times&&s.times.map((s,o)=>{var l,r,d;let c=!s.isClosed&&!s.available&&s.canEnquire,u=s.isClosed||!s.available&&!s.canEnquire||(l=e.date+"T"+s.time,r=new Date,d=new Date(l),r.getFullYear(),String(r.getMonth()+1).padStart(2,"0"),r.getDate(),r.getTime()>d.getTime());return(0,t.jsx)("li",{className:"time-item",children:(0,t.jsxs)(m.A.Item,{onClick:a=>u?null:((e,a,s,t)=>{if(e.target,a===ec.Time)return!1;s&&em(e=>({...e,Time:a,slotDate:(0,i.A)(new Date(s),"yyyy-MM-dd"),slotDateFormated:(0,i.A)(new Date(s),"do MMMM y"),slotType:t}))})(a,s,e.date,"events"==ec.restBookingType||c?"enquiry":"booking"),children:[!u&&(0,t.jsx)("input",{type:"radio",id:`zonalevents_time_${a+n}_${o}`,name:"zonalevents_Time",className:"sr-only","data-date":e.date,"data-type":"events"==ec.restBookingType||c?"enquiry":"booking"}),(0,t.jsx)("label",{htmlFor:`zonalevents_time_${a+n}_${o}`,disabled:u,className:"standard"==ec.restBookingType&&c?"limited":"",children:s.time})]})},`time-slot-index-${o}`)})})]},`time-session-index-${n}`))]},`time-day-index-${a}`)),(0,t.jsxs)("p",{className:"time-legend",children:[(0,t.jsx)("span",{children:"Available"}),(0,t.jsx)("span",{className:`limited ${"standard"==ec.restBookingType?"":"d-none"}`,children:"Enquiries only"}),(0,t.jsx)("span",{disabled:!0,children:"Unavailable"})]})]})})]})]}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{className:`form-group ${ec.Time&&er.areaId&&ec.restMenuShow&&ec.restMenus&&ec.restMenus.length>1?"":"d-none"}`,children:[(0,t.jsx)("label",{htmlFor:"zonalevents_menuId",className:"form-label text-center text-lg-start",children:"Select your preferred menu
1choice"}),(0,t.jsx)(f.Ay,{isDisabled:!!eo&&!!p.booking_menuIds,placeholder:"Choose menu",isSearchable:!1,options:eA,value:{value:er.menuIds,label:eO||"Choose menu"},onChange:(e,a)=>ed(a=>({...a,menuIds:e.value})),className:"react-select-container",classNamePrefix:"react-select"}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsx)("div",{className:`form-group ${ec.Time&&ec.restUpsellShow&&ec.restUpsells?"":"d-none"}`,children:ec.restUpsells&&ec.restUpsells.map((e,a)=>(0,t.jsxs)("div",{className:"form-group form-inline",children:[(0,t.jsx)("input",{type:"checkbox",id:`upsell${e.id}`,className:"form-control",value:e.id,onChange:a=>{var s;return s=a.target,void(console.log(`upsellIds changed: ${s.checked}, ${e}`),ed(a=>{let t=a.upsellIds||[],n=s.checked?[...t,e]:t.filter(a=>a.id!==e.id);return{...a,upsellIds:n}}))}}),(0,t.jsxs)("label",{htmlFor:`upsell${e.id}`,children:[(0,t.jsxs)("strong",{children:[e.name,e.price?" £"+e.price:""]}),(0,t.jsx)("br",{}),e.description]})]},`upsells-index-${a}`))})]})]}),(0,t.jsx)("div",{className:er.adults<=ec.maxPartySize?"":"d-none",children:(0,t.jsx)("div",{className:`inner ${"book"==ec.status&&1==ec.step?"":"d-none"}`,children:(0,t.jsx)("input",{type:"button",className:"btn btn-outline-dusk",value:"Next",onClick:()=>void(eg(1)&&ef(2)),disabled:0==er.siteId||!(er.adults&&er.menuIds&&ec.Date&&ec.Time)})})})]}),(0,t.jsxs)("div",{ref:D,id:"zonalevents_page_2",className:`widget-page ${er.siteId&&2==ec.step?"":"d-none"}`,"data-role":"page",children:[(0,t.jsxs)("div",{className:"inner",children:[(0,t.jsx)("h2",{children:"Booking details"}),(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{htmlFor:"zonalevents_FirstName",className:"form-label text-center text-lg-start",children:"First Name"}),(0,t.jsx)("input",{type:"text",id:"zonalevents_FirstName",name:"zonalevents_FirstName",value:er.firstname,onChange:e=>ed(a=>({...a,firstname:e.target.value})),className:"form-control",required:!0}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{htmlFor:"zonalevents_LastName",className:"form-label text-center text-lg-start",children:"Last Name"}),(0,t.jsx)("input",{type:"text",id:"zonalevents_LastName",name:"zonalevents_LastName",value:er.lastname,onChange:e=>ed(a=>({...a,lastname:e.target.value})),className:"form-control",required:!0}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{htmlFor:"zonalevents_Email",className:"form-label text-center text-lg-start",children:"Email"}),(0,t.jsx)("input",{type:"email",id:"zonalevents_Email",name:"zonalevents_Email",value:er.emailAddress,onChange:e=>ed(a=>({...a,emailAddress:e.target.value})),className:"form-control",required:!0}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{htmlFor:"zonalevents_PhoneNumber",className:"form-label text-center text-lg-start",children:"Telephone Number (no spaces)"}),(0,t.jsx)("input",{type:"tel",id:"zonalevents_PhoneNumber",name:"zonalevents_PhoneNumber",value:er.telephoneNumber,onChange:e=>ed(a=>({...a,telephoneNumber:e.target.value})),className:"form-control",required:!0}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]})]}),(0,t.jsxs)("div",{className:"inner",children:[(0,t.jsxs)("div",{className:"form-group form-inline",children:[(0,t.jsx)("input",{type:"checkbox",id:"zonalevents_EmailOptIn",name:"zonalevents_EmailOptIn",onChange:e=>{ed(a=>({...a,consent:{...a.consent,email:e.target.checked}}))},className:"form-control",value:"1"}),(0,t.jsx)("label",{htmlFor:"zonalevents_EmailOptIn",children:"Select if you would like to receive emails from us regarding news, events and offers."})]}),(0,t.jsxs)("div",{className:"form-group form-inline",children:[(0,t.jsx)("input",{type:"checkbox",id:"zonalevents_SmsOptIn",name:"zonalevents_SmsOptIn",onChange:e=>{ed(a=>({...a,consent:{...a.consent,sms:e.target.checked}}))},className:"form-control",value:"1"}),(0,t.jsx)("label",{htmlFor:"zonalevents_SmsOptIn",children:"Select if you would like to receive SMS/text messages about news, offers and events from us."})]})]}),(0,t.jsxs)("div",{className:"inner",children:[(0,t.jsx)("p",{children:"We will only send you marketing information from your favourite pub, Heartwood Inns and/or Brasserie Blanc if you consent to this by selecting the options above. From time to time we may also include information from trusted complementary third party brands with whom we are running events or offers but we will never share your details with them."}),(0,t.jsx)("p",{children:"Please note you are able to unsubscribe from communications at any time."}),(0,t.jsx)("p",{children:"The day after your booking you will receive an optional feedback request (which is not a marketing message)."}),(0,t.jsxs)("span",{className:"standard"==ec.restBookingType?"":"d-none",children:["Our booking terms and conditions can be found ",(0,t.jsx)("a",{href:"http://bookings.liveres.co.uk/tc.html",target:"_blank",rel:"nofollow noopener",children:"here"})," and apply to all bookings. "]}),(0,t.jsxs)("span",{className:"events"==ec.restBookingType?"":"d-none",children:["Our booking enquiries terms and conditions can be found ",(0,t.jsx)("a",{href:"http://bookings.liveres.co.uk/tc.html",target:"_blank",rel:"nofollow noopener",children:"here"})," and apply to all bookings for events or groups. "]}),(0,t.jsxs)("span",{children:["Click ",(0,t.jsx)("a",{href:"//heartwoodcollection.com/legal/",target:"_blank",children:"here"})," to review our privacy policy. "]})]}),(0,t.jsxs)("p",{className:"booking-details",children:[(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Date:"})," ",(0,t.jsx)("span",{className:"line-detail",children:ec.slotDateFormated})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Time:"})," ",(0,t.jsx)("span",{className:"line-detail",children:ec.Time.time})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Party size:"})," ",(0,t.jsxs)("span",{className:"line-detail",children:[er.adults," guests"]})]}),ec.restOccasionShow&&(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Occasion:"})," ",(0,t.jsx)("span",{className:"line-detail",children:eP})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Venue:"})," ",(0,t.jsx)("span",{className:"line-detail",children:ec.restName})]}),ez&&(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Area:"})," ",(0,t.jsx)("span",{className:"line-detail",children:ez})]}),eO&&(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Menu choice:"})," ",(0,t.jsx)("span",{className:"line-detail",children:eO})]}),er.upsellIds&&er.upsellIds.length>0&&(0,t.jsxs)("span",{className:"single-line",className:"zonalevents-upsell-name",children:[(0,t.jsx)("strong",{children:"Extras: "}),er.upsellIds&&er.upsellIds.map((e,a)=>(0,t.jsxs)("span",{children:[e.name,e.price?" £"+e.price:""]},`summary-upsells-index-${a}`))]})]}),(0,t.jsxs)("div",{className:`inner d-flex flex-row ${"book"==ec.status?"":"d-none"}`,children:[(0,t.jsx)("button",{type:"button",className:"btn btn-outline-dusk me-10",onClick:()=>ef(ec.step-1),children:"Back"}),(0,t.jsx)("input",{type:"button",className:"btn btn-primary ms-10",value:"events"==ec.restBookingType?"Enquire Now":"Book",onClick:()=>ek()})]})]}),(0,t.jsx)("div",{ref:M,id:"zonalevents_page_3",className:`widget-page ${er.siteId&&3==ec.step?"":"d-none"}`,"data-role":"page",children:(0,t.jsxs)("div",{className:"inner",children:["standard"==ec.restBookingType?(0,t.jsxs)("div",{children:[(0,t.jsxs)("h4",{children:["Thank you for making a dining reservation at ",ec.restName,"."]}),(0,t.jsxs)("p",{className:"booking-details",children:[(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Confirmation code:"})," ",(0,t.jsx)("span",{className:"line-detail",children:er.bookingReference})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Date:"})," ",(0,t.jsx)("span",{className:"line-detail",children:ec.slotDateFormated})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Time:"})," ",(0,t.jsx)("span",{className:"line-detail",children:ec.Time.time})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Party size:"})," ",(0,t.jsxs)("span",{className:"line-detail",children:[er.adults," guests"]})]}),ec.restOccasionShow&&(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Occasion:"})," ",(0,t.jsx)("span",{className:"line-detail",children:eP})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Venue:"})," ",(0,t.jsx)("span",{className:"line-detail",children:ec.restName})]}),ez&&(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Area:"})," ",(0,t.jsx)("span",{className:"line-detail",children:ez})]}),er?.menus&&er?.menus[0]?.name&&(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Menu choice:"})," ",(0,t.jsx)("span",{className:"line-detail",children:er?.menus[0]?.name})]}),er.upsellIds&&er.upsellIds.length>0&&(0,t.jsxs)("span",{className:"single-line",className:"zonalevents-upsell-name",children:[(0,t.jsx)("strong",{children:"Extras: "}),er.upsellIds&&er.upsellIds.map((e,a)=>(0,t.jsxs)("span",{children:[e.name,e.price?" £"+e.price:""]},`summary-upsells-index-${a}`))]})]}),ec.restUrl&&(0,t.jsxs)("p",{children:["Why don't you look at ",(0,t.jsx)("a",{href:`${ec.restUrl}menus/`,title:"Menus",children:"our menus"})," ahead of your visit? "]})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("h4",{children:["Thank you for making an enquiry at ",ec.restName," for ",er.adults," people at ",ec.slotDateFormated," ",ec.Time.time,"."]}),(0,t.jsxs)("p",{children:["A member of our team will be in touch shortly to discu
1ss your enquiry in more detail. ",(0,t.jsx)("br",{}),"The contact number we have noted for you is: ",er.telephoneNumber]}),(0,t.jsxs)("p",{children:["Enquiry reference code: ",er.bookingReference]}),(0,t.jsx)("p",{children:"We look forward to speaking with you soon."})]}),W&&(0,t.jsxs)("p",{className:"text-center",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-outline-dusk btn-sm btn-narrow mx-10 ms-lg-0",onClick:()=>{ed(e=>({...e,adults:0,areaId:"",menuIds:"",upsellIds:[]})),em(e=>({...e,status:"book",step:1,loading:!1,appMessage:null,appMessageButtons:!1}))},children:"Book another table"}),"clean"==V?(0,t.jsx)("button",{type:"button",className:"btn btn-outline-dusk btn-sm btn-narrow mx-10",onClick:()=>{let e=top.window.document.querySelector(".gldbm-panel__close");console.log("Lets find closing button..."),e&&(console.log("CLosing iframe now..."),e.click())},children:"Finish"}):(0,t.jsx)(g(),{href:"/",className:"btn btn-outline-dusk btn-sm btn-narrow mx-10",children:"Finish"})]}),Q?(0,t.jsx)("div",{dangerouslySetInnerHTML:{__html:Q}}):(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{children:"If you have any queries regarding your booking or if we can be of further assistance please do not hesitate to contact us. "}),(0,t.jsx)("p",{children:(0,t.jsx)("em",{children:"Thank you and we look forward to seeing you."})})]})]})})]})]}),(0,t.jsxs)("div",{className:`zonalevents-loader ${ec.loading?"":"d-none"}`,children:[(0,t.jsx)("div",{className:"loader",children:"Loading..."}),(0,t.jsxs)("div",{className:`zonalevents-message ${ec.appMessage?"":"d-none"}`,children:[(0,t.jsx)("span",{className:`zonalevents-message-close ${!ec.appMessageButtons?"":"d-none"}`,onClick:e=>{em(e=>({...e,loading:!1}))},children:"\xd7"}),(0,t.jsx)("p",{dangerouslySetInnerHTML:{__html:ec.appMessage}}),(0,t.jsxs)("p",{className:`${ec.appMessageButtons?"":"d-none"}`,style:{margin:"0.5rem 0 0"},children:[(0,t.jsx)("a",{href:`/event-enquiry/?location=${ec.restID}&date=${ec.slotDate}&partysize=${er.adults}&editable`,className:"btn btn-outline-dusk mb-15",children:"Enquire"}),(0,t.jsx)("button",{className:"btn btn-outline-dusk",onClick:()=>em(e=>({...e,loading:!1,Time:0})),children:"Try Again"})]})]})]})]})]})}function v(e){let a,s,p,x,v,{settings:j}=(0,o.M)(),N=e.settings,w=(j?.acf.optGeneral.optGtm,j?.acf.optGeneral.optPixel||!1),k=(j?.acf.optGeneral.optBrand,j?.general.title||!1),I=(0,n.useRef)(),D=(0,n.useRef)(!1),M=((0,n.useRef)(),(0,n.useRef)()),T=(0,n.useRef)(),_=(0,n.useRef)(),S=(0,l.useRouter)(),A=N.restApi+"/collins/v1",P=N.restApi+"/atreemo/v1",z="heartwood-secret-phrase-hard2guess",O=N.excludedOccasions,E=N.debug?console.log.bind(console,"[booking]"):()=>{},[C,q]=(0,n.useState)(null),[B,L]=(0,n.useState)(null),F=(0,n.useId)(),{utm_source:$,utm_medium:R,utm_campaign:U,utm_term:H,utm_content:G,promocode:Y,editable:W}=S.query,J=void 0!==W,{transaction_id:V,hotel_id:X,layout:Z}
1=S.query,K=B??N.defaultLocation,[Q,ee]=(0,n.useState)(null),[ea,es]=(0,n.useState)(null),et=2*Math.ceil((new Date().getHours()+2)/2),en=et<10?"0"+et+":00":et+":00",[eo,el]=(0,n.useState)(),ei=!!N.booking_date,[er,ed]=(0,n.useState)(null),[ec,em]=(0,n.useState)(()=>({bookingReference:null,siteId:N.defaultLocation||0,occasionId:"",duration:"",menuIds:"",upsellIds:[],adults:0,children:0,date:"",time:"",firstname:"",lastname:"",emailAddress:"",telephoneNumber:"",dob_day:"",dob_month:"",dob_year:"",notes:"",policyAccepted:!1,consent:{email:!1,sms:!1}})),[eu,ep]=(0,n.useState)(()=>{let e=new Date;return{step:1,status:"book",loading:!0,appMessage:null,appMessageButtons:!1,showDateDropdown:!1,restID:!1,restUrl:!1,restName:"",restPhone:"",restEmail:"",restAtreemoId:!1,restBookingType:N.restBookingType||"standard",restOccasionId:!1,restOccasionName:!1,restOccasionShow:"events"==N.restBookingType,restMenuName:!1,restMenuShow:!0,restUpsellShow:!0,restTimes:null,restDurations:null,restOccasions:null,restMenus:null,restUpsells:null,minPartySize:1,maxPartySize:9,marketingOptIn:"",marketingPrefIds:[],minDate:e,minActiveDate:new Date(e.getFullYear(),e.getMonth(),e.getDate()),maxDate:null,calendarMessages:null,Date:"",slotDate:null,slotDateFormated:null,Time:0,slotType:"enquiry",availableTimeslots:0,menuId:null,monthAvailability:{},loadingMonths:{},loadedMonths:{},advanceDatePending:!1,deposit:null,pixelEventPrefix:"events"==N.restBookingType?"Enquiry:":"Book table:",usePromocodes:!1}});function eg(){let e=I.current,a=e.closest(".booking-wrapper");a&&(e=a),e&&(0,h.VG)(window,{behavior:"smooth",top:e.offsetTop-180})}function eh(e){if(void 0===e)return!1;let a=e.value;if("radio"==e.getAttribute("type")){let a=e.getAttribute("name"),s=0,t=I.current?.querySelectorAll('[name="'+a+'"]');return!t||((t.forEach(function(e){e.checked&&s++}),s)?(e.closest(".form-group").classList.remove("input-error"),!0):(e.closest(".form-group").classList.add("input-error"),!1))}return a&&0!=a&&"null"!=a?"email"!=e.getAttribute("type")||/^(([^<>()\[\]\\.,;:\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,}))$/.test(a)?(e.closest(".form-group").classList.remove("input-error"),!0):(e.closest(".form-group").classList.add("input-error"),!1):(e.closest(".form-group").classList.add("input-error"),!1)}function ef(e){if(!I.current)return!1;let a=I.current?.querySelector("#zonalevents_page_"+e),s=a?.querySelectorAll("[required]"),t=0;return!function(e){if(!I.current)return;let a=I.current?.querySelector("#zonalevents_page_"+e),s=a?.querySelectorAll(".input-error");s&&s.forEach(e=>{e.classList.remove("input-error")})}(e),s&&s.forEach(function(e){!eh(e)&&t++}),"1"!=e||eu.Time||(t++,I.current.querySelector("#zonalevents_booking_time").closest(".form-group").classList.add("input-error")),!t}(0,n.useEffect)(()=>{if(X&&N?.locationOptions?.length){let e=N.locationOptions.find(e=>e.hotelid===X);
1(e?.zonalId||e?.id)&&L(e.zonalId||e.id)}},[X,N?.locationOptions]),(0,n.useEffect)(()=>{ec.siteId&&z&&ex()},[ec.siteId]);let ey=e=>{if(void 0===e)return!1;ep(a=>({...a,step:e})),eg(),"function"==typeof fbq&&2==e&&fbq("trackSingleCustom",w,eu.pixelEventPrefix+" Progress")};function eb(e){if(er&&er.id==e.id)return!1;D.current=!1;let a=N.booking_date||e.mindate||null,s={restID:e.id,restUrl:e.url,restName:e.name,restPhone:e.phone,restEmail:e.email,restAtreemoId:e.atreemoid,restOccasionId:e.collins_occasionid,restOccasionShow:"events"==N.restBookingType||!e.collins_occasionid,menuId:e.collins_menuid,restMenuShow:1==e.collins_menushow,restUpsellShow:1==e.collins_upsellshow,usePromocodes:1==e.usePromocodes,restMenus:!1,restUpsells:!1,loading:!1,advanceDatePending:!1,restOccasions:null,restOccasionName:!1,restMenuName:!1,restTimes:null,Time:0,Date:"",maxDate:e.maxdate?new Date(e.maxdate):null,calendarMessages:e.calendarMessages};a&&!N.booking_date&&(0,r.nb)(new Date(a).getTime())&&(a=new Date);let t={date:a?new Date(a):new Date,partysize:N.booking_partysize||2,time:N.booking_time||en,menuIds:ei&&N.booking_menuIds?N.booking_menuIds:e.collins_menuid};if(el(t),s.minDate=a?new Date(a):t.date,s.minActiveDate=a?new Date(a):t.date,s.Date=t.date,s.slotDate=(0,i.A)(new Date(t.date),"yyyy-MM-dd"),s.slotDateFormated=(0,i.A)(new Date(t?.date),"do MMMM y"),"book"==eu.status){let e;s.step=1,em(e=>({...e,adults:0})),e={Date:new Date,Time:0,slotDate:null,slotDateFormated:null,slotType:"enquiry",restTimes:null,loading:!1,appMessage:null,appMessageButtons:!1},eo?.date&&(e.Date=eo.date,e.slotDate=(0,i.A)(new Date(eo.date),"yyyy-MM-dd"),e.slotDateFormated=(0,i.A)(new Date(eo?.date),"do MMMM y")),ep(a=>({...a,...e}))}ep(e=>({...e,...s})),em(a=>({...a,siteId:e.collinsId,adults:t.partysize})),"function"==typeof fbq&&1==eu.step&&fbq("trackSingleCustom",w,eu.pixelEventPrefix+" Location change",{value:eu.restName}),V&&e.glapiurl&&e.glapipass&&e.glapioperator&&e.glapiinterface&&q({glApiUrl:e.glapiurl,glApiPass:e.glapipass,glApiOperator:e.glapioperator,glApiInterface:e.glapiinterface}),ee(e.enquiryInfo),es(e.confirmationInfo),ed(e)}async function ex(){if(!(ec.siteId&&z))return!1;try{let e=new URLSearchParams;e.append("siteId",ec.siteId),e.append("api_secret",z);let a=await fetch(A+"/marketing-preferences",{method:"POST",body:e});if(!a.ok)return!1;let s=await a.json();E("getMarketingPreferences response",s);let t=s?.data?.marketing_preferences;200==s.StatusCode&&Array.isArray(t)&&t.length&&t[0].description&&ep(e=>({...e,marketingOptIn:t[0].description,marketingPrefIds:t.map(e=>e.id).filter(Boolean)}))}catch(e){E("getMarketingPreferences failed, using default label",e)}}async function ev(){if(!(ec.siteId&&eu.Date&&z))return!1;ep(e=>({...e,loading:!0,appMessage:null}));let e=new URLSearchParams;e.append("siteId",ec.siteId),e.append("booking_date",(0,i.A)(new Date(eu.Date),"yyyy-MM-dd")),ec.adults&&e.append("party_size",ec.adults),e.append("api_secret",z);let a=await fetch(A+"/booking-types",{method:"POST",body:e});if(!a.ok)throw ep(e=>({...e,loading:!1})),Error("Failed to fetch data");let s=await a.json();if(E("getOccasions response",s),200==s.StatusCode&&s.data.booking_types)if("events"==eu.restBookingType){let e=s.data.booking_types.filter(function(e){return e.id.toString()!=eu.restOccasionId.toString()});O&&(e=e.filter(function(e){return -1==O.indexOf(e.id.toString())})),ep(a=>({...a,restOccasions:e,loading:!1})),em(e=>({...e,occasionId:""}))}else{let e=s.data.booking_types,a=e.filter(function(e){return e.available});if(a.length){D.current=!0;let s=e=>e&&a.some(function(a){return a.id.toString()==e.toString()}),t=s(ec.occasionId)?ec.occasionId:s(eu.restOccasionId)?eu.restOccasionId:"";t!=ec.occasionId&&em(e=>({...e,occasionId:t}));let n="";a.forEach(function(e){t&&t.toString()==e.id.toString()&&(n=e.name)}),ep(a=>({...a,restOccasions:e,restOccasionName:n,loading:!1}))}else if(D.current)em(e=>({...e,occasionId:""})),ep(a=>({...a,restOccasions:e,restOccasionName:!1,loading:!0,appMessageButtons:!1,appMessage:s.data&&s.data.notice?s.data.notice:"No booking types available for this date. Please try another date or party size."}));else if(D.current=!0,eu.restOccasionId)em(e=>({...e,occasionId:eu.restOccasionId})),ep(a=>({...a,restOccasions:e,restOccasionName:!1,advanceDatePending:!0,appMessage:null,loading:!0}));else{let a=new Date;a.setDate(a.getDate()+1);
1let s=(0,i.A)(a,"yyyy-MM-dd");ep(t=>({...t,restOccasions:e,restOccasionName:!1,Date:a,slotDate:s,slotDateFormated:(0,i.A)(a,"do MMMM y"),minActiveDate:a,appMessage:null,loading:!0}))}}else em(e=>({...e,occasionId:""})),ep(e=>({...e,restOccasions:null,restOccasionName:!1,loading:!0,appMessageButtons:!1,appMessage:s.data&&s.data.notice?s.data.notice:"No booking types available for this date. Please try another date or party size."}))}async function ej(e){if(!(ec.siteId&&ec.occasionId&&ec.adults&&z))return;let a=(0,i.A)(new Date(e),"yyyy-MM");ep(e=>({...e,loadingMonths:{...e.loadingMonths,[a]:!0}}));try{let s=new URLSearchParams;s.append("siteId",ec.siteId),s.append("occasionId",ec.occasionId),s.append("booking_date",(0,i.A)(new Date(e),"yyyy-MM-dd")),s.append("party_size",ec.adults),s.append("api_secret",z);let t=await fetch(A+"/month-availability",{method:"POST",body:s});if(t.ok){let e=await t.json();if(200==e.StatusCode&&Array.isArray(e.data.month_availability)){let s={};e.data.month_availability.forEach(function(e){e&&e.date&&(s[e.date]=!!e.available)}),ep(e=>({...e,monthAvailability:{...e.monthAvailability,...s},loadedMonths:{...e.loadedMonths,[a]:!0}}))}}}finally{ep(e=>{let s={...e.loadingMonths};return delete s[a],{...e,loadingMonths:s}})}}async function eN(){if(!(ec.siteId&&ec.occasionId&&z)||"standard"==eu.restBookingType)return!1;ep(e=>({...e,loading:!0,appMessage:null}));let e=new URLSearchParams;e.append("siteId",ec.siteId),e.append("occasionId",ec.occasionId),e.append("api_secret",z);let a=await fetch(A+"/restrictions",{method:"POST",body:e});if(!a.ok)throw ep(e=>({...e,loading:!1})),Error("Failed to fetch data");let s=await a.json();E("getRestrictions response",s),200==s.StatusCode&&s.data.minCovers&&s.data.maxCovers?(ep(e=>({...e,minPartySize:s.data.minCovers,maxPartySize:s.data.maxCovers,loading:!1})),em(e=>({...e,adults:Math.max(e.adults||eo?.partysize||0,s.data.minCovers)}))):ep(e=>({...e,loading:!0,appMessage:"No available Restrictions found"}))}async function ew(){if(!(ec.siteId&&ec.occasionId&&eu.Date&&ec.adults&&z))return!1;let e=eu.Time&&eu.Time.time?eu.Time.time:null;ep(e=>({...e,loading:!0,appMessage:null}));let a=new URLSearchParams;a.append("rest_code",ec.siteId),a.append("occasionId",ec.occasionId),a.append("booking_date",(0,i.A)(new Date(eu.Date),"yyyy-MM-dd")),a.append("party_size",ec.adults),a.append("api_secret",z);let s=await fetch(A+"/slots",{method:"POST",body:a});if(!s.ok)throw ep(e=>({...e,loading:!1})),Error("Failed to fetch data");let t=await s.json();if(E("getSlots response",t),200==t.StatusCode){let a=0,s=[],n=null,o={};if(Array.isArray(t.data.month_availability)&&t.data.month_availability.forEach(function(e){e&&e.date&&(o[e.date]=!!e.available)}),t.data.dates.length>0&&t.data.dates.forEach(function(t){let o=[{name:"Breakfast",times:[]},{name:"Lunch",times:[]},{name:"Dinner",times:[]}];t.times.length>0&&(a++,t.times.forEach(function(a){let s={time:a.time.split(":").length>2?a.time.substr(0,5):a.time,available:a.availabilities[0].available,canEnquire:a.availabilities[0].canEnquire,isClosed:a.availabilities[0].isClosed};a.time<"11:30"&&o[0].times.push(s),a.time>"11:29"&&a.time<"17:00"&&o[1].times.push(s),a.time>"16:59"&&o[2].times.push(s),ei&&s.time==eo.time?n=s:!ei&&e&&s.time==e&&(n=s)}),s.push({date:t.date.split("T")[0],sessions:o}))}),a>0){let e={restTimes:s,Time:0,availableTimeslots:a,loading:!1,deposit:t.data.deposit||null};if(n&&!n.isClosed&&(n.available||n.canEnquire)){let a="events"!=eu.restBookingType&&(n.isClosed||n.available||!n.canEnquire)?"booking":"enquiry";e.Time=n,e.slotType=a}ep(a=>({...a,...e,monthAvailability:{...a.monthAvailability,...o}}))}else ep(e=>({...e,loading:!0,restTimes:null,availableTimeslots:0,Time:0,monthAvailability:{...e.monthAvailability,...o},deposit:null,appMessage:'If you cannot find the availability you are looking for, please contact us by <a href="mailto:'+eu.restEmail+'" style="word-break: break-word;">'+eu.restEmail+"</a>."})),"function"==typeof fbq&&fbq("trackSingleCustom",w,eu.pixelEventPrefix+" Abandoned cart")}else ep(e=>({...e,loading:!0,restTimes:null,availableTimeslots:0,Time:0,appMessage:"No slots available. Please select a different date."}))}async function ek(){if(!(ec.siteId&&ec.occasionId&&eu.slotDate&&ec.adults&&eu.Time.time&&z))return!1;let e=new URLSearchParams;e.append("rest_code",ec.siteId),e.append("occasionId",ec.occasionId),e.append("booking_date",eu.slotDate),e.append("party_size",ec.adults),e.append("time",eu.Time.time),e.a
1ppend("api_secret",z);try{let a=await fetch(A+"/durations",{method:"POST",body:e});if(!a.ok)throw Error("Failed to fetch durations");let s=await a.json();if(E("getDurations response",s),200==s.StatusCode&&Array.isArray(s.data.durations)&&s.data.durations.length){let e=s.data.durations;ep(a=>({...a,restDurations:e})),em(a=>{let s=a=>e.some(e=>e.value==a),t=a.duration;return""!==t&&s(t)||(t=s(120)?120:s(-1)?-1:e[0].value),{...a,duration:t}})}else ep(e=>({...e,restDurations:null}))}catch(e){E("getDurations failed",e),ep(e=>({...e,restDurations:null}))}}async function eI(){if(!(ec.siteId&&ec.occasionId&&eu.slotDate&&ec.adults&&eu.Time.time&&z))return!1;ep(e=>({...e,loading:!0,appMessage:null}));let e=new URLSearchParams;e.append("siteId",ec.siteId),e.append("occasionId",ec.occasionId),e.append("adults",ec.adults),e.append("dates",eu.slotDate),e.append("time",eu.Time.time),e.append("api_secret",z);let a=await fetch(A+"/menus",{method:"POST",body:e});if(!a.ok)throw ep(e=>({...e,loading:!1})),Error("Failed to fetch data");let s=await a.json();if(E("getMenus response",s),200==s.StatusCode&&s.data.menus){let e=s.data.menus.filter(function(e){return e.available}),a=eu.menuId;a||1!=e.length||(a=e[0].id),eo?.menuIds?em(e=>({...e,menuIds:eo.menuIds})):em(e=>({...e,menuIds:a}));let t=!1;e&&e.forEach(function(e){ec.menuIds==e.id&&(t=e.name)}),eD(e,t)}else ep(e=>({...e,loading:!0,appMessage:"No available Menus found"}))}async function eD(e,a){if(!(ec.siteId&&ec.occasionId&&eu.slotDate&&ec.adults&&eu.Time.time&&z))return!1;ep(e=>({...e,loading:!0,appMessage:null}));let s=new URLSearchParams;s.append("siteId",ec.siteId),s.append("occasionId",ec.occasionId),s.append("adults",ec.adults),s.append("dates",eu.slotDate),s.append("time",eu.Time.time),s.append("api_secret",z);let t=await fetch(A+"/upsells",{method:"POST",body:s});if(!t.ok)throw ep(e=>({...e,loading:!1})),Error("Failed to fetch data");let n=await t.json();if(E("getUpsells response",n),200==n.StatusCode&&n.data.upsells){let s;n.data.upsells.length&&(s=n.data.upsells.filter(function(e){return e.available})),ep(t=>({...t,restUpsells:s,restMenus:e,restMenuName:a,loading:!1}))}else ep(s=>({...s,loading:!0,restMenus:e,restMenuName:a,appMessage:"No available Upsells found"}))}async function eM(){if(ef(2)){let e=[];
1if(eu.deposit&&eu.deposit.required&&eu.deposit.paymentUrlBase){let e=eu.deposit.paymentUrlBase+"&time="+encodeURIComponent(eu.Time.time)+"&email="+encodeURIComponent(ec.emailAddress||"")+"&first_name="+encodeURIComponent(ec.firstname||"")+"&last_name="+encodeURIComponent(ec.lastname||"")+"&phone="+encodeURIComponent(ec.telephoneNumber||"");""!==ec.duration&&ec.duration>0&&-1===e.indexOf("duration=")&&(e+="&duration="+encodeURIComponent(ec.duration)),E("deposit required - redirecting to hosted payment page",e),ep(e=>({...e,loading:!0,appMessage:null})),window.location.assign(e);return}"function"==typeof fbq&&fbq("trackSingleCustom",w,eu.pixelEventPrefix+" Create"),ep(e=>({...e,loading:!0,appMessage:null})),ec.upsellIds&&ec.upsellIds.length&&(ec.upsellIds.forEach(function(a){e.push(a.id)}),e=e.join());let a=new URLSearchParams;a.append("siteId",ec.siteId),a.append("occasionId",ec.occasionId),a.append("date",eu.slotDate),a.append("time",eu.Time.time),""!==ec.duration&&a.append("duration",ec.duration),a.append("adults",ec.adults),a.append("children",ec.children),a.append("firstname",ec.firstname),a.append("lastname",ec.lastname),a.append("emailAddress",ec.emailAddress),a.append("telephoneNumber",ec.telephoneNumber),a.append("EmailOptIn",ec.consent.email?"1":"0"),a.append("SmsOptIn",ec.consent.sms?"1":"0"),ec.consent.email&&eu.marketingPrefIds&&eu.marketingPrefIds.length&&a.append("marketing_preferences",eu.marketingPrefIds.join(",")),ec.dob_day&&ec.dob_month&&ec.dob_year&&(a.append("dob_day",ec.dob_day),a.append("dob_month",ec.dob_month),a.append("dob_year",ec.dob_year)),ec.notes&&a.append("notes",ec.notes),a.append("api_secret",z);let s=await fetch(A+"/"+eu.slotType,{method:"POST",body:a});if(!s.ok)throw ep(e=>({...e,loading:!1})),Error("Failed to fetch data");let t=await s.json();if(E("addBooking response",t),200==t.response.StatusCode){if(em(e=>({...e,...t.response.data})),ep(e=>({...e,status:"booked",step:3,loading:!1})),eg(),"function"==typeof fbq&&(fbq("trackSingleCustom",w,eu.pixelEventPrefix+" PartySize Change",{value:t.response.data.adults}),fbq("trackSingleCustom",w,eu.pixelEventPrefix+" Success")),window){window.dataLayer=window.dataLayer||[];let e=(0,r.Ri)("im_ref")||!1;if(window.dataLayer.push({event:"generate_lead",pub_location:k,form_type:"Book a table",reservation_id:t.response.data.bookingReference}),e){let a={event:"affiliate_booking",reservation_id:t.response.data.bookingReference,affiliate_id:e,pub_location:k};window.dataLayer.push(a)}if(e){let a={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({im_ref:e,bookingReference:t.response.data.bookingReference,emailAddress:t.response.data.emailAddress,promocode:eu.promocode||""})},s=await fetch("/api/impact/conversions",a);if(500==s.status)for(let e=0;e<3&&200!=(s=await fetch("/api/impact/conversions",a)).status;e++);console.log("Impact Response: ",await s.json())}}eu.restAtreemoId&&await eT(t.response.data)}else ep(e=>({...e,loading:!0,appMessage:t.response.data.message}))}else eg()}async function eT(e){let s=new URLSearchParams;s.append("firstname",ec.firstname),s.append("surname",ec.lastname),s.append("email",ec.emailAddress),s.append("venueRef",eu.restAtreemoId),s.append("EmailOptIn",ec.consent.email),s.append("SmsOptIn",ec.consent.sms),s.append("MobilPhone",ec.telephoneNumber),s.append("bookingId",e.bookingReference),s.append("bookingOccassion",eE),s.append("bookingMenu",eC),s.append("bookingType","standard"==eu.restBookingType?"Booking":"Enquiry"),s.append("restName",eu.restName),s.append("bookingDate",eu.slotDate),s.append("bookingTime",eu.Time.time),s.append("api_secret",z),(a=!!(0,r.Ri)(d.Bi)&&JSON.parse((0,r.Ri)(d.Bi)))&&!$&&($=a.utm_source||null,R=a.utm_medium||null,U=a.utm_campaign||null,H=a.utm_term||null,G=a.utm_content||null,Y=a.promocode||null),$&&s.append("utmSource",$),R&&s.append("utmMedium",R),U&&s.append("utmCampaign",U),H&&s.append("utmTerm",H),G&&s.append("utmContent",G),Y&&s.append("promocode",Y),V&&s.append("transaction_id",V),N?.atreemoOrigin&&s.append("origin",N.atreemoOrigin),((0,r.Ri)("im_ref")||0)&&s.append("affiliate_booking",1);let t=await fetch(P+"/add",{method:"POST",body:s});if(!t.ok)throw ep(e=>({...e,loading:!1})),Error("Failed to fetch data");E("Atreemo response",await t.json())}let e_=e=>{eh(e.target)};(0,n.useEffect)(()=>{V&&er?.collins_roomsoccasionid&&(er.collins_occasionid=er.collins_roomsoccasionid)},[ec.siteId]),(0,n.useEffect)(()=>{eu.Date&&ep(e=>({...e,restOccasions:null,restOccasionName:!1,restMenus:null,restMenuName:!1,restUpsells:null}))},[eu.Date]),(0,n.useEffect)(()=>{eu.Date&&!("standard"==eu.restBookingType&&ec.adults>eu.maxPartySize)&&ev()},[eu.Date,ec.adults]),(0,n.useEffect)(()=>{eu.restOccasionName&&ec.occasionId&&eN()},[eu.restOccasionName]),(0,n.useEffect)(()=>{ec.occasionId&&eu.restOccasions&&eu.restOccasions.forEach(function(e){ec.occasionId==e.id&&ep(a=>
1({...a,restOccasionName:e.name,restMenus:null,restMenuName:!1,restUpsells:null,restTimes:null,Time:0}))})},[ec.occasionId]),(0,n.useEffect)(()=>{ec.adults&&("standard"==eu.restBookingType&&ec.adults>eu.maxPartySize?ep(e=>({...e,loading:!0,appMessageButtons:!1,appMessage:'Looking to book a large table or party, click here to <span style="display:block; margin-top:0.5rem;"><a class="btn btn-outline-dusk" href="/event-enquiry/?location='+eu.restID+"&date="+eu.slotDate+"&partysize="+ec.adults+"&type="+(ec.occasionId||"")+"&time="+(eu.Time?eu.Time.time:"")+"&duration="+(""!==ec.duration?ec.duration:"")+'&editable">enquire now</a></span>'})):eu.Date&&eu.minPartySize<=ec.adults&&ec.adults<=eu.maxPartySize&&ep(e=>({...e,restMenus:null,restMenuName:!1,restUpsells:null})))},[ec.adults]),(0,n.useEffect)(()=>{eu.Date&&ec.adults&&ec.occasionId&&eu.minPartySize<=ec.adults&&ec.adults<=eu.maxPartySize&&ew()},[ec.adults,ec.occasionId,eu.Date]),(0,n.useEffect)(()=>{if(!(ec.siteId&&ec.occasionId&&ec.adults&&eu.minPartySize<=ec.adults&&ec.adults<=eu.maxPartySize))return;ep(e=>({...e,monthAvailability:{},loadedMonths:{},loadingMonths:{}}));let e=eu.minActiveDate||eu.minDate||new Date,a=new Date(e.getFullYear(),e.getMonth(),1);for(let e=0;e<=2;e++){let s=new Date(a.getFullYear(),a.getMonth()+e,1);if(eu.maxDate&&s>eu.maxDate)break;ej(s)}},[ec.occasionId,ec.adults]),(0,n.useEffect)(()=>{if(!eu.advanceDatePending)return;let e=eu.monthAvailability,a=(0,i.A)(new Date,"yyyy-MM-dd"),s=Object.keys(e).filter(function(s){return!0===e[s]&&s>a}).sort()[0];if(s){let e=new Date(s+"T00:00:00");ep(a=>({...a,advanceDatePending:!1,Date:e,slotDate:s,slotDateFormated:(0,i.A)(e,"do MMMM y"),minActiveDate:e}));return}if(Object.keys(eu.loadedMonths).length>=3){let e=new Date;e.setDate(e.getDate()+1);let a=(0,i.A)(e,"yyyy-MM-dd");ep(s=>({...s,advanceDatePending:!1,Date:e,slotDate:a,slotDateFormated:(0,i.A)(e,"do MMMM y"),minActiveDate:e}))}},[eu.advanceDatePending,eu.monthAvailability,eu.loadedMonths]),(0,n.useEffect)(()=>{let e=I.current.querySelector(".time-dropdown").closest(".form-group"),a="We are currently accepting enquiries for this date and would love to help you plan your visit. Please get in touch using the form below, and a team member will get back to you shortly. Alternatively, feel free to call us directly on "+eu.restPhone+". We look forward to hearing from you!";eu.Time?(e.classList.remove("input-error"),ek(),"enquiry"==eu.slotType&&"standard"==eu.restBookingType||"booking"==eu.slotType&&!1==eu.Time.available?ep(e=>({...e,loading:!0,appMessage:`<span style="display:block; margin-top:2rem;">${a}</span>`,appMessageButtons:!0})):(ep(e=>({...e,restMenus:null,restMenuName:!1,restUpsells:null})),ep(e=>({...e,loading:!1,appMessageButtons:!1,appMessage:null})),ec.occasionId&&ec.adults&&eu.Date&&eu.Time&&eI())):e.classList.add("input-error")},[eu.Time]),(0,n.useEffect)(()=>{ec.menuIds&&eu.restMenus?eu.restMenus.forEach(function(e){ec.menuIds==e.id&&ep(a=>({...a,restMenuName:e.name}))}):ec.menuIds||ep(e=>({...e,restMenuName:!1}))},[ec.menuIds,eu.restMenus]);let eS=(0,n.useMemo)(()=>N.locationOptions?N.locationOptions.map(e=>({value:e,label:e.name})):[],[N.locationOptions]),eA=(0,n.useMemo)(()=>eu.restOccasions?eu.restOccasions.filter(e=>e.available).map(e=>({value:e.id,label:e.name})):[],[eu.restOccasions]),eP=(0,n.useMemo)(()=>{if(!eu.minPartySize||!eu.maxPartySize)return[];let e=[];for(let a=eu.minPartySize;a<=eu.maxPartySize;a++)e.push({value:a,label:a});return"standard"==eu.restBookingType&&e.push({value:eu.maxPartySize+1,label:eu.maxPartySize+1+" or more"}),e},[eu.minPartySize,eu.maxPartySize,eu.restBookingType]),ez=(0,n.useMemo)(()=>eu.restMenus?eu.restMenus.filter(e=>e.available).map(e=>({value:e.id,label:e.name})):[],[eu.restMenus]),eO=(0,n.useMemo)(()=>eu.restDurations?eu.restDurations.map(e=>({value:e.value,label:e.value>0&&e.endTime?e.label+" (until "+e.endTime+")":e.label})):[],[eu.restDurations]),eE=((0,n.useMemo)(()=>{if(""===ec.duration)return!1;let e=eO.find(e=>e.value==ec.duration);return e?.label||!1},[eO,ec.duration]),(0,n.useMemo)(()=>{if(!eu.restOccasions||!ec.occasionId)return!1;let e=eu.restOccasions.find(e=>e.id==ec.occasionId);return e?.name||!1},[eu.restOccasions,ec.occasionId])),eC=(0,n.useMemo)(()=>
1{if(!eu.restMenus||!ec.menuIds)return!1;let e=eu.restMenus.find(e=>e.id==ec.menuIds);return e?.name||!1},[eu.restMenus,ec.menuIds]);return(0,n.useEffect)(()=>{a=!!(0,r.Ri)(d.Bi)&&JSON.parse((0,r.Ri)(d.Bi)),"function"==typeof fbq&&fbq("trackSingleCustom",w,eu.pixelEventPrefix+" Start");let e=I.current?.querySelectorAll("[required]");return e&&e.forEach(function(e){e.addEventListener("change",e_)}),()=>{let e=I.current?.querySelectorAll("[required]");e&&e.forEach(function(e){e.removeEventListener("change",e_)})}},[S]),(0,n.useEffect)(()=>{if(K&&N?.locationOptions?.length){let e=N.locationOptions.find(e=>e.zonalId===K||!e.zonalId&&e.id===K);e&&eb(e)}else K||ep(e=>({...e,loading:!1}))},[K,N?.locationOptions]),(0,t.jsx)("div",{children:(0,t.jsxs)("div",{ref:I,className:"zonalevents-widget v1",id:"zonalevents-app",children:[V&&C&&(0,t.jsx)(u,{BookingID:V,BookingData:ec,setBookingData:em,state:eu,setState:ep,GuestlineApi:C,optHotelId:X}),(0,t.jsxs)("form",{id:"zonalevents-booking-form",name:"zonalevents-booking-form",action:"",method:"POST",className:"text-center text-lg-start",children:[(0,t.jsxs)("div",{className:`form-group ${1==eu.step&&!K?"":"d-none"}`,children:[(0,t.jsx)("label",{htmlFor:"zonalevents_location_select",className:"form-label text-center text-lg-start",children:"Location"}),(0,t.jsx)(f.Ay,{placeholder:"Please select",isSearchable:!1,options:eS,value:{value:er,label:eu.restName||"Please select"},onChange:(e,a)=>eb(e.value),className:"react-select-container",classNamePrefix:"react-select"})]}),!!N.booking_treats&&(0,t.jsx)(b,{location:N.locationOptions?.find(e=>e.id===eu.restID)}),(0,t.jsx)("div",{id:"header",className:ec.siteId&&"booked"!=eu.status?"":"d-none",children:(0,t.jsxs)("div",{className:"inner",children:[(0,t.jsxs)("h3",{children:[eu.restName," ",(0,t.jsx)("br",{}),(0,t.jsx)("a",{href:`tel:${eu.restPhone}`,children:eu.restPhone})]}),eu.usePromocodes&&$&&(0,t.jsxs)("h4",{children:["Joining us on a Thursday evening for a spot of Apr\xe8s ski? ",(0,t.jsx)("br",{className:"d-none d-md-inline"}),"Call us directly on ",eu.restPhone," so we can allocate you a table"]}),(0,t.jsx)("div",{className:"events"==eu.restBookingType&&1==eu.step?"":"d-none",dangerouslySetInnerHTML:{__html:Q}})]})}),(0,t.jsxs)("div",{className:"widget-content",children:[(0,t.jsxs)("div",{ref:M,id:"zonalevents_page_1",className:`widget-page ${ec.siteId&&1==eu.step?"":"d-none"}`,"data-role":"page",children:[(0,t.jsxs)("div",{className:"inner",children:[(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{htmlFor:"zonalevents_Date",className:"form-label text-center text-lg-start",children:"Date"}),(0,t.jsx)("input",{type:"text",className:`form-control ${ei&&N.booking_date&&!J?"":"d-none"}`,value:eu.slotDateFormated,disabled:!0}),(0,t.jsxs)(m.A,{className:`dropdown ${ei&&N.booking_date&&!J?"d-none":"date-dropdown"}`,onToggle:e=>ep(e=>({...e,showDateDropdown:!e.showDateDropdown})),show:eu.showDateDropdown,children:[(0,t.jsxs)(m.A.Toggle,{className:"form-control dropdown-toggle",children:[eu.slotDateFormated||"Select Date",(0,t.jsx)("span",{className:"dropdown-indicator",children:(0,t.jsx)("svg",{height:"20",width:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})})})]}),(0,t.jsx)(m.A.Menu,{renderOnMount:!0,as:"div",className:"dropdown-menu",children:(0,t.jsxs)("div",{className:"dropdown-menu-inner",style:{position:"relative"},children:[(0,t.jsx)(c.Ay,{instanceId:F,className:"mx-auto",value:eu.Date,prevLabel:"Prev month",prev2Label:null,nextLabel:"Next month",next2Label:null,disabled:!0,onChange:(e,a)=>ep(a=>({...a,Date:e,slotDate:(0,i.A)(new Date(e),"yyyy-MM-dd"),slotDateFormated:(0,i.A)(new Date(e),"do MMMM y"),showDateDropdown:!1})),minDate:eu.minDate,maxDate:eu.maxDate,activeStartDate:eu.minActiveDate,onActiveStartDateChange:({activeStartDate:e,value:a,view:s})=>{ep(a=>({...a,minActiveDate:e})),e&&(!s||"month"===s)&&ec.occasionId&&ec.adults&&function(e){let a=new Date(e);for(let e=0;e<=2;e++){let s=new Date(a.getFullYear(),a.getMonth()+e,1);if(eu.maxDate&&s>eu.maxDate)break;let t=(0,i.A)(s,"yyyy-MM");eu.loadedMonths[t]||eu.loadingMonths[t]||ej(s)}}(e)},tileDisabled:({date:e,view:a})=>"month"===a&&!1===eu.monthAvailability[(0,i.A)(e,"yyyy-MM-dd")],formatLongDate:(e,a)=>(0,i.A)(new Date(a),"yyyy-MM-dd")}),eu.minActiveDate&&eu.loadingMonths[(0,i.A)(new Date(eu.minActiveDate),"yyyy-MM")]&&(0,t.jsx)("div",{className:"calendar-month-loading","aria-live":"polite",style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.65)",zIndex:2},children:(0,t.jsx)("div",{className:"loader",children:"Loading..."})})]})})]}),(0,t.jsx)(y,{state:eu})]}),(0,t.jsxs)("div",{className:`form-group ${eu.Date?"":"d-none"}`,children:[(0,t.jsx)("label",{htmlFor:"zonalevents_AdultCovers",className:"form-label text-center text-lg-start",children:"Party Size"}),(0,t.jsx)(f.Ay,{isDisabled:!!ei&&!!N.booking_partysize&&!J,placeholder:"How many guests?",isSearchable:!1,options:eP,value:{value:ec.adults,label:ec.adults||"How many guests?"},onChange:(e,a)=>em(a=>({...a,adults:e.value})),className:"react-select-container",classNamePrefix:"react-select"}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{className:`form-group ${eu.restOccasionShow&&eu.Date&&ec.adults&&ec.adults<=eu.maxPartySize?"":"d-none"}`,children:[(0,t.jsx)("label",{htmlFor:"zonalevents_occasionId",className:"form-label text-center text-lg-start",children:"Booking type"}),(0,t.jsx)(f.Ay,{isDisabled:!!ei&&!!N.booking_occasionId,placeholder:"Choose a booking type",isSearchable:!1,options:eA,value:{value:ec.occasionId,label:eE||"Choose a booking type"},onChange:(e,a)=>em(a=>({...a,occasionId:e.value})),className:"react-select-container",classNamePrefix:"react-select"}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{id:"area-wrapper",className:ec.adults<=eu.maxPartySize&&ec.occasionId?"":"d-none",children:[(0,t.jsxs)("div",{className:`form-group ${eu.Date&&ec.adults&&ec.occasionId&&eu.restTimes&&eu.availableTimeslots?"":"d-none"}`,children:[(0,t.jsx)("label",{htmlFor:"zonalevents_booking_time",className:"form-label text-center text-lg-start",children:"Time"}),(0,t.jsxs)("div",{className:"dropdown time-dropdown",children:[(0,t.jsx)("input",{type:"text",className:`form-control ${eo?.time&&N.booking_time&&!J?"":"d-none"}`,value:eu.Time?eu.Time.time:"Choose Time",id:"zonalevents_booking_time",disabled:!0}),(0,t.jsxs)(m.A,{className:ei&&N.booking_time&&!J?"d-none":"time-dropdown",children:[(0,t.jsxs)(m.A.Toggle,{className:"form-control dropdown-toggle scroll-me-up",children:[eu.Time?eu.Time.time:"Choose Time",(0,t.jsx)("span",{className:"dropdown-indicator",children:(0,t.jsx)("svg",{height:"20",width:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:(0,t.jsx)("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})})})]}),(0,t.jsx)(m.A.Menu,{renderOnMount:!0,as:"div",className:"dropdown-menu",children:(0,t.jsxs)("div",{className:"dropdown-menu-inner",children:[eu.restTimes&&eu.restTimes.map((e,a)=>(0,t.jsxs)("div",{className:"time-session",children:[(0,t.jsx)("h4",{className:`time-session-label ${eu.restTimes.length>1?"":"d-none"}`,children:e.date}),e.sessions&&e.sessions.map((s,n)=>(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:`time-session-label ${s.times.length>1?"":"d-none"}`,children:s.name}),(0,t.jsx)("ul",{className:"time-list",children:s.times&&s.times.map((s,o)=>{var l;let r=!s.isClosed&&!s.available&&s.canEnquire,d=s.isClosed||!s.available&&!s.canEnquire||(l=e.date+"T"+s.time,new Date().getTime()>
1new Date(l).getTime());return(0,t.jsx)("li",{className:"time-item",children:(0,t.jsxs)(m.A.Item,{onClick:a=>d?null:((e,a,s)=>{if(e===eu.Time)return!1;a&&ep(t=>({...t,Time:e,slotDate:(0,i.A)(new Date(a),"yyyy-MM-dd"),slotDateFormated:(0,i.A)(new Date(a),"do MMMM y"),slotType:s}))})(s,e.date,"events"==eu.restBookingType||r?"enquiry":"booking"),children:[!d&&(0,t.jsx)("input",{type:"radio",id:`zonalevents_time_${a+n}_${o}`,name:"zonalevents_Time",className:"sr-only","data-date":e.date,"data-type":"events"==eu.restBookingType||r?"enquiry":"booking"}),(0,t.jsx)("label",{htmlFor:`zonalevents_time_${a+n}_${o}`,disabled:d,className:"standard"==eu.restBookingType&&r?"limited":"",children:s.time})]})},`time-slot-index-${o}`)})})]},`time-session-index-${n}`))]},`time-day-index-${a}`)),(0,t.jsxs)("p",{className:"time-legend",children:[(0,t.jsx)("span",{children:"Available"}),(0,t.jsx)("span",{className:`limited ${"standard"==eu.restBookingType?"":"d-none"}`,children:"Enquiries only"}),(0,t.jsx)("span",{disabled:!0,children:"Unavailable"})]})]})})]})]}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),!1,(0,t.jsxs)("div",{className:`form-group ${eu.Time&&ec.occasionId&&eu.restMenuShow&&eu.restMenus&&eu.restMenus.length>1?"":"d-none"}`,children:[(0,t.jsx)("label",{htmlFor:"zonalevents_menuId",className:"form-label text-center text-lg-start",children:"Select your preferred menu choice"}),(0,t.jsx)(f.Ay,{isDisabled:!!ei&&!!N.booking_menuIds,placeholder:"Choose menu",isSearchable:!1,options:ez,value:{value:ec.menuIds,label:eC||"Choose menu"},onChange:(e,a)=>em(a=>({...a,menuIds:e.value})),className:"react-select-container",classNamePrefix:"react-select"}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsx)("div",{className:`form-group ${eu.Time&&eu.restUpsellShow&&eu.restUpsells?"":"d-none"}`,children:eu.restUpsells&&eu.restUpsells.map((e,a)=>(0,t.jsxs)("div",{className:"form-group form-inline",children:[(0,t.jsx)("input",{type:"checkbox",id:`upsell${e.id}`,className:"form-control",value:e.id,onChange:a=>{var s;return s=a.target,void em(a=>{let t=a.upsellIds||[],n=s.checked?[...t,e]:t.filter(a=>a.id!==e.id);return{...a,upsellIds:n}})}}),(0,t.jsxs)("label",{htmlFor:`upsell${e.id}`,children:[(0,t.jsxs)("strong",{children:[e.name,e.price?" £"+e.price:""]}),(0,t.jsx)("br",{}),e.description]})]},`upsells-index-${a}`))})]})]}),(0,t.jsx)("div",{className:ec.adults<=eu.maxPartySize?"":"d-none",children:(0,t.jsx)("div",{className:`inner ${"book"==eu.status&&1==eu.step?"":"d-none"}`,children:(0,t.jsx)("input",{type:"button",className:"btn btn-outline-dusk",value:"Next",onClick:()=>void(ef(1)&&ey(2)),disabled:0==ec.siteId||(s=eu.restMenus&&eu.restMenus.length>1,!ec.adults||!eu.Date||!eu.Time||!!s&&!ec.menuIds)})})})]}),(0,t.jsxs)("div",{ref:T,id:"zonalevents_page_2",className:`widget-page ${ec.siteId&&2==eu.step?"":"d-none"}`,"data-role":"page",children:[(0,t.jsxs)("div",{className:"inner",children:[(0,t.jsx)("h2",{children:"Booking details"}),(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{htmlFor:"zonalevents_FirstName",className:"form-label text-center text-lg-start",children:"First Name"}),(0,t.jsx)("input",{type:"text",id:"zonalevents_FirstName",name:"zonalevents_FirstName",value:ec.firstname,onChange:e=>em(a=>({...a,firstname:e.target.value})),className:"form-control",required:!0}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{htmlFor:"zonalevents_LastName",className:"form-label text-center text-lg-start",children:"Last Name"}),(0,t.jsx)("input",{type:"text",id:"zonalevents_LastName",name:"zonalevents_LastName",value:ec.lastname,onChange:e=>em(a=>({...a,lastname:e.target.value})),className:"form-control",required:!0}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{htmlFor:"zonalevents_Email",className:"form-label text-center text-lg-start",children:"Email"}
1),(0,t.jsx)("input",{type:"email",id:"zonalevents_Email",name:"zonalevents_Email",value:ec.emailAddress,onChange:e=>em(a=>({...a,emailAddress:e.target.value})),className:"form-control",required:!0}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),(0,t.jsxs)("div",{className:"form-group",children:[(0,t.jsx)("label",{htmlFor:"zonalevents_PhoneNumber",className:"form-label text-center text-lg-start",children:"Telephone Number (no spaces)"}),(0,t.jsx)("input",{type:"tel",id:"zonalevents_PhoneNumber",name:"zonalevents_PhoneNumber",value:ec.telephoneNumber,onChange:e=>em(a=>({...a,telephoneNumber:e.target.value})),className:"form-control",required:!0}),(0,t.jsx)("span",{className:"error-tip",children:"This field is required"})]}),!1,!1]}),(0,t.jsxs)("div",{className:"inner",children:[(0,t.jsxs)("div",{className:"form-group form-inline",children:[(0,t.jsx)("input",{type:"checkbox",id:"zonalevents_EmailOptIn",name:"zonalevents_EmailOptIn",onChange:e=>{em(a=>({...a,consent:{...a.consent,email:e.target.checked}}))},className:"form-control",value:"1"}),(0,t.jsx)("label",{htmlFor:"zonalevents_EmailOptIn",children:eu.marketingOptIn?(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:eu.marketingOptIn}}):"Select if you would like to receive emails from us regarding news, events and offers."})]}),(0,t.jsxs)("div",{className:"form-group form-inline",children:[(0,t.jsx)("input",{type:"checkbox",id:"zonalevents_SmsOptIn",name:"zonalevents_SmsOptIn",onChange:e=>{em(a=>({...a,consent:{...a.consent,sms:e.target.checked}}))},className:"form-control",value:"1"}),(0,t.jsx)("label",{htmlFor:"zonalevents_SmsOptIn",children:"Text me news, events and offers from us."})]})]}),N.legalText?(0,t.jsx)("div",{className:"inner",dangerouslySetInnerHTML:{__html:N.legalText}}):(0,t.jsxs)("div",{className:"inner",children:[(0,t.jsx)("p",{children:"We will only send you marketing information from your favourite pub, Heartwood Inns and/or Brasserie Blanc if you consent to this by selecting the options above. From time to time we may also include information from trusted complementary third party brands with whom we are running events or offers but we will never share your details with them."}),(0,t.jsx)("p",{children:"Please note you are able to unsubscribe from communications at any time."}),(0,t.jsx)("p",{children:"The day after your booking you will receive an optional feedback request (which is not a marketing message)."}),(0,t.jsxs)("span",{children:["Click ",(0,t.jsx)("a",{href:"//heartwoodcollection.com/legal/",target:"_blank",children:"here"})," to review our privacy policy. "]})]}),(0,t.jsxs)("p",{className:"booking-details",children:[(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Date:"})," ",(0,t.jsx)("span",{className:"line-detail",children:eu.slotDateFormated})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Time:"})," ",(0,t.jsx)("span",{className:"line-detail",children:eu.Time.time})]}),!1,(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Party size:"})," ",(0,t.jsxs)("span",{className:"line-detail",children:[ec.adults," guests"]})]}),eu.restOccasionShow&&(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Booking type:"})," ",(0,t.jsx)("span",{className:"line-detail",children:eE})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Venue:"})," ",(0,t.jsx)("span",{className:"line-detail",children:eu.restName})]}),eC&&(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Menu choice:"})," ",(0,t.jsx)("span",{className:"line-detail",children:eC})]}),ec.upsellIds&&ec.upsellIds.length>0&&(0,t.jsxs)("span",{className:"single-line",className:"zonalevents-upsell-name",children:[(0,t.jsx)("strong",{children:"Extras: "}),ec.upsellIds&&ec.upsellIds.map((e,a)=>(0,t.jsxs)("span",{children:[e.name,e.price?" £"+e.price:""]},`summary-upsells-index-${a}`))]})]}),eu.deposit&&eu.deposit.required&&eu.deposit.info&&(0,t.jsxs)("p",{className:"booking-deposit-notice",children:[(0,t.jsx)("strong",{children:"Booking fee:"})," ",(x="GBP"===(p=eu.deposit.info).currency?"\xa3":p.currency?p.currency+" ":"",v=p.amount_per?` per ${p.amount_per}`:"",`${x}${p.amount}${v} (${x}${p.total} total)`)," ","is required to secure this booking. Youâll be taken to our secure payment page to complete it."]}),(0,t.jsx)("div",{className:"inner",children:(0,t.jsxs)("div",{className:"form-group form-inline",children:[(0,t.jsx)("input",{type:"checkbox",id:"zonalevents_PolicyAccepted",name:"zonalevents_PolicyAccepted",checked:ec.policyAccepted,onChange:e=>em(a=>({...a,policyAccepted:e.target.checked})),className:"form-control",value:"1"}),N.policyText?(0,t.jsx)("label",{htmlFor:"zonalevents_PolicyAccepted",dangerouslySetInnerHTML:{__html:N.policyText}}):(0,t.jsxs)("label",{htmlFor:"zonalevents_PolicyAccepted",children:["I confirm I have read the ",(0,t.jsx)("a",{href:"https://heartwoodinns.com/terms/",target:"_blank",rel:"nofollow noopener",children:"booking policy"}),"."]})]})}),(0,t.jsxs)("div",{className:`inner d-flex flex-row ${"book"==eu.status?"":"d-none"}`,children:[(0,t.jsx)("button",{type:"button",className:"btn btn-outline-dusk me-10",onClick:()=>ey(eu.step-1),children:"Back"}),(0,t.jsx)("input",{type:"button",className:"btn btn-primary ms-10",value:eu.deposit&&eu.deposit.required?"Continue to Payment":"events"==eu.restBookingType?"Enquire Now":"Book",onClick:()=>eM(),disabled:!ec.policyAccepted})]})]}),(0,t.jsx)("div",{ref:_,id:"zonalevents_page_3",className:`widget-page ${ec.siteId&&3==eu.step?"":"d-none"}`,"data-role":"page",children:(0,t.jsxs)("div",{className:"inner",children:["standard"==eu.restBookingType?(0,t.jsxs)("div",{children:[(0,t.jsxs)("h4",{children:["Thank you for making a dining reservation at ",eu.restName,"."]}),(0,t.jsxs)("p",{className:"booking-details",children:[(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Confirmation code:"})," ",(0,t.jsx)("span",{className:"line-detail",children:ec.bookingReference})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Date:"})," ",(0,t.jsx)("span",{className:"line-detail",children:eu.slotDateFormated})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Time:"})," ",(0,t.jsx)("span",{className:"line-detail",children:ec.time||eu.Time.time})]}),!1,(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Party size:"})," ",(0,t.jsxs)("span",{className:"line-detail",children:[ec.adults," guests"]})]}),eu.restOccasionShow&&(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Booking type:"})," ",(0,t.jsx)("span",{className:"line-detail",children:eE})]}),(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Venue:"})," ",(0,t.jsx)("span",{className:"line-detail",children:eu.restName})]}),ec?.menus&&ec?.menus[0]?.name&&(0,t.jsxs)("span",{className:"single-line",children:[(0,t.jsx)("strong",{children:"Menu choice:"})," ",(0,t.jsx)("span",{className:"line-detail",children:ec?.menus[0]?.name})]}),ec.upsellIds&&ec.upsellIds.length>0&&(0,t.jsxs)("span",{className:"single-line",className:"zonalevents-upsell-name",children:[(0,t.jsx)("strong",{children:"Extras: "}),ec.upsellIds&&ec.upsellIds.map((e,a)=>(0,t.jsxs)("span",{children:[e.name,e.price?" £"+e.price:""]},`summary-upsells-index-${a}`))]})]}),eu.restUrl&&(0,t.jsxs)("p",{children:["Why don't you look at ",(0,t.jsx)("a",{href:`${eu.restUrl}menus/`,title:"Menus",children:"our menus"})," ahead of your visit? "]})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("h4",{children:["Thank you for making an enquiry at ",eu.restName," for ",ec.adults," people at ",eu.slotDateFormated," ",ec.time||eu.Time.time,"."]}),(0,t.jsxs)("p",{children:["A member of our team will be in touch shortly to discu
1ss your enquiry in more detail. ",(0,t.jsx)("br",{}),"The contact number we have noted for you is: ",ec.telephoneNumber]}),(0,t.jsxs)("p",{children:["Enquiry reference code: ",ec.bookingReference]}),(0,t.jsx)("p",{children:"We look forward to speaking with you soon."})]}),V&&(0,t.jsxs)("p",{className:"text-center",children:[(0,t.jsx)("button",{type:"button",className:"btn btn-outline-dusk btn-sm btn-narrow mx-10 ms-lg-0",onClick:()=>{em(e=>({...e,adults:0,menuIds:"",upsellIds:[]})),ep(e=>({...e,status:"book",step:1,loading:!1,appMessage:null,appMessageButtons:!1}))},children:"Book another table"}),"clean"==Z?(0,t.jsx)("button",{type:"button",className:"btn btn-outline-dusk btn-sm btn-narrow mx-10",onClick:()=>{let e=top.window.document.querySelector(".gldbm-panel__close");e&&e.click()},children:"Finish"}):(0,t.jsx)(g(),{href:"/",className:"btn btn-outline-dusk btn-sm btn-narrow mx-10",children:"Finish"})]}),ea?(0,t.jsx)("div",{dangerouslySetInnerHTML:{__html:ea}}):(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{children:"If you have any queries regarding your booking or if we can be of further assistance please do not hesitate to contact us. "}),(0,t.jsx)("p",{children:(0,t.jsx)("em",{children:"Thank you and we look forward to seeing you."})})]})]})})]})]}),(0,t.jsxs)("div",{className:`zonalevents-loader ${eu.loading?"":"d-none"}`,children:[(0,t.jsx)("div",{className:"loader",children:"Loading..."}),(0,t.jsxs)("div",{className:`zonalevents-message ${eu.appMessage?"":"d-none"}`,children:[(0,t.jsx)("span",{className:`zonalevents-message-close ${!eu.appMessageButtons?"":"d-none"}`,onClick:e=>{ep(e=>({...e,loading:!1}))},children:"\xd7"}),(0,t.jsx)("p",{dangerouslySetInnerHTML:{__html:eu.appMessage}}),(0,t.jsxs)("p",{className:`${eu.appMessageButtons?"":"d-none"}`,style:{margin:"0.5rem 0 0"},children:[(0,t.jsx)("a",{href:`/event-enquiry/?location=${eu.restID}&date=${eu.slotDate}&partysize=${ec.adults}&type=${ec.occasionId||""}&time=${eu.Time?eu.Time.time:""}&duration=${""!==ec.duration?ec.duration:""}&editable`,className:"btn btn-outline-dusk mb-15",children:"Enquire"}),(0,t.jsx)("button",{className:"btn btn-outline-dusk",onClick:()=>ep(e=>({...e,loading:!1,Time:0})),children:"Try Again"})]})]})]})]})})}function j(e){let{settings:a}=(0,o.M)(),s=(0,l.useRouter)(),i=(0,n.useMemo)(()=>{if(!s.isReady)return null;let a=s.query,t={...e.settings};if(Object.keys(a).length<=1){let e=new URLSearchParams(window.location.search);a={...a,location:e.get("location"),date:e.get("date"),partysize:e.get("partysize")}}let{location:n,date:o,partysize:l}=a;return console.log("router.query",a),o&&(t.booking_date=o,console.log("Default date: ",o)),l&&(t.booking_partysize=l),n&&(t.locationOptions.filter(e=>e.id==n).map(e=>{t.defaultLocation=e.zonalId||e.id}),console.log("Default location: ",n)),t},[e.settings,s.isReady,s.query]),r=(0,n.useMemo)(()=>{let e=i?.locationOptions||[];if(i?.defaultLocation){let a=e.find(e=>e.zonalId===i.defaultLocation||!e.zonalId&&e.id===i.defaultLocation);return!!(a?.use_collins&&a?.collinsId)}let a=e.filter(e=>e.zonalId||e.collinsId);return a.length>0&&a.every(e=>!!(e.use_collins&&e.collinsId))},[i]);return i?r?(0,t.jsx)(v,{...e,settings:i}):(0,t.jsx)(x,{...e,settings:i}):null}},2909:(e,a,s)=>{s.d(a,{Gv:()=>r,O0:()=>l,Tj:()=>t,Y:()=>i,ac:()=>d,pA:()=>n,vg:()=>o});let t=e=>void 0===e||"auto"===e||"instant"===e||"smooth"===e;function n(e,a){this.scrollLeft=e,this.scrollTop=a}let o=(e,a,s="cannot convert to dictionary.")=>`Failed to execute '${e}' on '${a}': ${s}`,l=(e,a,s)=>o(e,a,`The provided value '${s}' is not a valid enum value of type ScrollBehavior.`),i=(e,a,s)=>{var t;let n=`__SEAMLESS.BACKUP$${a}`;return e[n]||!e[a]||(null==(t=e[a])?void 0:t.__isPolyfill)||(e[n]=e[a]),e[n]||s},r=e=>{let a=typeof e;return null!==e&&("object"===a||"function"===a)},d=e=>e.ownerDocument.scrollingElement||e.ownerDocument.documentElement},9814:(e,a,s)=>{s.d(a,{Ox:()=>c,VG:()=>d});var t=s(2909);function n(){var e;let a;return n=a=(null==(e=window.performance)?void 0:e.now)?()=>window.performance.now():()=>window.Date.now(),a()}let o=e=>{let a=(n()-e.timeStamp)/(e.duration||500);if(a>1){e.method(e.targetX,e.targetY),e.callback();return}let s=(e.timingFunc||(e=>.5*(1-Math.cos(Math.PI*e))))(a),t=e.startX+(e.targetX-e.startX)*s,l=e.startY+(e.targetY-e.startY)*s;e.method(t,l),e.rafId=window.requestAnimationFrame(()=>{o(e)})},l=e=>isFinite(e)?Number(e):0,i=e=>(a,s,i)=>{let[r,d]=a.window===a?[(0,t.ac)(a.document.documentElement),"Window"]:[a,"Element"],
1c=null!=s?s:{};if(!(0,t.Gv)(c))throw TypeError((0,t.vg)(e,d));if(!(0,t.Tj)(c.behavior))throw TypeError((0,t.O0)(e,d,c.behavior));"scrollBy"===e&&(c.left=l(c.left)+r.scrollLeft,c.top=l(c.top)+r.scrollTop),((e,a,s)=>{var i,r,d;if(!(null!=(d=e.isConnected)?d:!e.ownerDocument||!(1&e.ownerDocument.compareDocumentPosition(e))))return;let c=e.scrollLeft,m=e.scrollTop,u=l(null!=(i=a.left)?i:c),p=l(null!=(r=a.top)?r:m);if(u===c&&p===m)return;let g=(0,t.Y)(HTMLElement.prototype,"scroll",t.pA),h=(0,t.Y)(Object.getPrototypeOf(e),"scroll",g).bind(e);if("smooth"!==a.behavior)return h(u,p);let f=()=>{window.removeEventListener("wheel",b),window.removeEventListener("touchmove",b)},y=Object.assign(Object.assign({},s),{timeStamp:n(),startX:c,startY:m,targetX:u,targetY:p,rafId:0,method:h,callback:()=>{f();let a=9===e.nodeType;e.dispatchEvent(function(e){if("function"==typeof Event)return new Event("scrollend",{bubbles:e,cancelable:!1});let a=document.createEvent("Event");return a.initEvent("scrollend",e,!1),a}(a))}}),b=()=>{window.cancelAnimationFrame(y.rafId),f()};window.addEventListener("wheel",b,{passive:!0,once:!0}),window.addEventListener("touchmove",b,{passive:!0,once:!0}),o(y)})(r,c,i)},r=i("scroll"),d=i("scrollTo"),c=r}}]);
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.