1const $=(s,r=document)=>r.querySelector(s),$$=(s,r=document)=>[...r.querySelectorAll(s)],CONFIG={FOCUSABLE:'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])'};function el(tag,attrs={},text=""){const e=document.createElement(tag);return Object.assign(e,attrs),text&&(e.textContent=text),e}function pollFor(selector,max=100,ms=300){return new Promise((resolve,reject)=>{let n=0;const id=setInterval(()=>{const found=$(selector);if(found){clearInterval(id),resolve(found);return}++n>=max&&(clearInterval(id),reject(selector))},ms)})}const shopifyFetch=(url,opts={})=>fetch(url,opts).then(r=>r.ok?r.json():Promise.reject(r));async function updateCartUI(){try{const{item_count}=await shopifyFetch("/cart.js"),icon=$("#cart-icon-bubble");if(!icon)return;let bubble=icon.querySelector(".cart-count-bubble");if(item_count===0){bubble&&bubble.remove();return}bubble||(bubble=el("div",{className:"cart-count-bubble"}),icon.appendChild(bubble)),bubble.innerHTML=`<span aria-hidden="true"${item_count>=100?' class="hidden"':""}>${item_count}</span><span class="visually-hidden">${item_count} ${item_count===1?"item":"items"}</span>`}catch(e){console.error("Cart UI error:",e)}}function announce(msg){let r=$("#wishlist-live-region");r||(r=el("div",{id:"wishlist-live-region",className:"visually-hidden"}),r.setAttribute("role","status"),r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true"),document.body.appendChild(r)),r.textContent="",setTimeout(()=>{r.textContent=msg},100)}async function handleAdd(btn,label,payload){btn.disabled=!0,btn.textContent="Adding...";try{await shopifyFetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(payload)}),btn.textContent="Added!",announce("Item added to cart"),await updateCartUI()}catch(e){btn.textContent="Error",console.error("Add-to-cart error:",e)}finally{setTimeout(()=>{btn.disabled=!1,btn.textContent=label},2e3)}}function initWishlistActions(){const container=$(".st-wishlist-details_products");container&&$$(".st-atc-button",container).forEach(orig=>{if(orig.previousElementSibling?.classList.contains("st-wishlist-add-to-cart"))return;const select=orig.closest("form")?.querySelector('select[name="id"]'),b=el("button",{type:"button",className:"st-wishlist-add-to-cart"},"Add to cart");b.addEventListener("click",()=>{const id=select?.value;id&&handleAdd(b,"Add to cart",{id,quantity:1})}),orig.style.display="none",orig.parentNode.insertBefore(b,orig)})}let _trapCleanup=null;function isDrawerOpen(drawer){const parent=drawer.closest(".st-wishlist-details");return parent?parent.classList.contains("st-is-open"):!1}function setTrap(drawer,on,triggerEl){if(!on){_trapCleanup?.(),_trapCleanup=null,triggerEl?.focus();return}drawer.setAttribute("role","dialog"),drawer.setAttribute("aria-modal","true"),drawer.setAttribute("aria-label","Wishlist");const firstFocusable=drawer.querySelector(".st-close-button")||drawer.querySelector(CONFIG.FOCUSABLE);setTimeout(()=>firstFocusable?.focus(),100);const handleKey=e=>{if(e.key==="Escape"){drawer.querySelector(".st-close-button")?.click(),setTrap(drawer,!1,triggerEl);return}if(e.key!=="Tab")return;const els=$$(CONFIG.FOCUSABLE,drawer).filter(f=>f.offsetWidth>0);if(!els.length)return;const first=els[0],last=els[els.length-1];if(!drawer.contains(document.activeElement)){e.preventDefault(),first.focus();return}e.shiftKey&&document.activeElement===first?(e.preventDefault(),last.focus()):!e.shiftKey&&document.activeElement===last&&(e.preventDefault(),first.focus())};document.addEventListener("keydown",handleKey),_trapCleanup=()=>{document.removeEventListener("keydown",handleKey),drawer.removeAttribute("aria-modal")}}document.addEventListener("DOMContentLoaded",()=>{pollFor(".st-wishlist-details_products").then(productsContainer=>{let debounce=null;const productsObserver=new MutationObserver(()=>{productsObserver.disconnect(),clearTimeout(debounce),debounce=setTimeout(()=>{initWishlistActions(),productsObserver.observe(productsContainer,{childList:!0,subtree:!0})},300)});initWishlistActions(),setTimeout(initWishlistActions,1e4),productsObserver.observe(productsContainer,{childList:!0,subtree:!0})}).catch(()=>console.warn("Wishlist products container not found.")),pollFor(".st-wishlist-details_wrapper").then(drawerPanel=>{const triggerBtn=$(".st-wishlist-details-button--header-icon"),drawerRoot=drawerPanel.closest(".st-wishlist-details");!triggerBtn||!drawerRoot||(triggerBtn.addEventListener("click",()=>{let n=0;const checkOpen=setInterval(()=>{isDrawerOpen(drawerPanel)&&(clearInterval(checkOpen),setTrap(drawerPanel,!0,triggerBtn)),++n>20&&clearInterval(checkOpen)},100)}),new MutationObserver(()=>
1{_trapCleanup&&!isDrawerOpen(drawerPanel)&&setTrap(drawerPanel,!1,triggerBtn)}).observe(drawerRoot,{attributes:!0,attributeFilter:["class"]}))}).catch(()=>console.warn("Wishlist drawer not found for focus-trap."))}); 2//# sourceMappingURL=/cdn/shop/t/3/assets/wishlist-custom.js.map?v=178708377030173683421782393899
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.