PageSourceSearch

https://www.lookfantastic.com/ssr-assets/FacetWrapper.astro_astro_type_script_index_0_lang.V33wk8SS.js

js lookfantastic.com collected 2026-10-09 21:36:24 UTC 27,787 bytes, 111 lines download raw bytes

1import{P as z}from"./pubsub.BZNGFF6h.js";const H={"<":"&lt;",">":"&gt;"},j=/[<>\\]/g;function _(o){return o==null?"":String(o).replace(/</g,H["<"]).replace(/>/g,H[">"])}function M(o){return o==null?"":String(o).replace(j,"").trim()}function I(o,g){o.attributes=["facet-option-group-raw","facet-option-name-raw","facet-search-letter"],o.injectors=["facet-inject"],o.triggers=["facet-trigger"],o.bindings=["facet-binding"],o.hydrateOptionTemplate=function(e,i,l,a,s){const n=e.querySelector("[facet-options]");n.innerHTML="",v(e,l),E(e,l,a);const t=i.cloneNode(!0),c=e.querySelectorAll('[facet-transmitter="options"]');s&&e.facetType!=="SliderFacet"?(e.facetOpen=!0,t.querySelector('[facet-receiver="options"]')?.classList?.add("active"),c?.forEach(r=>{r.setAttribute("aria-expanded","true")})):t.querySelector('[facet-receiver="options"]')?.classList?.contains("active")?(e.facetOpen=!0,c?.forEach(r=>{r.setAttribute("aria-expanded","true")})):c?.forEach(r=>{r.setAttribute("aria-expanded","false")}),n.append(t),o.bindAriaLabels(e,l,a)},o.mapOptions=function(e,i,l,a,s){k.setContext(e,l,a,s),g.publish("facet-hydrated",{element:e,data:i,currentSelections:l,facetType:a});let n=e.querySelectorAll("[facet-options-section]");if(!n?.length&&(n=e.templates.get(a)?.querySelectorAll("[facet-options-section]"),!n?.length))return;const t=e.querySelector("[facet-options-wrapper]"),c=n[0].cloneNode(!0);t.innerHTML="";let r;if(a==="SearchFacet"){let u=e.querySelectorAll("[facet-template-search]");if(u?.length||(u=e.templates.get(a)?.querySelectorAll("[facet-template-search]")),u?.length){r=u?.[0].cloneNode(!0),u.innerHTML="";const f=e.querySelector("[facet-search]");if(f){F.setOriginalData(e,i),f._inputHandler&&f.removeEventListener("input",f._inputHandler),f._inputHandler=function(x){const q={...F.getOriginalData(e)};q.options=h.getFilteredOptions(e,x.target.value);const{currentSelections:O,facetType:V,hydrateOptionCount:R}=k.getContext(e);o.mapOptions(e,q,O,V,R)},f.addEventListener("input",f._inputHandler);const b=F.getOriginalData(e);L(e,b)}}}v(e,i),E(e,i,l),e.querySelectorAll("[facet-transmitter='options']").forEach(u=>{u.removeEventListener("click",e.toggleOptions),u.addEventListener("click",e.toggleOptions)}),a==="SearchFacet"&&i?.options&&i.options.sort((u,f)=>{const b=(u.displayName||"").trim(),x=(f.displayName||"").trim(),y=/^[A-Za-zÀ-ÖØ-öø-ÿ]/.test(b),q=/^[A-Za-zÀ-ÖØ-öø-ÿ]/.test(x);return y&&!q?-1:!y&&q?1:b.localeCompare(x,void 0,{sensitivity:"base"})});const d=s!=="*"?parseInt(s,10):NaN,m=Number.isNaN(d)?i?.options?.length||0:Math.min(i?.options?.length||0,d);i?.options?.forEach((u,f)=>{if(!Number.isNaN(d)&&f>=d)return;const b=h.getGroupingChar(u?.displayName),x=_(b);if(r&&!t.querySelector(`[facet-search-letter='${x}']`)){const V=r.cloneNode(!0);v(V,i,f),E(V,i,l,f),t.append(V)}const y=c.cloneNode(!0);v(y,i,f),E(y,i,l,f),D(y,u,i,l);const q=y.querySelector('[facet-trigger="option"]'),O=o.config?.ariaLabels?.optionLabel;if(q&&O){const V={name:u?.displayName||"",count:u?.matchedProductCount??"",position:f+1,total:m},R=O.replace(/\{(name|count|position|total)\}/g,(S,T)=>String(V[T]??""));q.setAttribute("aria-label",R)}t.append(y)}),o.bindTriggers(e,a)},o.mapSlider=function(e,i,l){const a=e.querySelector("input[facet-slider-min]"),s=parseFloat(a?.getAttribute("step")||a?.step||1),n=s<1,t=n?s.toString().split(".")[1]?.length||2:0,c={...i,minValue:n?i.minValue:Math.floor(i.minValue),maxValue:n?i.maxValue:Math.ceil(i.maxValue)},r=l?.find(y=>y?.facetName===i?.facetName),p=r?.options?.[0]?.minValue?r?.options?.[0]?.minValue<c?.minValue?c?.minValue:r?.options?.[0]?.minValue:c?.minValue,d=r?.options?.[0]?.maxValue?r?.options?.[0]?.maxValue>c?.maxValue?c?.maxValue:r?.options?.[0]?.maxValue:c?.maxValue;r?.options?.[0]?.maxValue||i?.maxValue;const m=e.querySelectorAll("input[facet-slider-min]"),u=e.querySelectorAll("input[facet-slider-max]");let f=n?d:Math.ceil(d),b=n?p:Math.floor(p);[...m,...u].forEach(y=>{const q=y.type,O=y.hasAttribute("facet-slider-min")?"min":"max";y.setAttribute("min",String(O==="min"?c?.minValue:c?.minValue+(n?s:1))),y.setAttribute("max",String(O==="max"?c?.maxValue:c?.maxValue-(n?s:1))),y.setAttribute("value",String(O==="min"?b:f)),y.value=String(O==="min"?b:f);const V=e.querySelectorAll(`[facet-binding='${y.getAttribute("facet-binding")}']`);q==="range"&&(y.setAttribute("name",`${O}`),y.addEventListener("input",S=>{Array.from(V)?.forEach(T=>{if(S.target!==T){if(T.setAttribute("value",S.target.value),T.value=S.target.value,O==="min"){if(b=S.target.value,Number(S.target.value)>=Number(f)){let A=n?parseFloat((Number(S.target.value)+s).toFixed(t)):Number(S.target.value)+1;A=Math.min(A,c?.maxValue),[...u].forEach(w=>{w.setAttribute("value",String(A)),w.value=String(A),f=String(A)})}}else if(f=S.target.value,Number(S.target.value)<=Number(b)){let A=n?parseFloat((Number(S.target.value)-s).toFixed(t)):Number(S.target.value)-1;A=Math.max(A,c?.minValue),[...m].forEach(w=>{w.setAttribute("value",String(A)),w.value=String(A),b=String(A)})}x()}else S.target.setAttribute("value",S.target.value)})}
1)),q==="number"&&y.addEventListener("focusout",S=>{const T=Number(S.target.value),A=c?.minValue,w=c?.maxValue;let N;if(O==="min"){if(T<A)N=A;else if(T>=w)N=n?parseFloat((w-s).toFixed(t)):w-1,[...u].forEach($=>{$.setAttribute("value",String(w)),$.value=String(w)}),f=w;else if(N=n?parseFloat((Math.round(T/s)*s).toFixed(t)):Math.floor(T),N>=Number(f)){let $=n?parseFloat((N+s).toFixed(t)):N+1;$=Math.min($,w),[...u].forEach(P=>{P.setAttribute("value",String($)),P.value=String($)}),f=$}b=N}else{if(T>w?N=w:T<=A?N=A+(n?s:1):N=n?parseFloat((Math.round(T/s)*s).toFixed(t)):Math.ceil(T),N<=Number(b)){let $=n?parseFloat((N-s).toFixed(t)):N-1;$=Math.max($,A),[...m].forEach(P=>{P.setAttribute("value",String($)),P.value=String($)}),b=$}f=N}Array.from(V).forEach($=>{$.setAttribute("value",String(N)),$.value=String(N)}),x()}),e.querySelectorAll("[facet-transmitter='options']").forEach(S=>{S.removeEventListener("click",e.toggleOptions),S.addEventListener("click",e.toggleOptions)}),v(e,i),E(e,i,l)}),x(),v(e,i),o.bindTriggers(e,"SliderFacet");function x(){const y=Array.from(m),q=Array.from(u),O=y.find(N=>N.type==="range"),V=q.find(N=>N.type==="range");if(!O||!V)return;const R=Number(O?.min),T=Number(V?.max)-R,A=(Number(O?.value)-R)/T*100+"%",w=(Number(V?.value)-R)/T*100+"%";V.style.background=`linear-gradient(
2                    to right,
3                    #ddd 0%,
4                    #ddd ${A},
5                    #111111 ${A},
6                    #111111 ${w},
7                    #ddd ${w},
8                    #ddd 100%)`}},o.mapTabs=function(e,i){const l=e.querySelectorAll("[facet-tabs-section]");if(!l.length)return;const a=l[0].parentElement;if(!a)return;const s=l[0].cloneNode(!0);l.forEach(n=>n.remove()),i?.forEach(n=>{n?.options?.forEach((t,c)=>{const r=s.cloneNode(!0);v(r,n,c),E(r,n,i,c),o.bindAriaLabels(r,n,i,c),a.append(r)})}),o.bindAriaLabels(e,null,i),o.bindTriggers(e)},o.toggleOptions=function(e,i){i?.stopPropagation(),e.singleActiveFacet==="true"&&o.closeOtherFacets(e);let l=e.querySelector("[facet-receiver='options']");e.hydrated||(e.injectFacetOptions(),e.hydrated=!0);const a=l.classList.contains("active");return l.classList.toggle("active"),e.facetOpen=!a,e.querySelectorAll("[facet-transmitter='options']")?.forEach(s=>{s.setAttribute("aria-expanded",e.facetOpen?"true":"false")}),e.facetOpen},o.closeOtherFacets=function(e){document.querySelectorAll("elements-facet").forEach(l=>{if(l!==e&&l.facetOpen){const a=l.querySelector("[facet-receiver='options']");a&&a.classList.contains("active")&&(a.classList.remove("active"),l.querySelectorAll('[facet-transmitter="options"]')?.forEach(s=>{s.setAttribute("aria-expanded","false")}),l.facetOpen=!1)}})};const h={normalizeText(e){return e?e.normalize("NFD").replace(/[\u0300-\u036f]/g,""):""},getGroupingChar(e){const i=e?.[0]||"",l=this.normalizeText(i).toUpperCase();return/^[0-9]/.test(l)?"0-9":l},characterMatches(e,i){return this.getGroupingChar(i)===e},filterOptionsByText(e,i){if(!i)return e;const a=this.normalizeText(i).toUpperCase().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=new RegExp(`\\b${a}`,"i");return e.filter(n=>{const t=this.normalizeText(n.displayName||"");return s.test(t)})},getActiveCharacterFilter(e){const i=e.querySelector('[facet-filter-char][filter-active="true"]');return i?i.getAttribute("filter-value"):"*"},getFilteredOptions(e,i=""){const l=F.getOriginalData(e);if(!l?.options)return[];let a=l.options;const s=this.getActiveCharacterFilter(e);return s&&s!=="*"&&(a=a.filter(n=>this.characterMatches(s,n.displayName))),i&&(a=this.filterOptionsByText(a,i)),a}},F={setOriginalData(e,i){e._facetDataCache||(e._facetDataCache=i)},getOriginalData(e){return e._facetDataCache||null},clearOriginalData(e){delete e._facetDataCache}},k={setContext(e,i,l,a){e._facetContext={currentSelections:i,facetType:l,hydrateOptionCount:a}},getContext(e){return e._facetContext||{}},clearContext(e){delete e._facetContext}};function L(e,i){e.querySelectorAll("[facet-filter-char]").forEach(a=>{const s=a.getAttribute("filter-value");i?.options?.some(t=>h.characterMatches(s,t.displayName))?(a.removeAttribute("disabled"),a.classList.remove("disabled")):(a.setAttribute("disabled","true"),a.classList.add("disabled"))})}function v(e,i,l){o.attributes?.forEach(a=>{const s=l===void 0?`[${a}]`:`[${a}]`,n=e.querySelectorAll(s);
8n?.length&&n.forEach(t=>{o.bindAttribute(a,i,t,l)})})}function E(e,i,l,a){o.injectors?.forEach(s=>{const n=e.querySelectorAll(`[${s}]`);n?.length&&n.forEach(t=>{o.inject(t.getAttribute(s),i,t,l,a)})})}function D(e,i,l,a){const s=e.querySelector("input"),n=e.querySelector("label");if(!s||s.type!=="checkbox")return;const t=i?.optionName||i?.displayName,c=_(t),r=_(l?.facetName),p=i?.optionName?i.optionName:`[${i?.from??"*"} TO ${i?.to??"*"}]`,d=_(p);s.setAttribute("name",c),s.setAttribute("value",d),s.id=`${r}-${c}`,n&&n.setAttribute("for",s.id);const m=a?.find(u=>u?.facetName===l?.facetName);m?s.checked=m.options?.some(u=>u.optionName?u.optionName===i?.optionName:u.displayName===i?.displayName):s.checked=!1}return o.bindAttribute=function(e,i,l,a){let s="";switch(e){case"facet-option-group-raw":s=_(i?.facetName);break;case"facet-option-name-raw":{const n=i?.options?.[a];if(!n)break;n.optionName?s=_(n.optionName):"from"in n?s=`[${_(n.from??"*")} TO ${_(n.to??"*")}]`:"minValue"in n&&(s=`[${_(n.minValue)} TO ${_(n.maxValue)}]`);break}case"facet-search-letter":{s=_(h.getGroupingChar(i?.options?.[a]?.displayName));break}default:console.warn(`No binding for attribute: ${e}`);return}l.setAttribute(e,s)},o.inject=function(e,i,l,a,s){l.textContent=o.dataMap(e,i,s,a)},o.bindAriaLabels=function(e,i,l,a=null){const s=t=>{const c=t.getAttribute("facet-aria"),r=window.elements?.facets?.aria?.[c];if(!r)return;const p=r.replace(/{([^}]+)}/g,(d,m)=>{const u=o.dataMap(m,i,a,l);return u!==void 0?_(u):""});t.setAttribute("aria-label",p)};e.hasAttribute&&e.hasAttribute("facet-aria")&&s(e),e.querySelectorAll("[facet-aria]").forEach(s)},o.clearSelection=function(e){g.publish("clear-facet",e)},o.selectOption=function(e,i,l,a="option"){g.publish("option-selected",{group:e,option:i,facetType:l,action:a})},o.bindTriggers=function(e,i){e.querySelectorAll("[facet-trigger]")?.forEach(a=>{const s=a.getAttribute("facet-trigger");if(s==="clear-section")a.addEventListener("click",n=>{n.stopPropagation(),o.clearSelection(a.getAttribute("facet-option-group-raw"))});else if(s==="clear-option")a.addEventListener("click",n=>{n.stopPropagation();const t=a.getAttribute("facet-option-group-raw"),c=a.getAttribute("facet-option-name-raw");o.selectOption(t,c,i,"clear")});else if(s==="option"){const n=a._optionClickHandler,t=a._optionKeydownHandler;n&&a.removeEventListener("click",n),t&&a.removeEventListener("keydown",t);const c=p=>{p.stopPropagation();const d=a.getAttribute("facet-option-group-raw"),m=a.getAttribute("facet-option-name-raw");o.selectOption(d,m,i)},r=p=>{(p.key==="Enter"||p.key===" "||p.key==="Spacebar")&&(p.preventDefault(),p.stopPropagation(),!p.repeat&&a.click())};a._optionClickHandler=c,a._optionKeydownHandler=r,a.addEventListener("click",c),a.addEventListener("keydown",r)}else if(s==="clear-all"){const n=a._clearAllClickHandler;n&&a.removeEventListener("click",n);const t=c=>{c.stopPropagation(),o.clearSelection("*")};a._clearAllClickHandler=t,a.addEventListener("click",t)}else if(s==="form"){const n=a._formSubmitHandler;n&&a.removeEventListener("submit",n);const t=c=>{c.preventDefault();const r=new FormData(a),p=r.get("min"),d=r.get("max"),m=a.getAttribute("facet-option-group-raw");o.selectOption(m,`[${p} TO ${d}]`,i)};a._formSubmitHandler=t,a.addEventListener("submit",t)}else if(s==="filter-char"){const n=a._filterCharClickHandler;n&&a.removeEventListener("click",n);const t=c=>{const r=e.querySelector('.elements-facets-search-character[filter-active="true"]');r?.setAttribute("filter-active","false"),r?.setAttribute("aria-pressed","false"),a.setAttribute("filter-active","true"),a.setAttribute("aria-pressed","true");const d={...F.getOriginalData(e)},m=e.querySelector("[facet-search]"),u=m?m.value:"";d.options=h.getFilteredOptions(e,u);const{currentSelections:f,facetType:b,hydrateOptionCount:x}=k.getContext(e);o.mapOptions(e,d,f,b,x)};a._filterCharClickHandler=t,a.addEventListener("click",t)}})},o.isToggleExpanded=function(e,i){if(!e)return!1;const l=Array.from(e.children).filter((a,s)=>s>=i);return l.length>0?l[0].classList.contains("active"):!1},o.dataMap=function(e,i,l,a){switch(e){case"facet-option-name-display":return i?.options?.[l]?.displayName||`${o?.config?.currencySymbol||""}${i?.options?.[l]?.minValue} - ${o?.config?.currencySymbol||""}${i?.options?.[l]?.maxValue}`;case"facet-option-count":return`(${i?.options?.[l]?.matchedProductCount})`;case"facet-group-name-display":return i?.facetHeader;case"facet-search-letter":return h.getGroupingChar(i?.options?.[l]?.displayName);case"facet-active-selections-count":return!a?.find(s=>
8s?.facetName===i?.facetName)||!a.length?"":a?.find(s=>s?.facetName===i?.facetName)?.options?.length;case"facet-selected-count":return a?.find(s=>s?.facetName===i?.facetName)?.options?.length||"0";case"facet-selections":if(a?.find(s=>s?.facetName===i?.facetName)){const s=a?.find(n=>n?.facetName===i?.facetName);return s?.options?.length?s.options.map(t=>t?.displayName?t?.displayName:`${o?.config?.currencySymbol||""}${t.minValue} - ${o?.config?.currencySymbol||""}${t?.maxValue}`).filter(Boolean).join(", "):""}else return"";case"facet-total-selected-count":return a?.reduce((s,n)=>s+(n?.options?.length||0),0)||0}},o}const B=`query Search(
9  $query: String!,
10  $currency: Currency!,
11  $shippingDestination: Country!,
12  $limit: Int! = 30,
13  $offset: Int! = 0,
14  $facets: [FacetInput!]! = [],
15  $sort: ProductSort!
16  $concessionCode: String
17  $skipRedirectsEnabled: Boolean = false
18) {
19search(options: {currency: $currency, shippingDestination: $shippingDestination, limit: $limit, offset: $offset, facets: $facets, sort: $sort, concessionCode: $concessionCode}, query: $query,  skipRedirects: $skipRedirectsEnabled)
20  {
21    productList {
22      facets {
23        __typename
24        ... on RangedFacet {
25          facetName
26          facetHeader
27          options{
28            displayName
29            from
30            to
31            matchedProductCount
32          }
33        }
34        ... on SimpleFacet {
35          facetName
36          facetHeader
37          options{
38            optionName
39            displayName
40            matchedProductCount
41          }
42        }
43        ... on SliderFacet {
44          facetName
45          facetHeader
46          minValue
47          maxValue
48        }
49      }
50    }
51  }
52}`,G=`query CollectionPage(
53  $handle: PagePath!
54  $currency: Currency!
55  $shippingDestination: Country!
56  $offset: Int = 0
57  $limit: Int = 30
58  $sort: ProductSort!
59  $facets: [FacetInput!]! = []
60  $concessionCode: String
61  $skipRedirects: Boolean = false
62  $skipRecursivePathSearch: Boolean = false
63) {
64  page(path: $handle, skipRedirects: $skipRedirects, skipRecursivePathSearch: $skipRecursivePathSearch){
65    widgets {
66      __typename
67      ... on ProductListWidget {
68        productList(
69          input: {
70            currency: $currency
71            shippingDestination: $shippingDestination
72            limit: $limit
73            offset: $offset
74            sort: $sort
75            facets: $facets
76            concessionCode: $concessionCode
77          }
78        ) {
79          facets {
80            __typename
81            ... on RangedFacet {
82              facetName
83              facetHeader
84              options {
85                displayName
86                from
87                to
88                matchedProductCount
89              }
90            }
91            ... on SimpleFacet {
92              facetName
93              facetHeader
94              options {
95                optionName
96                displayName
97                matchedProductCount
98              }
99            }
100            ... on SliderFacet {
101              facetName
102              facetHeader
103              minValue
104              maxValue
105            }
106          }
107        }
108      }
109    }
110  }
111}`;function K(o){let g=[];return o?.map(h=>{h?.__typename==="SimpleFacet"||h?.__typename==="RangedFacet"?h?.options?.length&&g.push(h):g.push(h)}),g}function U(o){let g=[];return o?.forEach(h=>{const F=h?.indexOf(":"),k=h?.substring(0,F),L=h?.substring(F+1);g.push({facetName:M(k),selections:[{optionName:M(L)}]})}),g}async function C(o,g=[]){let h;o?.pageType==="search"?h=JSON.stringify({query:B,variables:{currency:o?.currency,shippingDestination:o?.shippingDestination,limit:30,offset:0,facets:g,sort:"RELEVANCE",query:o?.query,skipRedirects:o?.skipRedirectsEnabled||!1,...o?.concessionCode&&{concessionCode:o.concessionCode}}}):o?.pageType==="collection"&&(h=JSON.stringify({query:G,variables:{currency:o?.currency,shippingDestination:o?.shippingDestination,limit:30,offset:0,facets:g,sort:"RELEVANCE",handle:o?.query,skipRedirects:o?.skipRedirectsEnabled||!1,skipRecursivePathSearch:o?.skipRecursivePathSearchEnabled||!1,...o?.concessionCode&&{concessionCode:o.concessionCode}}}));try{const F=await fetch(o?.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:h});if(!F.ok)throw new Error(`error: ${F.status}`);const k=await F.json();let L;return o?.pageType==="search"?L=k?.data?.search?.productList?.facets:o?.pageType==="collection"&&(L=(k?.data?.page?.widgets).find(D=>D?.__typename==="ProductListWidget")?.productList?.facets),K(L)}catch(F){console.error(F)}}async function W(o,g){const{observer:h}=g,F=o.fetchOptions,k=o.filterName;let L,v,E;
111function D(){v=new URLSearchParams(window.location.search).get(k)?.split("|")??[],E=U(v)}function e(n){const t=[];return E?.forEach(c=>{const r=n?.find(d=>d?.facetName===c?.facetName);if(!r)return;let p;c?.selections?.forEach(d=>{if(d?.optionName.includes("[")&&(r?.__typename==="SliderFacet"||r?.__typename==="RangedFacet")){const m=d?.optionName.slice(1,-1).split(" TO "),u=m[0]==="*"?null:Number(m[0]),f=m[1]==="*"?null:Number(m[1]);r?.options?p=r?.options?.find(b=>b?.from==u&&b?.to==f):(p={...r},p.minValue=Number(m[0]),p.maxValue=Number(m[1]))}else p=r?.options?.find(m=>m?.optionName==d?.optionName);if(p){const m=t?.findIndex(u=>u?.facetName===c?.facetName);m===-1?t?.push({facetName:c?.facetName,options:[{...p}]}):t[m].options.push({...p})}})}),t}D();let i=await C(F,E);L=e(i),h.publish("facet-data",{facets:i,selections:L}),h.subscribe("clear-facet",async n=>{const t=new URL(window.location.href);if(n==="*")t.searchParams.delete(k);else{const r=v.filter(p=>!p?.startsWith(`${n}:`));r?.length?t.searchParams.set(k,r?.join("|")):t.searchParams.delete(k)}window.history.pushState(null,"",t.href),D();const c=E?.filter(r=>r?.selections&&r?.selections?.length>0);i=await C(F,c),L=e(i),h.publish("facet-data",{facets:i,selections:L,facetName:n}),h.publish("refresh-product-list")}),h.subscribe("option-selected",async({group:n,option:t,facetType:c,action:r})=>{const p=v?.includes(`${n}:${t}`);p?v?.splice(v?.findIndex(u=>u===`${n}:${t}`),1):c&&c==="SliderFacet"&&v?.find(u=>u.includes(n))?v[v?.findIndex(u=>u?.includes(n))]=`${n}:${t}`:v?.push(`${n}:${t}`);const d=new URL(window.location.href);v?.length?d.searchParams.set(k,v?.join("|")):d.searchParams.delete(k),window.history.pushState(null,"",d.href),D();const m=E?.filter(u=>u?.selections&&u?.selections?.length>0);i=await C(F,m),L=e(i),h.publish("facet-data",{facets:i,selections:L,group:r==="clear"?"":n}),h.publish("refresh-product-list",{facetName:n,optionName:t,action:p?"unselected":"selected"})});class l extends HTMLElement{constructor(){super(),this.facetRenderCount=this.getAttribute("facet-render-count"),this.handleDocumentClick=this.handleDocumentClick.bind(this),this.handleFocusOut=this.handleFocusOut.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.mapToggleReceivers=this.mapToggleReceivers.bind(this),this.facetTabs=this.querySelector("[facet-tabs]"),this.isToggleExpanded=!1,this.keepFacetActive=this.getAttribute("facet-keep-active")==="true",this.singleActiveFacet=this.getAttribute("single-active-facet")}async connectedCallback(){await customElements.whenDefined("elements-facet"),this.facetOptions=this.querySelectorAll("elements-facet"),this.facetsContainer=this.facetOptions?.[0]?.parentElement,this.facetTemplate=this.facetOptions?.[0],h.subscribe("facet-data",t=>{const{facets:c,selections:r,group:p=""}=t,d=Array.from(this.facetOptions);let m;c?.forEach((f,b)=>{const x=f.facetName.includes("_brand_")?"SearchFacet":f.__typename,y=f?.facetName===p&&this.keepFacetActive;d[b]?(m=d[b],this.initializeFacetNode(d[b],x,f,r,d[b].templates,b,y)):(m=this.facetTemplate.cloneNode(!0),this.initializeFacetNode(m,x,f,r,this.facetTemplate.templates,b,y),this.facetsContainer.append(m))}),d.filter((f,b)=>b>=(c?.length??0))?.forEach(f=>{f.remove()}),this.initializeFacetTabs(r),this.facetOptions=this.querySelectorAll("elements-facet"),this.facetRenderCount!=="*"&&this.initializeToggle(c?.length??0)}),i?.forEach((t,c)=>{if(this.facetOptions[c]){const r=this.facetOptions[c],p=t.facetName.includes("_brand_")?"SearchFacet":t.__typename;r.facetType=p,r.facetData=t,r.currentSelections=L,r.singleActiveFacet=this.singleActiveFacet,g.hydrateOptionTemplate(r,r.templates.get(p),t,r.currentSelections),r.hydrateOptions==="all"&&(r.injectFacetOptions(),r.hydrated=!0),r.querySelector("[facet-transmitter='options']").addEventListener("click",r.toggleOptions)}}),this.initializeFacetTabs(L),this.facetRenderCount!=="*"&&this.initializeToggle(i?.length??0),document.addEventListener("click",this.handleDocumentClick),document.addEventListener("focusout",this.handleFocusOut),document.addEventListener("keydown",this.handleKeyDown)}initializeFacetNode(t,c,r,p,d,m,u){t.facetType=c,t.facetData=r,t.currentSelections=p,t.templates=d,t.facetOpen=u,t.singleActiveFacet=this.singleActiveFacet,g.hydrateOptionTemplate(t,t.templates.get(c),r,t.currentSelections,u),t.injectFacetOptions();const f=t.querySelector("[facet-transmitter='options']");if(f&&f.addEventListener("click",t.toggleOptions),m>=this.facetRenderCount)if(this.isToggleExpanded){if(t.classList.contains("active"))return;t.classList.add("active")}else{if(!t.classList.contains("active"))return;t.classList.remove("active")}return t}initializeFacetTabs(t){this.facetTabs&&(t.length?(g.mapTabs(this.facetTabs,t),this.facetTabs.removeAttribute("facet-template-hidden")):this.facetTabs.setAttribute("facet-template-hidden",""))}initializeToggle(t){const c=this.querySelector("[facet-transmitter='toggle']");c&&(g.bindAriaLabels(c,null,L),t>this.facetRenderCount?c.removeAttribute("facet-template-hidden"):c.setAttribute("facet-template-hidden","")),c.removeEventListener("click",this.mapToggleReceivers),c.addEventListener("click",this.mapToggleReceivers)}mapToggleReceivers(){const t=this.querySelectorAll("[facet-receiver='toggle']"),
111c=this.querySelector("[facet-transmitter='toggle']");this.isToggleExpanded=!this.isToggleExpanded,this.isToggleExpanded?(c.setAttribute("aria-expanded","true"),c.setAttribute("facet-aria","lessFiltersToggle")):(c.setAttribute("aria-expanded","false"),c.setAttribute("facet-aria","moreFiltersToggle")),g.bindAriaLabels(c,null,L),h.publish("facet-toggle",this.isToggleExpanded),t&&t.forEach((r,p)=>{this.facetRenderCount!=="*"&&p>=this.facetRenderCount&&(this.isToggleExpanded?(r.classList.add("active"),p==this.facetRenderCount&&r.querySelector('[facet-transmitter="options"]').focus()):r.classList.remove("active"))})}disconnectedCallback(){document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("focusout",this.handleFocusOut),document.removeEventListener("keydown",this.handleKeyDown)}manageFacetVisibility(t=null,c=!1){if(this.singleActiveFacet==="false")return;const r=this.querySelectorAll("elements-facet");Array.from(r).filter(d=>d.facetOpen).forEach(d=>{if(c||t&&!d.contains(t)){const m=d.querySelector("[facet-receiver='options']");m&&(m.classList.remove("active"),d.querySelectorAll("[facet-transmitter='options']")?.forEach(u=>u.setAttribute("aria-expanded","false")),d.facetOpen=!1)}})}handleKeyDown(t){t.key==="Escape"&&(this.manageFacetVisibility(null,!0),t.target.closest("elements-facet").querySelector("[facet-transmitter='options']").focus())}handleFocusOut(t){t.stopPropagation(),this.manageFacetVisibility(t.relatedTarget)}handleDocumentClick(t){t.stopPropagation(),this.manageFacetVisibility(t.target)}}customElements.get("elements-facet-results")||customElements.define("elements-facet-results",l);class a extends HTMLElement{constructor(){super(),this.templates,this.hydrateOptions=this.getAttribute("facet-hydration"),this.facetID=this.getAttribute("facet-id"),this.visibleOptions=this.getAttribute("facet-visible-options"),this.toggleOptions=this.toggleOptions.bind(this),this.hydrated=!1}async connectedCallback(){h.subscribe(`facet-templates-${this.facetID}`,t=>{this.templates=t})}set facetType(t){this._facetType=t}set facetData(t){this._facetData=t}set currentSelections(t){this._currentSelections=t}set facetOpen(t){this._facetOpen=t}get facetOpen(){return this._facetOpen}get facetType(){return this._facetType}get facetData(){return this._facetData}get currentSelections(){return this._currentSelections}toggleOptions(t){return t?.stopPropagation(),g.toggleOptions(this,t)}injectFacetOptions(){this.facetType!=="SliderFacet"?g.mapOptions(this,this.facetData,this.currentSelections,this.facetType,this.visibleOptions):g.mapSlider(this,this.facetData,this.currentSelections)}}customElements.get("elements-facet")||customElements.define("elements-facet",a);class s extends HTMLElement{constructor(){super(),this.facetID=this.getAttribute("facet-id"),this.optionTemplates=this.indexOptionTemplates(this)}async connectedCallback(){this.remove(),h.publish(`facet-templates-${this.facetID}`,this.optionTemplates)}indexOptionTemplates(t){const c=new Map;return t&&t.querySelectorAll("[facet-template-group]").forEach(r=>{c.set(r.getAttribute("facet-template-group"),r)}),c}}customElements.get("elements-facet-options-templater")||customElements.define("elements-facet-options-templater",s)}class J{constructor(g){this.config=g,this.observer=new z,I(this,this.observer),W(g,this)}subscribe(g,h){this.observer.subscribe(g,h)}publish(g,h){this.observer.publish(g,h)}}const Z=new J({filterName:window.elements.facets.filterName,fetchOptions:window.elements.facets.fetchOptions,ariaLabels:window.elements.facets.ariaLabels,currencySymbol:window.elements.facets.currencySymbol});window.elements||(window.elements={});window.elements.facets={...window.elements.facets,...Z};const Q=new CustomEvent("elements-facet-wrapper");document.addEventListener("DOMContentLoaded",()=>window.dispatchEvent(Q));

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.