1import{b as E,j as t}from"./query-Q_ThwKGI.js";import{u as C,r as u}from"./react-vendor-wefok28f.js";import{s as z}from"./client-DjLwxtrO.js";import{B as S}from"./button-DrepnwkX.js";import{initializeTracking as T,trackPageView as B,trackLeadEvent as L}from"./trackingScripts-1XOvU7Jx.js";import{F}from"./FormUnavailableError-D5g8vwrQ.js";import{P as I}from"./index-C4Kq7kkR.js";import{M as m}from"./MarkdownText-DKqKFDLC.js";import{u as P}from"./useTranslation-DNoH3foE.js";import"./supabase-COHOFxoQ.js";import"./icons-By8asZST.js";const H=()=>{const{t:_}=P("forms"),{userCode:i,formSlug:c}=C(),[x,p]=u.useState(!1),{data:s,isLoading:g,error:a}=E({queryKey:["form",i,c],retry:!1,queryFn:async()=>{if(!i||!c)throw new Error("Missing parameters");const{data:o,error:r}=await z.rpc("get_public_form_by_slug",{p_user_code:parseInt(i),p_slug:c});if(r)throw r;const l=o;if(!l||l.status==="not_found")throw new Error("Form not found");if(l.status==="owner_blocked")throw new Error("OWNER_BLOCKED");return l.form}});u.useEffect(()=>(s!=null&&s.name&&(document.title=`${s.name} - Thank You`),()=>{document.title="Leads Flow"}),[s==null?void 0:s.name]),u.useEffect(()=>{if(!s||x)return;const o=()=>{T({facebook_pixel_id:s.facebook_pixel_id,google_analytics_id:s.google_analytics_id,google_tag_manager_id:s.google_tag_manager_id}),B(s.name,window.location.href),L(s.id),p(!0)},r=window;typeof r.requestIdleCallback=="function"?r.requestIdleCallback(o,{timeout:2e3}):setTimeout(o,0)},[s,x]);const b=o=>{const r=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/,l=o.match(r);return l&&l[2].length===11?`https://www.youtube.com/embed/${l[2]}`:null};if(g)return t.jsx(I,{});if(a||!s||!s.thank_you_settings){const o=(a==null?void 0:a.message)==="OWNER_BLOCKED";return t.jsx(F,{isOwnerBlocked:o})}const e=s.thank_you_settings,w=e.headline||e.congrats_text||"Congratulations!",y=e.headline_color||e.congrats_color||"#222222",j=e.headline_size||e.congrats_size||"3xl",f=e.subheadline||"",k=e.subheadline_color||"#666666",v=e.subheadline_size||"xl",n={sm:"text-sm",base:"text-base",lg:"text-lg",xl:"text-xl","2xl":"text-2xl","3xl":"text-3xl"},h={sm:"h-9 px-3 text-sm",md:"h-10 px-4",lg:"h-11 px-8 text-lg"},N=e.video_type==="url"?e.video_url:e.embed_code,d=s.theme;return t.jsx("div",{className:"min-h-screen flex items-center justify-center p-4",style:{backgroundColor:e.background_color||(d==null?void 0:d.backgroundColor)||"#ffffff"},children:t.jsxs("div",{className:"max-w-2xl w-full space-y-6",children:[t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("h1",{className:`font-bold ${n[j]||n["3xl"]}`,style:{color:y},children:t.jsx(m,{children:w})}),f&&t.jsx("p",{className:`${n[v]||n.xl}`,style:{color:k},children:t.jsx(m,{children:f})})]}),N&&t.jsx("div",{className:"w-full",children:e.video_type==="url"&&e.video_url?t.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:t.jsx("iframe",{className:"absolute top-0 left-0 w-full h-full rounded-lg",src:b(e.video_url)||e.video_url,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}):e.embed_code?t.jsx("div",{className:"w-full",dangerouslySetInnerHTML:{__html:e.embed_code}}):null}),e.show_next_steps&&e.next_steps.length>0&&t.jsxs("div",{className:"bg-card/50 backdrop-blur-sm rounded-lg p-6 space-y-4 mt-8",children:[t.jsx("h2",{className:"text-xl font-semibold text-foreground",children:_("thankYou.nextSteps")}),t.jsx("ol",{className:"space-y-3",children:e.next_steps.map((o,r)=>
1t.jsxs("li",{className:"flex items-start gap-3",children:[t.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-sm font-medium",style:{backgroundColor:e.button_color,color:"#ffffff"},children:r+1}),t.jsx("span",{className:"text-foreground pt-0.5",children:t.jsx(m,{children:o.text})})]},r))})]}),e.button_url&&t.jsx("div",{className:"text-center",children:t.jsx(S,{className:h[e.button_size]||h.lg,style:{backgroundColor:e.button_color},onClick:()=>{e.button_url&&(window.location.href=e.button_url)},children:e.button_text})})]})})};export{H 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.