import{r as s,aF as P,j as e,Z as d,a$ as t,b0 as U,aG as z,a7 as B,b1 as W,b2 as $,at as K,b3 as Z,b4 as q,b5 as H,a3 as J}from"./index-Bt7ohjT1.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:c="modal"}){var j;const r=c==="inline",E=!!o,[v,D]=s.useState(o),a=o??v,[m,l]=s.useState("form"),[u,R]=s.useState("adults"),[x,F]=s.useState(8),[p,T]=s.useState(void 0),[g,_]=s.useState(""),[f,A]=s.useState(""),[I,y]=s.useState(!1),[L,h]=s.useState(null),O=async n=>{if(!p||!a)return;const k=K(p,"yyyy-MM-dd");y(!0),h(null);const S=await Z({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(" "),b=r?Math.max(1,i.length-2):i.length-1,G=i.slice(0,b).join(" "),M=i.slice(b).join(" "),C=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",r?"rounded-[6px]":"rounded-[12px] mb-8"),style:{backgroundColor:t.pageBg,border:`1px solid ${t.green}`},children:[e.jsxs("div",{className:d("",r?"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",r?"text-3xl md:text-4xl lg:text-5xl":"text-2xl md:text-3xl"),style:{color:t.body},children:[G," ",e.jsx("span",{style:{color:t.green},children:M})]}),e.jsx("p",{className:"text-sm mt-1",style:{color:t.secondary},children:w})]}),m==="form"&&e.jsxs(e.Fragment,{children:[e.jsx(U,{framing:"check",audience:u,onAudienceChange:R,showAudienceToggle:!0,date:p,onDateChange:T,group:x,onGroupChange:F,onSubmit:()=>l("contact"),loading:!1,showCityField:!0,citySlug:a,onCityChange:D,cityLocked:E,preferredTime:g,onPreferredTimeChange:_,occasion:f,onOccasionChange:A,variant:c}),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",r?"mx-6 md:mx-10 lg:mx-12 mb-6 md:mb-10 lg:mb-12":"mx-5 mb-5"),children:[C&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs",style:{color:t.muted},children:[e.jsx(z,{className:"w-3.5 h-3.5",style:{color:t.green}}),"Checking ",e.jsx("strong",{className:"font-medium",style:{color:t.secondary},children:C})]}),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(B,{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:c,submitting:I,error:L}),m==="done"&&e.jsx($,{onClose:()=>l("form"),variant:c})]})}function X(){const{display:o}=J();return e.jsx(e.Fragment,{children:o})}export{V as C,X as U};