!function(){function c(e){let r="";return Object.entries(e).map(([e,t])=>{e=astra_search.search_post_types_labels[e]||e+"s";r+=``,t.map(e=>{t=e.title.rendered;var t=(new DOMParser).parseFromString(t,"text/html").documentElement.textContent,s=document.getElementById("ast-search-form"),a=document.getElementById("ast-seach-full-screen-form");r+=a||s?` ${t} `:` ${t} `})}),r}window.addEventListener("load",function(e){document.querySelectorAll(".search-field").forEach(n=>{n.addEventListener("input",function(e){const a=n.closest("form.search-form");var e=e.target.value.trim(),t=astra_search.search_page_condition?astra_search.search_page_post_types:astra_search.search_post_types,s=document.querySelectorAll(".ast-live-search-results");s&&s.forEach(function(e){e.parentNode.removeChild(e)});try{var r=`${astra_search.rest_api_url}wp/v2/posts${-1{e.type in t?t[e.type].push(e):t[e.type]=[e]});s=c(t);e=`
${s}
`}else e=`
`;s=document.querySelectorAll(".ast-live-search-results");s&&s.forEach(function(e){e.parentNode.removeChild(e)}),a.insertAdjacentHTML("beforeend",e)}},l.send()}catch(e){console.error("Error while fetching data:",e)}})})}),document.addEventListener("click",function(e){var e=e.target.closest("form.search-form");null!==e?e.querySelector(".ast-live-search-results")&&(e.querySelector(".ast-live-search-results").style.display="block"):(e=document.querySelectorAll(".ast-live-search-results"))&&e.forEach(function(e){e.style.display="none"})})}();