1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[83347],{3347(t,s,e){e.r(s),e.d(s,{default:()=>a});var i=e(4335),o=e(1452);class a extends i.A{static #t=this.options={texts:{add:"Add to wishlist",remove:"Remove from wishlist"}};init(){this.classList={isLoading:"product-wishlist-loading",addedState:"product-wishlist-added",notAddedState:"product-wishlist-not-added"},this.textsElement=this.el.querySelector(".product-wishlist-btn-content"),this._getWishlistStorage(),this._wishlistStorage||(this.el.style.display="none",console.warn("No wishlist storage found")),this._registerEvents(),this.initStateClasses()}_getWishlistStorage(){let t=document.querySelector("#wishlist-basket");t&&(this._wishlistStorage=window.PluginManager.getPluginInstanceFromElement(t,"WishlistStorage"))}_registerEvents(){this.el.addEventListener("click",this._onClick.bind(this)),this._wishlistStorage.$emitter.subscribe("Wishlist/onLoginRedirect",this.initStateClasses.bind(this))}initStateClasses(){this._wishlistStorage.has(this.options.productId)?this._addActiveState():this._removeActiveState(),this.el.classList.remove(this.classList.isLoading)}_onClick(t){if(t.preventDefault(),!this.el.classList.contains(this.classList.isLoading)){if(!window.customerLoggedInState&&window.useDefaultCookieConsent&&!o.A?.getItem("wishlist-enabled")){document.$emitter.publish("CookieConfiguration/requestConsent",{route:`${window.router["frontend.cookie.consent.offcanvas"]}?featureName=wishlist&cookieName=wishlist-enabled`,cookieName:"wishlist-enabled"});return}this._wishlistStorage.has(this.options.productId)?this._wishlistStorage.remove(this.options.productId,this.options.router.remove):this._wishlistStorage.add(this.options.productId,this.options.router.add)}}_addActiveState(){this.el.classList.remove(this.classList.notAddedState),this.el.classList.add(this.classList.addedState),this.el.setAttribute("title",this.options.texts.remove),this.textsElement&&(this.textsElement.innerHTML=this.options.texts.remove)}_removeActiveState(){this.el.classList.remove(this.classList.addedState),this.el.classList.add(this.classList.notAddedState),this.el.setAttribute("title",this.options.texts.add),this.textsElement&&(this.textsElement.innerHTML=this.options.texts.add)}}}}]);
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.