function announcementAccessFun(){document.addEventListener("DOMContentLoaded",function(){const announcement=document.getElementById("accessibility-announcement");function announceAccessibilityStatement(){const visibleAnnouncement=document.createElement("div");visibleAnnouncement.style.position="absolute",visibleAnnouncement.style.top="0",visibleAnnouncement.style.left="0",visibleAnnouncement.style.width="1px",visibleAnnouncement.style.height="1px",visibleAnnouncement.style.overflow="hidden",visibleAnnouncement.innerHTML=announcement.innerHTML,document.body.appendChild(visibleAnnouncement),setTimeout(()=>{document.body.removeChild(visibleAnnouncement)},5e3)}announceAccessibilityStatement()})}function targetlinkFun(){for(var links=document.querySelectorAll("a[href]:not([data-fancybox]):not(.useless-label-link)"),currentHost=window.location.hostname,i=0;i{image.hasAttribute("alt")||image.setAttribute("alt"," "),image.hasAttribute("empty-alt")&&image.getAttribute("alt")===" "&&image.setAttribute("alt","")})}function svgariaFun(){const svgs=document.getElementsByTagName("svg");Array.from(svgs).forEach(svg=>{svg.hasAttribute("aria-labelledby")||(svg.setAttribute("aria-hidden","true"),svg.setAttribute("focusable","false"))})}function inputlabelFun(){const inputs=document.querySelectorAll("input[type='password'], input[type='email'], input[type='text']");Array.from(inputs).forEach(input=>{if(!input.hasAttribute("aria-label")){const placeholder=input.getAttribute("placeholder"),value=input.value,labelValue=placeholder||value;labelValue&&input.setAttribute("aria-label",labelValue)}input.hasAttribute("required")&&input.setAttribute("aria-required","true")})}function tabtoClickFun(){let currentFocusedElement=null;document.addEventListener("keyup",event=>{event.key==="Tab"&&(currentFocusedElement=document.activeElement,console.log("\u5F53\u524D\u805A\u7126\u7684\u5143\u7D20:",currentFocusedElement)),event.key==="Enter"&¤tFocusedElement&&(currentFocusedElement.click(),console.log("\u89E6\u53D1\u4E86\u70B9\u51FB\u4E8B\u4EF6:",currentFocusedElement))})}function tosotrwdvidoeFun(){if(document.body.classList.contains("template-product"))for(var rwdVideos=document.getElementsByClassName("rwd-video"),i=0;i{if(!heading.classList.contains("header-logo")){const newHeading=document.createElement("h2");newHeading.innerHTML=heading.innerHTML,heading.parentNode.replaceChild(newHeading,heading)}})}function escCloseModal(){document.addEventListener("keydown",event=>{event.key==="Escape"&&setTimeout(()=>{let cart_drawer=document.querySelector("cart-drawer"),revy_winow=document.querySelector(".revy-upsell-popup-close-icon"),review_rating_popup=document.querySelector("#reviews_fade");if(cart_drawer&&cart_drawer.classList.contains("active")&&document.querySelector(".drawer__close").click(),revy_winow&&(revy_winow.click(),document.querySelector(".product-form__submit")?.focus()),review_rating_popup){let review_widget=document.querySelectorAll("product-info .ruk_rating_snippet");review_rating_popup.querySelector("#reviews_container-close")?.click(),window.innerWidth<=1e3?review_widget[0]?.focus():review_widget[1]?.focus()}},500)})}function klaviyoFormAriaLiveRemove(){document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('.klaviyo-form form[aria-live="polite"]').forEach(form=>{form.removeAttribute("aria-live")})})}function sswFormRequire(){document.addEventListener("DOMContentLoaded",()=>{let sswTargetIds=["login_modal","signup_modal"],sswObserver=new MutationObserver(()=>{sswTargetIds.forEach(id=>{let element=document.getElementById(id);if(element){new MutationObserver(mutationsList=>{mutationsList.forEach(mutation=>{(mutation.attributeName==="class"&&!element.classList.contains("ssw-in")||mutation.attributeName==="aria-hidden"&&element.getAttribute("aria-hidden")==="true")&&!document.querySelector("#signup_modal")?.classList.contains("ssw-in")&&!document.querySelector("#login_modal")?.classList.contains("ssw-in")&&(document.querySelector(".ssw-fave-btn button")||document.querySelector("[tabindex='0']"))?.focus()})}).observe(element,{attributes:!0,attributeFilter:["class","aria-hidden"]}),element.setAttribute("role","dialog"),element.setAttribute("aria-modal","true");let modalClose=element.querySelector(".ssw-close");modalClose.setAttribute("aria-label","Close"),modalClose.classList.add("first-focusable-element");let modalCloseSrOnly=document.createElement("span");modalCloseSrOnly.textContent="Close",modalCloseSrOnly.classList.add("sr-only"),modalClose.appendChild(modalCloseSrOnly);let sswModalLastFocusElement=document.createElement("a");sswModalLastFocusElement.textContent="Skip",sswModalLastFocusElement.setAttribute("rel","nofollow"),sswModalLastFocusElement.setAttribute("tabindex","0"),sswModalLastFocusElement.classList.add("last-focusable-element"),element.querySelector(".ssw-modal-content")?.append(sswModalLastFocusElement);let sswFirstFocusableElement=element.querySelector("input[type='email']")||element.querySelector(".first-focusable-element"),sswLastFocusableElement=element.querySelector(".last-focusable-element");if(element.addEventListener("keydown",function(e){e.target==sswFirstFocusableElement&&e.key=="Tab"&&e.shiftKey?(e.preventDefault(),sswLastFocusableElement.focus()):e.target==sswLastFocusableElement&&e.key=="Tab"&&!e.shiftKey&&(e.preventDefault(),sswFirstFocusableElement.focus())}),element.querySelector(".ssw-h3")){let oldHeadingElement=element.querySelector(".ssw-h3"),newHeadingElement=document.createElement("h3");newHeadingElement.innerHTML=oldHeadingElement.innerHTML,newHeadingElement.className=oldHeadingElement.className,oldHeadingElement.id&&(newHeadingElement.id=oldHeadingElement.id),newHeadingElement.setAttribute("role","heading"),newHeadingElement.setAttribute("aria-label",oldHeadingElement.innerHTML),newHeadingElement.setAttribute("title",oldHeadingElement.innerHTML),oldHeadingElement.parentNode.replaceChild(newHeadingElement,oldHeadingElement),element.setAttribute("aria-label",oldHeadingElement.innerHTML)}if(element.querySelector(".ssw-socialconnect")){let oldSocialElement=element.querySelector(".ssw-socialconnect"),newSocialElement=document.createElement("ul");Array.from(oldSocialElement.children).forEach(child=>{let templi=document.createElement("li");templi.innerHTML=child.innerHTML,templi.className=child.className,child.id&&(templi.id=child.id),newSocialElement.appendChild(templi)}),newSocialElement.className=oldSocialElement.className,oldSocialElement.id&&(newSocialElement.id=oldSocialElement.id),oldSocialElement.parentNode.replaceChild(newSocialElement,oldSocialElement),element.querySelectorAll(".ssw-social-btn a")?.forEach(el=>{el.getAttribute("tabindex")&&el.removeAttribute("tabindex"),el.getAttribute("aria-label")&&el.removeAttribute("aria-label"),(el.querySelector("svg")||el.querySelector("i"))&&(el.querySelector("svg")&&el.querySelector("svg").setAttribute("aria-hidden","true"),el.querySelector("i")&&el.querySelector("i").setAttribute("aria-hidden","true"))})}if(element.querySelector("form")){let requiredIndicated=document.createElement("small");requiredIndicated.classList.add("indicate-text"),requiredIndicated.innerText="* indicates a required field.",element.querySelector("form").prepend(requiredIndicated)}element.querySelectorAll("input[type='email'], input[type='password'], input.required")?.forEach((el,index)=>{el.setAttribute("required","required"),el.getAttribute("type")==="email"&&el.setAttribute("autocomplete","email"),id==="login_modal"?(el.getAttribute("type")==="password"&&el.setAttribute("autocomplete","current-password"),new MutationObserver(mutations=>{mutations.forEach(mutation=>{mutation.addedNodes.forEach(alertNode=>{if(alertNode.nodeType===1&&alertNode.classList.contains("ssw-alert")&&alertNode.classList.contains("ssw-alert-warning")){alertNode.setAttribute("role","region"),alertNode.setAttribute("aria-label","Warning Message");let closeElement=alertNode.querySelector(".ssw-close");closeElement&&alertNode.appendChild(closeElement)}})})}).observe(document.getElementById(id),{childList:!0,subtree:!0})):id===signup_modal&&(el.getAttribute("type")==="password"&&el.setAttribute("autocomplete","new-password"),el.getAttribute("name").contains("first_name")&&el.setAttribute("autocomplete","given-name"),el.getAttribute("name").contains("last_name")&&el.setAttribute("autocomplete","family-name"));let newElement=document.createElement("span");newElement.classList.add("sr-only"),newElement.textContent=el.getAttribute("aria-label")?`${el.getAttribute("aria-label")}. This field is required.`:"This field is required.";let newLabel=document.createElement("label");newLabel.innerHTML=el.getAttribute("placeholder")?`${el.getAttribute("placeholder")} *`:`${el.getAttribute("aria-label")} *`,el.getAttribute("id")?(el.setAttribute("aria-describedby",`${el.getAttribute("id")}_error`),newElement.setAttribute("id",`${el.getAttribute("id")}_error`),el.insertAdjacentElement("afterend",newElement),newLabel.setAttribute("for",el.getAttribute("id")),el.insertAdjacentElement("beforebegin",newLabel)):(el.setAttribute("id",`ssw_customerid_${index+1}`),el.setAttribute("aria-describedby",`ssw_customerid_${index+1}_error`),newElement.setAttribute("id",`ssw_customerid_${index+1}_error`),el.insertAdjacentElement("afterend",newElement))}),sswTargetIds.splice(sswTargetIds.indexOf(id),1)}}),sswTargetIds.length===0&&sswObserver.disconnect()});sswObserver.observe(document.body,{childList:!0,subtree:!0})})}function cardProductLinkRedirect(){document.addEventListener("DOMContentLoaded",function(){$(document).on("click",".link-1",function(e){e.preventDefault(),e.stopPropagation();let targetLink=this.getAttribute("data-link");targetLink&&(window.location.href=targetLink)}),$(document).on("keydown",".link-1",function(e){let targetLink=this.getAttribute("data-link");(targetLink&&e.key=="Enter"||targetLink&&e.key==" ")&&(e.preventDefault(),e.stopPropagation(),window.location.href=targetLink)})})}announcementAccessFun(),targetlinkFun(),titleroleFun(),imgALTFun(),svgariaFun(),inputlabelFun(),nomoreH1roleFun(),escCloseModal(),klaviyoFormAriaLiveRemove(),sswFormRequire(),cardProductLinkRedirect(); //# sourceMappingURL=/cdn/shop/t/106/assets/base-ada.js.map?v=7519436213677429681752133282