https://www.psd-nuernberg-arena.de/_assets/e48bd7cafa31ac2615b6e45…/toujou-solr-search.js?1791359085
1import{s as e,f as t,t as s}from"./tap-ffa8d19f.js";class i{static get TOGGLE_SELECTOR(){return".tx-solr-facet-show-all"}static get HIDDEN_FACETS_SELECTOR(){return".tx-solr-facet-hidden"}constructor(e){this.listEl=e,this._isOpen=!1,this._toggles=this.listEl.querySelectorAll(i.TOGGLE_SELECTOR),this._hiddenFacets=this.listEl.querySelectorAll(i.HIDDEN_FACETS_SELECTOR),this._toggles.length&&this._hiddenFacets.length&&this._toggles.forEach((e=>{e.labelMore=e.getAttribute("data-label-more"),e.labelLess=e.getAttribute("data-label-less"),e.addEventListener("click",this._onToggleClick.bind(this))}))}_onToggleClick(e){e.preventDefault(),this._isOpen=!this._isOpen,this._updateListUI(),this._updateTogglesUI()}_updateListUI(){this._hiddenFacets.forEach((e=>{e.style.display=this._isOpen?"block":"none"}))}_updateTogglesUI(){this._toggles.forEach((e=>{e.labelMore.length&&e.labelLess.length&&(e.textContent=String(this._isOpen?e.labelLess:e.labelMore))}))}}class r extends e{static get is(){return"toujou-solr-search"}static get properties(){return{isFilterOpen:{type:Boolean},isLoading:{type:Boolean},ajaxPageType:{type:Number,attribute:"ajax-page-type"},noScrollToResults:{type:Boolean,attribute:"no-scroll-to-results"},viewMode:{type:String,reflect:!0,attribute:"view-mode"},elementPartsSelectors:{type:Array,attribute:"element-parts-selector"}}}constructor(){super(),this.ajaxPageType=1632,this.searchBreakpoint=null,this.isFilterOpen=!1,this.isLoading=!1,this.viewMode=null,this.elementPartsSelectors=[".solr-filters",".solr-header",".solr-search",".solr-pagination--above",".solr-pagination--below",".solr-pagination--load-more",".item-list--solr",".solr-results__header"]}connectedCallback(){super.connectedCallback();const e=getComputedStyle(this).getPropertyValue("--toujou-solr-search-filters-breakpoint");this.searchBreakpoint=window.matchMedia(`(min-width: ${e})`),this.init(),this.facadeValueChangedSubscription=t(this,"toujou-solr-search-facade-value-changed").pipe(s((e=>this.performSearch(e.detail.url)))).subscribe()}disconnectedCallback(){super.disconnectedCallback(),this.facadeValueChangedSubscription.unsubscribe()}init(){this.initAjaxSearchFields(),this.initSearchCancelButton(),this.initAjaxForms(),this.initFilterModal(),this.initSlider(),this.initCollapsibleOptionList(),this.viewModeButtons.length>0&&(this.initViewModeButtons(),this.updateViewMode())}initAjaxSearchFields(){this.querySelectorAll(".solr-ajaxified").forEach((e=>{e.addEventListener("click",(t=>{const s=e.hasAttribute("href")?e.getAttribute("href"):e.getAttribute("data-url");if(null===s)return;"A"===e.nodeName&&t.preventDefault();const i=e.classList.contains("solr-ajaxified--load-more");this.performSearch(s,i)}))}))}initAjaxForms(){this.querySelectorAll(".solr-ajaxified-form").forEach((e=>{e.addEventListener("change",(()=>{e.querySelectorAll("[data-select-facet]").forEach((e=>{""===e.value&&e.setAttribute("disabled","")}));const t=new FormData(e),s=new URL(window.location.toString(),document.baseURI);s.search="",new URLSearchParams(t).forEach(((e,t)=>{s.searchParams.set(t,e)})),this.performSearch(s)}))}))}initSearchCancelButton(){const e=this.querySelector(".solr-search__input"),t=this.querySelector(".solr-search__form"),s=this.querySelector(".solr-search__input-cancel-button");null!==s&&s.addEventListener("click",(()=>{s.blur(),""!==e.value&&(e.value="",t.submit())}))}initFilterModal(){const e=this.querySelector(".solr-filter-button"),t=this.querySelector(".solr-filters__mobile-button--close");null!=e&&(e.addEventListener("click",(()=>{e.blur(),this.isFilterOpen=!this.isFilterOpen,this._updateFilterUI()})),t.addEventListener("click",(()=>{t.blur(),this.isFilterOpen=!1,this._updateFilterUI()})),this.searchBreakpoint.addEventListener("change",(e=>{e.matches&&(this.isFilterOpen=!1,this._updateFilterUI())})))}initSlider(){const e=this.querySelector(".slider--solr-cards");if(null===e)return;const t=()=>{const t=e.querySelector(".glider");if(!t||!t._glider)return;const s={slidesToShow:1,slidesToScroll:1,draggable:!0,scrollLock:!0,resizeLock:!0,rewind:!0,arrows:{prev:e.querySelector(":scope > .slider__control--prev"),next:e.querySelector(":scope > .slider__control--next")},responsive:[{breakpoint:480,settings:{slidesToShow:2}},{breakpoint:840,settings:{slidesToShow:3}},{breakpoint:1020,settings:{slidesToShow:4}}]};t._glider.setOption(s),t._glider.refresh(!0)};e.querySelector(".glider")?t():e.addEventListener("glider-loaded",t,{once:!0,passive:!0})}performSearch(e,t=!1){if(!0===this.isLoading)return;const s=new URL(e,document.baseURI);s.searchParams.append("type",this.ajaxPageType.toString(10));const i=document.createElement("toujou-spinner");i.setAttribute("centered-on-page",""),this.appendChild(i),this.isLoading=!0;!1!==this.dispatchEvent(new CustomEvent("toujou-solr-search-before-search",{bubbles:!0,cancelable:!0,detail:s}))&&fetch(s.toString()).then((e=>e.text())).then((e=>{const t=document.createElement("div");return t.innerHTML=e,t})).then((e=>{for(const s of this.elementPartsSelectors)try{const i=e.querySelector(s)?.innerHTML;t&&".item-list--solr"===s?this.querySelector(s).innerHTML+=i:this.querySelector(s).innerHTML=i??""}catch(e){console.debug(`element ${s} not found in solr container ${e}`)}})).then((()=>{!1===t&&(s.searchParams.delete("type"),this.viewMode&&s.searchParams.append("viewMode",this.viewMode),window.history.replaceState({},null,s.toString()))}
1)).catch((e=>{console.log(e)})).finally((()=>{i.remove(),this.isLoading=!1,this.isFilterOpen=!1,this._updateFilterUI(),this.init(),window.dispatchEvent(new CustomEvent("toujou-solr-search-new-ajax-result",{bubbles:!0})),!0!==t&&this._scrollToResultsTop()}))}createRenderRoot(){return this}_updateFilterUI(){const e=this.querySelector(".solr-filters");e&&(this.isFilterOpen?(e.setAttribute("is-visible",""),document.body.setAttribute("solr-search-filter-open","")):(e.removeAttribute("is-visible"),document.body.removeAttribute("solr-search-filter-open")))}_scrollToResultsTop(){if(this.noScrollToResults)return;const e=this.querySelector(".solr-results");e&&e.scrollIntoView()}initViewModeButtons(){this.viewModeButtons.forEach((e=>e.addEventListener("click",(()=>{const t=e.dataset.viewMode,s=new URL(document.location);s.searchParams.set("viewMode",t),window.history.replaceState({},null,s.toString()),this.updateViewMode()}))))}initCollapsibleOptionList(){this.querySelectorAll(".facet-option-list.collapse").forEach((e=>{e.collaspcielListInstance=new i(e)}))}updateViewMode(){const e=new URL(document.location);e.searchParams.has("viewMode")?this.viewMode=e.searchParams.get("viewMode"):this.viewMode=this.viewModeButtons[0].dataset.viewMode,this.viewModeButtons.forEach((e=>{const t=e.dataset.viewMode;e.setAttribute("aria-checked",t===this.viewMode?"true":"false"),e.setAttribute("tabindex",t===this.viewMode?"-1":"0")}))}get viewModeButtons(){return this.querySelectorAll(".solr-view-mode__button")}}customElements.define(r.is,r);//# sourceMappingURL=toujou-solr-search.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.