( function( window, document ) {
  function fitness_supplement_store_keepFocusInMenu() {
    document.addEventListener( 'keydown', function( e ) {
      const fitness_supplement_store_nav = document.querySelector( '.sidenav' );
      if ( ! fitness_supplement_store_nav || ! fitness_supplement_store_nav.classList.contains( 'open' ) ) {
        return;
      }
      const elements = [...fitness_supplement_store_nav.querySelectorAll( 'input, a, button' )],
        fitness_supplement_store_lastEl = elements[ elements.length - 1 ],
        fitness_supplement_store_firstEl = elements[0],
        fitness_supplement_store_activeEl = document.activeElement,
        tabKey = e.keyCode === 9,
        shiftKey = e.shiftKey;
      if ( ! shiftKey && tabKey && fitness_supplement_store_lastEl === fitness_supplement_store_activeEl ) {
        e.preventDefault();
        fitness_supplement_store_firstEl.focus();
      }
      if ( shiftKey && tabKey && fitness_supplement_store_firstEl === fitness_supplement_store_activeEl ) {
        e.preventDefault();
        fitness_supplement_store_lastEl.focus();
      }
    } );
  }
  fitness_supplement_store_keepFocusInMenu();
} )( window, document );