1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["listing.plugin"],{7937:(e,t,s)=>{s.d(t,{Z:()=>n});var i=s(3266),r=s(4049);let a=Object.freeze(new class{replaceFromMarkup(e,t){let s=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=e;"string"==typeof i&&(i=this._createMarkupFromString(i)),"string"==typeof t&&(t=[t]),this._replaceSelectors(i,t,s)}replaceElement(e,t){let s=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return("string"==typeof e&&(e=r.Z.querySelectorAll(document,e,s)),"string"==typeof t&&(t=r.Z.querySelectorAll(document,t,s)),e instanceof NodeList&&t instanceof NodeList&&t.length>e.length)?(i.Z.iterate(t,t=>{i.Z.iterate(e,e=>{e.innerHTML&&e.className===t.className&&(t.innerHTML=e.innerHTML)})}),!0):e instanceof NodeList?(i.Z.iterate(e,(e,s)=>{e.innerHTML&&(t[s].innerHTML=e.innerHTML)}),!0):t instanceof NodeList?(i.Z.iterate(t,t=>{e.innerHTML&&(t.innerHTML=e.innerHTML)}),!0):!!t&&!!e&&!!e.innerHTML&&(t.innerHTML=e.innerHTML,!0)}_replaceSelectors(e,t,s){i.Z.iterate(t,t=>{let i=r.Z.querySelectorAll(e,t,s),a=r.Z.querySelectorAll(document,t,s);this.replaceElement(i,a,s)})}_createMarkupFromString(e){return this._domParser.parseFromString(e,"text/html")}constructor(){this._domParser=new DOMParser}});class n{static replaceFromMarkup(e,t,s){a.replaceFromMarkup(e,t,s)}static replaceElement(e,t,s){return a.replaceElement(e,t,s)}}},5554:(e,t,s)=>{s.r(t),s.d(t,{default:()=>m});var i=s(9568),r=s(3107),a=s(3266),n=s(4049),l=s(2940),o=s(7937),c=s(615),h=s(1857),p=s.n(h);let d=Object.freeze(new class{getLocation(){return this._history.location}listen(e){return this._history.listen(e)}unlisten(e){e()}push(e,t,s){this._history.push({pathname:e,search:t,state:s})}replace(e,t,s){this._history.replace({pathname:e,search:t,state:s})}pushParams(e,t){let s=this.getLocation().pathname,i=l.parse(location.search),r=l.stringify(p()(i,e));this.push(s,r,t)}replaceParams(e,t){let s=this.getLocation().pathname,i=l.parse(location.search),r=l.stringify(p()(i,e));this.replace(s,r,t)}getSearch(){return this._history.location.search}constructor(){this._history=(0,c.lX)()}});class u{static getLocation(){return d.getLocation()}static listen(e){d.listen(e)}static unlisten(e){d.unlisten(e)}static push(e,t,s){d.push(e,t,s)}static replace(e,t){d.replace(e,t)}static pushParams(e,t){d.pushParams(e,t)}static replaceParams(e,t){d.replaceParams(e,t)}static getSearch(){return d.getSearch()}}var g=s(9610);class m extends i.Z{init(){this._registry=[],this.httpClient=new r.Z,this._urlFilterParams=l.parse(u.getSearch()),this._filterPanel=n.Z.querySelector(document,this.options.filterPanelSelector,!1),this._filterPanelActive=!!this._filterPanel,this._filterPanelActive&&(this._showResetAll=!1,this.activeFilterContainer=n.Z.querySelector(document,this.options.activeFilterContainerSelector),this.ariaLiveContainer=n.Z.querySelector(document,this.options.ariaLiveSelector,!1)),this._cmsProductListingWrapper=n.Z.querySelector(document,this.options.cmsProductListingWrapperSelector,!1),this._cmsProductListingWrapperActive=!!this._cmsProductListingWrapper,this._allFiltersInitializedDebounce=g.Z.debounce(this.sendDisabledFiltersRequest.bind(this),100),this._registerEvents()}refreshRegistry(){let e=this._registry.filter(e=>document.body.contains(e.el));this.init(),this._registry=e,window.PluginManager.initializePlugins()}changeListing(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._buildRequest(e,t),this._filterPanelActive&&this._buildLabels()}registerFilter(e){this._registry.push(e),this._setFilterState(e),this.options.disableEmptyFilter&&this._allFiltersInitializedDebounce()}_setFilterState(e){Object.keys(this._urlFilterParams).length>0&&"function"==typeof e.setValuesFromUrl&&e.setValuesFromUrl(this._urlFilterParams)&&this._filterPanelActive&&(this._showResetAll=!0,this._buildLabels())}deregisterFilter(e){this._registry=this._registry.filter(t=>t!==e)}_fetchValuesOfRegisteredFilters(){let e={};return this._registry.forEach(t=>{let s=t.getValues();
1Object.keys(s).forEach(t=>{Object.prototype.hasOwnProperty.call(e,t)?Object.values(s[t]).forEach(s=>{e[t].push(s)}):e[t]=s[t]})}),e}_mapFilters(e){let t={};return Object.keys(e).forEach(s=>{let i=e[s];Array.isArray(i)&&(i=i.join("|")),"".concat(i).length&&(t[s]=i)}),t}_buildRequest(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this._fetchValuesOfRegisteredFilters(),i=this._mapFilters(s);this._filterPanelActive&&(this._showResetAll=!!Object.keys(i).length),this.options.params&&Object.keys(this.options.params).forEach(e=>{i[e]=this.options.params[e]}),Object.entries(t).forEach(e=>{let[t,s]=e;i[t]=s});let r=l.stringify(i);this.sendDataRequest(r),delete i.slots,delete i["no-aggregations"],delete i["reduce-aggregations"],delete i["only-aggregations"],r=l.stringify(i),e&&this._updateHistory(r),this.options.scrollTopListingWrapper&&this._scrollTopOfListing()}_scrollTopOfListing(){let e=this._cmsProductListingWrapper.getBoundingClientRect();if(e.top>=0)return;let t=e.top+window.scrollY-this.options.scrollOffset;window.scrollTo({top:t,behavior:"smooth"})}_getDisabledFiltersParamsFromParams(e){let t=Object.assign({},{"only-aggregations":1,"reduce-aggregations":1},e);return delete t.p,delete t.order,delete t["no-aggregations"],t}_updateHistory(e){u.push(u.getLocation().pathname,e,{})}_buildLabels(){let e="";this._registry.forEach(t=>{let s=t.getLabels();s.length&&s.forEach(t=>{e+=this.getLabelTemplate(t)})}),this.activeFilterContainer.innerHTML=e;let t=n.Z.querySelectorAll(this.activeFilterContainer,".".concat(this.options.activeFilterLabelRemoveClass),!1);e.length&&(this._registerLabelEvents(t),this.createResetAllButton())}_registerLabelEvents(e){a.Z.iterate(e,e=>{e.addEventListener("click",()=>this.resetFilter(e))})}createResetAllButton(){this.activeFilterContainer.insertAdjacentHTML("beforeend",this.getResetAllButtonTemplate());let e=n.Z.querySelector(this.activeFilterContainer,this.options.resetAllFilterButtonSelector);e.removeEventListener("click",this.resetAllFilter.bind(this)),e.addEventListener("click",this.resetAllFilter.bind(this)),this._showResetAll||e.remove()}resetFilter(e){this._registry.forEach(t=>{t.reset(e.dataset.id)}),this._buildRequest(),this._buildLabels()}resetAllFilter(){this._registry.forEach(e=>{e.resetAll()}),this._buildRequest(),this._buildLabels()}getLabelTemplate(e){return'\n <span class="'.concat(this.options.activeFilterLabelClass,'">\n ').concat(this.getLabelPreviewTemplate(e),'\n <span aria-hidden="true">').concat(e.label,'</span>\n <button class="').concat(this.options.activeFilterLabelRemoveClass,'"\n data-id="').concat(e.id,'"\n aria-label="').concat(this.options.snippets.removeFilterAriaLabel,": ").concat(e.label,'">\n ×\n </button>\n </span>\n ')}getLabelPreviewTemplate(e){let t=this.options.activeFilterLabelPreviewClass;return e.previewHex?'\n <span class="'.concat(t,'" style="background-color: ').concat(e.previewHex,';"></span>\n '):e.previewImageUrl?'\n <span class="'.concat(t,'" style="background-image: url(\'').concat(e.previewImageUrl,"');\"></span>\n "):""}getResetAllButtonTemplate(){return'\n <button class="'.concat(this.options.resetAllFilterButtonClasses,'" aria-label="').concat(this.options.snippets.resetAllFiltersAriaLabel,'">\n ').concat(this.options.snippets.resetAllButtonText,"\n </button>\n ")}addLoadingIndicatorClass(){this._filterPanel.classList.add(this.options.loadingIndicatorClass)}removeLoadingIndicatorClass(){this._filterPanel.classList.remove(this.options.loadingIndicatorClass)}addLoadingElementLoaderClass(){this._cmsProductListingWrapper.classList.add(this.options.loadingElementLoaderClass)}removeLoadingElementLoaderClass(){this._cmsProductListingWrapper.classList.remove(this.options.loadingElementLoaderClass)}sendDataRequest(e){this._filterPanelActive&&this.addLoadingIndicatorClass(),this._cmsProductListingWrapperActive&&this.addLoadingElementLoaderClass(),this.options.disableEmptyFilter&&this.sendDisabledFiltersRequest(),this.httpClient.get("".concat(this.options.dataUrl,"?").concat(e),e=>{this.renderResponse(e),this._filterPanelActive&&(this.removeLoadingIndicatorClass(),this._updateAriaLive()),this._cmsProductListingWrapperActive&&this.removeLoadingElementLoaderClass()})}sendDisabledFiltersRequest(){let e=this._fetchValuesOfRegisteredFilters(),t=this._mapFilters(e);
1this.options.params&&Object.keys(this.options.params).forEach(e=>{t[e]=this.options.params[e]}),this._allFiltersInitializedDebounce=()=>{};let s=this._getDisabledFiltersParamsFromParams(t);this.httpClient.get("".concat(this.options.filterUrl,"?").concat(l.stringify(s)),e=>{let t=JSON.parse(e);this._registry.forEach(e=>{"function"==typeof e.refreshDisabledState&&e.refreshDisabledState(t,s)})})}renderResponse(e){o.Z.replaceFromMarkup(e,this.options.cmsProductListingSelector,!1),this._registry.forEach(e=>{"function"==typeof e.afterContentChange&&e.afterContentChange()}),window.PluginManager.initializePlugins(),this.$emitter.publish("Listing/afterRenderResponse",{response:e})}_updateAriaLive(){if(!this.options.ariaLiveUpdates||!this.ariaLiveContainer)return;let e=this.el.querySelector(this.options.cmsProductListingResultsSelector);this.ariaLiveContainer.innerHTML=e.dataset.ariaLiveText}_registerEvents(){window.onpopstate=this._onWindowPopstate.bind(this)}_onWindowPopstate(){this.refreshRegistry(),this._registry.forEach(e=>{0===Object.keys(this._urlFilterParams).length&&(this._urlFilterParams.p=1),this._setFilterState(e)}),this.options.disableEmptyFilter&&this._allFiltersInitializedDebounce(),this.changeListing(!1)}}m.options={dataUrl:"",filterUrl:"",params:{},filterPanelSelector:".filter-panel",cmsProductListingSelector:".cms-element-product-listing",cmsProductListingWrapperSelector:".cms-element-product-listing-wrapper",cmsProductListingResultsSelector:".js-listing-wrapper",activeFilterContainerSelector:".filter-panel-active-container",activeFilterLabelClass:"filter-active",activeFilterLabelRemoveClass:"filter-active-remove",activeFilterLabelPreviewClass:"filter-active-preview",resetAllFilterButtonClasses:"filter-reset-all btn btn-sm btn-outline-danger",resetAllFilterButtonSelector:".filter-reset-all",loadingIndicatorClass:"is-loading",loadingElementLoaderClass:"has-element-loader",ariaLiveSelector:".filter-panel-aria-live",ariaLiveUpdates:!0,disableEmptyFilter:!1,snippets:{resetAllButtonText:"Reset all",resetAllFiltersAriaLabel:"Reset all filters",removeFilterAriaLabel:"Remove filter"},scrollTopListingWrapper:!0,scrollOffset:15}},3107:(e,t,s)=>{s.d(t,{Z:()=>i});class i{get(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",i=this._createPreparedRequest("GET",e,s);return this._sendRequest(i,null,t)}post(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let r=this._createPreparedRequest("POST",e,i);return this._sendRequest(r,t,s)}delete(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let r=this._createPreparedRequest("DELETE",e,i);return this._sendRequest(r,t,s)}patch(e,t,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(t,i);let r=this._createPreparedRequest("PATCH",e,i);return this._sendRequest(r,t,s)}abort(){if(this._request)return this._request.abort()}setErrorHandlingInternal(e){this._errorHandlingInternal=e}_registerOnLoaded(e,t){t&&(!0===this._errorHandlingInternal?(e.addEventListener("load",()=>{t(e.responseText,e)}),e.addEventListener("abort",()=>{console.warn("the request to ".concat(e.responseURL," was aborted"))}),e.addEventListener("error",()=>{console.warn("the request to ".concat(e.responseURL," failed with status ").concat(e.status))}),e.addEventListener("timeout",()=>{console.warn("the request to ".concat(e.responseURL," timed out"))})):e.addEventListener("loadend",()=>{t(e.responseText,e)}))}_sendRequest(e,t,s){return this._registerOnLoaded(e,s),e.send(t),e}_getContentType(e,t){return e instanceof FormData&&(t=!1),t}_createPreparedRequest(e,t,s){return this._request=new XMLHttpRequest,this._request.open(e,t),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),s&&this._request.setRequestHeader("Content-type",s),this._request}constructor(){this._request=null,this._errorHandlingInternal=!1}}}}]);
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.