`;
// Append the search bar container after the menu
menu.parentNode.insertBefore(searchBarContainer, menu.nextSibling);
// Create the search icon button and append it to the menu
var searchLi = document.createElement('li');
searchLi.className = 'menu-search-icon';
searchLi.innerHTML = `
`;
menu.appendChild(searchLi);
// Find the button and search bar container
var searchIconLink = document.getElementById('searchIconLink');
var searchBar = document.getElementById('searchBarContainer');
// Add click event listener to the search icon button
searchIconLink.addEventListener('click', function () {
var isExpanded = searchIconLink.getAttribute('aria-expanded') === 'true';
searchIconLink.setAttribute('aria-expanded', !isExpanded);
searchBar.style.display = isExpanded ? 'none' : 'flex';
searchIconLink.setAttribute('aria-label', isExpanded ? 'Open search bar' : 'Close search bar');
});
});
//-----------------------------------------
// Content Template: search-menu-item - end
//-----------------------------------------