1import{r as i,j as e}from"./vendor-react-BeMwV2RB.js";import{D as P,a as q}from"./dialog-CJEzSaPg.js";import{B as D}from"./button-BJBnvF2M.js";import{C as k}from"./checkbox-BO34eVAC.js";import{u as $,F as f}from"./useFormValidation-DvgxymV6.js";import{useFormSubmission as V}from"./useFormSubmission-CWjcDT2x.js";import{c as A,r as v,h as B,p as I}from"./spamShield-BWEq4YhH.js";import{Q as L}from"./main-S1XLWSmD.js";import"./index-DtDbJvqO.js";import"./index-LD0EAUgB.js";import"./index-BjZIVrY8.js";import"./index-uOP7Wfgo.js";import"./index-DkhYxWet.js";import"./index-Z-0HkYUy.js";import"./vendor-icons-B3jArsxz.js";import"./index-BmHaEqrW.js";import"./index-B3CH6abI.js";import"./index-C8Gqg3RR.js";import"./input-402QBROr.js";import"./textarea-C9oSgQzA.js";import"./inputSanitization-CxhB9KOA.js";import"./index-BVzC4HHF.js";import"./formSubmission-CA6FnzN_.js";import"./openAiAdsPixel-Qj3FnKsq.js";import"./vendor-query-DT83e8T0.js";const O=({propertyAddress:n="",onSubmitted:c})=>{const{saving:u,handleSubmit:N}=V(),{errors:r,validateForm:S,clearError:b,clearAllErrors:C}=$(),{identifyUser:T}=L(),[a,d]=i.useState({name:"",email:"",phone:"",subject:"Showing",message:"",property:n,agent:"",consentToTexts:!1}),[o,y]=i.useState(()=>A()),[p,l]=i.useState(null),[h,m]=i.useState(null);i.useEffect(()=>{y(s=>v(s))},[]),i.useEffect(()=>{d(s=>({...s,property:n}))},[n]);const w=s=>{const t=s.replace(/\D/g,"");return t.length<=3?t:t.length<=6?`${t.slice(0,3)}-${t.slice(3)}`:`${t.slice(0,3)}-${t.slice(3,6)}-${t.slice(6,10)}`},x=s=>{const{name:t,value:g}=s.target;let j=g;t==="phone"&&(j=w(g)),d(M=>({...M,[t]:j})),b(t),p&&l(null),h&&m(null)},F=s=>{d(t=>({...t,consentToTexts:s})),s&&b("consent"),p&&l(null),h&&m(null)},E=async s=>{if(s.preventDefault(),!S(a))return;C(),await N(a,{spamMeta:I(o),onSuccess:()=>{T({email:a.email,firstName:a.name.split(" ")[0],lastName:a.name.split(" ").slice(1).join(" "),phone:a.phone}),d({name:"",email:"",phone:"",subject:"Showing",message:"",property:n,agent:"",consentToTexts:!1}),y(v()),l(null),m("Viewing request sent. Closing form..."),window.setTimeout(()=>c?.(),700)},onFailure:g=>{m(null),l(g)}})||(m(null),l("We couldn't schedule your viewing yet. Please try again."))};return e.jsxs("div",{className:"card card--static-hover p-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h3",{className:"text-2xl font-light tracking-wide mb-2",children:"Schedule A Tour"}),e.jsx("p",{className:"text-muted-foreground",children:"Request an in-person or virtual showing and we'll get back to you to confirm a time."})]}),e.jsxs("form",{onSubmit:E,className:"space-y-6",children:[e.jsxs("div",{style:B,"aria-hidden":"true",children:[e.jsx("label",{htmlFor:"tour-company",className:"text-xs",children:"Company"}),e.jsx("input",{id:"tour-company",name:"company",type:"text",tabIndex:-1,autoComplete:"off",value:o.honeypot||"",onChange:s=>y(t=>({...t,honeypot:s.target.value}))})]}),e.jsx("input",{type:"hidden",name:"renderedAt",value:o.renderedAt?String(o.renderedAt):""}),e.jsx("input",{type:"hidden",name:"jsChallenge",value:o.jsChallenge||""}),e.jsx("input",{type:"hidden",name:"pagePath",value:o.pagePath||""}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsx(f,{id:"name",name:"name",label:"Full Name",value:a.name,onChange:x,placeholder:"Your full name",required:!0,error:r.name}),e.jsx(f,{id:"email",name:"email",label:"Email Address",type:"email",value:a.email,onChange:x,placeholder:"[email protected]",required:!0,error:r.email})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsx(f,{id:"phone",name:"phone",label:"Phone Number",type:"tel",value:a.phone,onChange:x,placeholder:"555-123-4567",maxLength:12,required:!0,error:r.phone}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-1",children:"Property Address"}),e.jsx("div",{className:"px-3 py-2 rounded-md border border-input bg-muted text-sm text-muted-foreground min-h-[2.5rem] flex items-center",children:a.property||"No specific property"}),e.jsx("input",{type:"hidden",name:"property",value:a.property})]})]}),e.jsx(f,{id:"message",name:"message",label:"Message",type:"textarea",value:a.message,onChange:x,placeholder:"Tell us about your viewing preferences and any specific questions...",rows:5,required:!0,error:r.message}),e.jsxs("div",{className:`flex items-start space-x-3 p-4 bg-muted/50 rounded-lg ${r.consent?"border border-destructive":""}`,children:[e.jsx(k,{id:"consent",checked:a.consentToTexts,onCheckedChange:F,className:"mt-0.5"}),e.jsx("label",{htmlFor:"consent",className:"text-sm text-muted-foreground leading-relaxed",children:"By
1selecting this, you agree to receive text messages from The Thurber Team for agent outreach and continued support. Message and data rates may apply. Message frequency varies. Text HELP to 412-900-2243 for assistance. You can reply STOP to unsubscribe at any time."})]}),r.consent&&e.jsx("p",{className:"text-sm text-destructive mt-1",children:r.consent}),p&&e.jsx("p",{className:"text-sm text-destructive mt-1",children:p}),h&&e.jsx("p",{className:"text-sm text-emerald-700 mt-1",children:h}),e.jsx(D,{type:"submit",className:"w-full",disabled:u,children:u?"Sending...":"Schedule Tour"})]})]})},de=({isOpen:n,onClose:c,propertyAddress:u})=>e.jsx(P,{open:n,onOpenChange:c,children:e.jsx(q,{className:"z-[9999]",contentClassName:"sm:max-w-2xl max-h-[90vh] overflow-y-auto grid gap-4",children:e.jsx(O,{propertyAddress:u,onSubmitted:c})})});export{de 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.