window.addEventListener("DOMContentLoaded",function(){const e=document.querySelector("#pwp-onboarding-wizard");if(!e)return;const t=e.querySelector(".dialog-close"),o=e.querySelector("aside .wizard-progress"),s=e.querySelector("footer .wizard-progress"),r=e.querySelectorAll(".next-step button[value=next]"),a=e.querySelectorAll("section[data-step]");let c=1;function n(e){c=e,a&&o&&s&&(a.forEach(e=>{const t=parseInt(e.getAttribute("data-step"),10);e.hidden=t!==c}),o.querySelectorAll("[data-step]").forEach(e=>{const t=parseInt(e.getAttribute("data-step"),10),o=e.querySelector("button");t<c?(e.classList.add("is-complete"),e.classList.remove("is-active"),o&&o.removeAttribute("disabled")):(e.classList.remove("is-complete","is-active"),t===c&&e.classList.add("is-active"),o&&o.setAttribute("disabled",""))}),s.querySelectorAll("[data-step]").forEach(e=>{const t=parseInt(e.getAttribute("data-step"),10);t<c?(e.classList.add("is-complete"),e.classList.remove("is-active")):(e.classList.remove("is-complete","is-active"),t===c&&e.classList.add("is-active"))}))}e.addEventListener("close",function(e){l(new FormData(t)),e.stopPropagation(),document.querySelector("body").classList.remove("pwp-fixed")}),o&&o.addEventListener("click",function(e){const t=e.target.closest("button");if(!t)return;const o=parseInt(t.value,10);0<o&&o<10&&n(o),e.stopPropagation()}),0!==r.length&&r.forEach(t=>{t.addEventListener("click",function(t){!function(t){const o=function(t){return e.querySelector(`section[data-step="${t}"]`)}(t);if(o){const e=o.querySelector("form[data-type=interstitial]");if(e){const o=new FormData(e);o.set("step",t),l(o)}}}(c),n(c+1),t.stopPropagation()})});const i=e.querySelector("#onboarding-video");if(i){const e=i.querySelector(".overlay button"),t=i.querySelector("iframe");e&&t&&e.addEventListener("click",()=>{i.querySelector(".overlay").hidden=!0,t.src+="?autoplay=1"},{once:!0})}const l=async function(e){let t=new URLSearchParams;for(let[o,s]of e)t.append(o,s);const o=await fetch(pwpSettings.url,{method:"POST",headers:{Accept:"application/json, */*;q=0.1","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","X-Requested-With":"XMLHttpRequest"},body:t.toString()}),s=await o.json();return!!o.ok&&s};document.querySelector("body").classList.add("pwp-fixed"),e.showModal()});