1(function(){if(window.womCollectionRatingsInitialized)return;window.womCollectionRatingsInitialized=!0;let womOverallCompanyCache=null;function ensureWomFontAwesome(){if(document.getElementById("wom-fontawesome-stars")||document.querySelector('link[href*="font-awesome"][href*="all.min"]'))return;const link=document.createElement("link");link.id="wom-fontawesome-stars",link.rel="stylesheet",link.href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css",document.head.appendChild(link)}function buildCardRatingStarHtml(){return typeof window.buildWomCardStarHtml=="function"?window.buildWomCardStarHtml(15):'<svg viewBox="0 0 576 512" width="15" height="15" style="display:block;flex-shrink:0" aria-hidden="true"><path fill="#000000" d="M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z"/></svg>'}function slugifyCore(raw){return raw?raw.normalize("NFKC").replace(/[^\w]+/g,"_").replace(/_+/g,"_").replace(/^_+|_+$/g,"").toLowerCase():""}function titleFirstSegment(title){if(!title)return"";const head=title.normalize("NFKC").split(/\s*[ââââ-]\s*/)[0].trim();return slugifyCore(head)}function handleToSlug(handle){return handle?handle.toLowerCase().replace(/-/g,"_").replace(/[^\w_]+/g,"").replace(/_+/g,"_").replace(/^_+|_+$/g,""):""}function expandTheVariants(slug){const out=[];if(!slug)return out;if(out.push(slug),!slug.startsWith("the_"))out.push("the_"+slug);else{const rest=slug.slice(4);rest&&out.push(rest)}return out}function tailStrippedVariants(slug,maxStrips){const variants=[];let s=slug;for(let i=0;i<=maxStrips&&(variants.push(s),i!==maxStrips);i++){const li=s.lastIndexOf("_");if(li<=0)break;const next=s.slice(0,li);if(next.split("_").filter(Boolean).length<2)break;s=next}return variants}function ratingCandidatesForProduct(title,handle){const seen=new Set,add=slug=>{!slug||seen.has(slug)||seen.add(slug)},bases=new Set,t1=titleFirstSegment(title);t1&&bases.add(t1),title&&bases.add(slugifyCore(title));const h=handleToSlug(handle);h&&bases.add(h);for(const base of bases)for(const stripped of tailStrippedVariants(base,3))for(const v of expandTheVariants(stripped))add(v),v&&!v.startsWith("boldfit_")&&add("boldfit_"+v);return[...seen]}function pickRatingPayload(ratingsData,title,handle){for(const key of ratingCandidatesForProduct(title,handle)){const data=ratingsData[key];if(!data)continue;const rating=Number.parseFloat(String(data.overall_rating??data.overallRating??0))||0,count=Number(data.total_reviews??data.totalReviews??0)||0;if(rating>0&&count>0)return{data,rating,count}}return null}function updateCollectionRatings(ratingsData){if(!ratingsData||typeof ratingsData!="object")return;document.querySelectorAll(".wom-collection-rating").forEach(element=>{const productTitle=element.getAttribute("data-product-title")||"",productHandle=element.getAttribute("data-product-handle")||"",picked=pickRatingPayload(ratingsData,productTitle,productHandle);if(picked){const numberContainer=element.querySelector(".wom-rating-number"),countContainer=element.querySelector(".wom-rating-count"),starsFa=element.querySelector(".wom-rating-stars-fa"),isOverlay=element.classList.contains("wom-collection-rating--media-overlay"),rating=Math.min(5,Math.max(0,picked.rating));starsFa&&(isOverlay?starsFa.innerHTML=buildCardRatingStarHtml():typeof(window.bfRenderWomStars||window.renderWomStars)=="function"?starsFa.innerHTML=(window.bfRenderWomStars||window.renderWomStars)(rating,14):starsFa.innerHTML=buildCardRatingStarHtml()),numberContainer&&(isOverlay?(numberContainer.textContent=rating.toFixed(1),numberContainer.style.display=""):(numberContainer.textContent="",numberContainer.style.display="none")),countContainer&&(isOverlay?countContainer.style.display="none":(countContainer.textContent=`(${picked.count})`,countContainer.style.display="")),element.style.display=isOverlay?"inline-flex":"flex"}else element.style.display="none"})}function fetchCollectionRatings(){ensureWomFontAwesome(),fetch("https://api.thewordofmouth.in/api/overall_company/boldfit",{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"}}).then(response=>response.json()).then(data=>{womOverallCompanyCache=data,updateCollectionRatings(data)}).catch(error=>{console.error("WOM Collection Ratings: Failed to fetch",error)})}function onWomRefreshCollectionRatings(){ensureWomFontAwesome(),womOverallCompanyCache&&typeof womOverallCompanyCache=="object"&&updateCollectionRatings(womOverallCompanyCache),fetchCollectionRatings()}window.womApplyCachedCollectionRatings=function(){womOverallCompanyCache&&typeof womOverallCompanyCache=="object"&&(ensureWomFontAwesome(),updateCollectionRatings(womOverallCompanyCache))},window.womFetchCollectionRatings=fetchCollectionRatings,document.readyState==="loading"?document.addEventListener("DOMContentLoaded",fetchCollectionRatings):fetchCollectionRatings(),document.addEventListener("collection-updated",onWomRefreshCollectionRatings),document.addEventListener("wom-refresh-collection-ratings",onWomRefreshCollectionRatings),window.womNotifyCollectionProductsUpdated=onWomRefreshCollectionRatings})(); 2//# sourceMappingURL=/cdn/shop/t/170/assets/wom-collection-ratings.js.map?v=90158888699044845901785921277
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.