class PasswordAuth{constructor(){this.barCount=4}init(){this.initPasswordStrengthBars()}initPasswordStrengthBars(){document.querySelectorAll('[data-password="bar"]').forEach(t=>{let e=t.querySelector('input[type="password"]');var s=t.querySelector(".password-bar");if(e&&s){this.renderBars(s);let r=s.querySelectorAll(".strong-bar");e.addEventListener("input",()=>{var t=this.getPasswordScore(e.value);this.updateBarUI(r,t)})}else console.warn("Auth: Missing input or .password-bar in",t)})}renderBars(r){r.innerHTML="";for(let t=0;t<this.barCount;t++){var e=document.createElement("div");e.classList.add("strong-bar"),r.appendChild(e)}}getPasswordScore(t){let r=0;return 8<=t.length&&r++,/[A-Z]/.test(t)&&r++,/\d/.test(t)&&r++,/[\W_]/.test(t)&&r++,r}updateBarUI(t,e){t.forEach((t,r)=>{t.className="strong-bar",r<e&&t.classList.add("bar-active-"+e)})}}document.addEventListener("DOMContentLoaded",()=>{(new PasswordAuth).init()});