1import{r as a,j as e}from"./vendor-query-CkzHihbV.js";import{s as y}from"./index-BkCp4Oim.js";import{b as $}from"./vendor-react-BURQupeV.js";import{L as N,t as E,G as L,q as P,e as R,l as w,p as Y}from"./vendor-icons-BXE4rLvZ.js";import"./vendor-three-BdhJKhTS.js";import"./vendor-charts-CmLZutwu.js";import"./vendor-pdf-DcHU7zPv.js";function O(){var g,j;const{slug:l}=$(),[n,k]=a.useState(null),[v,d]=a.useState(!0),[u,c]=a.useState(null),[o,_]=a.useState(null),[x,C]=a.useState(""),[p,S]=a.useState(""),[h,f]=a.useState(!1),[q,b]=a.useState(!1);a.useEffect(()=>{l&&(async()=>{const{data:s,error:r}=await y.rpc("get_block_sweep_quote_by_slug",{_slug:l});if(r||!s){c((r==null?void 0:r.message)||"This quote isn't available."),d(!1);return}const i=s;if(i.expired){c("This quote link has expired."),d(!1);return}k(i),i.accepted_tier&&b(!0),d(!1)})()},[l]),a.useEffect(()=>{n&&(document.title=`Your roof options â ${n.address}`)},[n]);async function T(){if(!(!l||!o)){f(!0);try{const{data:s}=await y.rpc("accept_block_sweep_quote",{_slug:l,_tier:o,_name:x||null,_phone:p||null}),r=s;r!=null&&r.ok?b(!0):c((r==null?void 0:r.error)||"Could not submit")}catch(s){c((s==null?void 0:s.message)||"Could not submit")}finally{f(!1)}}}if(v)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background text-foreground",children:e.jsx(N,{className:"animate-spin h-6 w-6"})});if(u||!n)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background text-foreground p-6 text-center",children:e.jsxs("div",{children:[e.jsx(E,{className:"mx-auto h-8 w-8 text-destructive mb-2"}),e.jsx("h1",{className:"text-xl font-semibold",children:"Link expired"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:u||"This quote is no longer available."})]})});const t=n.brand||{},m=t.phone?`tel:${(t.phone||"").replace(/[^\d+]/g,"")}`:null;return e.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[e.jsx("header",{className:"border-b border-border",children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 sm:px-6 py-4 flex items-center gap-3",children:[t.logo_url?e.jsx("img",{src:t.logo_url,alt:t.name||"Roofer",className:"h-10 w-10 rounded object-contain"}):e.jsx("div",{className:"h-10 w-10 rounded bg-primary/10 flex items-center justify-center",children:e.jsx(L,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold truncate",children:t.name||"Your local roofer"}),t.website&&e.jsx("a",{href:t.website,className:"text-xs text-muted-foreground hover:underline truncate block",target:"_blank",rel:"noopener",children:t.website.replace(/^https?:\/\//,"")})]}),t.phone&&m&&e.jsxs("a",{href:m,className:"inline-flex items-center gap-1.5 rounded-full bg-primary text-primary-foreground px-3 py-1.5 text-xs font-semibold hover:opacity-90",children:[e.jsx(P,{className:"h-3.5 w-3.5"})," Call"]})]})}),e.jsxs("main",{className:"max-w-3xl mx-auto px-4 sm:px-6 py-6 space-y-5",children:[e.jsxs("section",{children:[e.jsxs("div",{className:"text-xs uppercase tracking-wide text-muted-foreground flex items-center gap-1",children:[e.jsx(R,{className:"h-3 w-3"})," Your roof â three options"]}),e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mt-1 leading-tight",children:n.address}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[t.name||"We"," put together three options for your home â priced from your actual roof measurement. Tap the one that feels right and we'll set up a quick, no-pressure in-person look."]})]}),q?e.jsxs("section",{className:"rounded-lg border border-emerald-500/40 bg-emerald-500/10 p-5 text-center",children:[e.jsx(w,{className:"h-8 w-8 text-emerald-600 mx-auto mb-2"}),e.jsx("div",{className:"text-lg font-bold",children:"Got it â thank you!"}),e.jsxs("p",{className:"text-sm mt-1",children:[t.name||"The team"," will reach out shortly to schedule the in-person look",t.phone?e.jsxs(e.Fragment,{children:[" or you can call ",e.jsx("a",{href:m,className:"underline font-semibold",children:t.phone})]}):null,"."]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3",children:(g=n.tiers)==null?void 0:g.map(s=>e.jsxs("button",{onClick:()=>_(s.key),className:`w-full text-left rounded-lg border p-4 transition ${o===s.key?"border-primary ring-2 ring-primary/40 bg-primary/5":s.key==="better"?"border-primary/40 bg-primary/5 hover:border-primary/70":"border-border bg-card hover:border-primary/40"}`,children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"text-xl font-bold",children:s.name}),s.key==="better"&&e.jsx("span",{className:"text-[10px] uppercase tracking-wide bg-primary text-primary-foreground rounded-full px-2 py-0.5 font-semibold",children:"Most popular"})]}),e.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:s.subtitle})]}),e.jsxs("div",{className:"text-2xl font-bold tabular-nums",children:["$",Math.round(s.total).toLocaleStr
1ing()]})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:s.warranty})]}),e.jsxs("ul",{className:"mt-3 text-xs space-y-0.5 text-muted-foreground",children:[s.line_items.slice(0,6).map((r,i)=>e.jsxs("li",{children:["⢠",r.label,r.qty>1?` (${r.qty} ${r.unit})`:""]},i)),s.line_items.length>6&&e.jsxs("li",{className:"italic",children:["+ ",s.line_items.length-6," more line items"]})]})]},s.key))}),o&&e.jsxs("section",{className:"rounded-lg border border-primary/40 bg-primary/5 p-4 space-y-3 sticky bottom-2",children:[e.jsx("div",{className:"text-sm font-semibold",children:"Request this option â no obligation"}),e.jsx("input",{placeholder:"Your name",value:x,onChange:s=>C(s.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm"}),e.jsx("input",{type:"tel",placeholder:"Best phone (555) 123-4567",value:p,onChange:s=>S(s.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm"}),e.jsxs("button",{onClick:T,disabled:h,className:"w-full rounded-md bg-primary text-primary-foreground px-4 py-2.5 text-sm font-semibold hover:opacity-90 disabled:opacity-50 inline-flex items-center justify-center gap-2",children:[h?e.jsx(N,{className:"h-4 w-4 animate-spin"}):e.jsx(w,{className:"h-4 w-4"}),"Request ",(j=n.tiers.find(s=>s.key===o))==null?void 0:j.name]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["This isn't a signed contract â just letting ",t.name||"the team"," know which option interests you so they can schedule a look."]})]})]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground text-center pt-2",children:["Options priced for ",n.address,". Powered by ",t.name||"your local roofer","."]})]})]})}export{O 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.