1const ACTIVE_CLASS="popup--active";function getCookie(e){const t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):""}function getLoginUrl(e){return e.dataset.loginUrl||(window.BASE_URL||"/")+"customer/ajax/login"}function bindPasswordToggle(e){const t=e.querySelector(".field-password"),n=t?.querySelector("input"),o=t?.querySelector("svg");if(!n||!o)return;const r=()=>{n.setAttribute("type","text")},i=()=>{n.setAttribute("type","password")};o.addEventListener("mousedown",r),o.addEventListener("touchstart",r),o.addEventListener("mouseup",i),o.addEventListener("mouseleave",i),o.addEventListener("touchend",i)}function initLoginPopup(){const e=document.querySelector('.wwl-login-popup[data-popup="wwl-login-popup"]'),t=document.querySelector('[data-popuptrigger="wwl-login-popup"]');if(!e||!t)return;t.setAttribute("data-island-bound","");const n=e.querySelector("form"),o=e.querySelector('button[type="submit"]'),r=e.querySelector(".wwl-login-popup__error-message"),i=e.querySelector(".popup__close-button"),a=n?.dataset.errorGeneric||"Could not authenticate. Please try again later";function s(){return e.classList.contains(ACTIVE_CLASS)}function u(){e.classList.remove(ACTIVE_CLASS),e.open=!1,t.focus()}t.addEventListener("click",function(t){t.preventDefault(),s()?u():(e.classList.add(ACTIVE_CLASS),e.open=!0,e.querySelector("input")?.focus())}),i?.addEventListener("click",u),window.addEventListener("keydown",e=>{"Escape"===e.key&&s()&&(e.preventDefault(),u())}),window.addEventListener("click",t=>{!s()||e.contains(t.target)||t.target.closest('[data-popuptrigger="wwl-login-popup"]')||u()}),bindPasswordToggle(e),n?.addEventListener("submit",async e=>{if(e.preventDefault(),e.stopPropagation(),!n.reportValidity())return;const t=n.querySelector('[name="username"]')?.value||"",i=n.querySelector('[name="password"]')?.value||"";o&&(o.disabled=!0),r&&r.replaceChildren();try{const e=await fetch(getLoginUrl(n),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({username:t,password:i,form_key:getCookie("form_key")})}),s=await e.json();if(s.errors){const e=document.createElement("span");return e.textContent=s.message||a,r?.append(e),void(o&&(o.disabled=!1))}window.location.href=s.redirectUrl||window.location.href}catch(e){const t=document.createElement("span");t.textContent=a,r?.append(t),o&&(o.disabled=!1)}})}initLoginPopup();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.