PageSourceSearch

https://www.toolstation.nl/_nuxt/asset/6.0.10/TsFilter-DplzH5S6.js

js toolstation.nl collected 2026-09-26 04:02:47 UTC 10,089 bytes, 3 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../../carouselThumbnail.DHXAGmwn.css","../../entry.IC0nXJmS.css"])))=>i.map(i=>d[i]);
2var U=(w,C,f)=>new Promise((V,A)=>{var D=o=>{try{l(f.next(o))}catch(p){A(p)}},b=o=>{try{l(f.throw(o))}catch(p){A(p)}},l=o=>o.done?V(o.value):Promise.resolve(o.value).then(D,b);l((f=f.apply(w,C)).next())});import{v as pe,H as X,j as Z,am as fe,ab as ge,q as me,u as m,b as _e,I as he,a as be,an as ve,c as z,ao as G,K as Te}from"./carouselThumbnail-BVGIAQ2F.js";import{c as xe,k as we,b as k,l as Fe,r as J,G as Re,m as Ce,O as x,P as i,Q as F,R as _,J as h,u as e,S as u,ab as O,X as $,_ as Ee,a7 as L,I as j,a6 as N,W as R,a0 as y,V as W,a1 as Se}from"./carousel-BVOjnoof.js";import{_ as $e}from"./entry-COcyHNV4.js";import{_ as ye}from"./TsVatToggle-BGCRqKR-.js";import{_ as Ve}from"./TsNoSavelistFound-Cf6WStgN.js";import"./TsCarouselTopBrands-CNwKM0SZ.js";import"./TsCardOutOfStock-CBZZzBco.js";import"./TsCardRoundedV1-9qCSFB4w.js";import"./TsButtonGroup-DHxkNh7i.js";import"./TsModalSubscriptionConfirmation-B9B3Kq-s.js";import"./TsTableColumn-_BitrsCO.js";const Ae=k({});let q=!1;function De(){const{locale:w}=pe(),C=X(),f=Ae;function V(){return U(this,null,function*(){const b="facets_translations_".concat(w.value);if(!q){q=!0;try{if(C.facetsTranslations[b]){f.value=C.facetsTranslations[b];return}const l=Z(),o=l.public.isFeatureEnv?"/api/facets-translation?locale=".concat(w.value):"".concat(l.public.translationCdnUrl,"/search_facets/").concat(w.value,".json"),p=yield fe(o,{method:"get"});p&&(f.value=p,C.setFacetsTranslations(b,p))}catch(l){const o={locality:w.value,filterTranslationError:!0},p=ge();if(p){const{$customClientErrorHandler:P}=p;P(l,"high","Filter Translation Error - There is an error in the filter translation service or query",o)}}finally{q=!1}}})}const A=xe(w,()=>{V()},{immediate:!0});we(()=>{A()});function D(b){var l;return((l=f.value)==null?void 0:l[b])||b.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,o=>o.toUpperCase())}return{getTranslation:D,fetchTranslations:V}}const Ie={class:"grow flex items-center justify-between"},ze={key:0},Oe={class:"pl-4 pr-1"},Le={class:"grow flex items-center justify-between"},je={class:"pl-4 pr-1"},Pe=["onClick"],Xe=Fe({__name:"TsFilter",props:{dataTestid:{},appendClass:{}},setup(w){const C=L(()=>z(()=>import("./TsTrollyCardTransition-DJLS61Y4.js").then(t=>t.T),__vite__mapDeps([0,1]),import.meta.url)),f=L(()=>z(()=>import("./Auth-MfowweAD.js").then(t=>t.T),__vite__mapDeps([0,1]),import.meta.url)),V=L(()=>z(()=>import("./TsNuxtCard-yvNW66C6.js").then(t=>t.a),__vite__mapDeps([0,1]),import.meta.url)),A=L(()=>z(()=>import("./TsCategoryFilters-DZ_Cvlgv.js"),__vite__mapDeps([0,1]),import.meta.url)),D=L(()=>z(()=>import("./TsChip-CcqmxPgV.js").then(t=>t.d),__vite__mapDeps([0,1]),import.meta.url)),b=L(()=>z(()=>import("./TsRatings-BP_dJAFv.js").then(t=>t.a),__vite__mapDeps([0,1]),import.meta.url)),l=me(),o=Z(),p=k(Object.keys(l.params).includes("brandName")),P=[{rating:5,text:m("fiveStars","5 stars")},{rating:4,text:m("fourStars","4 stars and up")},{rating:3,text:m("threeStars","3 stars and up")},{rating:2,text:m("twoStars","2 stars and up")},{rating:1,text:m("oneStar","1 star and up")}],Y=t=>{s.selectedRating===t?(c||G("remove_filter","rating:".concat(s.selectedRating,"_stars_and_higher"),"remove_single_filter","filter_panel"),c&&(s.previousSelectedRating=s.selectedRating),s.selectedRating=0):(c&&(s.previousSelectedRating=s.selectedRating||-1),s.selectedRating=t,c||r.pendingApplyFilterEvents.push({filter:"rating:".concat(s.selectedRating,"_stars_and_higher"),interaction_location:"filter_panel"})),c||(r.isWatchTrigger=!r.isWatchTrigger),H()},ee=t=>{const n="reviewFilterValue:".concat(t),v=r.selectedFilterState.indexOf(n);v!==-1?r.selectedFilterState.splice(v,1):(r.selectedFilterState=r.selectedFilterState.filter(g=>!g.startsWith("reviewFilterValue:")),r.selectedFilterState.push(n)),r.onFilterChange(c,!1,"rating",String(t)),c||(r.isWatchTrigger=!r.isWatchTrigger),H()},te=t=>{E[t]=!E[t],Te({options:{eventAction:"click",eventProperties:{filter:t},eventInteraction:!0,eventLabel:"plp_category_block_view_more",eventName:"plp_category_block_view_more"}})},I=w,s=X(),{isMobile:c}=_e(),ae=k(!1),r=he(),{getTranslation:se}=De(),re=k(),B=J({}),E=J({});Re(()=>{re.value=be()});const H=()=>{let t=0;const n=document.getElementById("ts-plp-filters");n&&(t=n.offsetTop-210),window.scrollTo({top:t,behavior:"smooth"})},ne=()=>U(this,null,function*(){r.resetFilters(),G("remove_filter",null,"remove_all_filters","filter_panel"),s.selectedRating=0,r.isExtractFilterFromRouteSkip=!0;const t=r.extractFiltersFromQuery(l.query);t&&t.length>0?yield r.handleNavigate(l,null,null,null,s.selectedRating):r.isWatchTrigger=!r.isWatchTrigger}),ie=t=>{if(s.filters){const n=s.filters[t];return n&&Object.keys(n).length>3}}
2,le=t=>{B[t]=!B[t]},oe=Ce(()=>s.filterOrders.filter(t=>(s.filters[t]||t==="review")&&!ve.includes(t)).map(t=>t)),ce=t=>Object.entries(t).map(([n,v])=>{const g=n.match(/\d+/g),M=g?parseInt(g[0]):1/0;return{label:n,count:v,min:M}}).sort((n,v)=>n.min-v.min),de=m("averageRating","Beoordeling");return(t,n)=>{const v=Ee,g=$e,M=ye,ue=Ve;return i(),x(j,null,[e(c)?_("",!0):(i(),F(M,{key:0,id:"ts-plp-filters","data-testid":"".concat(I.dataTestid,"-filter"),"append-class":"m-0 justify-between items-center px-4 mt-2 mb-6"},{default:u(()=>[h(g,{"append-class":"flex items-center text-idle-black text-nowrap font-semibold","data-testid":"filters-text"},{default:u(()=>[O($(e(m)("filters","Filters"))+" ",1),h(v,{name:"flowbite:filter-outline",size:"20"})]),_:1}),!e(c)&&(e(r).selectedFilterState.length>0||e(s).selectedRating)?(i(),F(g,{key:0,"append-class":"cursor-pointer underline text-info font-semibold",size:"sm","data-testid":"filter-clear-all-button",onClick:n[0]||(n[0]=a=>ne())},{default:u(()=>[O($(e(m)("clearAll","Alles wissen")),1)]),_:1})):_("",!0)]),_:1},8,["data-testid"])),h(e(V),{"data-testid":"".concat(I.dataTestid,"-filter"),"append-class":e(R)("bg-white border-[#F1F8FF] pt-0",I.appendClass),"no-shadow":""},{default:u(()=>[h(e(A)),h(e(C),{"data-testid":"".concat(I.dataTestid,"-filter-accordion"),"append-class":"mb-0",open:""},{default:u(()=>[(i(!0),x(j,null,N(e(oe),(a,K)=>(i(),x("div",{key:a},[e(s).filters&&e(s).filters[a]&&Object.keys(e(s).filters[a]).length>0&&(!e(p)||a!=="brand")?(i(),F(e(f),{key:0,"data-testid":"".concat(I.dataTestid,"-filter-accordion-tab-").concat(a),heading:e(se)(a),"append-class":e(R)("gap-0 px-0 border-[#D9E6ED] first:border-t-0",e(c)&&"p-4"),"body-class":e(R)("px-0 border-[#D9E6ED] pb-4 border-b-0",e(c)&&"px-4"),active:e(B)[a]||K<6,onClickTab:d=>le(a)},{heading:u(({heading:d,isOpen:T})=>[y("span",Ie,[h(g,{as:"span",variant:"h4","append-class":"mb-0"},{default:u(()=>{var S;return[O($(d)+" ",1),(S=e(s).filters)!=null&&S[a]?(i(),F(g,{key:0,as:"span","append-class":"mb-0"},{default:u(()=>[O("("+$(Object.entries(e(s).filters[a]).length)+")",1)]),_:2},1024)):_("",!0)]}),_:2},1024),T&&e(ae)?(i(),x("span",ze,[h(ue,{class:"border-2 rounded-full h-9 w-40",onClick:n[1]||(n[1]=Se(()=>{},["stop"]))})])):_("",!0)])]),icon:u(({isOpen:d})=>[y("span",Oe,[h(v,{class:W([e(R)(d&&"rotate-90"),"!size-4"]),name:"flowbite:angle-right-outline",size:"20"},null,8,["class"])])]),default:u(()=>[y("div",{class:W({"max-h-[10rem] overflow-y-auto":e(E)[a],"max-h-none":!e(E)[a]})},[a!=="priceRange"?(i(!0),x(j,{key:0},N(e(s).filters[a],(d,T,S)=>(i(),x("div",{key:a+"-"+T},[S<3||e(E)[a]?(i(),F(e(D),{key:0,id:a+"-"+T,modelValue:e(r).selectedFilterState,"onUpdate:modelValue":n[2]||(n[2]=Q=>e(r).selectedFilterState=Q),"data-testid":"checkbox-".concat(T),"append-class":"my-2",size:"lg",label:T,value:a+":"+T,quantity:d,"force-show":!0,onChange:Q=>e(r).onFilterChange(e(c),!1,a,T)},null,8,["id","modelValue","data-testid","label","value","quantity","onChange"])):_("",!0)]))),128)):(i(!0),x(j,{key:1},N(ce(e(s).filters[a]),(d,T)=>(i(),x("div",{key:a+"-"+d.label},[T<3||e(E)[a]?(i(),F(e(D),{key:0,id:d.label,modelValue:e(r).selectedFilterState,"onUpdate:modelValue":n[3]||(n[3]=S=>e(r).selectedFilterState=S),"data-testid":"checkbox-".concat(d.label),"append-class":"my-2",size:"lg",label:d.label,value:a+":"+d.label,quantity:d.count,"force-show":!0,onChange:S=>e(r).onFilterChange(e(c),!1,a,d.label)},null,8,["id","modelValue","data-testid","label","value","quantity","onChange"])):_("",!0)]))),128))],2),ie(a)?(i(),F(g,{key:0,"append-class":"text-info underline cursor-pointer mt-4",weight:"semibold",size:"sm",onClick:d=>te(a)},{default:u(()=>[O($(e(E)[a]?e(m)("showLess","Laat minder zien"):e(m)("showMore","Laat meer zien")),1)]),_:2},1032,["onClick"])):_("",!0)]),_:2},1032,["data-testid","heading","append-class","body-class","active","onClickTab"])):_("",!0)]))),128)),P&&e(s).review_count?(i(),F(e(f),{key:0,"data-testid":I.dataTestid+"-rating-accordion-tab",heading:e(de),"append-class":e(R)("gap-0 px-0 border-[#D9E6ED] first:border-t-0",e(c)&&"p-4"),"body-class":e(R)("px-0 border-[#D9E6ED] pb-4 border-b-0",e(c)&&"px-4")},{heading:u(()=>[y("span",Le,[h(g,{as:"span",variant:"h4","append-class":"mb-0"},{default:u(()=>[O($(e(m)("averageRating","Beoordeling")),1)]),_:1})])]),icon:u(({isOpen:a})=>[y("span",je,[h(v,{class:W([e(R)(a&&"rotate-90"),"!size-4"]),name:"flowbite:angle-right-outline",size:"20"},null,8,["class"])])]),default:u(()=>[e(s).review_count?(i(),x(j,{key:0},N(P,a=>y("div",{key:a.rating,class:"mt-2"},[e(s).review_count[a.rating]?(i(),x("div",{key:0,class:W(e(R)("flex gap-4  hover:font-bold cursor-pointer",e(s).selectedRating===a.rating?"text-info font-bold":"")),onClick:K=>e(o).public.vertexAiEnabled||e(s).enableVertex?ee(a.rating):Y(a.rating)},[h(e(b),{"model-value":a.rating,"data-testid":"rating-accordion-tsrating-".concat(a.rating),"read-only":"",size:"base"},null,8,["model-value","data-testid"]),y("p",null,$(a.text),1)],10,Pe)):_("",!0)])),64)):_("",!0)]),_:1},8,["data-testid","heading","append-class","body-class"])):_("",!0)]),_:1},8,["data-testid"])]),_:1},8,["data-testid","append-class"])],64)}}});
2export{Xe as default};
3//# sourceMappingURL=TsFilter-DplzH5S6.js.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.