`,!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?"});
/* ==================== GEYSER HEALTH CHECK — WINTER CAMPAIGN (v2) ==================== */
i(".vfrc-message.vfrc-message--extension-GeyserWelcome,.vfrc-message.vfrc-message--extension-GeyserWelcome .vfrc-message__content,.vfrc-message.vfrc-message--extension-GeyserResults,.vfrc-message.vfrc-message--extension-GeyserResults .vfrc-message__content,.vfrc-message.vfrc-message--extension-ext_geyserWelcome,.vfrc-message.vfrc-message--extension-ext_geyserWelcome .vfrc-message__content,.vfrc-message.vfrc-message--extension-ext_geyserResults,.vfrc-message.vfrc-message--extension-ext_geyserResults .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-geyser-fullwidth");
const GTRK=[P("ext_geyserStarted","geyser_started"),P("ext_geyserDiagnosticCompleted","geyser_diagnostic_completed"),P("ext_geyserBookingStart","geyser_booking_start")];
const GW={name:"GeyserWelcome",type:"response",match:({trace:g})=>"ext_geyserWelcome"===g?.type||"ext_geyserWelcome"===g?.payload?.name,render:({element:el})=>{
c.trackEvent("geyser_welcome_viewed",{event_category:"funnel"});
const box=e.createElement("div");box.className="vf-wide-card";
box.innerHTML=`
Winter alert: cold months are peak season for geyser bursts & leaks
Is your geyser ready for winter?
Answer 8 quick questions and Jess will assess your burst risk before the cold does it for you.
Why now
Geysers are South Africa's #1 home insurance claim \u2014 and winter is when most of them fail. The average burst costs R15,000\u2013R50,000+ in damage, and most failures are preventable.
What you'll get
Geyser risk assessment
Takes about 2 minutes
`;
el.appendChild(box);L(el,box);a.hideFor(box);o.hide();
box.querySelector(".jgw-btn").addEventListener("click",()=>{
c.trackEvent("geyser_welcome_cta_click",{event_category:"funnel"});
const card=box.querySelector(".jgw-card");card&&card.classList.add("jgw-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 GR={name:"GeyserResults",type:"response",match:({trace:g})=>"ext_geyserResults"===g?.type||"ext_geyserResults"===g?.payload?.name,render:({trace:g,element:el})=>{
const pl=d(g),zone=pl.zone||"caution",findings=pl.findings||"";
const zones={
danger:{accent:"linear-gradient(90deg,#E24B4A,#D85A30)",color:"#E24B4A",chipBg:"#FCEBEB",chipText:"#791F1F",icon:'',headline:"Your geyser is at high risk this winter",subtext:"Based on your answers, a few things seriously concern me \u2014 and winter is exactly when geysers like yours fail:",nudge:"Don't wait this one out. A burst now means weeks of disruption and R15,000\u2013R50,000+ in damage. Get a vetted pro out this week.",cta:"Book a geyser inspection",pulse:!0,segments:4},
caution:{accent:"linear-gradient(90deg,#EF9F27,#BA7517)",color:"#EF9F27",chipBg:"#FAEEDA",chipText:"#633806",icon:'',headline:"Your geyser needs attention before winter peaks",subtext:"Nothing has failed yet, but these warning signs tend to turn into bursts once the cold sets in:",nudge:"A service now costs a fraction of a burst later \u2014 and mid-winter is when plumbers get booked out. Beat the rush.",cta:"Book a geyser check-up",pulse:!1,segments:3},
safe:{accent:"linear-gradient(90deg,#97C459,#639922)",color:"#639922",chipBg:"#EAF3DE",chipText:"#27500A",icon:'',headline:"Your geyser's in good shape \u2014 let's keep it that way",subtext:"Based on your answers, here's what's working in your favour going into winter:",nudge:"An annual service can double a geyser's lifespan and keeps you covered when it matters. A pre-winter once-over locks in that peace of mind.",cta:"Book a preventative service",pulse:!1,segments:1}
};
const z2=zones[zone]||zones.caution,list=findings.split(",").map(f2=>f2.trim()).filter(Boolean);
c.trackEvent("geyser_results_viewed",{event_category:"funnel",zone:zone,findings_count:list.length});
let segs="";for(let s2=0;s2<5;s2++)segs+=``;
let chips="";list.forEach((f2,i2)=>{chips+=`${f2}`});
const box=e.createElement("div");box.className="vf-wide-card";
box.innerHTML=`
${z2.icon}
${z2.headline}
${segs}
${z2.subtext}
${chips}
${z2.nudge}
All Kandua Pros are vetted and rated 4.5\u2605 or higher
`;
el.appendChild(box);L(el,box);a.hideFor(box);o.hide();
box.querySelectorAll(".jgr-btn").forEach(btn=>{btn.addEventListener("click",()=>{
c.trackEvent("geyser_book_pro_click",{event_category:"funnel",zone:zone});
o.show();t.interact({type:btn.getAttribute("data-action"),payload:{}});
})});
return()=>{o.hide()};
}};
/* ==================== END GEYSER HEALTH CHECK ==================== */
t=window.voiceflow.chat,t.load({verify:{projectID:"6a1d7b09a2bdb2f81d8077cd"},url:"https://general-runtime.sanlamstudios.voiceflow.com",versionID:"production",launch:{event:{type:"launch",payload:{event:"santamgeyser"}}},assistant:{persistence:"memory",extensions:[y,w,q,A,_,z,E,M,T,GW,GR,...TRK,...GTRK]}}).then(()=>{t.open(),e.querySelectorAll(".launch_jess").forEach(e=>e.addEventListener("click",()=>t.open()))})},e.body.appendChild(o)}()}(document);