(()=>{"use strict";function t(){return 3.5*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16)}function e(e,r){if(r.classList.contains("is-expanded"))return e.classList.remove("is-no-overflow"),r.classList.remove("is-search-fit"),void e.classList.remove("is-search-fit");var o=Math.max(0,r.clientHeight-t()),s=r.scrollHeight<=o;e.classList.toggle("is-no-overflow",s)}function r(t){var r,o,s=t.querySelector(".attrakt--custom-selector__viewport"),a=t.querySelector(".attrakt--custom-selector__toggle-more");if(s&&a){parseInt(s.getAttribute("data-max-height"),10);var i=null!==(r=a.getAttribute("data-show-more"))&&void 0!==r?r:"",n=null!==(o=a.getAttribute("data-show-less"))&&void 0!==o?o:"";a.addEventListener("click",(function(){var r=s.classList.toggle("is-expanded");a.setAttribute("aria-expanded",r?"true":"false"),a.textContent=r?n:i,e(t,s)})),new ResizeObserver((function(){return e(t,s)})).observe(s),e(t,s)}}function o(r){var o=r.querySelector(".attrakt--custom-selector__search-input"),s=r.querySelector(".attrakt--custom-selector__viewport");if(o){var a=s&&parseInt(s.getAttribute("data-max-height"),10)||0,i=new Map;s.querySelectorAll(":scope > a").forEach((function(t){var e=[t.textContent||""];t.querySelectorAll("img[alt]").forEach((function(t){return e.push(t.getAttribute("alt")||"")})),i.set(t,e.join(" ").toLowerCase().replace(/\s+/g," ").trim())})),o.addEventListener("input",(function(){var n=o.value.toLowerCase().trim();if(i.forEach((function(t,e){!n||t.includes(n)?e.removeAttribute("hidden"):(e.setAttribute("hidden","hidden"),document.activeElement===e&&e.blur())})),s&&!s.classList.contains("is-expanded")){var c=Math.max(0,a-t()),l=""!==n&&a>0&&s.scrollHeight<=c;s.classList.toggle("is-search-fit",l),r.classList.toggle("is-search-fit",l),e(r,s)}}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll(".attrakt--custom-selector--collapsible").forEach(r),document.querySelectorAll(".attrakt--custom-selector--searchable").forEach(o)}))})();