1import{j as e,m as E,A as H}from"./vendor-motion-i3VZ6rIW.js";import{c as X,r,h as ne,f as ie}from"./vendor-react-DPq4nRXU.js";import{b as le,d as ce,e as ue}from"./usePublicData-NvbnltOq.js";import{u as de,x as Z,s as V,C as me,B as F,i as U,a as O,y as xe,w as pe}from"./index-uu5Ind1I.js";import{P as he}from"./PhoneInput-BVVUgELg.js";import{A as ee}from"./arrow-left-DbkuGbLE.js";import{C as fe}from"./chevron-left-CWQNO-nq.js";import{s as Y}from"./types-ByNwzYMu.js";import ge from"./NotFound-DAgN7M1B.js";import"./vendor-query-2yB9p-Rm.js";import"./vendor-supabase-CXidNrjy.js";import"./chevron-down-ejGq_1sJ.js";import"./search-DPDCSnXK.js";const J=Y().trim().min(1).max(100),Q=Y().trim().email().max(255),ye=Y().trim().min(6).max(30),N=["intro","name","package","date","phone","email"],be={enter:n=>({x:n>0?120:-120,opacity:0}),center:{x:0,opacity:1},exit:n=>({x:n>0?-120:120,opacity:0})};function ve({cityId:n,citySlug:f,cityName:A,packages:g,defaultPackageSlug:k,defaultDate:m,defaultCountryCode:D}){const y=X(),{t:a}=de(),{country:S}=Z(),[o,b]=r.useState(0),[C,v]=r.useState(1),[j,K]=r.useState(!1),[c,T]=r.useState(!1),[u,_]=r.useState(""),[x,te]=r.useState(k||""),[d,ae]=r.useState(m||""),[p,re]=r.useState(""),[h,se]=r.useState(""),[G,I]=r.useState(null),M=r.useRef(null);r.useEffect(()=>{(async()=>{try{const{data:s}=await V.from("form_attempts").insert({city_id:n,current_step:"intro",country:S||null,user_agent:navigator.userAgent,selected_package_slug:k||null}).select("id").single();s&&(M.current=s.id)}catch(s){console.error("Failed to create form attempt:",s)}})()},[n,S,k]);const $=r.useCallback(async t=>{if(M.current)try{await V.from("form_attempts").update(t).eq("id",M.current)}catch(s){console.error("Failed to update form attempt:",s)}},[]),i=c?"success":N[o],l=g.find(t=>t.slug===x),R=r.useCallback(()=>{switch(i){case"intro":return null;case"name":return u.trim()?J.safeParse(u).success?null:a("Name is too long (max 100 characters)"):a("Please enter your name");case"package":return x?null:a("Please select an experience");case"date":return d?null:a("Please select a date");case"phone":return!p.trim()||p.replace(/[^0-9]/g,"").length<6?a("Please enter a valid phone number"):null;case"email":return h.trim()?Q.safeParse(h).success?null:a("Please enter a valid email address"):a("Please enter your email");default:return null}},[i,u,x,d,p,h,a]),z=r.useCallback(()=>R()===null,[R]),w=r.useCallback(async()=>{const t=R();if(t){I(t);return}if(I(null),o<N.length-1){const s=N[o+1];v(1),b(P=>P+1),$({current_step:s,...u&&{name:u},...x&&{selected_package_slug:x},...d&&{preferred_date:d},...p&&{phone:p},...h&&{email:h},...l&&{package_id:l.id}})}else{K(!0);try{const s=J.parse(u),P=Q.parse(h),W=ye.parse(p);await V.from("contact_submissions").insert({city_id:n,package_id:(l==null?void 0:l.id)||null,name:s,email:P,phone:W,preferred_date:d||null}),V.functions.invoke("create-kommo-lead",{body:{name:s,email:P,phone:W,packageTitle:(l==null?void 0:l.title)||x||void 0,citySlug:f,cityName:A||f,preferredDate:d||void 0,country:S||void 0}}).then(B=>{B.error?console.error("Kommo lead creation failed:",B.error):console.log("Kommo lead created successfully")}).catch(B=>console.error("Kommo lead creation error:",B)),$({completed:!0,current_step:"success",name:s,email:P,phone:W,preferred_date:d||null,package_id:(l==null?void 0:l.id)||null,selected_package_slug:x||null}),T(!0)}catch(s){console.error("Submission error:",s)}finally{K(!1)}}},[o,z,n,u,h,p,l,d]),oe=()=>{I(null),o>0?(v(-1),b(t=>t-1)):y(-1)},q=i==="intro"?0:o/N.length*100;return c?e.jsxs(E.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.5},className:"flex flex-col items-center justify-center text-center gap-6 px-6",children:[e.jsx(E.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.2,type:"spring",stiffness:200},className:"w-20 h-20 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(me,{className:"w-10 h-10 text-primary"})}),e.jsx("h2",{className:"font-heading text-3xl sm:text-4xl text-foreground",children:a("Thank you!")}),e.jsx("p",{className:"text-muted-foreground text-lg max-w-xs",children:a("Our team will shortly contact you!")}),e.jsxs(F,{variant:"outline",className:"mt-4 border-border/40",onClick:()=>y(`/${f}`),children:[e.jsx(ee,{className:"w-4 h-4 mr-2"}),a("Back to packages")]})]}):e.jsxs("div",{className:"flex flex-col w-full max-w-md mx-auto px-4 sm:px-0",children:[i!=="intro"&&e.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[e.jsx("div",{className:"flex-1 h-1 bg-white/10 rounded-full overflow-hidden",children:e.jsx(E.div,{className:"h-full rounded-full bg-primary",initial:!1,animate:{width:`${q}%`},transition:{duration:.3}})}),e.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums",children:[Math.round(q),"%"]})]}),e.jsx("div",{className:"relative min-h-[220px] flex items-center",children:e.jsx(H,{mode:"wait",custom:C,children:e.jsxs(E.div,{custom:C,variants:be,initial:"enter",animate:"center",exit:"exit",transition:{duration:.3,ease:"easeInOut"},className:"w-full",children:[i==="intro"&&e.jsxs("div",{className:"flex flex-col items-center text-center gap-5",children:[e.jsx("h2",{className:"font-heading text-2xl sm:text-3xl text-foreground leading-snug",children:a("To secure your date, kindly confirm your information.")}),e.jsx("p",{className:"text-muted-foreground text-base max-w-xs",children:a("Our team will personally contact you within 10 minutes.")}),e.jsxs(F,{onClick:w,className:"gradient-cta hover:gradient-cta-hover text-white font-semibold px-8 mt-2",children:[a("Let's go"),e.jsx(U,{className:"w-4 h-4 ml-1"})]})]}),i==="name"&&e.jsx(L,{title:a("Your name"),children:e.jsx("input",{type:"text",value:u,onChange:t=>_(t.target.value),onKeyDown:t=>t.key==="Enter"&&z()&&w(),placeholder:"Leo",autoFocus:!0,maxLength:100,className:O("w-full h-14 px-4 roun
1ded-xl border border-border/40","bg-white/5 backdrop-blur-sm text-foreground text-lg","placeholder:text-muted-foreground/50","focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary/30","transition-all")})}),i==="package"&&e.jsx(L,{title:a("What experience do you like?"),children:e.jsx("div",{className:"grid gap-2 max-h-[40vh] overflow-y-auto pr-1",children:g.map(t=>e.jsx("button",{type:"button",onClick:()=>{te(t.slug),setTimeout(()=>{v(1),b(s=>s+1)},250)},className:O("w-full text-left px-4 py-3.5 rounded-xl border transition-all","hover:bg-white/10",x===t.slug?"border-primary bg-primary/10 text-foreground":"border-border/40 bg-white/5 text-foreground/80"),children:e.jsx("span",{className:"font-medium",children:t.title})},t.slug))})}),i==="date"&&e.jsx(L,{title:a("What date do you like to make your proposal?"),children:e.jsx("input",{type:"date",value:d,onChange:t=>ae(t.target.value),onKeyDown:t=>t.key==="Enter"&&w(),autoFocus:!0,min:new Date().toISOString().split("T")[0],className:O("w-full h-14 px-4 rounded-xl border border-border/40","bg-white/5 backdrop-blur-sm text-foreground text-lg","focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary/30","transition-all","[color-scheme:dark]")})}),i==="phone"&&e.jsx(L,{title:a("Your phone number"),children:e.jsx(he,{value:p,onChange:re,defaultCountryCode:D,onSubmit:()=>z()&&w()})}),i==="email"&&e.jsx(L,{title:a("Your e-mail"),children:e.jsx("input",{type:"email",value:h,onChange:t=>se(t.target.value),onKeyDown:t=>t.key==="Enter"&&z()&&w(),placeholder:"[email protected]",autoFocus:!0,maxLength:255,className:O("w-full h-14 px-4 rounded-xl border border-border/40","bg-white/5 backdrop-blur-sm text-foreground text-lg","placeholder:text-muted-foreground/50","focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary/30","transition-all")})})]},i)})}),e.jsx(H,{children:G&&e.jsx(E.p,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"text-sm text-destructive mt-3 text-center",children:G})}),i!=="intro"&&e.jsxs("div",{className:"flex items-center justify-between mt-4 gap-3",children:[e.jsxs(F,{variant:"ghost",onClick:oe,className:"text-muted-foreground",children:[e.jsx(fe,{className:"w-4 h-4 mr-1"}),a("Back")]}),e.jsxs(F,{onClick:w,disabled:j,className:"gradient-cta hover:gradient-cta-hover text-white font-semibold px-6",children:[j?a("Sending..."):o===N.length-1?a("Submit"):a("Next"),!j&&o<N.length-1&&e.jsx(U,{className:"w-4 h-4 ml-1"})]})]})]})}function L({title:n,children:f}){return e.jsxs("div",{className:"space-y-5",children:[e.jsx("h2",{className:"font-heading text-2xl sm:text-3xl text-foreground leading-tight text-center",children:n}),f]})}function Te(){const{city:n}=ne(),f=X(),[A]=ie(),g=A.get("package"),k=A.get("date"),{data:m,isLoading:D}=le(n),{data:y=[],isLoading:a}=ce(m==null?void 0:m.id),{country:S}=Z(),o=r.useMemo(()=>g?y.find(c=>c.slug===g):y[0],[y,g]),{data:b}=ue(o==null?void 0:o.id),C=r.useMemo(()=>{if(!b)return{photos:[],videos:[]};const c=[],T=[];for(const u of b.categories){for(const _ of u.photos)c.push(_.url);for(const _ of u.videos)T.push(_.url)}return{photos:c,videos:T}},[b]),v=(o==null?void 0:o.heroVideoDesktop)||C.videos[0],j=C.photos[0];if(!D&&!m)return e.jsx(ge,{});const K=y.map(c=>({id:c.id,slug:c.slug,title:c.title}));return e.jsxs("div",{className:"relative min-h-[100dvh] flex flex-col items-center justify-center overflow-hidden bg-background",children:[e.jsx(xe,{title:"Contact Us | Vika Krol",description:"Get in touch with Vika Krol to plan your dream proposal in Paris.",noindex:!0}),e.jsxs("div",{className:"absolute inset-0 z-0",children:[v?e.jsx("video",{src:v,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,className:"w-full h-full object-cover"}):j?e.jsx("img",{src:j,alt:"",className:"w-full h-full object-cover"}):null,e.jsx("div",{className:"absolute inset-0 bg-black/65 backdrop-blur-[2px]"})]}),e.jsx("button",{type:"button",onClick:()=>f(-1),className:"absolute top-6 left-6 z-20 text-white/70 hover:text-white transition-colors",children:e.jsx(ee,{className:"w-6 h-6"})}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center w-full max-w-lg px-4 py-8 sm:py-12 min-h-[100dvh] justify-center",children:[e.jsx("img",{src:pe,alt:"
1Vika Krol",className:"h-12 sm:h-14 mb-10 object-contain drop-shadow-lg"}),e.jsx("div",{className:"w-full rounded-2xl border border-white/10 bg-black/40 backdrop-blur-xl p-6 sm:p-8 shadow-elevated",children:D||a?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"})}):e.jsx(ve,{cityId:m.id,citySlug:n,cityName:m.display_name,packages:K,defaultPackageSlug:g,defaultDate:k,defaultCountryCode:S})})]})]})}export{Te as default};
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.