import{e as Q,r as a,j as e,L as D}from"./vendor-react-CVHocMAO.js";import{c9 as k,k as L,cE as X,L as l,I as c,b_ as z,bH as Z,B as w,bT as ee,F as te,U as se,a4 as ae,R as ne,Y as re}from"./index-DXdAv5n3.js";import"./vendor-maps-BX5dXCaZ.js";import"./vendor-amplify-BttVyssp.js";import{C as ie}from"./circle-check-CJi34ijI.js";import"./vendor-radix-Boyzn9qx.js";import"./vendor-motion-CP2nHqR4.js";const oe=["Elegant","Casual","Party / Nightlife","Corporate","Intimate","Outdoor","Family-friendly"],le=["Venue","Catering","Photography","Entertainment","Decor","Florist","Bartending","Rentals"];async function ce(n){return k("/concierge/inquiries",{method:"POST",body:JSON.stringify(n)})}async function ue(){return k("/concierge/inquiries/me")}const O=0,j=1e5,M=1e3,C="conciergePendingInquiry";function de(){if(typeof window>"u")return null;try{const n=sessionStorage.getItem(C);return n?JSON.parse(n):null}catch{return null}}function me(){typeof window<"u"&&sessionStorage.removeItem(C)}const q=n=>`$${n.toLocaleString("en-US",{maximumFractionDigits:0})}${n>=j?"+":""}`;function T({label:n,selected:i,onToggle:o}){return e.jsx("button",{type:"button","aria-pressed":i,onClick:o,className:te("rounded-full border px-4 py-2 text-sm font-medium transition-colors",i?"border-brand-500 bg-brand-50 text-brand-700":"border-gray-300 bg-white text-[#4B4B4B] hover:border-gray-400"),children:n})}const xe=({onSubmitted:n})=>{const{toast:i}=ee(),{user:o}=L(),h=Q(),s=a.useMemo(()=>de(),[]),[g,_]=a.useState(s?String(s.guestCount):""),[r,S]=a.useState(s?[s.budgetMin,s.budgetMax]:[5e3,25e3]),[b,R]=a.useState((s==null?void 0:s.eventDate)??""),[m,G]=a.useState((s==null?void 0:s.dateFlexible)??!1),[p,U]=a.useState((s==null?void 0:s.vibes)??[]),[B,W]=a.useState((s==null?void 0:s.vibeOther)??""),[y,A]=a.useState((s==null?void 0:s.location)??""),[f,V]=a.useState((s==null?void 0:s.services)??[]),[F,Y]=a.useState((s==null?void 0:s.servicesOther)??""),[v,J]=a.useState((s==null?void 0:s.description)??""),[I,u]=a.useState(null),E=(t,d,$)=>{$(d.includes(t)?d.filter(H=>H!==t):[...d,t])},x=X({mutationFn:t=>ce(t),onSuccess:t=>{me(),n(t)},onError:()=>{i({title:"Something went wrong",description:"We couldn't submit your request. Please try again in a moment.",variant:"destructive"})}}),P=a.useRef(!1);a.useEffect(()=>{o&&s&&!P.current&&(P.current=!0,x.mutate(s))},[o,s,x]);const N=a.useMemo(()=>{const t=parseInt(g,10);return Number.isFinite(t)?t:NaN},[g]),K=t=>{if(t.preventDefault(),u(null),!Number.isFinite(N)||N<1){u("Please enter how many guests you're expecting.");return}if(r[1]<r[0]){u("Your maximum budget can't be lower than your minimum.");return}if(!y.trim()){u("Please tell us roughly where your event will be.");return}if(!m&&!b){u("Please pick a date, or check “My date is flexible”.");return}if(!v.trim()){u("Please describe your event so we know what to source.");return}const d={guestCount:N,budgetMin:r[0],budgetMax:r[1],eventDate:m?void 0:b,dateFlexible:m,vibes:p,vibeOther:B.trim()||void 0,location:y.trim(),services:f,servicesOther:F.trim()||void 0,description:v.trim()};if(!o){try{sessionStorage.setItem(C,JSON.stringify(d))}catch{}h(`/auth?redirect=${encodeURIComponent("/concierge")}`);return}x.mutate(d)};return e.jsxs("form",{onSubmit:K,className:"space-y-8",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"concierge-guests",children:"How many guests are you expecting?"}),e.jsx(c,{id:"concierge-guests",type:"number",min:1,inputMode:"numeric",placeholder:"e.g. 80",value:g,onChange:t=>_(t.target.value),className:"max-w-[200px]"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx(l,{children:"What's your total budget?"}),e.jsxs("span",{className:"text-sm font-medium text-[#0F0F0F]",children:[q(r[0])," – ",q(r[1])]})]}),e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(l,{htmlFor:"concierge-budget-min",className:"text-xs font-normal text-[#4B4B4B]",children:"Minimum"}),e.jsx(c,{id:"concierge-budget-min",type:"number",min:O,max:j,step:M,inputMode:"numeric",placeholder:"e.g. 5,000",value:Number.isFinite(r[0])?r[0]:"",onChange:t=>S([t.target.value===""?0:Number(t.target.value),r[1]]),className:"max-w-[160px]"})]}),e.jsx("span",{className:"pb-2 text-sm text-[#4B4B4B]",children:"–"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(l,{htmlFor:"concierge-budget-max",className:"text-xs font-normal text-[#4B4B4B]",children:"Maximum"}),e.jsx(c,{id:"concierge-budget-max",type:"number",min:O,max:j,step:M,inputMode:"numeric",placeholder:"e.g. 25,000",value:Number.isFinite(r[1])?r[1]:"",onChange:t=>S([r[0],t.target.value===""?0:Number(t.target.value)]),className:"max-w-[160px]"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"concierge-date",children:"When is your event?"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsx(c,{id:"concierge-date",type:"date",value:b,disabled:m,onChange:t=>R(t.target.value),className:"max-w-[220px]"}),e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm text-[#4B4B4B]",children:[e.jsx(z,{checked:m,onCheckedChange:t=>G(t===!0)}),"My date is flexible / not sure yet"]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(l,{children:"What's the vibe?"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:oe.map(t=>e.jsx(T,{label:t,selected:p.includes(t),onToggle:()=>E(t,p,U)},t))}),e.jsx(c,{placeholder:"Something else? Describe the vibe (optional)",value:B,onChange:t=>W(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"concierge-location",children:"Where will it be?"}),e.jsx(c,{id:"concierge-location",placeholder:"City or area, e.g. Philadelphia, PA",value:y,onChange:t=>A(t.target.value)})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(l,{children:"What should we source?"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:le.map(t=>e.jsx(T,{label:t,selected:f.includes(t),onToggle:()=>E(t,f,V)},t))}),e.jsx(c,{placeholder:"Anything else you need? (optional)",value:F,onChange:t=>Y(t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"concierge-description",children:"Tell us about your event"}),e.jsx(Z,{id:"concierge-description",rows:6,placeholder:"The more detail the better — the occasion, must-haves, any inspiration, special requests, anything that makes it yours.",value:v,onChange:t=>J(t.target.value)})]}),I&&e.jsx("p",{className:"text-sm text-red-600",children:I}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{type:"submit",disabled:x.isPending,className:"w-full rounded-full bg-gradient-to-r from-brand-400 to-brand-500 py-6 text-base font-medium text-white shadow-lg transition-all hover:brightness-90 hover:shadow-xl sm:w-auto sm:px-10",children:x.isPending?"Sending…":o?"Submit my event":"Continue"}),!o&&e.jsx("p",{className:"text-sm text-[#4B4B4B]",children:"You'll sign in to send your request — don't worry, your answers are saved."})]})]})};function he(n=!0){const{user:i}=L();return se({queryKey:["concierge-inquiry","me",i==null?void 0:i.id],queryFn:()=>ue(),enabled:!!i&&n,staleTime:6e4,retry:!1})}function ge(){return e.jsxs("div",{className:"rounded-3xl border border-brand-100 bg-brand-50/60 p-8 text-center md:p-12",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-white shadow-sm",children:e.jsx(ie,{className:"h-7 w-7 text-brand-500"})}),e.jsx("h2",{className:"mb-2 text-2xl font-semibold text-[#0F0F0F]",children:"Got it, we're on your event"}),e.jsxs("p",{className:"mx-auto max-w-md text-[#4B4B4B]",children:["A member of our team is sourcing options that fit your budget and vibe. We'll send your first slate of options"," ",e.jsx("strong",{children:"within 10 days"}),". Keep an eye on your inbox. No action needed from you right now."]}),e.jsx(w,{asChild:!0,variant:"outline",className:"mt-6 rounded-full px-6",children:e.jsx(D,{to:"/",children:"Back to home"})})]})}const we=()=>{const[n,i]=a.useState(null),{data:o,isLoading:h}=he(),s=!!(n||o);return e.jsx(ae,{showSearch:!1,showFooter:!0,children:e.jsx("div",{className:"bg-gradient-to-b from-brand-50/70 to-white",children:e.jsxs("div",{className:"container mx-auto px-4 py-12 md:py-16",children:[e.jsx(w,{asChild:!0,variant:"ghost",className:"mb-4 -ml-2 inline-flex items-center gap-1.5 rounded-full text-sm font-medium text-[#4B4B4B] hover:text-[#0F0F0F]",children:e.jsxs(D,{to:"/",children:[e.jsx(ne,{className:"h-4 w-4"}),"Back to home"]})}),e.jsxs("div",{className:"mx-auto max-w-3xl text-center",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-white px-3 py-1 text-sm font-medium text-brand-600 shadow-sm",children:[e.jsx(re,{className:"h-4 w-4"}),"PLEC Concierge"]}),e.jsx("h1",{className:"mt-5 text-4xl font-semibold leading-tight text-[#0F0F0F] md:text-5xl",children:"Need help planning your event?"}),e.jsx("p",{className:"mx-auto mt-4 max-w-2xl text-lg leading-relaxed text-[#4B4B4B]",children:"Keep your event under control and under budget. Let a member of our team source the prices for you."})]}),e.jsx("div",{className:"mx-auto mt-10 max-w-2xl",children:h?e.jsx("div",{className:"h-64 animate-pulse rounded-3xl bg-gray-100"}):s?e.jsx(ge,{}):e.jsx("div",{className:"rounded-3xl border border-gray-200 bg-white p-6 shadow-sm md:p-10",children:e.jsx(xe,{onSubmitted:i})})})]})})})};export{we as default};