1"use strict";(self.NiveaXwebpackJsonp=self.NiveaXwebpackJsonp||[]).push([[160],{23688:(t,e,i)=>{i.r(e),i.d(e,{default:()=>n});var r=i(98684);class n{constructor(t){var e;this.element=t,this.ratingAndStarsDistributionElement=this.element.querySelector(".nx-product-ratings__rating-and-stars-distribution"),this.productReviewsSectionElement=this.element.querySelector(".nx-product-reviews__section"),this.loadReviewsURL=null===(e=this.ratingAndStarsDistributionElement)||void 0===e?void 0:e.getAttribute("data-filterurl"),this.ratingFilterBtn=this.element.querySelector(".nx-product-ratings__filter"),this.spinner=this.element.querySelector(".nx-product-rating__spinner"),this.init()}init(){var t;this.addListenersToRatingSummaries(),null===(t=this.ratingFilterBtn)||void 0===t||t.addEventListener("click",()=>this.removeActiveFilter())}addListenersToRatingSummaries(){var t;const e=null===(t=this.ratingAndStarsDistributionElement)||void 0===t?void 0:t.querySelectorAll(".nx-product-ratings__rating-wrapper");e&&e.forEach(t=>{const i=t.querySelector(".nx-rating__total"),r=t.querySelector(".nx-rating__total-sum");i&&r&&"0"!=r.getAttribute("data-star-distribution")&&(this.addLinkStyleToRatingWrapper(t),t.addEventListener("click",()=>{const r=t.getAttribute("data-filter-text");t.classList.contains("nx-product-ratings__rating-wrapper--link-active")?(this.loadReviews("",null),this.removeActiveLinkStyleOnRatingWrappers(e)):(this.loadReviews(i.getAttribute("data-rating"),r),this.toggleActiveLinkStyleOnRatingWrappers(t,e))}))})}removeActiveFilter(){var t;const e=null===(t=this.ratingAndStarsDistributionElement)||void 0===t?void 0:t.querySelectorAll(".nx-product-ratings__rating-wrapper");this.loadReviews("",null),this.removeActiveLinkStyleOnRatingWrappers(e)}addLinkStyleToRatingWrapper(t){(0,r.iQ)(t,"nx-product-ratings__rating-wrapper--link")}toggleActiveLinkStyleOnRatingWrappers(t,e){this.removeActiveLinkStyleOnRatingWrappers(e),(0,r.iQ)(t,"nx-product-ratings__rating-wrapper--link-active")}removeActiveLinkStyleOnRatingWrappers(t){t.forEach(t=>{(0,r.vy)(t,"nx-product-ratings__rating-wrapper--link-active")})}showSpinner(){this.spinner.classList.remove("nx-product-rating__spinner--hide")}hideSpinner(){this.spinner.classList.add("nx-product-rating__spinner--hide")}removeLoadMoreCustomEventLister(){document.dispatchEvent(new CustomEvent("NiveaXLoadMoreLoaded:removeEvent"))}loadReviews(t,e){this.showSpinner();let i=decodeURIComponent(this.loadReviewsURL).replace("###",t),n=new XMLHttpRequest;return n.onload=()=>{if(n.status>=200&&n.status<300){const t=(0,r.Uo)(n.responseText);this.productReviewsSectionElement.querySelector(".nx-reviews-wrapper").replaceWith(t),e?(this.ratingFilterBtn.querySelector(".nx-product-ratings__filter-text").textContent=e,this.ratingFilterBtn.style.visibility=""):this.ratingFilterBtn.style.visibility="hidden",this.removeLoadMoreCustomEventLister(),window.NiveaX.initModules(),this.hideSpinner()}else console.error("The request failed!"),this.hideSpinner()},n.open("GET",i),n.send(),this}}}}]); 2//# sourceMappingURL=/dist/NiveaX/./modules/RatingAndStarsDistribution.6908d148.js.7ea262a6.map
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.