',!e.getElementById("vf-anti-zoom-style")){const st=e.createElement("style");st.id="vf-anti-zoom-style",st.textContent="@media(max-width:1024px){.vf-anti-zoom input,.vf-anti-zoom textarea,.vf-anti-zoom select{font-size:16px!important;-webkit-text-size-adjust:100%}}",e.head.appendChild(st)}i.appendChild(r),L(i,r),a.hideFor(r);const s=r.querySelector(".vf-loc-input"),d=r.querySelector(".vf-loc-drop"),c=r.querySelector(".vf-loc-helper"),p=r.querySelector(".vf-loc-chip"),f=r.querySelector(".vf-loc-chip-val"),v=r.querySelector(".vf-loc-loading"),h=r.querySelector(".vf-loc-error"),u=r.querySelector(".vf-loc-btn"),m=r.querySelector(".vf-loc-inputwrap"),g=r.querySelector(".vf-loc-main"),x=r.querySelector(".vf-loc-done"),b=r.querySelector(".vf-loc-done-val"),y=r.querySelector(".vf-loc-fallback a"),D=r.querySelector(".vf-loc-change"),F=r.querySelector(".vf-form-card");let w=null,_=null,z=null,E=null;function T(){v.classList.remove("show")}function j(e){h.textContent=e,h.style.display="block",T()}function q(){h.style.display="none"}function A(e){const t=["sublocality_level_1","locality","administrative_area_level_3"];for(const n of t){const t=e.find(e=>e.types.includes(n));if(t)return t.long_name}return""}function G(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{try{const t=e=>e.parentElement||e.getRootNode&&e.getRootNode().host||null,n=e=>{try{const t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflowY)&&e.scrollHeight>e.clientHeight+4}catch(e){return!1}};let o=t(u);for(let a=0;a<30&&o&&o!==e.documentElement&&o!==e.body;a++){try{!n(o)&&o.scrollTop&&(o.scrollTop=0)}catch(e){}o=t(o)}let a=null,i=u;for(let e=0;e<30&&i;e++){if(i.classList&&i.classList.contains("vfrc-chat--dialog")){a=i;break}i=t(i)}if(!a||!n(a)){let o=t(u);for(let i=0;i<30&&o&&o!==e.documentElement&&o!==e.body;i++){if(n(o)){a=o;break}o=t(o)}}if(!a||!n(a))return;const r=a.getBoundingClientRect(),s=u.getBoundingClientRect().bottom-r.bottom+24;s>0&&a.scrollTo({top:a.scrollTop+s,behavior:"smooth"})}catch(e){}})})}function H(t){z&&(v.querySelector("span").textContent="Getting location details...",v.classList.add("show"),d.classList.remove("show"),s.classList.remove("open"),z.getDetails({placeId:t.place_id,fields:["address_components","formatted_address","geometry","name"],sessionToken:E},(t,i)=>{if(T(),i===google.maps.places.PlacesServiceStatus.OK&&t){const i={formattedAddress:t.formatted_address,suburb:A(t.address_components||[])||t.name||"",lat:t.geometry.location.lat(),lng:t.geometry.location.lng()};w=i,s.value=t.formatted_address,f.textContent=i.formattedAddress,p.classList.add("show"),m.style.display="none",c.classList.remove("show"),u.disabled=!1,q(),E=new google.maps.places.AutocompleteSessionToken,G()}else j("Could not get location details. Please try another suburb.")}))}function B(t){d.innerHTML="";const V=(t||[]).filter(p2=>(p2.types||[]).some(q2=>["sublocality","sublocality_level_1","locality","neighborhood"].includes(q2)));if(0===V.length)return d.innerHTML='
No suburbs found. Try a different spelling.
',d.classList.add("show"),void s.classList.add("open");V.slice(0,2).forEach(t=>{const n=e.createElement("div");n.className="vf-loc-item",n.innerHTML='',n.querySelector(".vf-loc-item-main").textContent=t.structured_formatting.main_text,n.querySelector(".vf-loc-item-sec").textContent=t.structured_formatting.secondary_text,n.addEventListener("click",()=>H(t)),n.addEventListener("touchstart",()=>{n.style.background="#dbeafe"},{passive:!0}),n.addEventListener("touchend",()=>{n.style.background=""},{passive:!0}),d.appendChild(n)}),d.classList.add("show"),s.classList.add("open")}return D.addEventListener("click",()=>{w=null,p.classList.remove("show"),m.style.display="",u.disabled=!0,q(),s.focus()}),y.addEventListener("click",e=>{e.preventDefault(),t.interact({type:"captured",payload:{locationFallback:!0}}),n.blurActive(),o.show(),n.disable()}),u.onclick=()=>{w?(q(),S("formattedAddress",w.formattedAddress),S("suburb",w.suburb),S("googleLat",w.lat.toString()),S("googleLong",w.lng.toString()),b.textContent=w.formattedAddress,g.style.opacity="0",setTimeout(()=>{g.style.display="none",x.classList.add("show"),F.style.padding="0",F.style.border="none",F.style.background="transparent"},250),n.blurActive(),o.show(),n.disable(),t.interact({type:"captured",payload:{formattedAddress:w.formattedAddress,suburb:w.suburb,latitude:w.lat,longitude:w.lng,locationConfirmed:!0}})):j("Please select your suburb before continuing.")},async function(){try{await new Promise((t,n)=>{if(window.google&&window.google.maps)return void t();const o=e.createElement("script");o.src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC51PJx9faiS3ptAxYuMfkYKKtTU00Tz-Q&libraries=places",o.onload=()=>t(),o.onerror=()=>n(new Error("Failed to load Google Maps")),e.head.appendChild(o)}),_=new google.maps.places.AutocompleteService;const t=e.createElement("div");t.style.display="none",e.body.appendChild(t),z=new google.maps.places.PlacesService(t),E=new google.maps.places.AutocompleteSessionToken,function(){let t;s.addEventListener("input",()=>{const e=s.value.trim();return clearTimeout(t),0===e.length?(c.classList.remove("show"),d.classList.remove("show"),void s.classList.remove("open")):(c.textContent="Select your suburb from the suggestions below",c.classList.add("show"),void(t=setTimeout(()=>{var t;e.length>=1&&(t=e,_&&_.getPlacePredictions({input:t,componentRestrictions:{country:"za"},types:["(regions)"],sessionToken:E},(e,t)=>{t===google.maps.places.PlacesServiceStatus.OK&&e?B(e):t===google.maps.places.PlacesServiceStatus.ZERO_RESULTS?(d.innerHTML='
No suburbs found. Try a different spelling.
',d.classList.add("show"),s.classList.add("open")):(d.classList.remove("show"),s.classList.remove("open"))}))},300)))}),s.addEventListener("keydown",e=>{" "!==e.key&&32!==e.keyCode||e.stopPropagation()}),e.addEventListener("click",e=>{m.contains(e.target)||(d.classList.remove("show"),s.classList.remove("open"))})}()}catch(e){j("Failed to load location services. Please refresh and try again.")}}(),()=>{o.show(),n.disable()}}},z={name:"calendar-picker",type:"response",match:({trace:e})=>"calendar"===e?.type||"calendar-picker"===e?.payload?.name,render:({element:i})=>{o.hide(),n.enable();const r=e.createElement("div");if(r.className="vf-wide-card",r.innerHTML='
`,i.appendChild(m),L(i,m),a.hideFor(m)}}}const q=j({name:"ext_progress_step1",step:2,label:"Tell us what you need done"}),A=j({name:"ext_progress_step2",step:3,label:"Where and when you need help"});
/* ==================== HOME FITNESS TEST - STORM SEASON CAMPAIGN (v1) ==================== */
let KD_SEL="";
i(".vfrc-message.vfrc-message--extension-FitnessWelcome,.vfrc-message.vfrc-message--extension-FitnessWelcome .vfrc-message__content,.vfrc-message.vfrc-message--extension-FitnessResults,.vfrc-message.vfrc-message--extension-FitnessResults .vfrc-message__content,.vfrc-message.vfrc-message--extension-ext_fitnessWelcome,.vfrc-message.vfrc-message--extension-ext_fitnessWelcome .vfrc-message__content,.vfrc-message.vfrc-message--extension-ext_fitnessResults,.vfrc-message.vfrc-message--extension-ext_fitnessResults .vfrc-message__content{width:100%!important;max-width:100%!important;align-self:stretch!important;padding-left:0!important;padding-right:0!important;background:transparent!important;border:0!important;border-radius:0!important;box-shadow:none!important}","data-vf-fitness-fullwidth");
const FTRK=[P("extfitnessStarted","fitness_started"),P("ext_fitnessDiagnosticCompleted","fitness_diagnostic_completed"),P("ext_fitnessBookingStart","fitness_booking_start")];
const FW={name:"FitnessWelcome",type:"response",match:({trace:g})=>"ext_fitnessWelcome"===g?.type||"ext_fitnessWelcome"===g?.payload?.name,render:({element:el})=>{
c.trackEvent("fitness_welcome_viewed",{event_category:"funnel"});
const box=e.createElement("div");box.className="vf-wide-card";
box.innerHTML=`
Home truth: unfit homes pick up injuries — small niggles become big ones
Is your home match fit?
Answer 6 quick questions and Jess will score your home's fitness — and spot the small niggles before they become injuries.
Why it matters
When you're unfit, injuries happen — and homes are no different. Small things like a blocked gutter or a dripping tap are quick, affordable fixes when caught early. Left alone, they quietly turn into massive damage — a R500 gutter clean today can prevent a R50,000 ceiling repair tomorrow.
What you'll get
Your home's fitness score out of 100
A personalised training plan to fix the weak spots
Takes about 4 minutes
`;
el.appendChild(box);L(el,box);a.hideFor(box);o.hide();
box.querySelector(".jfw-btn").addEventListener("click",()=>{
c.trackEvent("fitness_welcome_cta_click",{event_category:"funnel"});
const card=box.querySelector(".jfw-card");card&&card.classList.add("jfw-exit");
setTimeout(()=>{box.style.overflow="hidden";box.style.maxHeight=box.scrollHeight+"px";box.offsetHeight;box.style.transition="max-height .35s ease,opacity .35s ease";box.style.maxHeight="0";box.style.opacity="0"},350);
setTimeout(()=>{try{box.remove()}catch(err){}o.show();t.interact({type:"start_diagnostic",payload:{}})},700);
});
return()=>{o.hide()};
}};
const FR={name:"FitnessResults",type:"response",match:({trace:g})=>"ext_fitnessResults"===g?.type||"ext_fitnessResults"===g?.payload?.name,render:({trace:g,element:el})=>{
if(!e.getElementById("vf-inter-font")){const fl=e.createElement("link");fl.id="vf-inter-font";fl.rel="stylesheet";fl.href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap";e.head.appendChild(fl)}
const pl=d(g);
const clean=v=>{const s2=String(v==null?"":v).trim();return""===s2||"0"===s2||"null"===s2.toLowerCase()||"undefined"===s2.toLowerCase()?"":s2};
const zoneKey=(()=>{const z3=clean(pl.zone).toLowerCase().replace(/[\s-]+/g,"_");return["match_fit","needs_training","injury_time"].includes(z3)?z3:"needs_training"})();
const findings=clean(pl.findings),svcRaw=clean(pl.services),urgRaw=clean(pl.urgent),ptsRaw=Number(clean(pl.points));
const pts=isNaN(ptsRaw)?8:Math.max(0,ptsRaw);
const VALID=["plumber","electrician","handyman","painter"];
const parseList=s2=>s2.split(",").map(x2=>x2.trim().toLowerCase()).filter(x2=>VALID.includes(x2));
let services=[...new Set(parseList(svcRaw))];services.length||(services=["handyman"]);
const urgent=new Set(parseList(urgRaw).filter(x2=>services.includes(x2)));
const SVC={
plumber:{label:"Plumber",reason:"Tracking down and fixing hidden leaks",icon:''},
electrician:{label:"Electrician",reason:"Surge protection and DB board check",icon:''},
handyman:{label:"Handyman",reason:"Gutter and downpipe clearing before the rains",icon:''},
painter:{label:"Painter",reason:"Damp treatment and exterior waterproofing",icon:''}
};
const HEALTH={
plumber:{service:"Leak detection and repairs",id:"eabe5594-2374-46f8-85b2-cda37d74c0d1",summary:"Suspects a leak and requires investigation"},
electrician:{service:"Electrical repairs, fault finding and/or surge protection",id:"1bc17f92-fd47-460a-8b98-9371b9010926",summary:"Requires electrical repairs and/ or surge protection"},
handyman:{service:"general home maintenance",id:"8c5b3671-50e5-4d7a-8f55-156372d8a4e1",summary:"General help required around the home"},
painter:{service:"Exterior painting",id:"724a8c31-6b83-492e-b6a4-4f24317650f9",summary:"Professional exterior painting"}
};
const zones={
injury_time:{accent:"#E24B4A",chipBg:"#FCEBEB",chipText:"#791F1F",badge:"Injury Time",headline:"Your home is in injury time",subtext:"Based on your answers, a few things need urgent attention before the season tests them for real:",sub2:"A few things need urgent attention:",pulse:!0},
needs_training:{accent:"#EF9F27",chipBg:"#FAEEDA",chipText:"#633806",badge:"Needs Training",headline:"Your home needs some training",subtext:"Nothing has failed yet, but a few areas are holding your score back:",sub2:"Areas holding your score back:",pulse:!1},
match_fit:{accent:"#639922",chipBg:"#EAF3DE",chipText:"#27500A",badge:"Match Fit",headline:"Your home is match fit",subtext:"Here's what's working in your favour going into the season:",sub2:"What's working in your favour:",pulse:!1}
};
const z2=zones[zoneKey],list=findings.split(",").map(f2=>f2.trim()).filter(f2=>f2&&"0"!==f2);
let sc=Math.round(100-5.2*pts);
"match_fit"===zoneKey?sc=Math.max(80,Math.min(100,sc)):"needs_training"===zoneKey?sc=Math.max(50,Math.min(79,sc)):sc=Math.max(15,Math.min(49,sc));
c.trackEvent("fitness_results_viewed",{event_category:"funnel",zone:zoneKey,score:sc,services:services.join(","),urgent:[...urgent].join(","),findings_count:list.length});
const POS=["gutters recently cleared","stable db board","surge protection installed","no hidden leaks","backup battery maintained","exterior walls sound"],
CONCERN=["gutters overdue","occasional db tripping","plug-level surge protection only","meter not checked","backup battery aging","peeling paint"],
SERIOUS=["gutters never cleared","db board tripping frequently","warm db board","no surge protection","active water leak","backup battery flat","damp and cracks on walls"];
const classify=f2=>{const lf=f2.toLowerCase();
if(POS.includes(lf))return"pos";if(SERIOUS.includes(lf))return"bad";if(CONCERN.includes(lf))return"warn";
if(/\b(maintained|installed|sound|recently|stable|still|clear|cleared|good)\b/.test(lf)&&!/\b(no|never|not|without)\b/.test(lf))return"pos";
if(/\b(active|never|frequent|frequently|warm|flat|spinning|damp|crack)\b/.test(lf))return"bad";
return"warn"};
const CHIP={pos:{bg:"#EAF3DE",tx:"#27500A",ic:"\u2713 "},warn:{bg:"#FAEEDA",tx:"#633806",ic:""},bad:{bg:"#FCEBEB",tx:"#791F1F",ic:""}};
let chips="";list.forEach((f2,i2)=>{const cl=CHIP[classify(f2)];chips+=`${cl.ic}${f2}`});
const selected=new Set(urgent.size?urgent:[services[0]]);
let svcHTML="";services.forEach(k2=>{const s2=SVC[k2],on=selected.has(k2),u2=urgent.has(k2);
svcHTML+=`