1import{fetchLists}from"./bao-swym.js";class WishlistSelect extends window.BAO.CustomElement(){connectedCallback(){super.connectedCallback(),window.SwymCallbacks||(window.SwymCallbacks=[]),window.SwymCallbacks.push(()=>{fetchLists().then(lists=>{this.populateWishlists(lists)})})}setupListeners(){super.setupListeners(),this.toggleExpanded=this.toggleExpanded.bind(this),this.selectWishlist=this.selectWishlist.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleFocusOut=this.handleFocusOut.bind(this),document.addEventListener("swym:lists-updated",()=>{this.populateWishlists()}),this.listeners.add(this.trigger,"click",this.toggleExpanded),this.listeners.add(this,"keydown",this.handleKeyDown),this.listeners.add(this,"focusout",this.handleFocusOut)}setExpanded(expanded){const value=expanded?"true":"false";this.setAttribute("aria-expanded",value),this.trigger.setAttribute("aria-expanded",value)}handleKeyDown(event){event.key!=="Escape"||!this.expanded||(this.setExpanded(!1),this.trigger.focus())}handleFocusOut(event){this.contains(event.relatedTarget)||this.setExpanded(!1)}populateWishlists(lists){lists.forEach(list=>{const option=document.createElement("option");option.value=list.lid,option.innerText=list.lname,this.select.appendChild(option);const button=document.createElement("button");button.classList.add("btn-Button","prd-DetailVariants_DropdownOption"),button.dataset.lid=list.lid,button.value=list.lname,button.addEventListener("click",this.selectWishlist);const span=document.createElement("span");span.classList.add("prd-DetailVariants_VariantLabel"),span.innerText=list.lname,button.appendChild(span),this.dropdown.appendChild(button)})}toggleExpanded(){const willExpand=!this.expanded;this.setExpanded(willExpand),willExpand&&this.dropdown.querySelector("button")?.focus()}selectWishlist(event){const lid=event.currentTarget.dataset.lid;this.dataset.lid=lid,this.dataset.wishlistName=event.currentTarget.innerText,this.select.value=lid,this.setExpanded(!1),this.trigger.focus(),this.externalEls.variantSelect.element.value?this.externalEls.addToWishList.element.removeAttribute("disabled"):this.externalEls.addToWishList.element.setAttribute("disabled",!0)}get select(){return this.els.select.element}get dropdown(){return this.els.dropdown.element}get expanded(){return this.getAttribute("aria-expanded")==="true"}get trigger(){return this.els.trigger.element}}customElements.get("wishlist-select")||customElements.define("wishlist-select",WishlistSelect); 2//# sourceMappingURL=/cdn/shop/t/914/assets/wishlist-select.js.map?v=128277890823881756621788783201
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.