PageSourceSearch

https://www.clinique.com/cdn/shop/t/82/assets/fredhopper-grid-element.DEAiTh8v.min.js

js clinique.com collected 2026-09-24 08:58:16 UTC 39,593 bytes, 282 lines download raw bytes

1import{B as t}from"./BaseElement.wji90fuE.min.js";import{n as e,e as i,t as s,x as r,T as a,r as n,q as o,u as l,o as c}from"./vendor-lit.2u3dzq2T.min.js";import{d,O as h}from"./debounce.uPZYEJlg.min.js";import{e as u,r as p,g as m,j as f,k as b,s as g,m as y,l as v,n as x,o as k}from"./filter-state.CHhZ4ouW.min.js";import{a as $,c as C,s as F,i as S,d as w,r as E}from"./helpers.BN2Mmr8t.min.js";import{p as M,D as I,r as L,b as A,a as P,c as O,d as N}from"./query-args.CUSVvFza.min.js";import{r as R,s as T,a as q,C as j}from"./card-color-filter.DWWjrMTa.min.js";import{r as D}from"./sdk.Biy77z8a.min.js";function B(t,e,i){return Number.isFinite(t)?i<e?e:Math.min(Math.max(t,e),i):e}function U(t,e,i){return i<=e?0:(B(t,e,i)-e)/(i-e)*100}var _=Object.defineProperty,G=Object.getOwnPropertyDescriptor,K=(t,e,i,s)=>{for(var r,a=s>1?void 0:s?G(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(a=(s?r(e,i,a):r(a))||a);return s&&a&&_(e,i,a),a};let H=class extends t{constructor(){super(...arguments),this.facetId="",this.min=0,this.max=0,this.step=1,this.valueMin=0,this.valueMax=0,this.minLabel="",this.maxLabel="",this.minId="",this.maxId="",this.minName="",this.maxName="",this.minPlaceholder="No min",this.maxPlaceholder="No max",this.toLabel="to",this.minAria="Minimum price",this.maxAria="Maximum price",this.currentMin=0,this.currentMax=0,this.onRangeInput=t=>{const e=t.target,i=Number(e.value);"min"===e.dataset.handle?this.currentMin=B(Math.min(i,this.currentMax),this.min,this.max):this.currentMax=B(Math.max(i,this.currentMin),this.min,this.max),this.syncDom()},this.onRangeChange=()=>{this.commit()},this.onNumberInput=t=>{const e=t.target,i=e.value.trim();if("min"===e.dataset.fhrFacetRangeInput){const t=""===i?this.min:Number(i);Number.isFinite(t)&&(this.currentMin=B(Math.min(t,this.currentMax),this.min,this.max))}else{const t=""===i?this.max:Number(i);Number.isFinite(t)&&(this.currentMax=B(Math.max(t,this.currentMin),this.min,this.max))}this.minRange.value=String(this.currentMin),this.maxRange.value=String(this.currentMax),this.updateFill(),this.updateStacking()},this.onNumberChange=()=>{this.syncDom()}}firstUpdated(t){super.firstUpdated(t),this.resetFromProps(),this.syncDom()}updated(t){super.updated(t),(t.has("valueMin")||t.has("valueMax")||t.has("min")||t.has("max"))&&(this.resetFromProps(),this.syncDom())}resetFromProps(){const t=B(this.valueMin,this.min,this.max),e=B(this.valueMax,this.min,this.max);this.currentMin=Math.min(t,e),this.currentMax=Math.max(t,e)}syncDom(){this.minRange&&(this.minRange.value=String(this.currentMin),this.maxRange.value=String(this.currentMax),this.minNumber.value=this.currentMin<=this.min?"":String(this.currentMin),this.maxNumber.value=this.currentMax>=this.max?"":String(this.currentMax),this.updateFill(),this.updateStacking())}updateFill(){const t=U(this.currentMin,this.min,this.max),e=100-U(this.currentMax,this.min,this.max);this.fill.style.setProperty("--fhr-price-slider-fill-start",`${t}%`),this.fill.style.setProperty("--fhr-price-slider-fill-end",`${e}%`)}updateStacking(){const t=this.min+(this.max-this.min)/2;this.slider.dataset.minOnTop=String(this.currentMin>t)}commit(){this.syncDom(),this.minNumber.dispatchEvent(new Event("change",{bubbles:!0}))}render(){return r`
2      <div
3        class="flex flex-col gap-lg"
4        data-fhr-facet-range
5        data-fhr-facet-id=${this.facetId}
6      >
7        <div class="flex flex-col gap-2xs">
8          <div class="group/price-slider relative h-[12px] w-full" data-slider>
9            <span
10              class="pointer-events-none absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-border-02"
11              aria-hidden="true"
12            ></span>
13            <span
14              class="pointer-events-none absolute start-(--fhr-price-slider-fill-start) end-(--fhr-price-slider-fill-end) top-1/2 h-px -translate-y-1/2 bg-foreground"
15              data-fill
16              aria-hidden="true"
17            ></span>
18            <input
19              type="range"
20              class="fhr-price-slider__range pointer-events-none absolute start-0 top-0 z-30 m-0 h-[12px] w-full appearance-none bg-transparent p-0 group-data-[min-on-top=true]/price-slider:z-40 focu
20s:outline-none"
21              data-handle="min"
22              min=${this.min}
23              max=${this.max}
24              step=${this.step}
25              aria-label=${this.minAria}
26              @input=${this.onRangeInput}
27              @change=${this.onRangeChange}
28            />
29            <input
30              type="range"
31              class="fhr-price-slider__range pointer-events-none absolute start-0 top-0 z-40 m-0 h-[12px] w-full appearance-none bg-transparent p-0 group-data-[min-on-top=true]/price-slider:z-30 focus:outline-none"
32              data-handle="max"
33              min=${this.min}
34              max=${this.max}
35              step=${this.step}
36              aria-label=${this.maxAria}
37              @input=${this.onRangeInput}
38              @change=${this.onRangeChange}
39            />
40          </div>
41          <div
42            class="flex justify-between body-sm text-foreground-secondary"
43            aria-hidden="true"
44          >
45            <span>${this.minLabel}</span>
46            <span>${this.maxLabel}</span>
47          </div>
48        </div>
49
50        <div class="flex items-center gap-xs">
51          <input
52            type="number"
53            class="h-(--spacing-forms-height) min-w-0 flex-1 border border-border-01 bg-background px-2xs body-sm text-foreground"
54            id=${this.minId}
55            name=${this.minName}
56            min=${this.min}
57            max=${this.max}
58            step=${this.step}
59            inputmode="numeric"
60            placeholder=${this.minPlaceholder}
61            aria-label=${this.minAria}
62            data-fhr-facet-range-input="min"
63            @input=${this.onNumberInput}
64            @change=${this.onNumberChange}
65          />
66          <span class="shrink-0 body-sm text-foreground-secondary"
67            >${this.toLabel}</span
68          >
69          <input
70            type="number"
71            class="h-(--spacing-forms-height) min-w-0 flex-1 border border-border-01 bg-background px-2xs body-sm text-foreground"
72            id=${this.maxId}
73            name=${this.maxName}
74            min=${this.min}
75            max=${this.max}
76            step=${this.step}
77            inputmode="numeric"
78            placeholder=${this.maxPlaceholder}
79            aria-label=${this.maxAria}
80            data-fhr-facet-range-input="max"
81            @input=${this.onNumberInput}
82            @change=${this.onNumberChange}
83          />
84        </div>
85      </div>
86    `}};K([e({type:String,attribute:"facet-id"})],H.prototype,"facetId",2),K([e({type:Number})],H.prototype,"min",2),K([e({type:Number})],H.prototype,"max",2),K([e({type:Number})],H.prototype,"step",2),K([e({type:Number,attribute:"value-min"})],H.prototype,"valueMin",2),K([e({type:Number,attribute:"value-max"})],H.prototype,"valueMax",2),K([e({type:String,attribute:"min-label"})],H.prototype,"minLabel",2),K([e({type:String,attribute:"max-label"})],H.prototype,"maxLabel",2),K([e({type:String,attribute:"min-id"})],H.prototype,"minId",2),K([e({type:String,attribute:"max-id"})],H.prototype,"maxId",2),K([e({type:String,attribute:"min-name"})],H.prototype,"minName",2),K([e({type:String,attribute:"max-name"})],H.prototype,"maxName",2),K([e({type:String,attribute:"min-placeholder"})],H.prototype,"minPlaceholder",2),K([e({type:String,attribute:"max-placeholder"})],H.prototype,"maxPlaceholder",2),K([e({type:String,attribute:"to-label"})],H.prototype,"toLabel",2),K([e({type:String,attribute:"min-aria"})],H.prototype,"minAria",2),K([e({type:String,attribute:"max-aria"})],H.prototype,"maxAria",2),K([i("[data-slider]")],H.prototype,"slider",2),K([i('[data-handle="min"]')],H.prototype,"minRange",2),K([i('[data-handle="max"]')],H.prototype,"maxRange",2),K([i("[data-fill]")],H.prototype,"fill",2),K([i('[data-fhr-facet-range-input="min"]')],H.prototype,"minNumber",2),K([i('[data-fhr-facet-range-input="max"]')],H.prototype,"maxNumber",2),H=K([s("fredhopper-price-slider")],H);var z=(t=>
86(t.Idle="idle",t.Loading="loading",t.Ready="ready",t.Empty="empty",t.Fallback="fallback",t))(z||{});const V={minPlaceholder:"No min",maxPlaceholder:"No max",toLabel:"to",minAria:"Minimum price",maxAria:"Maximum price"},J={colors:{},facetIds:[]};function Q(t){return t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Z(t,e){return e[Q(t.value)]??e[Q(t.label)]}function W(t,e){return"range"===t.type||t.values.length>=2||t.values.some(i=>{var s;return null==(s=e[t.id])?void 0:s.includes(i.value)})}var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,tt=(t,e,i,s)=>{for(var r,a=s>1?void 0:s?Y(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(a=(s?r(e,i,a):r(a))||a);return s&&a&&X(e,i,a),a};const et="fhr-filters-change";let it=class extends t{constructor(){super(...arguments),this.context="aside",this.facets=[],this.activeFilters={},this.rangeLabels=V,this.swatchConfig=J,this.phase=z.Idle,this.disabled=!1,this.syncInProgress=!1,this.debouncedEmitFilters=d(()=>{this.emitFiltersChange()},h),this.boundFacetChange=t=>{if(this.disabled||this.syncInProgress)return;const e=t.target;e instanceof HTMLInputElement&&(e.matches("[data-fhr-facet-input]")||e.matches("[data-fhr-facet-range-input]"))&&this.debouncedEmitFilters()}}createRenderRoot(){return document.createElement("div")}connectedCallback(){super.connectedCallback(),this.addEventListener("change",this.boundFacetChange)}disconnectedCallback(){this.removeEventListener("change",this.boundFacetChange),super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),this.renderPanel()}updated(t){super.updated(t),(t.has("facets")||t.has("activeFilters")||t.has("rangeLabels")||t.has("swatchConfig")||t.has("phase")||t.has("disabled"))&&this.renderPanel()}cancelPendingFilterEmit(){this.debouncedEmitFilters.cancel()}collectFilters(){return function(t,e){const i={};return t.querySelectorAll("input[data-fhr-facet-input]:checked:not(:disabled)").forEach(t=>{const e=t.name;e&&(i[e]=[...i[e]??[],t.value])}),t.querySelectorAll("[data-fhr-facet-range]").forEach(t=>{const s=t.getAttribute("data-fhr-facet-id");if(!s)return;const r=t.querySelector('[data-fhr-facet-range-input="min"]'),a=t.querySelector('[data-fhr-facet-range-input="max"]');if(!r||!a)return;const n=e.find(t=>"range"===t.type&&t.id===s),o=r.value.trim(),l=a.value.trim(),c=""===o?(null==n?void 0:n.min)??Number.NaN:Number(o),d=""===l?(null==n?void 0:n.max)??Number.NaN:Number(l);Number.isFinite(c)&&Number.isFinite(d)&&(c>d||n&&c<=n.min&&d>=n.max||(i[s]=[u(c,d)]))}),i}(this,this.facets)}renderPanel(){const t=(e=this.facets,i=this.phase,e.length>0&&(i===z.Ready||i===z.Loading||i===z.Empty));var e,i;this.hidden=!t,this.setAttribute("aria-busy",this.phase===z.Loading?"true":"false"),this.syncInProgress=!0,o(t?function(t,e,i,s=V,n=J){const o=i??$().filters,l=t.findIndex(t=>W(t,o));return r`${t.map((t,i)=>function(t,e,i,s,n,o){return"range"===t.type?function(t,e,i,s,a){const n=`Details-${e}-${t.id}`,o=`Filter-${e}-${t.id}-min`,l=`Filter-${e}-${t.id}-max`,c=p(t,i);return r`
87    <details
88      id=${n}
89      class="group/filter-dropdown js-filter border-b border-b-border-02 py-accordion-paddingvertical lg:px-sm"
90      data-fhr-facet-id=${t.id}
91      data-fhr-facet-type="range"
92      ?open=${s}
93    >
94      <summary class="focus-inset flow-root">
95        <div
96          class="flex w-full items-center justify-between body-sm font-normal"
97        >
98          <span class="fhr-facet__title">${t.name}</span>
99          <span class="ml-6 flex items-center">
100            <span class="inline-flex" aria-hidden="true">
101              <svg-icon
102                src="icon-plus"
103                class="group-open/filter-dropdown:hidden"
104                focusable="false"
105              ></svg-icon>
106              <svg-icon
107                src="icon-minus"
108                class="hidden group-open/filter-dropdown:inline-flex"
109                focusable="false"
110              ></svg-icon>
111            </span>
112          </span>
113        </div>
114      </summary>
115      <div class="px-2xs pt-xs pb-sm">
116        <fredhopper-price-slider
117          facet-id=${t.id}
118          .min=${t.min}
119          .max=${t.max}
120          .valueMin=${c.min}
121          .valueMax=${c.max}
122          min-id=${o}
123          max-id=${l}
124          min-name="${t.id}_min"
125          max-name="${t.id}_max"
126          min-label=${m(t.id,t.min)}
127          max-label=${m(t.id,t.max)}
128          min-placeholder=${a.minPlaceholder}
129          max-placeholder=${a.maxPlaceholder}
130          to-label=${a.toLabel}
131          min-aria=${a.minAria}
132          max-aria=${a.maxAria}
133        ></fredhopper-price-slider>
134      </div>
135    </details>
136  `}
136(t,e,i,s,n):function(t,e,i,s,n){if(!W(t,i))return a;const o=function(t,e){return!!e.facetIds.includes(t.id)&&t.values.some(t=>Z(t,e.colors))}(t,n),l=`Details-${e}-${t.id}`;return r`
137    <details
138      id=${l}
139      class="group/filter-dropdown js-filter border-b border-b-border-02 py-accordion-paddingvertical lg:px-sm"
140      data-fhr-facet-id=${t.id}
141      ?open=${s}
142    >
143      <summary class="focus-inset flow-root">
144        <div
145          class="flex w-full items-center justify-between body-sm font-normal"
146        >
147          <span class="fhr-facet__title">${t.name}</span>
148          <span class="ml-6 flex items-center">
149            <span class="inline-flex" aria-hidden="true">
150              <svg-icon
151                src="icon-plus"
152                class="group-open/filter-dropdown:hidden"
153                focusable="false"
154              ></svg-icon>
155              <svg-icon
156                src="icon-minus"
157                class="hidden group-open/filter-dropdown:inline-flex"
158                focusable="false"
159              ></svg-icon>
160            </span>
161          </span>
162        </div>
163      </summary>
164      <div class="my-sm py-2xs">
165        <ul class="list-unstyled space-y-forms-gapvertical" role="list">
166          ${t.values.map((s,l)=>o?function(t,e,i,s,n,o){var l;const c=`Filter-${i}-${t.id}-${s+1}`,d=void 0!==e.count&&e.count<=0||void 0,h=(null==(l=n[t.id])?void 0:l.includes(e.value))??!1,u=Z(e,o),p=void 0!==e.count?`${e.label} (${e.count})`:e.label;return r`
167    <li>
168      <label
169        class="group/fhr-swatch flex cursor-pointer items-center gap-xs"
170        for=${c}
171      >
172        <input
173          type="checkbox"
174          class="peer sr-only"
175          id=${c}
176          name=${t.id}
177          value=${e.value}
178          data-fhr-facet-input
179          .checked=${h}
180          ?disabled=${d}
181        />
182        <span
183          class="fhr-facet-swatch relative block size-6 shrink-0 rounded-colorswatch-radius bg-cover bg-center peer-checked:[outline:1px_solid_var(--color-foreground)] peer-checked:outline-offset-2 peer-disabled:opacity-40 before:absolute before:inset-0 before:rounded-colorswatch-radius before:border before:border-(--color-overlay) before:content-['']"
184          style=${u?`background:${u};`:a}
185          aria-hidden="true"
186        ></span>
187        <span
188          class="fhr-facet__option peer-disabled:text-border mt-px text-foreground select-none"
189          >${p}</span
190        >
191      </label>
192    </li>
193  `}(t,s,e,l,i,n.colors):function(t,e,i,s,a){var n;const o=`Filter-${i}-${t.id}-${s+1}`,l=void 0!==e.count&&e.count<=0||void 0,c=(null==(n=a[t.id])?void 0:n.includes(e.value))??!1,d=void 0!==e.count?r`<span>${e.label} (${e.count})</span>`:r`<span>${e.label}</span>`;return r`
194    <li>
195      <div class="group/checkbox flex items-center justify-start gap-x-xs">
196        <label
197          class="relative flex size-6 shrink-0 cursor-pointer items-center"
198          for=${o}
199        >
200          <input
201            type="checkbox"
202            class="peer size-6 cursor-pointer appearance-none border border-border-02 bg-background transition-all checked:border-foreground checked:bg-foreground disabled:cursor-not-allowed disabled:border-border-01"
203            id=${o}
204            name=${t.id}
205            value=${e.value}
206            data-fhr-facet-input
207            aria-labelledby="${o}_label"
208            .checked=${c}
209            ?disabled=${l}
210          />
211          <span
212            class="peer-disabled:text-border pointer-events-none absolute inset-0 flex items-center justify-center text-background opacity-0 transition-opacity peer-checked:opacity-100"
213          >
214            <svg-icon
215              src="icon-checkmark"
216              style="--icon-size: 16px;"
217              class="block shrink-0"
218            ></svg-icon>
219          </span>
220        </label>
221        <label
222          class="group-has-[:disabled]/checkbox:text-border mt-px cursor-pointer text-foreground select-none"
223          for=${o}
224        >
225          <p
226            id="${o}_label"
227            class="fhr-facet__option group-has-[:disabled]/checkbox:text-border block text-foreground"
228          >
229            ${d}
230          </p>
231        </label>
232      </div>
233    </li>
234  `}(t,s,e,l,i))}
235        </ul>
236      </div>
237    </details>
238  `}(t,e,i,s,o)}(t,e,o,i===l&&"aside"===e,s,n))}`}(this.facets,this.context,this.activeFilters,this.rangeLabels,this.swatchConfig):a,this,{host:this}),this.syncInProgress=!1}emitFiltersChange(){this.dispatchEvent(new CustomEvent(et,{bubbles:!0,composed:!0,detail:{filters:this.collectFilters(),context:this.context}}))}render(){return r``}};tt([e({type:String})],it.prototype,"context",2),tt([e({attribute:!1})],it.prototype,"facets",2),tt([e({attribute:!1})],it.prototype,"activeFilters",2),tt([e({attribute:!1})],it.prototype,"rangeLabels",2),tt([e({attribute:!1})],it.prototype,"swatchConfig",2),tt([e({type:String})],it.prototype,"phase",2),tt([e({type:Boolean})],it.prototype,"disabled",2),tt([n()],it.prototype,"syncInProgress",2),it=tt([s("fredhopper-facets")],it);const st=(t,e)=>{const i=Number.parseInt(t??"",10);return Number.isFinite(i)?i:e};function rt(t,e,i){const s=t=>"desktop"===i?t.desktopPos:t.mobilePos,r=e.map((t,e)=>({block:t,listOrder:e,pos:s(t)})).filter(t=>{return e=t.block,("desktop"===i?"mobile"!==e.visibility:"desktop"!==e.visibility)&&Number.isFinite(t.pos)&&t.pos>=1;var e}).sort((t,e)=>t.pos-e.pos||t.listOrder-e.listOrder),a=new Map;let n=1,o=0;for(let l=0;l<t;l+=1){for(;o<r.length&&r[o].pos<=n;
238)a.set(r[o].block,l),o+=1,n+=1;n+=1}return a}function at(t,e){if(0===e.length)return Array.from({length:t},(t,e)=>({kind:"product",index:e}));const i=rt(t,e,"desktop"),s=rt(t,e,"mobile"),r=new Map,a=(t,e,i)=>{const s=r.get(t)??[];s.push({block:e,copy:i}),r.set(t,s)};for(const o of e){const t=i.get(o),e=s.get(o),r="mobile"!==o.visibility,n="desktop"!==o.visibility;r&&n&&null!=t&&t===e?a(t,o,"both"):(r&&null!=t&&a(t,o,"desktop"),n&&null!=e&&a(e,o,"mobile"))}const n=[];for(let o=0;o<t;o+=1){for(const t of r.get(o)??[])n.push({kind:"block",block:t.block,copy:t.copy});n.push({kind:"product",index:o})}return n}function nt(t,e){if("both"===e)return t;const i="desktop"===e?"max-lg:hidden":"lg:hidden";return t.replace(/class=(["'])(.*?)\1/,(t,e,s)=>`class=${e}${s} ${i}${e}`)}var ot=Object.defineProperty,lt=(t,e,i,s)=>{for(var r,a=void 0,n=t.length-1;n>=0;n--)(r=t[n])&&(a=r(e,i,a)||a);return a&&ot(e,i,a),a};const ct={rootMargin:"800px 0px",threshold:0};class dt extends t{constructor(){super(...arguments),this.limit=I,this.sectionId="",this.mobileColumns="2",this.defaultSort="",this.localeFromApp=!0,this.enforcedFilter="",this.loadingMore=!1,this.loadMoreError=!1,this.items=[],this.facets=[],this.facetCatalog=[],this.info=null,this.page=1,this.settled=!1,this.usingFallback=!1,this.cardElementReady=!1,this.inlineBlocks=[],this.fallbackUl=null,this.fallbackObserver=null,this.fallbackInjecting=!1,this.fallbackCardObserver=null,this.inFlight=!1,this.loadGeneration=0,this.checkScrollDepthOnLoad=!1,this.loadTimer=null,this.initialized=!1,this.lastInput="",this.landingPage=C(),this.labels={},this.swatchConfig=J,this.sortSyncInProgress=!1,this.hydratedKeys=new Set,this.cardObserver=null,this.ssrCountText=null,this.boundPopState=()=>{this.usingFallback||this.shouldReloadOnPopState()&&this.loadInitial()},this.boundLoadMore=t=>{t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||0!==t.button||(t.preventDefault(),this.loadMore())},this.boundFiltersChange=t=>{if(this.usingFallback)return;if(!(t instanceof CustomEvent))return;const e=t.detail;this.applyFilters(e.filters)},this.boundActiveFilterClick=t=>{if(this.usingFallback)return;const e=t.target;if(!(e instanceof Element))return;if(e.closest("[data-fhr-clear-filters]")){const t=L(this.enforcedFilter);if(!f(t))return;return void this.applyFilters({})}const i=e.closest("[data-fhr-active-filter]");if(!(i instanceof HTMLElement))return;const s=i.getAttribute("data-fhr-facet-id");if(!s)return;const r=i.getAttribute("data-fhr-facet-value")||void 0,a=L(this.enforcedFilter);this.applyFilters(b(a,{facetId:s,value:r}))},this.boundActiveFilterFocus=t=>{const e=t.target;if(!(e instanceof Element))return;const i=e.closest("[data-fhr-active-filter]");i instanceof HTMLElement&&i.scrollIntoView({block:"nearest",inline:"nearest"})},this.boundSortChange=t=>{if(this.usingFallback||this.sortSyncInProgress)return;const e=t.currentTarget;let i="";if(e instanceof HTMLSelectElement)i=e.value;else{if(!(e instanceof HTMLElement&&e.matches("elc-select[data-fhr-sort]")))return;i=e.value}this.applySortChange(i,e)},this.itemsInlineActive=!1}buildQueryArgs(t){return A({mode:this.queryMode,input:this.queryInput,page:t,limit:this.limit,defaultSort:this.defaultSort,enforcedFilter:this.enforcedFilter,localeFromApp:this.localeFromApp,facets:this.facets})}shouldReloadOnPopState(){return!0}scrubEnforcedFromUrl(){const t=P(this.enforcedFilter);if(0===Object.keys(t).length)return;const{page:e,sort:i,filters:s}=$();Object.keys(s).some(e=>e in t)&&F({page:e,sort:i,filters:g(s,t)},{replace:!0})}createRenderRoot(){return document.createElement("div")}connectedCallback(){super.connectedCallback(),this.loadLabels(),this.loadSwatchConfig(),S(),this.awaitCardElement(),window.addEventListener("popstate",this.boundPopState)}awaitCardElement(){"undefined"!=typeof customElements&&(customElements.get("dynamic-product-card")?this.cardElementReady=!0:customElements.whenDefined("dynamic-product-card").then(()=>{this.cardElementReady=!0}))}disconnectedCallback(){var t,e;window.removeEventListener("popstate",this.boundPopState),null==(t=this.el("[data-fhr-load-more]"))||t.removeEventListener("click",this.boundLoadMore),this.unwireSortControls(),this.unwireFacetControls(),this.clearLoadTimer(),this.teardownF
238allbackInGrid(),null==(e=this.cardObserver)||e.disconnect(),this.cardObserver=null,super.disconnectedCallback()}getSortControls(){return Array.from(this.querySelectorAll("elc-select[data-fhr-sort]"))}setSortControlValue(t,e){const i=t.querySelector("select");"value"in t&&t.value!==e&&(t.value=e),i&&i.value!==e&&(i.value=e)}wireSortControls(){this.getSortControls().forEach(t=>{var e;t.addEventListener("change",this.boundSortChange),null==(e=t.querySelector("select"))||e.addEventListener("change",this.boundSortChange)})}unwireSortControls(){this.getSortControls().forEach(t=>{var e;t.removeEventListener("change",this.boundSortChange),null==(e=t.querySelector("select"))||e.removeEventListener("change",this.boundSortChange)})}wireFacetControls(){this.addEventListener(et,this.boundFiltersChange),this.addEventListener("click",this.boundActiveFilterClick),this.addEventListener("focusin",this.boundActiveFilterFocus)}unwireFacetControls(){this.removeEventListener(et,this.boundFiltersChange),this.removeEventListener("click",this.boundActiveFilterClick),this.removeEventListener("focusin",this.boundActiveFilterFocus)}firstUpdated(t){var e;super.firstUpdated(t),this.lastInput=this.queryInput,this.initialized=!0,this.inlineBlocks=function(t){const e=Array.from(t.querySelectorAll("template[data-fhr-ingrid]")),i=[];for(const s of e){const t=s.innerHTML.trim();if(t){const e=st(s.dataset.position,0);i.push({html:t,desktopPos:e,mobilePos:st(s.dataset.mobilePosition,e),visibility:s.dataset.visibility||"both",listOrder:i.length})}s.remove()}return i}(this),null==(e=this.el("[data-fhr-load-more]"))||e.addEventListener("click",this.boundLoadMore),this.initSortControls(),this.wireFacetControls(),this.beginLoad()}async initSortControls(){await customElements.whenDefined("elc-select"),this.wireSortControls(),this.syncSortControls()}updated(t){super.updated(t),this.initialized&&this.queryInput!==this.lastInput&&(this.lastInput=this.queryInput,this.facetCatalog=[],this.resetPaging(),F({page:1},{replace:!0}),this.beginLoad()),this.syncDom()}beginLoad(){this.settled=!1,this.usingFallback=!1,this.loadMoreError=!1,this.queryInput&&this.startLoadTimer(),this.loadInitial()}loadLabels(){const t=document.getElementById(`fhr-grid-labels-${this.sectionId}`);if(null==t?void 0:t.textContent)try{this.labels=JSON.parse(t.textContent)}catch{}}loadSwatchConfig(){const t=document.getElementById(`fhr-color-swatches-${this.sectionId}`);if(null==t?void 0:t.textContent)try{const e=JSON.parse(t.textContent);this.swatchConfig={colors:e.colors&&"object"==typeof e.colors?e.colors:{},facetIds:Array.isArray(e.facetIds)?e.facetIds:[]}}catch{}}applySortChange(t,e){this.sortSyncInProgress=!0,this.getSortControls().forEach(i=>{i!==e&&(e instanceof HTMLSelectElement&&i.contains(e)||this.setSortControlValue(i,t))}),this.sortSyncInProgress=!1;const i=t&&t!==this.defaultSort?t:"";this.resetPaging(),F({page:1,sort:i},{replace:!1}),this.beginLoad()}applyFilters(t){this.checkScrollDepthOnLoad=!0,this.resetPaging();const e=g(t,P(this.enforcedFilter));F({page:1,filters:e},{replace:!1}),this.querySelectorAll("fredhopper-facets").forEach(t=>{t.cancelPendingFilterEmit()}),this.syncFacetPanels(this.phase),this.syncActiveFilters(this.phase),this.beginLoad()}resetPaging(){this.page=1,this.landingPage=1}syncSortControls(){const t=O(this.defaultSort);this.sortSyncInProgress=!0,this.getSortControls().forEach(e=>{this.setSortControlValue(e,t)}),this.sortSyncInProgress=!1}t(t,e){let i=this.labels[t]??t;if(e)for(const[s,r]of Object.entries(e))i=i.replace(new RegExp(`\\{${s}\\}`,"g"),String(r));return i}async loadInitial(){var t;const e=++this.loadGeneration;this.scrubEnforcedFromUrl(),null==(t=this.cardObserver)||t.disconnect();const{page:i}=$(),s=w(Math.max(i,this.landingPage));this.syncSortControls(),this.page=1,await this.fetchResults({append:!1,generation:e});for(let r=2;r<=s&&this.hasUnloadedResults&&!this.usingFallback&&e===this.loadGeneration;r++)this.page=r,await this.fetchResults({append:!0,generation:e});e===this.loadGeneration&&(this.checkScrollDepthOnLoad?(this.checkScrollDepthOnLoad=!1,this.correctScrollDepth()):this.restoreScroll())}async correctScrollDepth(){await this.updateComplete;const t=this.querySelectorAll("#product-grid > *"),e=t[t.length-1];e instanceof HTMLElement&&(e.getBoundingClientRect().bottom>=window.innerHeight||e.scrollIntoView({block:"end",behavior:"auto"}))}get hasUnloadedResults(){var t;const e=null==(t=this.info)?void 0:t.totalResults;return null==e||this.items.length<e}async fetchResults({append:t,generation:e=this.loadGeneration}){var i;if(!this.queryInput)return this.items=[],void(this.info=null);if(!t||!this.inFlight){this.inFlight=!0,t&&(this.loadingMore=!0,this.loadMoreError=!1);try{const s=await D(this.buildQueryArgs(this.page));if(!s.items.length&&!s.redirectUrl&&s.info.totalResults>0)throw new Error("No items in FHR response");if(e!==this.loadGeneration)return;if(this.usingFallback)return;if(s.redirectUrl)return void this.clearLoadTimer();if(this.info=s.info,t||null==(i=this.cardObserver)||i.disconnect(),this.items=t?this.dedupe([...this.items,...s.items]):this.dedupe(s.items),!t){this.itemsInlineActive=this.inl
238ineContentActive;const t=new Set(this.items.map(t=>this.itemKey(t)));for(const e of this.hydratedKeys)t.has(e)||this.hydratedKeys.delete(e);this.settleReady(),this.facets=s.facets,this.facetCatalog=y(this.facetCatalog,s.facets)}}catch{if(e!==this.loadGeneration)return;t?(this.page=Math.max(1,this.page-1),this.loadMoreError=!0):this.settled||this.fallToSsr()}finally{e===this.loadGeneration&&(this.loadingMore=!1,this.inFlight=!1)}}}settleReady(){this.settled=!0,this.cardElementReady&&this.clearLoadTimer()}fallToSsr(){this.settled=!0,this.usingFallback=!0,this.clearLoadTimer(),document.dispatchEvent(new CustomEvent("fhr:fallback",{detail:{sectionId:this.sectionId}}))}startLoadTimer(){this.clearLoadTimer(),this.loadTimer=setTimeout(()=>{this.phase===z.Loading&&this.fallToSsr()},6e3)}clearLoadTimer(){null!=this.loadTimer&&(clearTimeout(this.loadTimer),this.loadTimer=null)}dedupe(t){const e=new Set,i=[];for(const s of t){const t=s.variantId??s.handle??JSON.stringify(s.raw);e.has(t)||(e.add(t),i.push(s))}return i}async loadMore(){this.loadingMore||this.inFlight||(this.page+=1,await this.fetchResults({append:!0}),this.loadMoreError||F({page:this.page},{replace:!1}),this.manageFocusAfterLoadMore())}manageFocusAfterLoadMore(){requestAnimationFrame(()=>{var t;const e=this.querySelector("[data-fhr-load-more]");!e||e.hidden?null==(t=this.querySelector("[data-fhr-end]"))||t.focus({preventScroll:!0}):e.focus({preventScroll:!0})})}restoreScroll(){const t=E();null!=t&&requestAnimationFrame(()=>window.scrollTo(0,t))}get phase(){return this.queryInput?this.usingFallback?z.Fallback:this.settled?0===this.items.length?z.Empty:this.cardElementReady?z.Ready:z.Loading:z.Loading:z.Idle}el(t){return this.querySelector(t)}toggle(t,e){const i=this.el(t);i&&(i.hidden=!e)}toggleEmpty(t){this.toggle("[data-fhr-empty]",t)}syncHeading(){}toggleAll(t,e){this.querySelectorAll(t).forEach(t=>{t.hidden=!e})}syncPhase(){}syncDom(){const t=this.phase;this.syncPhase();const e=t===z.Ready,i=t===z.Empty,s=t===z.Fallback,r=t===z.Loading,n=!this.settled&&this.items.length>0,l=e||n;this.toggle("[data-fhr-skeleton]",r&&!n),this.toggleAll("[data-fhr-ssr-fallback]",s),s&&this.ensureFallbackInGrid(),this.toggle("[data-fhr-topbar]",t!==z.Idle),this.toggle("[data-fhr-aside]",r||e||s),this.toggle("[data-fhr-banner]",r||e||s&&this.hasFallbackCards),this.toggle("#product-grid",l),this.toggle("[data-fhr-footer]",l),this.toggleEmpty(i),this.syncHeading();const c=this.el("#product-grid");c&&(c.setAttribute("aria-busy",this.loadingMore||n?"true":"false"),o(l?this.renderGridChildren():a,c,{host:this}),e&&this.observeCards());const d=e||i||n,h=this.el("[data-fhr-count]");h&&null===this.ssrCountText&&(this.ssrCountText=h.textContent),this.toggle("[data-fhr-count]",d||s),this.toggle("[data-fhr-count-skeleton]",r&&!n);let u="";if(h&&d){const e=this.displayTotal(t,n),i=1===e?"productCountOne":"productCountOther";u=this.t(i,{count:e}),h.textContent=u}else h&&s&&null!==this.ssrCountText&&(u=this.ssrCountText,h.textContent=u);const p=this.el("[data-fhr-status]"),m=r?this.t("loading"):u;p&&p.textContent!==m&&(p.textContent=m),e&&this.syncFooter(),this.syncFacetPanels(t),this.syncActiveFilters(t),this.syncViewResultsButton(t),this.syncColorFilter()}syncColorFilter(){const t=N(this.enforcedFilter),e=R(t,this.resolveDisplayFacets(t),this.swatchConfig.facetIds),i=T(e);this.getAttribute(q)!==i&&(this.setAttribute(q,i),document.dispatchEvent(new CustomEvent(j,{detail:{sectionId:this.sectionId,labels:i}})))}displayTotal(t,e=!1){var i;return t===z.Ready||e?(null==(i=this.info)?void 0:i.totalResults)??this.items.length:this.items.length}syncViewResultsButton(t){this.usingFallback||(t===z.Ready||t===z.Loading||t===z.Empty)&&this.querySelectorAll("[data-fhr-view-results]").forEach(e=>{if(!(e instanceof HTMLButtonElement))return;if(t===z.Loading)return e.textContent=this.t("viewResultsLoading"),void e.setAttribute("aria-busy","true");const i=this.displayTotal(t);e.textContent=this.t("viewResultsCount",{count:i}),e.removeAttribute("aria-busy")})}syncActiveFilters(t){const e=this.el("[data-fhr-active-filters]");if(!e)return;const i=!this.usingFallback&&(t===z.Ready||t===z.Loading||t===z.Empty),s=L(this.enforcedFilter),n=i?v(s,this.resolveDisplayFacets(s)):[];e.hidden=0===n.length,o(n.length>0?function(t,e){return 0===t.length?a:r`
239    ${t.map(t=>function(t,e){return r`
240    <button
241      type="button"
242      class="inline-flex shrink-0 snap-start scroll-mx-3xs items-center gap-2xs border border-border-01 px-xs py-3xs body-sm font-normal uppercase"
243      data-fhr-active-filter
244      data-fhr-facet-id=${t.facetId}
245      data-fhr-facet-value=${t.value??""}
246      aria-label=${e}
247    >
248      <span>${t.label}</span>
249      <svg-icon
250        src="icon-close"
251        class="shrink-0 icon-sm"
252        aria-hidden="true"
253        focusable="false"
254      ></svg-icon>
255    </button>
256  `}(t,e.removeLabel(t)))}
257    <button
258      type="button"
259      class="btn hidden shrink-0 lg:block"
260      variant="tertiary"
261      data-fhr-clear-filters
262    >
263      ${e.clearAll}
264    </button>
265  `}(n,{clearAll:this.t("clearAll"),removeLabel:t=>this.t("removeFilter",{filter:t.label})}):a,e,{host:this}),this.syncDrawerClearButtons(n.length>0)}syncDrawerClearButtons(t){const e=new Set;this.querySelectorAll("[data-fhr-clear-filters]").forEach(i=>{if(i.closest("[data-fhr-active-filters]"))return;i.hidden=!t,i.disabled=!t;const s=i.closest("[data-fhr-drawer-footer]");s instanceof HTMLElement&&e.add(s)}),e.forEach(e=>{e.toggleAttribute("data-fhr-drawer-footer-clear-visible",t)})}syncFooter(){var t,e;const i=this.items.length,s=(null==(t=this.info)?void 0:t.totalResults)??i,r=(null==(e=this.info)?void 0:e.pageSize)??s,a=s>0&&i<s,n=this.el("[data-fhr-showing]");n&&(n.textContent=this.t("showingCount",{shown:i,total:s}));const o=this.el("[data-fhr-error]");o&&(o.hidden=!this.loadMoreError);const l=this.el("[data-fhr-load-more]");l&&(l.hidden=!a,l.setAttribute("aria-busy",this.loadingMore?"true":"false"),l.setAttribute("aria-disabled",this.loadingMore?"true":"false"),l.textContent=this.loadingMore?this.t("loading"):this.t("loadMore"));const c=this.el("[data-fhr-end]");c&&(c.hidden=a||s<=r)}resolveDisplayFacets(t=$().filters){return x(this.facets,t,this.facetCatalog)}syncFacetPanels(t){const e=L(this.enforcedFilter),i=k(this.resolveDisplayFacets(e),P(this.enforcedFilter)),s={minPlaceholder:this.t("rangeMinPlaceholder"),maxPlaceholder:this.t("rangeMaxPlaceholder"),toLabel:this.t("rangeTo"),minAria:this.t("rangeMinAria"),maxAria:this.t("rangeMaxAri
265a")};this.querySelectorAll("fredhopper-facets").forEach(r=>{r.activeFilters=e,r.facets=i,r.rangeLabels=s,r.swatchConfig=this.swatchConfig,r.phase=t,r.disabled=this.usingFallback})}get inlineContentActive(){if(0===this.inlineBlocks.length)return!1;const{sort:t,filters:e}=$();return!t&&!f(e)}itemKey(t){return t.variantId??t.handle??JSON.stringify(t.raw)}renderGridChildren(){if(!this.itemsInlineActive)return l(this.items,t=>`product:${this.itemKey(t)}`,(t,e)=>this.renderProduct(t,e));const t=at(this.items.length,this.inlineBlocks);return l(t,t=>{return"product"===t.kind?`product:${this.itemKey(this.items[t.index])}`:(e=t.block,i=t.copy,`ingrid:${e.listOrder}:${i}`);var e,i},t=>"product"===t.kind?this.renderProduct(this.items[t.index],t.index):r`${c(nt(t.block.html,t.copy))}`)}setupCardObserver(){this.cardObserver||"undefined"==typeof IntersectionObserver||(this.cardObserver=new IntersectionObserver(t=>{var e;let i=!1;for(const s of t){if(!s.isIntersecting)continue;const t=s.target;null==(e=this.cardObserver)||e.unobserve(t);const r=t.dataset.cardKey;r&&!this.hydratedKeys.has(r)&&(this.hydratedKeys.add(r),i=!0)}i&&this.requestUpdate()},ct))}observeCards(){const t=this.el("#product-grid");t&&(this.setupCardObserver(),this.cardObserver&&t.querySelectorAll(":scope > li[data-card-key]").forEach(t=>{var e;(null==(e=t.querySelector("dynamic-product-card"))?void 0:e.getAttribute("handle"))||this.cardObserver.observe(t)}))}get hasFallbackCards(){const t=this.el('[data-fhr-ssr-fallback] [sub-section-id="product-grid-container"] ul');return!!t&&t.children.length>0}ensureFallbackInGrid(){if(this.fallbackObserver)return;const t=this.el('[data-fhr-ssr-fallback] [sub-section-id="product-grid-container"] ul');t&&(this.fallbackUl=t,this.inlineContentActive&&this.injectFallbackInGrid(),this.observeFallbackCards(),this.fallbackObserver=new MutationObserver(()=>{this.inlineContentActive&&this.injectFallbackInGrid(),this.observeFallbackCards()}),this.fallbackObserver.observe(t,{childList:!0}))}observeFallbackCards(){const t=this.fallbackUl;t&&"undefined"!=typeof IntersectionObserver&&(this.fallbackCardObserver??(this.fallbackCardObserver=new IntersectionObserver(t=>{var e;for(const i of t){if(!i.isIntersecting)continue;null==(e=this.fallbackCardObserver)||e.unobserve(i.target);const t=i.target.querySelector("dynamic-product-card[data-handle]:not([handle])"),s=null==t?void 0:t.dataset.handle;t&&s&&t.setAttribute("handle",s)}},ct)),t.querySelectorAll("dynamic-product-card[data-handle]:not([handle])").forEach(t=>this.fallbackCardObserver.observe(t.closest("li")??t)))}injectFallbackInGrid(){var t,e;const i=this.fallbackUl;if(!i||this.fallbackInjecting)return;this.fallbackInjecting=!0,null==(t=this.fallbackObserver)||t.disconnect(),i.querySelectorAll(":scope > li[data-ingrid]").forEach(t=>t.remove());const s=Array.from(i.querySelectorAll(":scope > li:not([data-ingrid])")),r=at(s.length,this.inlineBlocks);let a=[];for(const n of r)if("product"===n.kind){const t=s[n.index];for(const e of a)i.insertBefore(e,t);a=[]}else{const t=this.blockToElement(n.block,n.copy);t&&a.push(t)}for(const n of a)i.appendChild(n);null==(e=this.fallbackObserver)||e.observe(i,{childList:!0}),this.fallbackInjecting=!1}blockToElement(t,e){const i=document.createElement("template");i.innerHTML=nt(t.html,e);const s=i.content.querySelector("li");return s?document.importNode(s,!0):null}teardownFallbackInGrid(){var t,e;null==(t=this.fallbackObserver)||t.disconnect(),this.fallbackObserver=null,null==(e=this.fallbackCardObserver)||e.disconnect(),this.fallbackCardObserver=null,this.fallbackUl=null}renderProduct(t,e){const i=this.itemKey(t),s=e<9,n=s||this.hydratedKeys.has(i),o=n?t.handle??"":"",l=n?t.variantId??"":"",c=n&&"search"===this.queryMode?t.sku??"":"",d=n&&"search"===this.queryMode?this.queryInput:"";return r`<li class="${"product-grid-card relative row-span-6 mb-productcard-gridgap grid w-full min-w-0 grid-rows-subgrid items-stretch overflow-hidden"}" data-card-key=${i}>
266      <dynamic-product-card
267        image=${t.image??""}
268        title=${t.title??""}
269        price=${t.price??a}
270        compare-at-price=${t.compareAtPrice??a}
271        vat-callout=${this.labels.vatCallout||a}
272        handle=${o}
273        variant-id=${l}
274        matched-sku=${c}
275        matched-query=${d}
276        unknown-label=${this.t("unknownProduct")}
277        apply-unique-id="true"
278        force-eager-image=${s?"true":"false"}
279        template="product-card-plp"
280        title-tag="h2"
281      ></dynamic-product-card>
282    </li>`}render(){return r``}}lt([e({type:Number})],dt.prototype,"limit"),lt([e({type:String,attribute:"section-id"})],dt.prototype,"sectionId"),lt([e({type:String,attribute:"mobile-columns"})],dt.prototype,"mobileColumns"),lt([e({type:String,attribute:"default-sort"})],dt.prototype,"defaultSort"),lt([e({type:Boolean,attribute:"locale-from-app",converter:t=>M(t)})],dt.prototype,"localeFromApp"),lt([e({type:String,attribute:"data-enforced-filter"})],dt.prototype,"enforcedFilter"),lt([n()],dt.prototype,"loadingMore"),lt([n()],dt.prototype,"loadMoreError"),lt([n()],dt.prototype,"items"),lt([n()],dt.prototype,"facets"),lt([n()],dt.prototype,"info"),lt([n()],dt.prototype,"page"),lt([n()],dt.prototype,"settled"),lt([n()],dt.prototype,"usingFallback"),lt([n()],dt.prototype,"cardElementReady"),lt([n()],dt.prototype,"inlineBlocks");export{dt as F,z as a};

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.