import{r as s,c9 as P,j as e,Y as d,cz as t,cA as z,ca as B,a3 as U,cB as W,cC as K,ar as Y,cD as $,cE as q,cF as H,a2 as J}from"./index-BUHDA7zi.js";function V({city:o,headline:N="Check your date in 30 seconds",sub:w="Enter your date, time and group size. We check real availability and email you the answer in seconds.",variant:r="modal"}){var j;const c=r==="inline",E=!!o,[D,v]=s.useState(o),a=o??D,[m,l]=s.useState("form"),[u,R]=s.useState("adults"),[x,A]=s.useState(8),[p,F]=s.useState(void 0),[g,T]=s.useState(""),[f,_]=s.useState(""),[I,y]=s.useState(!1),[L,h]=s.useState(null),O=async n=>{if(!p||!a)return;const k=Y(p,"yyyy-MM-dd");y(!0),h(null);const S=await $({audience:u,city:a,date:k,preferredTime:g,occasion:f,groupSize:x,...n});if(y(!1),!S.ok){h(S.error??q);return}H("check_date_lead_submitted",{city:a,date:k,audience:u,group:x,preferredTime:g,source:"TOP_FORM_INLINE"}),l("done")},i=N.split(" "),C=c?Math.max(1,i.length-2):i.length-1,M=i.slice(0,C).join(" "),G=i.slice(C).join(" "),b=a?((j=P.find(n=>n.slug===a))==null?void 0:j.name)??a.charAt(0).toUpperCase()+a.slice(1):null;return e.jsxs("div",{className:d("overflow-hidden",c?"rounded-[6px]":"rounded-[12px] mb-8"),style:{backgroundColor:t.pageBg,border:`1px solid ${t.green}`},children:[e.jsxs("div",{className:d("",c?"px-6 md:px-10 lg:px-12 pt-6 md:pt-10 lg:pt-12":"px-5 md:px-6 pt-5 md:pt-6"),children:[e.jsxs("h3",{className:d("font-display italic font-black uppercase tracking-tight leading-tight",c?"text-3xl md:text-4xl lg:text-5xl":"text-2xl md:text-3xl"),style:{color:t.body},children:[M," ",e.jsx("span",{style:{color:t.green},children:G})]}),e.jsx("p",{className:"text-sm mt-1",style:{color:t.secondary},children:w})]}),m==="form"&&e.jsxs(e.Fragment,{children:[e.jsx(z,{framing:"check",audience:u,onAudienceChange:R,showAudienceToggle:!0,date:p,onDateChange:F,group:x,onGroupChange:A,onSubmit:()=>l("contact"),loading:!1,showCityField:!0,citySlug:a,onCityChange:v,cityLocked:E,preferredTime:g,onPreferredTimeChange:T,occasion:f,onOccasionChange:_,variant:r}),e.jsxs("div",{className:d("-mt-2 pt-3 border-t border-white/5 flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6",c?"mx-6 md:mx-10 lg:mx-12 mb-6 md:mb-10 lg:mb-12":"mx-5 mb-5"),children:[b&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs",style:{color:t.muted},children:[e.jsx(B,{className:"w-3.5 h-3.5",style:{color:t.green}}),"Checking ",e.jsx("strong",{className:"font-medium",style:{color:t.secondary},children:b})]}),e.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 sm:flex sm:flex-wrap sm:gap-x-5",children:["Groups from 8","Instant confirmation","Individual payments"].map(n=>e.jsxs("span",{className:"flex items-center gap-2 text-[13px]",style:{color:t.body},children:[e.jsx("span",{className:"inline-flex items-center justify-center w-4 h-4 rounded-full border shrink-0",style:{backgroundColor:"rgba(151,196,89,.15)",borderColor:"rgba(151,196,89,.4)"},children:e.jsx(U,{className:"w-2.5 h-2.5",style:{color:t.green},strokeWidth:3})}),n]},n))})]})]}),m==="contact"&&e.jsx(W,{onBack:()=>{h(null),l("form")},onSubmit:O,variant:r,submitting:I,error:L}),m==="done"&&e.jsx(K,{onClose:()=>l("form"),variant:r})]})}function X(){const{display:o}=J();return e.jsx(e.Fragment,{children:o})}export{V as C,X as U};