1import{j as e}from"./ui-vendor-B12AOeKi.js";import{u as U,e as q,r as a}from"./react-vendor-DZt7wVAJ.js";import{s as K}from"./index-CUOC2qQu.js";import"./charts-vendor-B6q1L48j.js";import"./supabase-vendor-dOy44Gxq.js";import"./animation-vendor-BAVy02gd.js";const i="#1B2D5C",T="#5BBA47",w="#C98A0B",j="#C0392B",D="Paul Santiago",S="351-500-6067",V=(()=>{const n=[];for(let r=7;r<=18;r++)for(const c of["00","30"]){const d=String(r).padStart(2,"0");n.push(`${d}:${c}`)}return n})();function G(n){const[r,c]=n.split(":").map(Number),d=r>=12?"PM":"AM";return`${r%12===0?12:r%12}:${String(c).padStart(2,"0")} ${d}`}function R(){const n=new Date,r=n.getTimezoneOffset();return new Date(n.getTime()-r*6e4).toISOString().slice(0,10)}function J(n){if(!n)return"";try{return new Date(n).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"})}catch{return""}}const Q=[{value:"email",label:"By email",sub:"We'll send your written offer to your inbox"},{value:"paperwork",label:"With my paperwork",sub:"We'll include it with your service paperwork"},{value:"both",label:"Both",sub:"Email it to me and include it with my paperwork"}];function m({accent:n,eyebrow:r,heading:c,children:d,footer:f,testNote:y}){return e.jsx("div",{style:{minHeight:"100vh",backgroundImage:"linear-gradient(180deg,#DCE6F5 0%,#EEF2F7 45%,#ffffff 100%)",backgroundColor:"#EEF2F7",fontFamily:"-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif",WebkitFontSmoothing:"antialiased",color:i,display:"flex",alignItems:"center",justifyContent:"center",padding:"40px 14px",boxSizing:"border-box"},children:e.jsxs("div",{style:{width:"100%",maxWidth:560,background:"#ffffff",border:"1px solid #D6DEE8",borderRadius:16,overflow:"hidden",boxShadow:"0 18px 44px rgba(27,45,92,.14)"},children:[y?e.jsx("div",{style:{background:"#FFF6DA",borderBottom:"1px solid #F0DFA6",color:"#7A5B00",padding:"10px 32px",fontSize:12,fontWeight:700},children:"Test preview â nothing was recorded on any customer record."}):null,e.jsxs("div",{style:{padding:"22px 32px",borderBottom:"1px solid #E5EBF3",fontWeight:800,letterSpacing:1.4,textTransform:"uppercase",fontSize:11},children:[e.jsx("span",{style:{color:n,fontSize:14,lineHeight:1},children:"â"})," ",e.jsx("span",{style:{verticalAlign:"middle"},children:r})]}),e.jsxs("div",{style:{padding:"38px 36px 20px 36px",textAlign:"center"},children:[e.jsx("h1",{style:{fontFamily:"'Arial Black',Impact,sans-serif",fontWeight:900,fontSize:24,lineHeight:1.25,color:i,margin:0},children:c}),e.jsx("div",{style:{height:4,width:72,background:n,borderRadius:2,margin:"16px auto 20px auto"}}),d]}),f?e.jsx("div",{style:{padding:"16px 36px 28px 36px",textAlign:"center",color:"#6B7A96",fontSize:12,lineHeight:1.5},children:f}):null]})})}function re(){const[n]=U(),r=q(),c=(n.get("id")||"").trim(),d=(n.get("sig")||"").trim(),f=(n.get("r")||"").trim().toLowerCase(),y=(n.get("state")||"").trim().toLowerCase(),p=f==="confirm"||f==="cancel"||f==="reschedule"?f:null,l=(n.get("test")||"")==="1",z=!l&&(!c||!p||!d),[u,g]=a.useState(()=>
1y==="error"?"error":!l&&(y==="invalid"||!c&&!p&&!d)?"invalid":"ask"),[o,x]=a.useState(!1),[b,h]=a.useState(null),[B,F]=a.useState(null),[H,I]=a.useState(null),[P,O]=a.useState(null),[E,C]=a.useState(""),[N,M]=a.useState("09:00"),[k,Y]=a.useState(null);a.useEffect(()=>{z&&u==="ask"&&g(y==="error"?"error":"invalid")},[z,u,y]);const v=a.useMemo(()=>{switch(p){case"cancel":return{accent:j,heading:"Cancel your appointment?",message:"Tap below and we'll cancel your service appointment. You can always call us to book a new one.",button:"Yes, Cancel My Appointment"};case"reschedule":return{accent:w,heading:"Need a different day or time?",message:"Tap below and we'll help you pick a new day and time for your service appointment.",button:"Yes, I Need To Reschedule"};default:return{accent:T,heading:"Confirm your appointment",message:"Tap below to confirm you'll be here. We're looking forward to seeing you.",button:"Yes, Confirm My Appointment"}}},[p]),W=async t=>{if(l)return{};const{data:s,error:A}=await K.functions.invoke("acquire-appointment-response",{body:{id:c,r:p,sig:d,...t}});if(A)throw A;if(s&&typeof s=="object"&&"error"in s)throw new Error(String(s.error));return s||{}},L=async()=>{if(!(z&&!l||o)){x(!0),h(null);try{const t=await W({});if(p==="confirm")g(t.simpleMode===!0?"done":"prefs");else if(p==="reschedule"){const s=typeof t.rescheduleUrl=="string"?t.rescheduleUrl:null,A=typeof t.rescheduleInstructions=="string"?t.rescheduleInstructions:null;I(s),O(A),g(s?"book":"done")}else g("done")}catch(t){console.error("appointment response failed",t),h("Something went wrong. Please try again in a moment.")}finally{x(!1)}}},$=async()=>{if(o)return;if(!E){h("Please choose the date you booked.");return}const t=new Date(`${E}T${N}:00`);if(Number.isNaN(t.getTime())){h("Please choose a valid date and time.");return}x(!0),h(null);try{await W({newAppointmentAt:t.toISOString()}),Y(t.toISOString()),g("done")}catch(s){console.error("reschedule report failed",s),h("Something went wrong. Please try again in a moment.")}finally{x(!1)}},_=async t=>{if(!o){x(!0),h(null);try{await W({pref:t}),F(t),g("done")}catch(s){console.error("offer preference failed",s),h("Something went wrong. Please try again in a moment.")}finally{x(!1)}}};if(u==="invalid"||u==="error"){const t=u==="error";return e.jsxs(m,{testNote:l,accent:j,eyebrow:"Service Appointment",heading:t?"Something went wrong":"Link expired or invalid",children:[e.jsx("title",{children:t?"Something went wrong":"Link expired or invalid"}),e.jsxs("p",{style:{color:"#3A4A6B",fontSize:16,lineHeight:1.6},children:["Please give us a call at ",S," and we'll take care of your appointment right away."]})]})}return u==="book"?e.jsxs(m,{testNote:l,accent:w,eyebrow:"Service Appointment",heading:"Book your new time",footer:"Once you've booked, come back to this page and tell us the new time.",children:[e.jsx("title",{children:"Reschedule your appointment"}),e.jsx("p",{style:{color:"#3A4A6B",fontSize:16,lineHeight:1.6},children:P||"Pick any day and time that works for you using our online scheduler."}),e.jsx("div",{style:{marginTop:26},children:e.jsx("a",{href:H||"#",target:"_blank",rel:"noopener noreferrer",style:{display:"inline-block",background:w,color:"#ffffff",textDecoration:"none",fontWeight:800,fontSize:16,padding:"14px 26px",borderRadius:10,boxShadow:"0 8px 20px rgba(27,45,92,.18)"},children:"Open The Scheduler"})}),e.jsx("div",{style:{marginTop:22},children:e.jsx("button",{type:"button",onClick:()=>{h(null),C(R()),g("newtime")},style:{background:"none",border:"none",color:i,fontWeight:800,fontSize:14,textDecoration:"underline",cursor:"pointer"},children:"I've booked â tell us the new time"})})]}):u==="newtime"?e.jsxs(m,{testNote:l,accent:w,eyebrow:"Service Appointment",heading:"What day and time did you book?",children:[e.jsx("title",{children:"Confirm your new appointment time"}),e.jsx("p",{style:{color:"#3A4A6B",fontSize:16,lineHeight:1.6},children:"Let us know your new appointment so we have your vehicle ready â and so we can still prepare your complimentary appraisal."}),e.jsxs("div",{style:{marginTop:20,display:"grid",gap:12,textAlign:"left"},children:[e.jsxs("label",{style:{fontSize:12,fontWeight:800,color:i,textTransform:"uppercase",letterSpacing:1},children:["New date",e.jsx("input",{type:"date",value:E,min:R(),onChange:t=>C(t.target.value),style:{display:"block",width:"100%",marginTop:6,padding:"12px 14px",fontSize:16,borderRadius:10,border:"2px s
1olid #D6DEE8",color:i,boxSizing:"border-box"}})]}),e.jsxs("label",{style:{fontSize:12,fontWeight:800,color:i,textTransform:"uppercase",letterSpacing:1},children:["New time",e.jsx("select",{value:N,onChange:t=>M(t.target.value),style:{display:"block",width:"100%",marginTop:6,padding:"12px 14px",fontSize:16,borderRadius:10,border:"2px solid #D6DEE8",color:i,background:"#fff",boxSizing:"border-box"},children:V.map(t=>e.jsx("option",{value:t,children:G(t)},t))})]})]}),e.jsx("div",{style:{marginTop:24},children:e.jsx("button",{type:"button",onClick:$,disabled:o,style:{background:w,color:"#fff",border:"none",fontWeight:800,fontSize:16,padding:"14px 26px",borderRadius:10,cursor:o?"wait":"pointer",opacity:o?.7:1,boxShadow:"0 8px 20px rgba(27,45,92,.18)"},children:o?"Savingâ¦":"Save My New Time"})}),b&&e.jsx("div",{style:{marginTop:16,color:j,fontSize:14},children:b}),e.jsx("div",{style:{marginTop:18,fontSize:12},children:e.jsx("button",{type:"button",onClick:()=>g("done"),style:{background:"none",border:"none",color:"#6B7A96",textDecoration:"underline",cursor:"pointer"},children:"Skip â I'll confirm by phone"})})]}):u==="prefs"?e.jsxs(m,{testNote:l,accent:T,eyebrow:"Service Appointment",heading:"You're confirmed â thank you",children:[e.jsx("title",{children:"Appointment confirmed"}),e.jsxs("p",{style:{color:"#3A4A6B",fontSize:16,lineHeight:1.6},children:["While your vehicle is here for service, our team will c
1omplete a"," ",e.jsx("strong",{children:"complimentary appraisal"})," and prepare a real purchase offer for you â no obligation."]}),e.jsx("p",{style:{color:i,fontSize:16,fontWeight:800,lineHeight:1.5,marginTop:22},children:"How would you like to receive your offer?"}),e.jsx("div",{style:{marginTop:14,display:"grid",gap:10},children:Q.map(t=>e.jsxs("button",{type:"button",onClick:()=>_(t.value),disabled:o,style:{textAlign:"left",background:"#F4F7FB",border:`2px solid ${o?"#D6DEE8":i}`,borderRadius:12,padding:"14px 16px",cursor:o?"wait":"pointer",opacity:o?.65:1},children:[e.jsx("div",{style:{fontWeight:900,fontSize:16,color:i},children:t.label}),e.jsx("div",{style:{fontSize:13,color:"#5B6B85",marginTop:2},children:t.sub})]},t.value))}),b&&e.jsx("div",{style:{marginTop:16,color:j,fontSize:14},children:b})]}):u==="done"?p==="confirm"?e.jsxs(m,{testNote:l,accent:T,eyebrow:"Service Appointment",heading:"All set â we'll see you soon",footer:"You can close this window.",children:[e.jsx("title",{children:"Appointment confirmed"}),e.jsxs("p",{style:{color:"#3A4A6B",fontSize:16,lineHeight:1.6},children:["Your appointment is confirmed and we've noted that you'd like your offer"," ",e.jsx("strong",{children:B==="email"?"sent by email":B==="paperwork"?"included with your paperwork":B==="both"?"by email and with your paperwork":"presented during your visit"}),"."]}),e.jsxs("div",{style:{marginTop:24,background:i,color:"#fff",borderRadius:12,padding:"18px 20px"},children:[e.jsx("div",{style:{fontSize:11,letterSpacing:2,textTransform:"uppercase",color:T,fontWeight:900},children:"When you arrive, ask for"}),e.jsx("div",{style:{fontSize:22,fontWeight:900,margin:"6px 0 2px 0"},children:D}),e.jsx("div",{style:{fontSize:13,opacity:.9},children:"Vehicle Acquisition Manager"}),e.jsx("div",{style:{marginTop:10,fontSize:18,fontWeight:900},children:e.jsxs("a",{href:`tel:1${S.replace(/\D/g,"")}`,style:{color:"#fff",textDecoration:"none"},children:["â ",S]})})]})]}):p==="cancel"?e.jsxs(m,{testNote:l,accent:i,eyebrow:"Service Appointment",heading:"Your appointment is cancelled",footer:"You can close this window.",children:[e.jsx("title",{children:"Appointment cancelled"}),e.jsxs("p",{style:{color:"#3A4A6B",fontSize:16,lineHeight:1.6},children:["Thanks for letting us know. When you're ready to book again, give us a call at"," ",S," and we'll find a time that works."]})]}):e.jsxs(m,{testNote:l,accent:w,eyebrow:"Service Appointment",heading:k?"Your new time is saved":"We'll be in touch to reschedule",footer:"You can close this window.",children:[e.jsx("title",{children:k?"Appointment rescheduled":"Reschedule requested"}),k?e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{color:"#3A4A6B",fontSize:16,lineHeight:1.6},children:"Thanks â we've updated your appointment to:"}),e.jsx("div",{style:{marginTop:14,background:i,color:"#fff",borderRadius:12,padding:"16px 20px",fontSize:18,fontWeight:900},children:J(k)}),e.jsxs("p",{style:{color:"#3A4A6B",fontSize:15,lineHeight:1.6,marginTop:18},children:["When you arrive, ask for ",e.jsx("strong",{children:D})," â we'll also complete your complimentary appraisal while your vehicle is here. Questions? Call ",S,"."]})]}):e.jsxs("p",{style:{color:"#3A4A6B",fontSize:16,lineHeight:1.6},children:["Thanks for letting us know. Someone from our team will reach out to find a better day and time. Need it sooner? Call us at ",S,"."]})]}):e.jsxs(m,{testNote:l,accent:v.accent,eyebrow:"Service Appointment",heading:v.heading,footer:"Didn't mean to click? Just close this window â nothing is recorded until you tap the button.",children:[e.jsx("title",{children:"Confirm your appointment"}),e.jsx("p",{style:{color:"#3A4A6B",fontSize:16,lineHeight:1.6},children:v.message}),e.jsx("div",{style:{marginTop:28},children:e.jsx("button",{type:"button",onClick:L,disabled:o,style:{display:"inline-block",background:v.accent,color:"#ffffff",border:"none",cursor:o?"wait":"pointer",fontWeight:800,fontSize:16,padding:"14px 26px",borderRadius:10,minHeight:48,boxSizing:"border-box",opacity:o?.7:1,boxShadow:"0 8px 20px rgba(27,45,92,.18)"},children:o?"Sendingâ¦":v.button})}),b&&e.jsx("div",{style:{marginTop:16,color:j,fontSize:14},children:b}),e.jsx("div",{style:{marginTop:18,fontSize:12,color:"#6B7A96"},children:e.jsx("button",{type:"button",onClick:()=>r("/",{replace:!0}),style:{background:"none",border:"none",color:"#6B7A96",textDecoration:"underline",cursor:"pointer"}
1,children:"Not you? Close this page"})})]})}export{re 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.