`,!e.getElementById("vf-anti-zoom-style")){const t=e.createElement("style");t.id="vf-anti-zoom-style",t.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(t)}return r},_={name:"ext_location_picker",type:"response",match:({trace:e})=>"ext_location_picker"===e?.type||"ext_location_picker"===e?.payload?.name,render:({element:i})=>{o.hide(),n.enable();const r=C({label:"Where do you need the work done?",description:"Please enter your street number, name and suburb below then select from the list.",submitText:"Confirm Location",errorText:"Please select a location before continuing.",htmlField:'
Type at least 3 characters to see suggestions
Selected Location:
Getting your location...
'});i.appendChild(r),L(i,r),a.hideFor(r);const s=r.querySelector(".vf-location-input"),l=r.querySelector(".vf-input-icon"),d=r.querySelector(".vf-dropdown-container"),c=r.querySelector(".vf-input-helper"),p=r.querySelector(".vf-selected-location"),f=r.querySelector(".vf-selected-address"),v=r.querySelector(".vf-location-loading"),h=r.querySelector(".vf-error"),u=r.querySelector(".vf-submit"),m=r.querySelector(".vf-autocomplete-wrapper"),g=r.querySelector("label"),x=r.querySelector(".vf-desc"),b=e.createElement("div");b.className="vf-location-fallback",b.innerHTML='Issues providing your location? Click here...',u.insertAdjacentElement("afterend",b);const y=b.querySelector("a");let w=null,_=null,z=null,E=null,M=[];function T(){v.style.display="none"}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 B(t){if(d.innerHTML="",!t||0===t.length)return void d.classList.remove("show");const n=t.slice(0,2);M=n,n.forEach((t,o)=>{const a=e.createElement("div");a.className="vf-prediction-item",a.style.cssText="padding:16px;cursor:pointer;border-bottom:1px solid #e5e7eb;display:flex;align-items:center;gap:12px;-webkit-tap-highlight-color:transparent;transition:background 0.15s ease";const i=e.createElement("div");i.style.cssText="width:20px;height:20px;flex-shrink:0;color:#6b7280",i.innerHTML="\ud83d\udccd",a.appendChild(i);const r=e.createElement("div");r.style.cssText="flex:1;min-width:0";const h=e.createElement("div");h.style.cssText="font-weight:600;color:#111827;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis",h.textContent=t.structured_formatting.main_text;const g=e.createElement("div");g.style.cssText="color:#6b7280;font-size:13px;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis",g.textContent=t.structured_formatting.secondary_text,r.appendChild(h),r.appendChild(g),a.appendChild(r),o===n.length-1&&(a.style.borderBottom="none"),a.addEventListener("mouseenter",()=>{a.style.background="#eff6ff"}),a.addEventListener("mouseleave",()=>{a.style.background="white"}),a.addEventListener("click",()=>{!function(t){z&&(v.querySelector("span").textContent="Getting location details...",v.style.display="flex",d.classList.remove("show"),z.getDetails({placeId:t.place_id,fields:["address_components","formatted_address","geometry","name"],sessionToken:E},(t,n)=>{if(T(),n===google.maps.places.PlacesServiceStatus.OK&&t){const n={formattedAddress:t.formatted_address,suburb:A(t.address_components||[]),lat:t.geometry.location.lat(),lng:t.geometry.location.lng()};s.value=t.formatted_address,function(t){w=t,f.textContent=t.formattedAddress,p.classList.add("show"),c.classList.remove("show"),d.classList.remove("show"),u.disabled=!1,u.style.background="#0551fb",u.style.cursor="pointer",q(),T(),window.innerWidth<=768&&(s.style.display="none",l&&(l.style.display="none"),m.style.marginBottom="0"),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){}})})}(n),E=new google.maps.places.AutocompleteSessionToken}else j("Could not get location details. Please try another address.")}))}(t)}),a.addEventListener("touchstart",()=>{a.style.background="#dbeafe"},{passive:!0}),a.addEventListener("touchend",()=>{a.style.background="#eff6ff"},{passive:!0}),d.appendChild(a)}),d.classList.add("show")}return u.disabled=!0,u.style.background="#9ca3af",u.style.cursor="not-allowed",y.addEventListener("click",e=>{e.preventDefault(),t.interact({type:"captured",payload:{locationFallback:!0}}),n.blurActive(),o.show(),n.disable()}),u.onclick=()=>{w?(q(),k.celebrate(u),setTimeout(()=>{g&&(g.style.display="none"),x&&(x.style.display="none"),m&&(m.style.display="none"),v&&(v.style.display="none"),h&&(h.style.display="none"),u&&(u.style.display="none"),b&&(b.style.display="none"),c&&(c.style.display="none")},1e3),S("formattedAddress",w.formattedAddress),S("suburb",w.suburb),S("googleLat",w.lat.toString()),S("googleLong",w.lng.toString()),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 a location 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),e.length>0&&e.length<3?(c.textContent=`Type ${3-e.length} more character${3-e.length==1?"":"s"}`,c.classList.add("show"),void d.classList.remove("show")):0===e.length?(c.classList.remove("show"),void d.classList.remove("show")):(c.textContent="Select an address from the suggestions below",c.classList.add("show"),void(t=setTimeout(()=>{var t;e.length>=3&&(t=e,_&&_.getPlacePredictions({input:t,componentRestrictions:{country:"za"},types:["address"],sessionToken:E},(e,t)=>{t===google.maps.places.PlacesServiceStatus.OK&&e?B(e):t===google.maps.places.PlacesServiceStatus.ZERO_RESULTS?(d.innerHTML='
No addresses found. Try a different search.
',d.classList.add("show")):d.classList.remove("show")}))},300)))}),s.addEventListener("keydown",e=>{" "!==e.key&&32!==e.keyCode||e.stopPropagation()}),e.addEventListener("click",e=>{m.contains(e.target)||d.classList.remove("show")})}()}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=C({label:"When would you like the work to be done?",description:"",submitText:"Confirm date",errorText:"Please pick a date before confirming.",htmlField:'\n
`,t.appendChild(s),L(t,s),a.hideFor(s);const l=s.querySelector(".vf-progress-pct"),d=s.querySelector(".vf-progress-fill");[...s.querySelectorAll(".vf-step-dot")].forEach((e,t)=>{const o=t+1;e.classList.remove("complete","current"),o1-Math.pow(1-e,3))(n));d.style.width=o+"%",l.textContent=o+"%",n<1&&requestAnimationFrame(e)}(c)}}}const q=j({name:"ext_progress_step1",step:1,title:"Problem diagnosis",subtitle:"We are understanding your issue."}),A=j({name:"ext_progress_step2",step:2,title:"Location",subtitle:"Where do you need help?"});
/* ==================== HOME FITNESS TEST - STORM SEASON CAMPAIGN (v1) ==================== */
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=`
Season alert: storms and load shedding put every SA home to the test
Is your home match fit?
Answer 7 quick questions and Jess will score your home's fitness before the weather tests it for real.
Why now
Most storm and power surge damage is preventable, yet it drives thousands of SA insurance claims every season. Blocked gutters, tired DB boards and hidden leaks quietly turn into repairs of R15,000 to R50,000+.
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 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:",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:",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:",pulse:!1}
};
const z2=zones[zoneKey],list=findings.split(",").map(f2=>f2.trim()).filter(f2=>f2&&"0"!==f2);
let sc=Math.round(100-4.5*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});
let chips="";list.forEach((f2,i2)=>{chips+=`${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+=`